aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp_classification_internal.h
blob: 78eaac90486083cc15b922234d9abd8f38e1ec13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/* Copyright (c) 2014, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */


/**
 * @file
 *
 * ODP Classification Internal
 * Describes the classification internal Functions
 */

#ifndef __ODP_CLASSIFICATION_INTERNAL_H_
#define __ODP_CLASSIFICATION_INTERNAL_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <odp/api/classification.h>
#include <odp/api/queue.h>
#include <odp_packet_internal.h>
#include <odp/api/packet_io.h>
#include <odp_packet_io_internal.h>
#include <odp_classification_datamodel.h>

/** Classification Internal function **/

/**
@internal
match_qos_cos

Select a CoS for the given Packet based on QoS values
This function returns the COS object matching the L2 and L3 QoS
based on the l3_preference value of the pktio
**/
cos_t *match_qos_cos(pktio_entry_t *entry, const uint8_t *pkt_addr,
		     odp_packet_hdr_t *hdr);
/**
@internal

Packet Classifier

Start function for Packet Classifier
This function calls Classifier module internal functions for a given packet and
selects destination queue and packet pool based on selected PMR and CoS.
**/
int cls_classify_packet(pktio_entry_t *entry, const uint8_t *base,
			uint16_t pkt_len, uint32_t seg_len, odp_pool_t *pool,
			odp_packet_hdr_t *pkt_hdr);

/**
Packet IO classifier init

This function does initialization of classifier object associated with pktio.
This function should be called during pktio initialization.
**/
int pktio_classifier_init(pktio_entry_t *pktio);

/**
@internal
match_pmr_cos

Match a PMR chain with a Packet and return matching CoS
This function gets called recursively to check the chained PMR Term value
with the packet.

**/
cos_t *match_pmr_cos(cos_t *cos, const uint8_t *pkt_addr, pmr_t *pmr,
		     odp_packet_hdr_t *hdr);
/**
@internal
CoS associated with L3 QoS value

This function returns the CoS associated with L3 QoS value
**/
cos_t *match_qos_l3_cos(pmr_l3_cos_t *l3_cos, const uint8_t *pkt_addr,
			odp_packet_hdr_t *hdr);

/**
@internal
CoS associated with L2 QoS value

This function returns the CoS associated with L2 QoS value
**/
cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, const uint8_t *pkt_addr,
			odp_packet_hdr_t *hdr);
/**
@internal
Flow Signature Calculation

This function calculates the Flow Signature for a packet based on
CoS and updates in Packet Meta Data
**/
int update_flow_signature(uint8_t *pkt_addr, cos_t *cos);

/**
@internal
Allocate a odp_pmr_t Handle
*/
odp_pmr_t alloc_pmr(pmr_t **pmr);

/**
@internal
Pointer to pmr_t Handle
This function checks for validity of odp_pmr_t Handle
*/
pmr_t *get_pmr_entry(odp_pmr_t pmr_id);

/**
@internal
Pointer to pmr_t Handle
*/
pmr_t *get_pmr_entry_internal(odp_pmr_t pmr_id);

/**
@internal
Pointer to odp_cos_t Handle
*/
cos_t *get_cos_entry(odp_cos_t cos_id);

/**
@internal
Pointer to odp_cos_t Handle
This function checks for validity of odp_cos_t Handle
*/
cos_t *get_cos_entry_internal(odp_cos_t cos_id);

/**
@internal
Verify PMR with a Packet

This function goes through each PMR_TERM value in pmr_t structure and
calls verification function for each term.Returns 1 if PMR matches or 0
Otherwise.
**/
int verify_pmr(pmr_t *pmr, const uint8_t *pkt_addr, odp_packet_hdr_t *pkt_hdr);

#ifdef __cplusplus
}
#endif
#endif