aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp_classification_internal.h
blob: 55932802c73448371acbc1bed10187b2bf0c135b (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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/* 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/classification.h>
#include <odp/queue.h>
#include <odp_packet_internal.h>
#include <odp/packet_io.h>
#include <odp_packet_io_internal.h>
#include <odp_classification_datamodel.h>

/** Classification Internal function **/

/**
@internal
Select a CoS for the given Packet based on pktio

This function will call all the PMRs associated with a pktio for
a given packet and will return the matched COS object.
This function will check PMR, L2 and L3 QoS COS object associated
with the PKTIO interface.

Returns the default cos if the packet does not match any PMR
Returns the error_cos if the packet has an error
**/
cos_t *pktio_select_cos(pktio_entry_t *pktio, uint8_t *pkt_addr,
		       odp_packet_hdr_t *pkt_hdr);

/**
@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, uint8_t *pkt_addr,
		     odp_packet_hdr_t *hdr);
/**
Packet Classifier

Start function for Packet Classifier
This function calls Classifier module internal functions for a given packet and
enqueues the packet to specific Queue based on PMR and CoS selected.
**/
int packet_classifier(odp_pktio_t pktio, odp_packet_t pkt);
/**
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, 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, 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, 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_set_t Handle
*/
odp_pmr_set_t alloc_pmr_set(pmr_t **pmr);

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

/**
@internal
Pointer to pmr_set_t Handle
This function checks for validity of pmr_set_t Handle
*/
pmr_set_t *get_pmr_set_entry(odp_pmr_set_t pmr_set_id);

/**
@internal
Pointer to pmr_set_t Handle
*/
pmr_set_t *get_pmr_set_entry_internal(odp_pmr_set_t pmr_set_id);

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

/**
@internal
Pointer to pmr_set_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, uint8_t *pkt_addr, odp_packet_hdr_t *pkt_hdr);

#ifdef __cplusplus
}
#endif
#endif