2 * Copyright (c) 2017, Cisco Systems, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
34 #include <rte_ethdev.h>
35 #include <rte_flow_driver.h>
36 #include <rte_ether.h>
40 #include "enic_compat.h"
45 #define FLOW_TRACE() \
46 rte_log(RTE_LOG_DEBUG, enicpmd_logtype_flow, \
48 #define FLOW_LOG(level, fmt, args...) \
49 rte_log(RTE_LOG_ ## level, enicpmd_logtype_flow, \
52 /** Info about how to copy items into enic filters. */
54 /** Function for copying and validating an item. */
55 int (*copy_item)(const struct rte_flow_item *item,
56 struct filter_v2 *enic_filter, u8 *inner_ofst);
57 /** List of valid previous items. */
58 const enum rte_flow_item_type * const prev_items;
59 /** True if it's OK for this item to be the first item. For some NIC
60 * versions, it's invalid to start the stack above layer 3.
62 const u8 valid_start_item;
65 /** Filtering capabilities for various NIC and firmware versions. */
66 struct enic_filter_cap {
67 /** list of valid items and their handlers and attributes. */
68 const struct enic_items *item_info;
71 /* functions for copying flow actions into enic actions */
72 typedef int (copy_action_fn)(const struct rte_flow_action actions[],
73 struct filter_action_v2 *enic_action);
75 /* functions for copying items into enic filters */
76 typedef int(enic_copy_item_fn)(const struct rte_flow_item *item,
77 struct filter_v2 *enic_filter, u8 *inner_ofst);
79 /** Action capabilities for various NICs. */
80 struct enic_action_cap {
81 /** list of valid actions */
82 const enum rte_flow_action_type *actions;
83 /** copy function for a particular NIC */
84 int (*copy_fn)(const struct rte_flow_action actions[],
85 struct filter_action_v2 *enic_action);
88 /* Forward declarations */
89 static enic_copy_item_fn enic_copy_item_ipv4_v1;
90 static enic_copy_item_fn enic_copy_item_udp_v1;
91 static enic_copy_item_fn enic_copy_item_tcp_v1;
92 static enic_copy_item_fn enic_copy_item_eth_v2;
93 static enic_copy_item_fn enic_copy_item_vlan_v2;
94 static enic_copy_item_fn enic_copy_item_ipv4_v2;
95 static enic_copy_item_fn enic_copy_item_ipv6_v2;
96 static enic_copy_item_fn enic_copy_item_udp_v2;
97 static enic_copy_item_fn enic_copy_item_tcp_v2;
98 static enic_copy_item_fn enic_copy_item_sctp_v2;
99 static enic_copy_item_fn enic_copy_item_sctp_v2;
100 static enic_copy_item_fn enic_copy_item_vxlan_v2;
101 static copy_action_fn enic_copy_action_v1;
102 static copy_action_fn enic_copy_action_v2;
105 * Legacy NICs or NICs with outdated firmware. Only 5-tuple perfect match
108 static const struct enic_items enic_items_v1[] = {
109 [RTE_FLOW_ITEM_TYPE_IPV4] = {
110 .copy_item = enic_copy_item_ipv4_v1,
111 .valid_start_item = 1,
112 .prev_items = (const enum rte_flow_item_type[]) {
113 RTE_FLOW_ITEM_TYPE_END,
116 [RTE_FLOW_ITEM_TYPE_UDP] = {
117 .copy_item = enic_copy_item_udp_v1,
118 .valid_start_item = 0,
119 .prev_items = (const enum rte_flow_item_type[]) {
120 RTE_FLOW_ITEM_TYPE_IPV4,
121 RTE_FLOW_ITEM_TYPE_END,
124 [RTE_FLOW_ITEM_TYPE_TCP] = {
125 .copy_item = enic_copy_item_tcp_v1,
126 .valid_start_item = 0,
127 .prev_items = (const enum rte_flow_item_type[]) {
128 RTE_FLOW_ITEM_TYPE_IPV4,
129 RTE_FLOW_ITEM_TYPE_END,
135 * NICs have Advanced Filters capability but they are disabled. This means
136 * that layer 3 must be specified.
138 static const struct enic_items enic_items_v2[] = {
139 [RTE_FLOW_ITEM_TYPE_ETH] = {
140 .copy_item = enic_copy_item_eth_v2,
141 .valid_start_item = 1,
142 .prev_items = (const enum rte_flow_item_type[]) {
143 RTE_FLOW_ITEM_TYPE_VXLAN,
144 RTE_FLOW_ITEM_TYPE_END,
147 [RTE_FLOW_ITEM_TYPE_VLAN] = {
148 .copy_item = enic_copy_item_vlan_v2,
149 .valid_start_item = 1,
150 .prev_items = (const enum rte_flow_item_type[]) {
151 RTE_FLOW_ITEM_TYPE_ETH,
152 RTE_FLOW_ITEM_TYPE_END,
155 [RTE_FLOW_ITEM_TYPE_IPV4] = {
156 .copy_item = enic_copy_item_ipv4_v2,
157 .valid_start_item = 1,
158 .prev_items = (const enum rte_flow_item_type[]) {
159 RTE_FLOW_ITEM_TYPE_ETH,
160 RTE_FLOW_ITEM_TYPE_VLAN,
161 RTE_FLOW_ITEM_TYPE_END,
164 [RTE_FLOW_ITEM_TYPE_IPV6] = {
165 .copy_item = enic_copy_item_ipv6_v2,
166 .valid_start_item = 1,
167 .prev_items = (const enum rte_flow_item_type[]) {
168 RTE_FLOW_ITEM_TYPE_ETH,
169 RTE_FLOW_ITEM_TYPE_VLAN,
170 RTE_FLOW_ITEM_TYPE_END,
173 [RTE_FLOW_ITEM_TYPE_UDP] = {
174 .copy_item = enic_copy_item_udp_v2,
175 .valid_start_item = 0,
176 .prev_items = (const enum rte_flow_item_type[]) {
177 RTE_FLOW_ITEM_TYPE_IPV4,
178 RTE_FLOW_ITEM_TYPE_IPV6,
179 RTE_FLOW_ITEM_TYPE_END,
182 [RTE_FLOW_ITEM_TYPE_TCP] = {
183 .copy_item = enic_copy_item_tcp_v2,
184 .valid_start_item = 0,
185 .prev_items = (const enum rte_flow_item_type[]) {
186 RTE_FLOW_ITEM_TYPE_IPV4,
187 RTE_FLOW_ITEM_TYPE_IPV6,
188 RTE_FLOW_ITEM_TYPE_END,
191 [RTE_FLOW_ITEM_TYPE_SCTP] = {
192 .copy_item = enic_copy_item_sctp_v2,
193 .valid_start_item = 0,
194 .prev_items = (const enum rte_flow_item_type[]) {
195 RTE_FLOW_ITEM_TYPE_IPV4,
196 RTE_FLOW_ITEM_TYPE_IPV6,
197 RTE_FLOW_ITEM_TYPE_END,
200 [RTE_FLOW_ITEM_TYPE_VXLAN] = {
201 .copy_item = enic_copy_item_vxlan_v2,
202 .valid_start_item = 0,
203 .prev_items = (const enum rte_flow_item_type[]) {
204 RTE_FLOW_ITEM_TYPE_UDP,
205 RTE_FLOW_ITEM_TYPE_END,
210 /** NICs with Advanced filters enabled */
211 static const struct enic_items enic_items_v3[] = {
212 [RTE_FLOW_ITEM_TYPE_ETH] = {
213 .copy_item = enic_copy_item_eth_v2,
214 .valid_start_item = 1,
215 .prev_items = (const enum rte_flow_item_type[]) {
216 RTE_FLOW_ITEM_TYPE_VXLAN,
217 RTE_FLOW_ITEM_TYPE_END,
220 [RTE_FLOW_ITEM_TYPE_VLAN] = {
221 .copy_item = enic_copy_item_vlan_v2,
222 .valid_start_item = 1,
223 .prev_items = (const enum rte_flow_item_type[]) {
224 RTE_FLOW_ITEM_TYPE_ETH,
225 RTE_FLOW_ITEM_TYPE_END,
228 [RTE_FLOW_ITEM_TYPE_IPV4] = {
229 .copy_item = enic_copy_item_ipv4_v2,
230 .valid_start_item = 1,
231 .prev_items = (const enum rte_flow_item_type[]) {
232 RTE_FLOW_ITEM_TYPE_ETH,
233 RTE_FLOW_ITEM_TYPE_VLAN,
234 RTE_FLOW_ITEM_TYPE_END,
237 [RTE_FLOW_ITEM_TYPE_IPV6] = {
238 .copy_item = enic_copy_item_ipv6_v2,
239 .valid_start_item = 1,
240 .prev_items = (const enum rte_flow_item_type[]) {
241 RTE_FLOW_ITEM_TYPE_ETH,
242 RTE_FLOW_ITEM_TYPE_VLAN,
243 RTE_FLOW_ITEM_TYPE_END,
246 [RTE_FLOW_ITEM_TYPE_UDP] = {
247 .copy_item = enic_copy_item_udp_v2,
248 .valid_start_item = 1,
249 .prev_items = (const enum rte_flow_item_type[]) {
250 RTE_FLOW_ITEM_TYPE_IPV4,
251 RTE_FLOW_ITEM_TYPE_IPV6,
252 RTE_FLOW_ITEM_TYPE_END,
255 [RTE_FLOW_ITEM_TYPE_TCP] = {
256 .copy_item = enic_copy_item_tcp_v2,
257 .valid_start_item = 1,
258 .prev_items = (const enum rte_flow_item_type[]) {
259 RTE_FLOW_ITEM_TYPE_IPV4,
260 RTE_FLOW_ITEM_TYPE_IPV6,
261 RTE_FLOW_ITEM_TYPE_END,
264 [RTE_FLOW_ITEM_TYPE_SCTP] = {
265 .copy_item = enic_copy_item_sctp_v2,
266 .valid_start_item = 1,
267 .prev_items = (const enum rte_flow_item_type[]) {
268 RTE_FLOW_ITEM_TYPE_IPV4,
269 RTE_FLOW_ITEM_TYPE_IPV6,
270 RTE_FLOW_ITEM_TYPE_END,
273 [RTE_FLOW_ITEM_TYPE_VXLAN] = {
274 .copy_item = enic_copy_item_vxlan_v2,
275 .valid_start_item = 1,
276 .prev_items = (const enum rte_flow_item_type[]) {
277 RTE_FLOW_ITEM_TYPE_UDP,
278 RTE_FLOW_ITEM_TYPE_END,
283 /** Filtering capabilities indexed this NICs supported filter type. */
284 static const struct enic_filter_cap enic_filter_cap[] = {
285 [FILTER_IPV4_5TUPLE] = {
286 .item_info = enic_items_v1,
288 [FILTER_USNIC_IP] = {
289 .item_info = enic_items_v2,
292 .item_info = enic_items_v3,
296 /** Supported actions for older NICs */
297 static const enum rte_flow_action_type enic_supported_actions_v1[] = {
298 RTE_FLOW_ACTION_TYPE_QUEUE,
299 RTE_FLOW_ACTION_TYPE_END,
302 /** Supported actions for newer NICs */
303 static const enum rte_flow_action_type enic_supported_actions_v2[] = {
304 RTE_FLOW_ACTION_TYPE_QUEUE,
305 RTE_FLOW_ACTION_TYPE_MARK,
306 RTE_FLOW_ACTION_TYPE_FLAG,
307 RTE_FLOW_ACTION_TYPE_END,
310 /** Action capabilities indexed by NIC version information */
311 static const struct enic_action_cap enic_action_cap[] = {
312 [FILTER_ACTION_RQ_STEERING_FLAG] = {
313 .actions = enic_supported_actions_v1,
314 .copy_fn = enic_copy_action_v1,
316 [FILTER_ACTION_V2_ALL] = {
317 .actions = enic_supported_actions_v2,
318 .copy_fn = enic_copy_action_v2,
323 mask_exact_match(const u8 *supported, const u8 *supplied,
327 for (i = 0; i < size; i++) {
328 if (supported[i] != supplied[i])
335 * Copy IPv4 item into version 1 NIC filter.
338 * Item specification.
339 * @param enic_filter[out]
340 * Partially filled in NIC filter structure.
341 * @param inner_ofst[in]
342 * Should always be 0 for version 1.
345 enic_copy_item_ipv4_v1(const struct rte_flow_item *item,
346 struct filter_v2 *enic_filter, u8 *inner_ofst)
348 const struct rte_flow_item_ipv4 *spec = item->spec;
349 const struct rte_flow_item_ipv4 *mask = item->mask;
350 struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4;
351 struct ipv4_hdr supported_mask = {
352 .src_addr = 0xffffffff,
353 .dst_addr = 0xffffffff,
362 mask = &rte_flow_item_ipv4_mask;
364 /* This is an exact match filter, both fields must be set */
365 if (!spec || !spec->hdr.src_addr || !spec->hdr.dst_addr) {
366 FLOW_LOG(ERR, "IPv4 exact match src/dst addr");
370 /* check that the suppied mask exactly matches capabilty */
371 if (!mask_exact_match((const u8 *)&supported_mask,
372 (const u8 *)item->mask, sizeof(*mask))) {
373 FLOW_LOG(ERR, "IPv4 exact match mask");
377 enic_filter->u.ipv4.flags = FILTER_FIELDS_IPV4_5TUPLE;
378 enic_5tup->src_addr = spec->hdr.src_addr;
379 enic_5tup->dst_addr = spec->hdr.dst_addr;
385 * Copy UDP item into version 1 NIC filter.
388 * Item specification.
389 * @param enic_filter[out]
390 * Partially filled in NIC filter structure.
391 * @param inner_ofst[in]
392 * Should always be 0 for version 1.
395 enic_copy_item_udp_v1(const struct rte_flow_item *item,
396 struct filter_v2 *enic_filter, u8 *inner_ofst)
398 const struct rte_flow_item_udp *spec = item->spec;
399 const struct rte_flow_item_udp *mask = item->mask;
400 struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4;
401 struct udp_hdr supported_mask = {
412 mask = &rte_flow_item_udp_mask;
414 /* This is an exact match filter, both ports must be set */
415 if (!spec || !spec->hdr.src_port || !spec->hdr.dst_port) {
416 FLOW_LOG(ERR, "UDP exact match src/dst addr");
420 /* check that the suppied mask exactly matches capabilty */
421 if (!mask_exact_match((const u8 *)&supported_mask,
422 (const u8 *)item->mask, sizeof(*mask))) {
423 FLOW_LOG(ERR, "UDP exact match mask");
427 enic_filter->u.ipv4.flags = FILTER_FIELDS_IPV4_5TUPLE;
428 enic_5tup->src_port = spec->hdr.src_port;
429 enic_5tup->dst_port = spec->hdr.dst_port;
430 enic_5tup->protocol = PROTO_UDP;
436 * Copy TCP item into version 1 NIC filter.
439 * Item specification.
440 * @param enic_filter[out]
441 * Partially filled in NIC filter structure.
442 * @param inner_ofst[in]
443 * Should always be 0 for version 1.
446 enic_copy_item_tcp_v1(const struct rte_flow_item *item,
447 struct filter_v2 *enic_filter, u8 *inner_ofst)
449 const struct rte_flow_item_tcp *spec = item->spec;
450 const struct rte_flow_item_tcp *mask = item->mask;
451 struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4;
452 struct tcp_hdr supported_mask = {
463 mask = &rte_flow_item_tcp_mask;
465 /* This is an exact match filter, both ports must be set */
466 if (!spec || !spec->hdr.src_port || !spec->hdr.dst_port) {
467 FLOW_LOG(ERR, "TCPIPv4 exact match src/dst addr");
471 /* check that the suppied mask exactly matches capabilty */
472 if (!mask_exact_match((const u8 *)&supported_mask,
473 (const u8 *)item->mask, sizeof(*mask))) {
474 FLOW_LOG(ERR, "TCP exact match mask");
478 enic_filter->u.ipv4.flags = FILTER_FIELDS_IPV4_5TUPLE;
479 enic_5tup->src_port = spec->hdr.src_port;
480 enic_5tup->dst_port = spec->hdr.dst_port;
481 enic_5tup->protocol = PROTO_TCP;
487 * Copy ETH item into version 2 NIC filter.
490 * Item specification.
491 * @param enic_filter[out]
492 * Partially filled in NIC filter structure.
493 * @param inner_ofst[in]
494 * If zero, this is an outer header. If non-zero, this is the offset into L5
495 * where the header begins.
498 enic_copy_item_eth_v2(const struct rte_flow_item *item,
499 struct filter_v2 *enic_filter, u8 *inner_ofst)
501 struct ether_hdr enic_spec;
502 struct ether_hdr enic_mask;
503 const struct rte_flow_item_eth *spec = item->spec;
504 const struct rte_flow_item_eth *mask = item->mask;
505 struct filter_generic_1 *gp = &enic_filter->u.generic_1;
509 /* Match all if no spec */
514 mask = &rte_flow_item_eth_mask;
516 memcpy(enic_spec.d_addr.addr_bytes, spec->dst.addr_bytes,
518 memcpy(enic_spec.s_addr.addr_bytes, spec->src.addr_bytes,
521 memcpy(enic_mask.d_addr.addr_bytes, mask->dst.addr_bytes,
523 memcpy(enic_mask.s_addr.addr_bytes, mask->src.addr_bytes,
525 enic_spec.ether_type = spec->type;
526 enic_mask.ether_type = mask->type;
528 if (*inner_ofst == 0) {
530 memcpy(gp->layer[FILTER_GENERIC_1_L2].mask, &enic_mask,
531 sizeof(struct ether_hdr));
532 memcpy(gp->layer[FILTER_GENERIC_1_L2].val, &enic_spec,
533 sizeof(struct ether_hdr));
536 if ((*inner_ofst + sizeof(struct ether_hdr)) >
537 FILTER_GENERIC_1_KEY_LEN)
539 /* Offset into L5 where inner Ethernet header goes */
540 memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst],
541 &enic_mask, sizeof(struct ether_hdr));
542 memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst],
543 &enic_spec, sizeof(struct ether_hdr));
544 *inner_ofst += sizeof(struct ether_hdr);
550 * Copy VLAN item into version 2 NIC filter.
553 * Item specification.
554 * @param enic_filter[out]
555 * Partially filled in NIC filter structure.
556 * @param inner_ofst[in]
557 * If zero, this is an outer header. If non-zero, this is the offset into L5
558 * where the header begins.
561 enic_copy_item_vlan_v2(const struct rte_flow_item *item,
562 struct filter_v2 *enic_filter, u8 *inner_ofst)
564 const struct rte_flow_item_vlan *spec = item->spec;
565 const struct rte_flow_item_vlan *mask = item->mask;
566 struct filter_generic_1 *gp = &enic_filter->u.generic_1;
570 /* Match all if no spec */
574 /* Don't support filtering in tpid */
579 mask = &rte_flow_item_vlan_mask;
580 RTE_ASSERT(mask->tpid == 0);
583 if (*inner_ofst == 0) {
584 /* Outer header. Use the vlan mask/val fields */
585 gp->mask_vlan = mask->tci;
586 gp->val_vlan = spec->tci;
588 /* Inner header. Mask/Val start at *inner_ofst into L5 */
589 if ((*inner_ofst + sizeof(struct vlan_hdr)) >
590 FILTER_GENERIC_1_KEY_LEN)
592 memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst],
593 mask, sizeof(struct vlan_hdr));
594 memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst],
595 spec, sizeof(struct vlan_hdr));
596 *inner_ofst += sizeof(struct vlan_hdr);
602 * Copy IPv4 item into version 2 NIC filter.
605 * Item specification.
606 * @param enic_filter[out]
607 * Partially filled in NIC filter structure.
608 * @param inner_ofst[in]
609 * Must be 0. Don't support inner IPv4 filtering.
612 enic_copy_item_ipv4_v2(const struct rte_flow_item *item,
613 struct filter_v2 *enic_filter, u8 *inner_ofst)
615 const struct rte_flow_item_ipv4 *spec = item->spec;
616 const struct rte_flow_item_ipv4 *mask = item->mask;
617 struct filter_generic_1 *gp = &enic_filter->u.generic_1;
621 if (*inner_ofst == 0) {
623 gp->mask_flags |= FILTER_GENERIC_1_IPV4;
624 gp->val_flags |= FILTER_GENERIC_1_IPV4;
626 /* Match all if no spec */
631 mask = &rte_flow_item_ipv4_mask;
633 memcpy(gp->layer[FILTER_GENERIC_1_L3].mask, &mask->hdr,
634 sizeof(struct ipv4_hdr));
635 memcpy(gp->layer[FILTER_GENERIC_1_L3].val, &spec->hdr,
636 sizeof(struct ipv4_hdr));
638 /* Inner IPv4 header. Mask/Val start at *inner_ofst into L5 */
639 if ((*inner_ofst + sizeof(struct ipv4_hdr)) >
640 FILTER_GENERIC_1_KEY_LEN)
642 memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst],
643 mask, sizeof(struct ipv4_hdr));
644 memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst],
645 spec, sizeof(struct ipv4_hdr));
646 *inner_ofst += sizeof(struct ipv4_hdr);
652 * Copy IPv6 item into version 2 NIC filter.
655 * Item specification.
656 * @param enic_filter[out]
657 * Partially filled in NIC filter structure.
658 * @param inner_ofst[in]
659 * Must be 0. Don't support inner IPv6 filtering.
662 enic_copy_item_ipv6_v2(const struct rte_flow_item *item,
663 struct filter_v2 *enic_filter, u8 *inner_ofst)
665 const struct rte_flow_item_ipv6 *spec = item->spec;
666 const struct rte_flow_item_ipv6 *mask = item->mask;
667 struct filter_generic_1 *gp = &enic_filter->u.generic_1;
672 gp->mask_flags |= FILTER_GENERIC_1_IPV6;
673 gp->val_flags |= FILTER_GENERIC_1_IPV6;
675 /* Match all if no spec */
680 mask = &rte_flow_item_ipv6_mask;
682 if (*inner_ofst == 0) {
683 memcpy(gp->layer[FILTER_GENERIC_1_L3].mask, &mask->hdr,
684 sizeof(struct ipv6_hdr));
685 memcpy(gp->layer[FILTER_GENERIC_1_L3].val, &spec->hdr,
686 sizeof(struct ipv6_hdr));
688 /* Inner IPv6 header. Mask/Val start at *inner_ofst into L5 */
689 if ((*inner_ofst + sizeof(struct ipv6_hdr)) >
690 FILTER_GENERIC_1_KEY_LEN)
692 memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst],
693 mask, sizeof(struct ipv6_hdr));
694 memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst],
695 spec, sizeof(struct ipv6_hdr));
696 *inner_ofst += sizeof(struct ipv6_hdr);
702 * Copy UDP item into version 2 NIC filter.
705 * Item specification.
706 * @param enic_filter[out]
707 * Partially filled in NIC filter structure.
708 * @param inner_ofst[in]
709 * Must be 0. Don't support inner UDP filtering.
712 enic_copy_item_udp_v2(const struct rte_flow_item *item,
713 struct filter_v2 *enic_filter, u8 *inner_ofst)
715 const struct rte_flow_item_udp *spec = item->spec;
716 const struct rte_flow_item_udp *mask = item->mask;
717 struct filter_generic_1 *gp = &enic_filter->u.generic_1;
722 gp->mask_flags |= FILTER_GENERIC_1_UDP;
723 gp->val_flags |= FILTER_GENERIC_1_UDP;
725 /* Match all if no spec */
730 mask = &rte_flow_item_udp_mask;
732 if (*inner_ofst == 0) {
733 memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr,
734 sizeof(struct udp_hdr));
735 memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr,
736 sizeof(struct udp_hdr));
738 /* Inner IPv6 header. Mask/Val start at *inner_ofst into L5 */
739 if ((*inner_ofst + sizeof(struct udp_hdr)) >
740 FILTER_GENERIC_1_KEY_LEN)
742 memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst],
743 mask, sizeof(struct udp_hdr));
744 memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst],
745 spec, sizeof(struct udp_hdr));
746 *inner_ofst += sizeof(struct udp_hdr);
752 * Copy TCP item into version 2 NIC filter.
755 * Item specification.
756 * @param enic_filter[out]
757 * Partially filled in NIC filter structure.
758 * @param inner_ofst[in]
759 * Must be 0. Don't support inner TCP filtering.
762 enic_copy_item_tcp_v2(const struct rte_flow_item *item,
763 struct filter_v2 *enic_filter, u8 *inner_ofst)
765 const struct rte_flow_item_tcp *spec = item->spec;
766 const struct rte_flow_item_tcp *mask = item->mask;
767 struct filter_generic_1 *gp = &enic_filter->u.generic_1;
772 gp->mask_flags |= FILTER_GENERIC_1_TCP;
773 gp->val_flags |= FILTER_GENERIC_1_TCP;
775 /* Match all if no spec */
782 if (*inner_ofst == 0) {
783 memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr,
784 sizeof(struct tcp_hdr));
785 memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr,
786 sizeof(struct tcp_hdr));
788 /* Inner IPv6 header. Mask/Val start at *inner_ofst into L5 */
789 if ((*inner_ofst + sizeof(struct tcp_hdr)) >
790 FILTER_GENERIC_1_KEY_LEN)
792 memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst],
793 mask, sizeof(struct tcp_hdr));
794 memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst],
795 spec, sizeof(struct tcp_hdr));
796 *inner_ofst += sizeof(struct tcp_hdr);
802 * Copy SCTP item into version 2 NIC filter.
805 * Item specification.
806 * @param enic_filter[out]
807 * Partially filled in NIC filter structure.
808 * @param inner_ofst[in]
809 * Must be 0. Don't support inner SCTP filtering.
812 enic_copy_item_sctp_v2(const struct rte_flow_item *item,
813 struct filter_v2 *enic_filter, u8 *inner_ofst)
815 const struct rte_flow_item_sctp *spec = item->spec;
816 const struct rte_flow_item_sctp *mask = item->mask;
817 struct filter_generic_1 *gp = &enic_filter->u.generic_1;
824 /* Match all if no spec */
829 mask = &rte_flow_item_sctp_mask;
831 memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr,
832 sizeof(struct sctp_hdr));
833 memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr,
834 sizeof(struct sctp_hdr));
839 * Copy UDP item into version 2 NIC filter.
842 * Item specification.
843 * @param enic_filter[out]
844 * Partially filled in NIC filter structure.
845 * @param inner_ofst[in]
846 * Must be 0. VxLAN headers always start at the beginning of L5.
849 enic_copy_item_vxlan_v2(const struct rte_flow_item *item,
850 struct filter_v2 *enic_filter, u8 *inner_ofst)
852 const struct rte_flow_item_vxlan *spec = item->spec;
853 const struct rte_flow_item_vxlan *mask = item->mask;
854 struct filter_generic_1 *gp = &enic_filter->u.generic_1;
861 /* Match all if no spec */
866 mask = &rte_flow_item_vxlan_mask;
868 memcpy(gp->layer[FILTER_GENERIC_1_L5].mask, mask,
869 sizeof(struct vxlan_hdr));
870 memcpy(gp->layer[FILTER_GENERIC_1_L5].val, spec,
871 sizeof(struct vxlan_hdr));
873 *inner_ofst = sizeof(struct vxlan_hdr);
878 * Return 1 if current item is valid on top of the previous one.
880 * @param prev_item[in]
881 * The item before this one in the pattern or RTE_FLOW_ITEM_TYPE_END if this
883 * @param item_info[in]
884 * Info about this item, like valid previous items.
885 * @param is_first[in]
886 * True if this the first item in the pattern.
889 item_stacking_valid(enum rte_flow_item_type prev_item,
890 const struct enic_items *item_info, u8 is_first_item)
892 enum rte_flow_item_type const *allowed_items = item_info->prev_items;
896 for (; *allowed_items != RTE_FLOW_ITEM_TYPE_END; allowed_items++) {
897 if (prev_item == *allowed_items)
901 /* This is the first item in the stack. Check if that's cool */
902 if (is_first_item && item_info->valid_start_item)
909 * Build the intenal enic filter structure from the provided pattern. The
910 * pattern is validated as the items are copied.
913 * @param items_info[in]
914 * Info about this NICs item support, like valid previous items.
915 * @param enic_filter[out]
916 * NIC specfilc filters derived from the pattern.
920 enic_copy_filter(const struct rte_flow_item pattern[],
921 const struct enic_items *items_info,
922 struct filter_v2 *enic_filter,
923 struct rte_flow_error *error)
926 const struct rte_flow_item *item = pattern;
927 u8 inner_ofst = 0; /* If encapsulated, ofst into L5 */
928 enum rte_flow_item_type prev_item;
929 const struct enic_items *item_info;
931 u8 is_first_item = 1;
937 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
938 /* Get info about how to validate and copy the item. If NULL
939 * is returned the nic does not support the item.
941 if (item->type == RTE_FLOW_ITEM_TYPE_VOID)
944 item_info = &items_info[item->type];
946 /* check to see if item stacking is valid */
947 if (!item_stacking_valid(prev_item, item_info, is_first_item))
950 ret = item_info->copy_item(item, enic_filter, &inner_ofst);
952 goto item_not_supported;
953 prev_item = item->type;
959 rte_flow_error_set(error, ret, RTE_FLOW_ERROR_TYPE_ITEM,
960 NULL, "enic type error");
964 rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
965 item, "stacking error");
970 * Build the intenal version 1 NIC action structure from the provided pattern.
971 * The pattern is validated as the items are copied.
974 * @param enic_action[out]
975 * NIC specfilc actions derived from the actions.
979 enic_copy_action_v1(const struct rte_flow_action actions[],
980 struct filter_action_v2 *enic_action)
984 for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
985 if (actions->type == RTE_FLOW_ACTION_TYPE_VOID)
988 switch (actions->type) {
989 case RTE_FLOW_ACTION_TYPE_QUEUE: {
990 const struct rte_flow_action_queue *queue =
991 (const struct rte_flow_action_queue *)
993 enic_action->rq_idx =
994 enic_rte_rq_idx_to_sop_idx(queue->index);
1002 enic_action->type = FILTER_ACTION_RQ_STEERING;
1007 * Build the intenal version 2 NIC action structure from the provided pattern.
1008 * The pattern is validated as the items are copied.
1010 * @param actions[in]
1011 * @param enic_action[out]
1012 * NIC specfilc actions derived from the actions.
1016 enic_copy_action_v2(const struct rte_flow_action actions[],
1017 struct filter_action_v2 *enic_action)
1021 for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
1022 switch (actions->type) {
1023 case RTE_FLOW_ACTION_TYPE_QUEUE: {
1024 const struct rte_flow_action_queue *queue =
1025 (const struct rte_flow_action_queue *)
1027 enic_action->rq_idx =
1028 enic_rte_rq_idx_to_sop_idx(queue->index);
1029 enic_action->flags |= FILTER_ACTION_RQ_STEERING_FLAG;
1032 case RTE_FLOW_ACTION_TYPE_MARK: {
1033 const struct rte_flow_action_mark *mark =
1034 (const struct rte_flow_action_mark *)
1037 /* ENIC_MAGIC_FILTER_ID is reserved and is the highest
1038 * in the range of allows mark ids.
1040 if (mark->id >= ENIC_MAGIC_FILTER_ID)
1042 enic_action->filter_id = mark->id;
1043 enic_action->flags |= FILTER_ACTION_FILTER_ID_FLAG;
1046 case RTE_FLOW_ACTION_TYPE_FLAG: {
1047 enic_action->filter_id = ENIC_MAGIC_FILTER_ID;
1048 enic_action->flags |= FILTER_ACTION_FILTER_ID_FLAG;
1051 case RTE_FLOW_ACTION_TYPE_VOID:
1058 enic_action->type = FILTER_ACTION_V2;
1062 /** Check if the action is supported */
1064 enic_match_action(const struct rte_flow_action *action,
1065 const enum rte_flow_action_type *supported_actions)
1067 for (; *supported_actions != RTE_FLOW_ACTION_TYPE_END;
1068 supported_actions++) {
1069 if (action->type == *supported_actions)
1075 /** Get the NIC filter capabilties structure */
1076 static const struct enic_filter_cap *
1077 enic_get_filter_cap(struct enic *enic)
1079 if (enic->flow_filter_mode)
1080 return &enic_filter_cap[enic->flow_filter_mode];
1085 /** Get the actions for this NIC version. */
1086 static const struct enic_action_cap *
1087 enic_get_action_cap(struct enic *enic)
1089 static const struct enic_action_cap *ea;
1091 if (enic->filter_tags)
1092 ea = &enic_action_cap[FILTER_ACTION_V2_ALL];
1094 ea = &enic_action_cap[FILTER_ACTION_RQ_STEERING_FLAG];
1098 /* Debug function to dump internal NIC action structure. */
1100 enic_dump_actions(const struct filter_action_v2 *ea)
1102 if (ea->type == FILTER_ACTION_RQ_STEERING) {
1103 FLOW_LOG(INFO, "Action(V1), queue: %u\n", ea->rq_idx);
1104 } else if (ea->type == FILTER_ACTION_V2) {
1105 FLOW_LOG(INFO, "Actions(V2)\n");
1106 if (ea->flags & FILTER_ACTION_RQ_STEERING_FLAG)
1107 FLOW_LOG(INFO, "\tqueue: %u\n",
1108 enic_sop_rq_idx_to_rte_idx(ea->rq_idx));
1109 if (ea->flags & FILTER_ACTION_FILTER_ID_FLAG)
1110 FLOW_LOG(INFO, "\tfilter_id: %u\n", ea->filter_id);
1114 /* Debug function to dump internal NIC filter structure. */
1116 enic_dump_filter(const struct filter_v2 *filt)
1118 const struct filter_generic_1 *gp;
1121 char ip4[16], ip6[16], udp[16], tcp[16], tcpudp[16], ip4csum[16];
1122 char l4csum[16], ipfrag[16];
1124 switch (filt->type) {
1125 case FILTER_IPV4_5TUPLE:
1126 FLOW_LOG(INFO, "FILTER_IPV4_5TUPLE\n");
1128 case FILTER_USNIC_IP:
1130 /* FIXME: this should be a loop */
1131 gp = &filt->u.generic_1;
1132 FLOW_LOG(INFO, "Filter: vlan: 0x%04x, mask: 0x%04x\n",
1133 gp->val_vlan, gp->mask_vlan);
1135 if (gp->mask_flags & FILTER_GENERIC_1_IPV4)
1137 (gp->val_flags & FILTER_GENERIC_1_IPV4)
1138 ? "ip4(y)" : "ip4(n)");
1140 sprintf(ip4, "%s ", "ip4(x)");
1142 if (gp->mask_flags & FILTER_GENERIC_1_IPV6)
1144 (gp->val_flags & FILTER_GENERIC_1_IPV4)
1145 ? "ip6(y)" : "ip6(n)");
1147 sprintf(ip6, "%s ", "ip6(x)");
1149 if (gp->mask_flags & FILTER_GENERIC_1_UDP)
1151 (gp->val_flags & FILTER_GENERIC_1_UDP)
1152 ? "udp(y)" : "udp(n)");
1154 sprintf(udp, "%s ", "udp(x)");
1156 if (gp->mask_flags & FILTER_GENERIC_1_TCP)
1158 (gp->val_flags & FILTER_GENERIC_1_TCP)
1159 ? "tcp(y)" : "tcp(n)");
1161 sprintf(tcp, "%s ", "tcp(x)");
1163 if (gp->mask_flags & FILTER_GENERIC_1_TCP_OR_UDP)
1164 sprintf(tcpudp, "%s ",
1165 (gp->val_flags & FILTER_GENERIC_1_TCP_OR_UDP)
1166 ? "tcpudp(y)" : "tcpudp(n)");
1168 sprintf(tcpudp, "%s ", "tcpudp(x)");
1170 if (gp->mask_flags & FILTER_GENERIC_1_IP4SUM_OK)
1171 sprintf(ip4csum, "%s ",
1172 (gp->val_flags & FILTER_GENERIC_1_IP4SUM_OK)
1173 ? "ip4csum(y)" : "ip4csum(n)");
1175 sprintf(ip4csum, "%s ", "ip4csum(x)");
1177 if (gp->mask_flags & FILTER_GENERIC_1_L4SUM_OK)
1178 sprintf(l4csum, "%s ",
1179 (gp->val_flags & FILTER_GENERIC_1_L4SUM_OK)
1180 ? "l4csum(y)" : "l4csum(n)");
1182 sprintf(l4csum, "%s ", "l4csum(x)");
1184 if (gp->mask_flags & FILTER_GENERIC_1_IPFRAG)
1185 sprintf(ipfrag, "%s ",
1186 (gp->val_flags & FILTER_GENERIC_1_IPFRAG)
1187 ? "ipfrag(y)" : "ipfrag(n)");
1189 sprintf(ipfrag, "%s ", "ipfrag(x)");
1190 FLOW_LOG(INFO, "\tFlags: %s%s%s%s%s%s%s%s\n", ip4, ip6, udp,
1191 tcp, tcpudp, ip4csum, l4csum, ipfrag);
1193 for (i = 0; i < FILTER_GENERIC_1_NUM_LAYERS; i++) {
1194 mbyte = FILTER_GENERIC_1_KEY_LEN - 1;
1195 while (mbyte && !gp->layer[i].mask[mbyte])
1201 for (j = 0; j <= mbyte; j++) {
1203 gp->layer[i].mask[j]);
1207 FLOW_LOG(INFO, "\tL%u mask: %s\n", i + 2, buf);
1209 for (j = 0; j <= mbyte; j++) {
1211 gp->layer[i].val[j]);
1215 FLOW_LOG(INFO, "\tL%u val: %s\n", i + 2, buf);
1219 FLOW_LOG(INFO, "FILTER UNKNOWN\n");
1224 /* Debug function to dump internal NIC flow structures. */
1226 enic_dump_flow(const struct filter_action_v2 *ea, const struct filter_v2 *filt)
1228 enic_dump_filter(filt);
1229 enic_dump_actions(ea);
1234 * Internal flow parse/validate function.
1237 * This device pointer.
1238 * @param pattern[in]
1239 * @param actions[in]
1241 * @param enic_filter[out]
1242 * Internal NIC filter structure pointer.
1243 * @param enic_action[out]
1244 * Internal NIC action structure pointer.
1247 enic_flow_parse(struct rte_eth_dev *dev,
1248 const struct rte_flow_attr *attrs,
1249 const struct rte_flow_item pattern[],
1250 const struct rte_flow_action actions[],
1251 struct rte_flow_error *error,
1252 struct filter_v2 *enic_filter,
1253 struct filter_action_v2 *enic_action)
1255 unsigned int ret = 0;
1256 struct enic *enic = pmd_priv(dev);
1257 const struct enic_filter_cap *enic_filter_cap;
1258 const struct enic_action_cap *enic_action_cap;
1259 const struct rte_flow_action *action;
1263 memset(enic_filter, 0, sizeof(*enic_filter));
1264 memset(enic_action, 0, sizeof(*enic_action));
1267 rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_NUM,
1268 NULL, "No pattern specified");
1273 rte_flow_error_set(error, EINVAL,
1274 RTE_FLOW_ERROR_TYPE_ACTION_NUM,
1275 NULL, "No action specified");
1281 rte_flow_error_set(error, ENOTSUP,
1282 RTE_FLOW_ERROR_TYPE_ATTR_GROUP,
1284 "priority groups are not supported");
1286 } else if (attrs->priority) {
1287 rte_flow_error_set(error, ENOTSUP,
1288 RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,
1290 "priorities are not supported");
1292 } else if (attrs->egress) {
1293 rte_flow_error_set(error, ENOTSUP,
1294 RTE_FLOW_ERROR_TYPE_ATTR_EGRESS,
1296 "egress is not supported");
1298 } else if (!attrs->ingress) {
1299 rte_flow_error_set(error, ENOTSUP,
1300 RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,
1302 "only ingress is supported");
1307 rte_flow_error_set(error, EINVAL,
1308 RTE_FLOW_ERROR_TYPE_ATTR,
1309 NULL, "No attribute specified");
1313 /* Verify Actions. */
1314 enic_action_cap = enic_get_action_cap(enic);
1315 for (action = &actions[0]; action->type != RTE_FLOW_ACTION_TYPE_END;
1317 if (action->type == RTE_FLOW_ACTION_TYPE_VOID)
1319 else if (!enic_match_action(action, enic_action_cap->actions))
1322 if (action->type != RTE_FLOW_ACTION_TYPE_END) {
1323 rte_flow_error_set(error, EPERM, RTE_FLOW_ERROR_TYPE_ACTION,
1324 action, "Invalid action.");
1327 ret = enic_action_cap->copy_fn(actions, enic_action);
1329 rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE,
1330 NULL, "Unsupported action.");
1334 /* Verify Flow items. If copying the filter from flow format to enic
1335 * format fails, the flow is not supported
1337 enic_filter_cap = enic_get_filter_cap(enic);
1338 if (enic_filter_cap == NULL) {
1339 rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE,
1340 NULL, "Flow API not available");
1343 enic_filter->type = enic->flow_filter_mode;
1344 ret = enic_copy_filter(pattern, enic_filter_cap->item_info,
1345 enic_filter, error);
1350 * Push filter/action to the NIC.
1353 * Device structure pointer.
1354 * @param enic_filter[in]
1355 * Internal NIC filter structure pointer.
1356 * @param enic_action[in]
1357 * Internal NIC action structure pointer.
1360 static struct rte_flow *
1361 enic_flow_add_filter(struct enic *enic, struct filter_v2 *enic_filter,
1362 struct filter_action_v2 *enic_action,
1363 struct rte_flow_error *error)
1365 struct rte_flow *flow;
1371 flow = rte_calloc(__func__, 1, sizeof(*flow), 0);
1373 rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
1374 NULL, "cannot allocate flow memory");
1378 /* entry[in] is the queue id, entry[out] is the filter Id for delete */
1379 entry = enic_action->rq_idx;
1380 ret = vnic_dev_classifier(enic->vdev, CLSF_ADD, &entry, enic_filter,
1383 flow->enic_filter_id = entry;
1384 flow->enic_filter = *enic_filter;
1386 rte_flow_error_set(error, ret, RTE_FLOW_ERROR_TYPE_HANDLE,
1387 NULL, "vnic_dev_classifier error");
1395 * Remove filter/action from the NIC.
1398 * Device structure pointer.
1399 * @param filter_id[in]
1401 * @param enic_action[in]
1402 * Internal NIC action structure pointer.
1406 enic_flow_del_filter(struct enic *enic, u16 filter_id,
1407 struct rte_flow_error *error)
1413 ret = vnic_dev_classifier(enic->vdev, CLSF_DEL, &filter_id, NULL, NULL);
1415 rte_flow_error_set(error, ret, RTE_FLOW_ERROR_TYPE_HANDLE,
1416 NULL, "vnic_dev_classifier failed");
1421 * The following functions are callbacks for Generic flow API.
1425 * Validate a flow supported by the NIC.
1427 * @see rte_flow_validate()
1431 enic_flow_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attrs,
1432 const struct rte_flow_item pattern[],
1433 const struct rte_flow_action actions[],
1434 struct rte_flow_error *error)
1436 struct filter_v2 enic_filter;
1437 struct filter_action_v2 enic_action;
1442 ret = enic_flow_parse(dev, attrs, pattern, actions, error,
1443 &enic_filter, &enic_action);
1445 enic_dump_flow(&enic_action, &enic_filter);
1450 * Create a flow supported by the NIC.
1452 * @see rte_flow_create()
1455 static struct rte_flow *
1456 enic_flow_create(struct rte_eth_dev *dev,
1457 const struct rte_flow_attr *attrs,
1458 const struct rte_flow_item pattern[],
1459 const struct rte_flow_action actions[],
1460 struct rte_flow_error *error)
1463 struct filter_v2 enic_filter;
1464 struct filter_action_v2 enic_action;
1465 struct rte_flow *flow;
1466 struct enic *enic = pmd_priv(dev);
1470 ret = enic_flow_parse(dev, attrs, pattern, actions, error, &enic_filter,
1475 rte_spinlock_lock(&enic->flows_lock);
1476 flow = enic_flow_add_filter(enic, &enic_filter, &enic_action,
1479 LIST_INSERT_HEAD(&enic->flows, flow, next);
1480 rte_spinlock_unlock(&enic->flows_lock);
1486 * Destroy a flow supported by the NIC.
1488 * @see rte_flow_destroy()
1492 enic_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
1493 __rte_unused struct rte_flow_error *error)
1495 struct enic *enic = pmd_priv(dev);
1499 rte_spinlock_lock(&enic->flows_lock);
1500 enic_flow_del_filter(enic, flow->enic_filter_id, error);
1501 LIST_REMOVE(flow, next);
1502 rte_spinlock_unlock(&enic->flows_lock);
1507 * Flush all flows on the device.
1509 * @see rte_flow_flush()
1513 enic_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
1515 struct rte_flow *flow;
1516 struct enic *enic = pmd_priv(dev);
1520 rte_spinlock_lock(&enic->flows_lock);
1522 while (!LIST_EMPTY(&enic->flows)) {
1523 flow = LIST_FIRST(&enic->flows);
1524 enic_flow_del_filter(enic, flow->enic_filter_id, error);
1525 LIST_REMOVE(flow, next);
1527 rte_spinlock_unlock(&enic->flows_lock);
1532 * Flow callback registration.
1536 const struct rte_flow_ops enic_flow_ops = {
1537 .validate = enic_flow_validate,
1538 .create = enic_flow_create,
1539 .destroy = enic_flow_destroy,
1540 .flush = enic_flow_flush,