blob: 874d44b317157a4f711d9f829d09ef3b322fac26 [file] [log] [blame]
Ben Menchaca84f36632014-02-28 20:57:38 +00001/*
2 **************************************************************************
Murat Sezgina05befb2019-10-08 17:00:37 -07003 * Copyright (c) 2014-2015, 2018-2020 The Linux Foundation. All rights reserved.
Ben Menchaca84f36632014-02-28 20:57:38 +00004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all copies.
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
13 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 **************************************************************************
15 */
16
17struct ecm_classifier_instance;
18
19/*
20 * Classifier types.
21 * MUST BE RECORDED IN ASCENDING ORDER OF PRIORITY
22 */
23enum ecm_classifier_types {
24 ECM_CLASSIFIER_TYPE_DEFAULT = 0, /* MUST BE FIRST, Default classifier */
Murat Sezginf4f7ab42018-10-12 17:01:46 -070025#ifdef ECM_CLASSIFIER_MARK_ENABLE
26 ECM_CLASSIFIER_TYPE_MARK, /* Mark classifier */
27#endif
Hai Shalom81f4e202014-06-04 09:30:27 -070028#ifdef ECM_CLASSIFIER_HYFI_ENABLE
Ben Menchaca84f36632014-02-28 20:57:38 +000029 ECM_CLASSIFIER_TYPE_HYFI, /* HyFi classifier */
Hai Shalom81f4e202014-06-04 09:30:27 -070030#endif
Murat Sezginb3731e82014-11-26 12:20:59 -080031#ifdef ECM_CLASSIFIER_DSCP_ENABLE
Gareth Williams8932a912014-06-11 18:06:25 -070032 ECM_CLASSIFIER_TYPE_DSCP, /* Provides DSCP and DSCP remarking support */
Murat Sezginb3731e82014-11-26 12:20:59 -080033#endif
34#ifdef ECM_CLASSIFIER_NL_ENABLE
Ben Menchaca84f36632014-02-28 20:57:38 +000035 ECM_CLASSIFIER_TYPE_NL, /* Provides netlink interface */
Murat Sezginb3731e82014-11-26 12:20:59 -080036#endif
Murat Sezgina05befb2019-10-08 17:00:37 -070037#ifdef ECM_CLASSIFIER_OVS_ENABLE
38 ECM_CLASSIFIER_TYPE_OVS, /* OVS classifier */
39#endif
Gareth Williamsdcda9b92015-05-13 10:08:15 +010040#ifdef ECM_CLASSIFIER_PCC_ENABLE
41 ECM_CLASSIFIER_TYPE_PCC, /* Parental control subsystem support classifier */
42#endif
Ben Menchaca84f36632014-02-28 20:57:38 +000043 ECM_CLASSIFIER_TYPES, /* MUST BE LAST */
44};
45typedef enum ecm_classifier_types ecm_classifier_type_t;
46
47/*
48 * enum ecm_classifier_relevances
49 * Whether a classifier is relevant to a connection
50 */
51enum ecm_classifier_relevances {
52 ECM_CLASSIFIER_RELEVANCE_MAYBE = 0, /* Classifier has not yet determined relevance */
53 ECM_CLASSIFIER_RELEVANCE_NO, /* Classifier is not relevant to a connection (classifier will be unassigned from the connection after returning this from a process() call) */
54 ECM_CLASSIFIER_RELEVANCE_YES, /* Classifier is relevant to the connection, process actions will be inspected by the front end when returning this from a process() call */
55};
56typedef enum ecm_classifier_relevances ecm_classifier_relevence_t;
57
58/*
59 * enum ecm_classifier_acceleration_modes
60 * Modes in which a connection may be accelerated
Murat Sezgind701ac52014-08-20 14:02:30 -070061 *
62 * These are used by a classifier to indicate its desire to accelerate.
Ben Menchaca84f36632014-02-28 20:57:38 +000063 */
64enum ecm_classifier_acceleration_modes {
65 ECM_CLASSIFIER_ACCELERATION_MODE_DONT_CARE = 0, /* Classifier does not care if the connection is accelerated */
66 ECM_CLASSIFIER_ACCELERATION_MODE_NO, /* Connection must not be accelerated */
67 ECM_CLASSIFIER_ACCELERATION_MODE_ACCEL, /* Connection can be accelerated whenever */
68};
69typedef enum ecm_classifier_acceleration_modes ecm_classifier_acceleration_mode_t;
70
71/*
72 * Process actions
73 * A process result, that is relevant, may contain zero or more actions for the front end.
74 * Due to the parallel processing nature of classifiers, *usually* the action(s) of the highest priority
75 * classifier will override any lower priority actions. This is up to front end discretion, of course.
76 */
Gareth Williams27c3db12014-06-11 17:37:56 -070077#define ECM_CLASSIFIER_PROCESS_ACTION_DROP 0x00000001 /* Drop */
78#define ECM_CLASSIFIER_PROCESS_ACTION_QOS_TAG 0x00000002 /* Contains flow & return qos tags */
Ben Menchaca84f36632014-02-28 20:57:38 +000079#define ECM_CLASSIFIER_PROCESS_ACTION_ACCEL_MODE 0x00000004 /* Contains an accel mode */
80#define ECM_CLASSIFIER_PROCESS_ACTION_TIMER_GROUP 0x00000008 /* Contains a timer group change */
Murat Sezgin62c92832015-03-06 16:08:31 -080081
82#ifdef ECM_CLASSIFIER_DSCP_ENABLE
Gareth Williamsbd03e232014-06-11 17:55:28 -070083#define ECM_CLASSIFIER_PROCESS_ACTION_DSCP 0x00000010 /* Contains DSCP marking information */
84#define ECM_CLASSIFIER_PROCESS_ACTION_DSCP_DENY 0x00000020 /* Denies any DSCP changes */
Manish Vermaed493782019-05-27 12:56:02 +053085
86#define ECM_CLASSIFIER_PROCESS_ACTION_IGS_QOS_TAG 0x00000040 /* Contains flow & return ingress qos tags */
Murat Sezgin62c92832015-03-06 16:08:31 -080087#endif
Ben Menchaca84f36632014-02-28 20:57:38 +000088
Murat Sezgin964bfd82019-11-18 14:28:37 -080089#ifdef ECM_CLASSIFIER_OVS_ENABLE
90#define ECM_CLASSIFIER_PROCESS_ACTION_OVS_VLAN_TAG 0x00000080 /* Contains OVS VLAN tags */
Suman Ghoshe1c939c2019-11-12 20:43:04 +053091#define ECM_CLASSIFIER_PROCESS_ACTION_OVS_VLAN_QINQ_TAG 0x00000100 /* Contains OVS QinQ VLAN tags */
92#define ECM_CLASSIFIER_PROCESS_ACTION_OVS_MCAST_DENY_ACCEL 0x00000200 /* Multicast OVS flow */
Murat Sezgin964bfd82019-11-18 14:28:37 -080093#endif
94
Ben Menchaca84f36632014-02-28 20:57:38 +000095/*
96 * struct ecm_classifier_process_response
97 * Response structure returned by a process call
98 */
99struct ecm_classifier_process_response {
100 ecm_classifier_relevence_t relevance; /* Is this classifier relevant to the connection? */
101 uint32_t became_relevant; /* DB time the classifier became relevant or not relevant, if relevance is maybe this field is not relevant! */
102
103 uint32_t process_actions; /* Actions this process response contains */
104
105 /*
106 * The following fields are only to be inspected if this response is relevant AND the process_actions indicates so
107 */
108 bool drop; /* Drop packet at hand */
Gareth Williams27c3db12014-06-11 17:37:56 -0700109 uint32_t flow_qos_tag; /* QoS tag to use for the packet */
110 uint32_t return_qos_tag; /* QoS tag to use for the packet */
Manish Vermaed493782019-05-27 12:56:02 +0530111 uint16_t igs_flow_qos_tag; /* Ingress QoS tag to use for the packet */
112 uint16_t igs_return_qos_tag; /* Ingress QoS tag to use for the return packet */
Murat Sezgin62c92832015-03-06 16:08:31 -0800113#ifdef ECM_CLASSIFIER_DSCP_ENABLE
Gareth Williamsbd03e232014-06-11 17:55:28 -0700114 uint8_t flow_dscp; /* DSCP mark for flow */
115 uint8_t return_dscp; /* DSCP mark for return */
Murat Sezgin62c92832015-03-06 16:08:31 -0800116#endif
Murat Sezgin964bfd82019-11-18 14:28:37 -0800117#ifdef ECM_CLASSIFIER_OVS_ENABLE
118 uint32_t ingress_vlan_tag[2]; /* Ingress VLAN tags */
119 uint32_t egress_vlan_tag[2]; /* Egress VLAN tags */
Suman Ghosha11fc922020-01-08 14:34:03 +0530120#ifdef ECM_MULTICAST_ENABLE
121 int32_t egress_netdev_index[ECM_DB_MULTICAST_IF_MAX]; /* Multicast egress net device interface index */
122 uint32_t egress_mc_vlan_tag[ECM_DB_MULTICAST_IF_MAX][2]; /* Multicast egress VLAN tags */
123#endif
Murat Sezgin964bfd82019-11-18 14:28:37 -0800124#endif
Ben Menchaca84f36632014-02-28 20:57:38 +0000125 ecm_classifier_acceleration_mode_t accel_mode; /* Acceleration needed for this connection */
126 ecm_db_timer_group_t timer_group; /* Timer group the connection should be in */
127};
128
129/*
Murat Sezginb2676062015-06-12 17:05:31 -0700130 * Sync rule structure.
131 * Acceleration engine's sync parameters will be stored
132 * in this data structure to update the classifiers.
133 */
134struct ecm_classifier_rule_sync {
Murat Sezgina05befb2019-10-08 17:00:37 -0700135 /*
136 * TODO: Use directional arrays for flow/return.
137 */
Murat Sezginb2676062015-06-12 17:05:31 -0700138 uint32_t flow_tx_packet_count;
Murat Sezgina05befb2019-10-08 17:00:37 -0700139 uint32_t flow_tx_byte_count;
140 uint32_t flow_rx_packet_count;
141 uint32_t flow_rx_byte_count;
Murat Sezginb2676062015-06-12 17:05:31 -0700142 uint32_t return_tx_packet_count;
Murat Sezgina05befb2019-10-08 17:00:37 -0700143 uint32_t return_tx_byte_count;
144 uint32_t return_rx_packet_count;
145 uint32_t return_rx_byte_count;
Murat Sezginb2676062015-06-12 17:05:31 -0700146 uint32_t reason;
147};
148
149/*
150 * Create rule structure.
151 * Additional create rule parameters from the classifiers
152 * will be copied to this data structure before pushing them to
153 * the underlying accelaration engine.
154 */
155struct ecm_classifier_rule_create {
156
157};
158
159/*
Ben Menchaca84f36632014-02-28 20:57:38 +0000160 * To be implemented by all classifiers
161 */
162typedef void (*ecm_classifier_ref_method_t)(struct ecm_classifier_instance *ci);
163typedef int (*ecm_classifier_deref_callback_t)(struct ecm_classifier_instance *ci);
164typedef void (*ecm_classifier_process_callback_t)(struct ecm_classifier_instance *ci, ecm_tracker_sender_type_t sender, struct ecm_tracker_ip_header *ip_hdr, struct sk_buff *skb, struct ecm_classifier_process_response *process_response);
165 /* Process new data for connection, process_response is populated with the response of processing */
Murat Sezginb2676062015-06-12 17:05:31 -0700166typedef void (*ecm_classifier_sync_from_v4_callback_t)(struct ecm_classifier_instance *ci, struct ecm_classifier_rule_create *ecrc);
167 /* Sync the accel engine state with state from the classifier */
168typedef void (*ecm_classifier_sync_to_v4_callback_t)(struct ecm_classifier_instance *ci, struct ecm_classifier_rule_sync *sync);
169 /* Sync the classifier state with current accel engine state */
170typedef void (*ecm_classifier_sync_from_v6_callback_t)(struct ecm_classifier_instance *ci, struct ecm_classifier_rule_create *ecrc);
171 /* Sync the accel engine state with state from the classifier */
172typedef void (*ecm_classifier_sync_to_v6_callback_t)(struct ecm_classifier_instance *ci, struct ecm_classifier_rule_sync *sync);
173 /* Sync the classifier state with current accel engine state */
Ben Menchaca84f36632014-02-28 20:57:38 +0000174typedef ecm_classifier_type_t (*ecm_classifier_type_get_callback_t)(struct ecm_classifier_instance *ci);
175 /* Get type of classifier this is */
176typedef bool (*ecm_classifier_reclassify_allowed_get_callback_t)(struct ecm_classifier_instance *ci);
177 /* Get whether reclassification is allowed */
178typedef void (*ecm_classifier_reclassify_callback_t)(struct ecm_classifier_instance *ci);
179 /* Reclassify */
180typedef void (*ecm_classifier_last_process_response_get_callback_t)(struct ecm_classifier_instance *ci, struct ecm_classifier_process_response *process_response);
181 /* Get last process response */
Gareth Williamsf98d4192015-03-11 16:55:41 +0000182#ifdef ECM_STATE_OUTPUT_ENABLE
Gareth Williamsd5618a82015-05-20 11:13:32 +0100183typedef int (*ecm_classifier_state_get_callback_t)(struct ecm_classifier_instance *ci, struct ecm_state_file_instance *sfi);
184 /* Get state output. Returns 0 upon success. */
Gareth Williamsf98d4192015-03-11 16:55:41 +0000185#endif
Ben Menchaca84f36632014-02-28 20:57:38 +0000186
187/*
Murat Sezgine34b0172015-11-05 21:58:14 -0800188 * Determines if a connection should be kept.
189 */
190typedef bool (*ecm_classifier_should_keep_connection_t)
191 (struct ecm_classifier_instance *ci, uint8_t *mac);
192
193/*
Ben Menchaca84f36632014-02-28 20:57:38 +0000194 * Base class for all types of classifiers
195 */
196struct ecm_classifier_instance {
197 struct ecm_classifier_instance *ca_next; /* DB use only: Connection assignment next pointer */
198 struct ecm_classifier_instance *ca_prev; /* DB use only: Connection assignment prev pointer */
199
200 ecm_classifier_process_callback_t process; /* Process new skb */
201 ecm_classifier_sync_from_v4_callback_t sync_from_v4;
Murat Sezginb2676062015-06-12 17:05:31 -0700202 /* Sync the accel engine with state from the classifier */
203 ecm_classifier_sync_to_v4_callback_t sync_to_v4;/* Sync the classifier with state from the accel engine */
Ben Menchaca84f36632014-02-28 20:57:38 +0000204 ecm_classifier_sync_from_v6_callback_t sync_from_v6;
Murat Sezginb2676062015-06-12 17:05:31 -0700205 /* Sync the accel engine with state from the classifier */
206 ecm_classifier_sync_to_v6_callback_t sync_to_v6;/* Sync the classifier with state from the accel engine */
Ben Menchaca84f36632014-02-28 20:57:38 +0000207 ecm_classifier_type_get_callback_t type_get; /* Get type of classifier */
208 ecm_classifier_reclassify_allowed_get_callback_t reclassify_allowed;
209 /* Get whether reclassification is allowed */
210 ecm_classifier_reclassify_callback_t reclassify;
211 /* Reclassify */
212 ecm_classifier_last_process_response_get_callback_t last_process_response_get;
213 /* Return last process response */
Murat Sezgine34b0172015-11-05 21:58:14 -0800214 ecm_classifier_should_keep_connection_t should_keep_connection;
215 /* Check if connection should be kept when FDB updates */
Gareth Williamsf98d4192015-03-11 16:55:41 +0000216#ifdef ECM_STATE_OUTPUT_ENABLE
Gareth Williamsd5618a82015-05-20 11:13:32 +0100217 ecm_classifier_state_get_callback_t state_get;
218 /* Return its state */
Gareth Williamsf98d4192015-03-11 16:55:41 +0000219#endif
Ben Menchaca84f36632014-02-28 20:57:38 +0000220 ecm_classifier_ref_method_t ref;
221 ecm_classifier_deref_callback_t deref;
222};
223
Gareth Williamsf98d4192015-03-11 16:55:41 +0000224#ifdef ECM_STATE_OUTPUT_ENABLE
Ben Menchaca84f36632014-02-28 20:57:38 +0000225/*
Gareth Williamsd5618a82015-05-20 11:13:32 +0100226 * ecm_classifier_process_response_state_get()
227 * Output detail for the process response
Ben Menchaca84f36632014-02-28 20:57:38 +0000228 *
Gareth Williamsd5618a82015-05-20 11:13:32 +0100229 * Returns 0 on success.
Ben Menchaca84f36632014-02-28 20:57:38 +0000230 */
Gareth Williamsd5618a82015-05-20 11:13:32 +0100231static inline int ecm_classifier_process_response_state_get(struct ecm_state_file_instance *sfi, struct ecm_classifier_process_response *pr)
Ben Menchaca84f36632014-02-28 20:57:38 +0000232{
Gareth Williamsd5618a82015-05-20 11:13:32 +0100233 int result;
234
235 if ((result = ecm_state_prefix_add(sfi, "pr"))) {
236 return result;
237 }
Ben Menchaca84f36632014-02-28 20:57:38 +0000238
239 if (pr->relevance == ECM_CLASSIFIER_RELEVANCE_NO) {
Gareth Williamsd5618a82015-05-20 11:13:32 +0100240 return ecm_state_write(sfi, "relevant", "%s", "no");
Ben Menchaca84f36632014-02-28 20:57:38 +0000241 }
242
243 if (pr->process_actions & ECM_CLASSIFIER_PROCESS_ACTION_DROP) {
244 if (pr->drop) {
Gareth Williamsd5618a82015-05-20 11:13:32 +0100245 if ((result = ecm_state_write(sfi, "drop", "yes"))) {
246 return result;
247 }
Ben Menchaca84f36632014-02-28 20:57:38 +0000248 } else {
Gareth Williamsd5618a82015-05-20 11:13:32 +0100249 if ((result = ecm_state_write(sfi, "drop", "no"))) {
250 return result;
251 }
Ben Menchaca84f36632014-02-28 20:57:38 +0000252 }
253 }
254
Ben Menchaca84f36632014-02-28 20:57:38 +0000255 if (pr->relevance == ECM_CLASSIFIER_RELEVANCE_MAYBE) {
Gareth Williamsd5618a82015-05-20 11:13:32 +0100256 if ((result = ecm_state_write(sfi, "accel", "denied"))) {
257 return result;
258 }
259 if ((result = ecm_state_write(sfi, "relevant", "maybe"))) {
260 return result;
261 }
Ben Menchaca84f36632014-02-28 20:57:38 +0000262 } else {
Gareth Williamsd5618a82015-05-20 11:13:32 +0100263 if ((result = ecm_state_write(sfi, "relevant", "yes"))) {
264 return result;
265 }
266 if (pr->process_actions & ECM_CLASSIFIER_PROCESS_ACTION_ACCEL_MODE) {
267 if (pr->accel_mode == ECM_CLASSIFIER_ACCELERATION_MODE_ACCEL) {
268 if ((result = ecm_state_write(sfi, "accel", "wanted"))) {
269 return result;
270 }
271 }
272 else if (pr->accel_mode == ECM_CLASSIFIER_ACCELERATION_MODE_NO) {
273 if ((result = ecm_state_write(sfi, "accel", "denied"))) {
274 return result;
275 }
276 }
277 /* Else don't care */
278 }
Ben Menchaca84f36632014-02-28 20:57:38 +0000279 }
280
Murat Sezgin964bfd82019-11-18 14:28:37 -0800281#ifdef ECM_CLASSIFIER_OVS_ENABLE
282 if (pr->process_actions & ECM_CLASSIFIER_PROCESS_ACTION_OVS_VLAN_TAG) {
Suman Ghosha11fc922020-01-08 14:34:03 +0530283#ifdef ECM_MULTICAST_ENABLE
284 int i;
285#endif
286
287 /*
288 * TODO: Clean up the function later to print classifier
289 * specific data in each classifier’s state_get function.
290 */
Suman Ghosha33d7df2020-01-31 21:45:20 +0530291 if (pr->ingress_vlan_tag[0] != ECM_FRONT_END_VLAN_ID_NOT_CONFIGURED) {
Suman Ghosha11fc922020-01-08 14:34:03 +0530292 if ((result = ecm_state_write(sfi, "ingress_vlan_tag[0]", "0x%x", pr->ingress_vlan_tag[0]))) {
293 return result;
294 }
Murat Sezgin964bfd82019-11-18 14:28:37 -0800295 }
Suman Ghosha11fc922020-01-08 14:34:03 +0530296
Suman Ghosha33d7df2020-01-31 21:45:20 +0530297 if (pr->egress_vlan_tag[0] != ECM_FRONT_END_VLAN_ID_NOT_CONFIGURED) {
Suman Ghosha11fc922020-01-08 14:34:03 +0530298 if ((result = ecm_state_write(sfi, "egress_vlan_tag[0]", "0x%x", pr->egress_vlan_tag[0]))) {
299 return result;
300 }
Murat Sezgin964bfd82019-11-18 14:28:37 -0800301 }
Suman Ghosha11fc922020-01-08 14:34:03 +0530302
303#ifdef ECM_MULTICAST_ENABLE
304 for (i = 0; i < ECM_DB_MULTICAST_IF_MAX; i++) {
305
Suman Ghosha33d7df2020-01-31 21:45:20 +0530306 if (pr->egress_mc_vlan_tag[i][0] == ECM_FRONT_END_VLAN_ID_NOT_CONFIGURED) {
Suman Ghosha11fc922020-01-08 14:34:03 +0530307 continue;
308 }
309
310 if ((result = ecm_state_write(sfi, "port_interface_index", "%d", pr->egress_netdev_index[i]))) {
311 return result;
312 }
313
314 if ((result = ecm_state_write(sfi, "port_egress_vlan_tag[0]", "0x%x", pr->egress_mc_vlan_tag[i][0]))) {
315 return result;
316 }
317 }
318#endif
Murat Sezgin964bfd82019-11-18 14:28:37 -0800319 }
320
321 if (pr->process_actions & ECM_CLASSIFIER_PROCESS_ACTION_OVS_VLAN_QINQ_TAG) {
Suman Ghosha11fc922020-01-08 14:34:03 +0530322#ifdef ECM_MULTICAST_ENABLE
323 int i;
324#endif
325
326 /*
327 * TODO: Clean up the function later to print classifier
328 * specific data in each classifier’s state_get function.
329 */
Suman Ghosha33d7df2020-01-31 21:45:20 +0530330 if (pr->ingress_vlan_tag[1] != ECM_FRONT_END_VLAN_ID_NOT_CONFIGURED) {
Suman Ghosha11fc922020-01-08 14:34:03 +0530331 if ((result = ecm_state_write(sfi, "ingress_vlan_tag[1]", "0x%x", pr->ingress_vlan_tag[1]))) {
332 return result;
333 }
Murat Sezgin964bfd82019-11-18 14:28:37 -0800334 }
Suman Ghosha11fc922020-01-08 14:34:03 +0530335
Suman Ghosha33d7df2020-01-31 21:45:20 +0530336 if (pr->egress_vlan_tag[1] != ECM_FRONT_END_VLAN_ID_NOT_CONFIGURED) {
Suman Ghosha11fc922020-01-08 14:34:03 +0530337 if ((result = ecm_state_write(sfi, "egress_vlan_tag[1]", "0x%x", pr->egress_vlan_tag[1]))) {
338 return result;
339 }
Murat Sezgin964bfd82019-11-18 14:28:37 -0800340 }
Suman Ghosha11fc922020-01-08 14:34:03 +0530341
342#ifdef ECM_MULTICAST_ENABLE
343 for (i = 0; i < ECM_DB_MULTICAST_IF_MAX; i++) {
344
Suman Ghosha33d7df2020-01-31 21:45:20 +0530345 if (pr->egress_mc_vlan_tag[i][1] == ECM_FRONT_END_VLAN_ID_NOT_CONFIGURED) {
Suman Ghosha11fc922020-01-08 14:34:03 +0530346 continue;
347 }
348
349 if ((result = ecm_state_write(sfi, "port_interface_index", "%d", pr->egress_netdev_index[i]))) {
350 return result;
351 }
352
353 if ((result = ecm_state_write(sfi, "port_egress_vlan_tag[1]", "0x%x", pr->egress_mc_vlan_tag[i][1]))) {
354 return result;
355 }
356 }
357#endif
Murat Sezgin964bfd82019-11-18 14:28:37 -0800358 }
359#endif
360
Manish Vermaed493782019-05-27 12:56:02 +0530361#ifdef ECM_CLASSIFIER_DSCP_ENABLE
Gareth Williamsd5618a82015-05-20 11:13:32 +0100362 if (pr->process_actions & ECM_CLASSIFIER_PROCESS_ACTION_QOS_TAG) {
363 if ((result = ecm_state_write(sfi, "flow_qos_tag", "%u", pr->flow_qos_tag))) {
364 return result;
365 }
366 if ((result = ecm_state_write(sfi, "return_qos_tag", "%u", pr->return_qos_tag))) {
367 return result;
368 }
369 }
Manish Vermaed493782019-05-27 12:56:02 +0530370
371 if (pr->process_actions & ECM_CLASSIFIER_PROCESS_ACTION_IGS_QOS_TAG) {
372 if ((result = ecm_state_write(sfi, "igs_flow_qos_tag", "%u", pr->igs_flow_qos_tag))) {
373 return result;
374 }
375 if ((result = ecm_state_write(sfi, "igs_return_qos_tag", "%u", pr->igs_return_qos_tag))) {
376 return result;
377 }
378 }
379
Gareth Williamsd5618a82015-05-20 11:13:32 +0100380 if (pr->process_actions & ECM_CLASSIFIER_PROCESS_ACTION_DSCP) {
381 if ((result = ecm_state_write(sfi, "flow_dscp", "%u", pr->flow_dscp))) {
382 return result;
383 }
384 if ((result = ecm_state_write(sfi, "return_dscp", "%u", pr->return_dscp))) {
385 return result;
386 }
387 }
388#endif
389 if (pr->process_actions & ECM_CLASSIFIER_PROCESS_ACTION_TIMER_GROUP) {
390 if ((result = ecm_state_write(sfi, "timer_group", "%d", pr->timer_group))) {
391 return result;
392 }
393 }
394
395 return ecm_state_prefix_remove(sfi);
Ben Menchaca84f36632014-02-28 20:57:38 +0000396}
Gareth Williamsf98d4192015-03-11 16:55:41 +0000397#endif
398
Murat Sezginc725ad82016-04-13 17:12:50 -0700399extern struct ecm_classifier_instance *ecm_classifier_assign_classifier(struct ecm_db_connection_instance *ci, ecm_classifier_type_t type);
400extern bool ecm_classifier_reclassify(struct ecm_db_connection_instance *ci, int assignment_count, struct ecm_classifier_instance *assignments[]);