2 * Copyright (c) 2019 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <vnet/vnet.h>
17 #include <vppinfra/vec.h>
18 #include <vppinfra/format.h>
19 #include <vlib/unix/cj.h>
22 #include <vnet/ip/ip.h>
23 #include <vnet/ethernet/ethernet.h>
24 #include <vnet/ethernet/arp_packet.h>
25 #include <vnet/vxlan/vxlan.h>
26 #include <dpdk/device/dpdk.h>
28 #include <dpdk/device/dpdk_priv.h>
29 #include <vppinfra/error.h>
31 /* check if flow is L2 flow */
32 #define FLOW_IS_L2_LAYER(f) \
33 (f->type == VNET_FLOW_TYPE_ETHERNET)
35 /* check if flow is L4 type */
36 #define FLOW_IS_L4_LAYER(f) \
37 ((f->type == VNET_FLOW_TYPE_IP4_N_TUPLE) || \
38 (f->type == VNET_FLOW_TYPE_IP6_N_TUPLE))
40 /* check if flow is L4 tunnel type */
41 #define FLOW_IS_L4_TUNNEL_LAYER(f) \
42 ((f->type >= VNET_FLOW_TYPE_IP4_VXLAN) || \
43 (f->type <= VNET_FLOW_TYPE_IP6_GTPU_IP6))
45 /* constant structs */
46 static const struct rte_flow_attr ingress = {.ingress = 1 };
49 mac_address_is_all_zero (const u8 addr[6])
53 for (i = 0; i < 6; i++)
61 dpdk_flow_add (dpdk_device_t * xd, vnet_flow_t * f, dpdk_flow_entry_t * fe)
63 struct rte_flow_item_eth eth[2] = { };
64 struct rte_flow_item_ipv4 ip4[2] = { };
65 struct rte_flow_item_ipv4 inner_ip4[2] = { };
66 struct rte_flow_item_ipv6 ip6[2] = { };
67 struct rte_flow_item_ipv6 inner_ip6[2] = { };
68 struct rte_flow_item_udp udp[2] = { };
69 struct rte_flow_item_tcp tcp[2] = { };
70 struct rte_flow_item_gtp gtp[2] = { };
71 struct rte_flow_action_mark mark = { 0 };
72 struct rte_flow_action_queue queue = { 0 };
73 struct rte_flow_item *item, *items = 0;
74 struct rte_flow_action *action, *actions = 0;
79 vxlan_hdr_sz = sizeof (vxlan_header_t),
80 raw_sz = sizeof (struct rte_flow_item_raw)
85 struct rte_flow_item_raw item;
86 u8 val[raw_sz + vxlan_hdr_sz];
89 u16 src_port, dst_port, src_port_mask, dst_port_mask;
93 if (f->actions & (~xd->supported_flow_actions))
94 return VNET_FLOW_ERROR_NOT_SUPPORTED;
98 vec_add2 (items, item, 1);
99 item->type = RTE_FLOW_ITEM_TYPE_ETH;
100 if (f->type == VNET_FLOW_TYPE_ETHERNET)
102 vnet_flow_ethernet_t *te = &f->ethernet;
104 clib_memset (ð[0], 0, sizeof (eth[0]));
105 clib_memset (ð[1], 0, sizeof (eth[1]));
107 /* check if SMAC/DMAC/Ether_type assigned */
108 if (!mac_address_is_all_zero (te->eth_hdr.dst_address))
110 clib_memcpy_fast (ð[0].dst, &te->eth_hdr.dst_address,
111 sizeof (eth[0].dst));
112 clib_memset (ð[1].dst, 0xFF, sizeof (eth[1].dst));
115 if (!mac_address_is_all_zero (te->eth_hdr.src_address))
117 clib_memcpy_fast (ð[0].src, &te->eth_hdr.src_address,
118 sizeof (eth[0].src));
119 clib_memset (ð[1].src, 0xFF, sizeof (eth[1].src));
122 if (te->eth_hdr.type)
124 eth[0].type = clib_host_to_net_u16 (te->eth_hdr.type);
125 eth[1].type = clib_host_to_net_u16 (0xFFFF);
129 item->mask = eth + 1;
138 if ((f->type == VNET_FLOW_TYPE_IP4_N_TUPLE) ||
139 (f->type == VNET_FLOW_TYPE_IP6_N_TUPLE))
141 vec_add2 (items, item, 1);
142 item->type = RTE_FLOW_ITEM_TYPE_VLAN;
147 if (FLOW_IS_L2_LAYER (f))
151 vec_add2 (items, item, 1);
152 if ((f->type == VNET_FLOW_TYPE_IP6_N_TUPLE) ||
153 (f->type == VNET_FLOW_TYPE_IP6_GTPC) ||
154 (f->type == VNET_FLOW_TYPE_IP6_GTPU) ||
155 (f->type == VNET_FLOW_TYPE_IP6_GTPU_IP4) ||
156 (f->type == VNET_FLOW_TYPE_IP6_GTPU_IP6))
158 vnet_flow_ip6_n_tuple_t *t6 = &f->ip6_n_tuple;
159 item->type = RTE_FLOW_ITEM_TYPE_IPV6;
161 if (!clib_memcmp (&t6->src_addr.mask, &zero_addr, 16) &&
162 !clib_memcmp (&t6->dst_addr.mask, &zero_addr, 16))
169 clib_memcpy_fast (ip6[0].hdr.src_addr, &t6->src_addr.addr, 16);
170 clib_memcpy_fast (ip6[1].hdr.src_addr, &t6->src_addr.mask, 16);
171 clib_memcpy_fast (ip6[0].hdr.dst_addr, &t6->dst_addr.addr, 16);
172 clib_memcpy_fast (ip6[1].hdr.dst_addr, &t6->dst_addr.mask, 16);
174 item->mask = ip6 + 1;
177 src_port = t6->src_port.port;
178 dst_port = t6->dst_port.port;
179 src_port_mask = t6->src_port.mask;
180 dst_port_mask = t6->dst_port.mask;
181 protocol = t6->protocol;
183 else if ((f->type == VNET_FLOW_TYPE_IP4_N_TUPLE) ||
184 (f->type == VNET_FLOW_TYPE_IP4_GTPC) ||
185 (f->type == VNET_FLOW_TYPE_IP4_GTPU) ||
186 (f->type == VNET_FLOW_TYPE_IP4_GTPU_IP4) ||
187 (f->type == VNET_FLOW_TYPE_IP4_GTPU_IP6))
189 vnet_flow_ip4_n_tuple_t *t4 = &f->ip4_n_tuple;
190 item->type = RTE_FLOW_ITEM_TYPE_IPV4;
192 if (!t4->src_addr.mask.as_u32 && !t4->dst_addr.mask.as_u32)
199 ip4[0].hdr.src_addr = t4->src_addr.addr.as_u32;
200 ip4[1].hdr.src_addr = t4->src_addr.mask.as_u32;
201 ip4[0].hdr.dst_addr = t4->dst_addr.addr.as_u32;
202 ip4[1].hdr.dst_addr = t4->dst_addr.mask.as_u32;
204 item->mask = ip4 + 1;
207 src_port = t4->src_port.port;
208 dst_port = t4->dst_port.port;
209 src_port_mask = t4->src_port.mask;
210 dst_port_mask = t4->dst_port.mask;
211 protocol = t4->protocol;
213 else if (f->type == VNET_FLOW_TYPE_IP4_VXLAN)
215 vnet_flow_ip4_vxlan_t *v4 = &f->ip4_vxlan;
216 ip4[0].hdr.src_addr = v4->src_addr.as_u32;
217 ip4[1].hdr.src_addr = -1;
218 ip4[0].hdr.dst_addr = v4->dst_addr.as_u32;
219 ip4[1].hdr.dst_addr = -1;
220 item->type = RTE_FLOW_ITEM_TYPE_IPV4;
222 item->mask = ip4 + 1;
224 dst_port = v4->dst_port;
228 protocol = IP_PROTOCOL_UDP;
232 rv = VNET_FLOW_ERROR_NOT_SUPPORTED;
237 vec_add2 (items, item, 1);
238 if (protocol == IP_PROTOCOL_UDP)
240 item->type = RTE_FLOW_ITEM_TYPE_UDP;
242 if ((src_port_mask == 0) && (dst_port_mask == 0))
249 udp[0].hdr.src_port = clib_host_to_net_u16 (src_port);
250 udp[1].hdr.src_port = clib_host_to_net_u16 (src_port_mask);
251 udp[0].hdr.dst_port = clib_host_to_net_u16 (dst_port);
252 udp[1].hdr.dst_port = clib_host_to_net_u16 (dst_port_mask);
254 item->mask = udp + 1;
257 else if (protocol == IP_PROTOCOL_TCP)
259 item->type = RTE_FLOW_ITEM_TYPE_TCP;
261 if ((src_port_mask == 0) && (dst_port_mask == 0))
267 tcp[0].hdr.src_port = clib_host_to_net_u16 (src_port);
268 tcp[1].hdr.src_port = clib_host_to_net_u16 (src_port_mask);
269 tcp[0].hdr.dst_port = clib_host_to_net_u16 (dst_port);
270 tcp[1].hdr.dst_port = clib_host_to_net_u16 (dst_port_mask);
272 item->mask = tcp + 1;
276 rv = VNET_FLOW_ERROR_NOT_SUPPORTED;
280 /* Tunnel header match */
281 if (f->type == VNET_FLOW_TYPE_IP4_VXLAN)
283 u32 vni = f->ip4_vxlan.vni;
284 vxlan_header_t spec_hdr = {
285 .flags = VXLAN_FLAGS_I,
286 .vni_reserved = clib_host_to_net_u32 (vni << 8)
288 vxlan_header_t mask_hdr = {
290 .vni_reserved = clib_host_to_net_u32 (((u32) - 1) << 8)
293 clib_memset (raw, 0, sizeof raw);
294 raw[0].item.relative = 1;
295 raw[0].item.length = vxlan_hdr_sz;
297 clib_memcpy_fast (raw[0].val + raw_sz, &spec_hdr, vxlan_hdr_sz);
298 raw[0].item.pattern = raw[0].val + raw_sz;
299 clib_memcpy_fast (raw[1].val + raw_sz, &mask_hdr, vxlan_hdr_sz);
300 raw[1].item.pattern = raw[1].val + raw_sz;
302 vec_add2 (items, item, 1);
303 item->type = RTE_FLOW_ITEM_TYPE_RAW;
305 item->mask = raw + 1;
307 else if (f->type == VNET_FLOW_TYPE_IP4_GTPC)
309 vnet_flow_ip4_gtpc_t *gc = &f->ip4_gtpc;
310 gtp[0].teid = clib_host_to_net_u32 (gc->teid);
313 vec_add2 (items, item, 1);
314 item->type = RTE_FLOW_ITEM_TYPE_GTPC;
316 item->mask = gtp + 1;
318 else if (f->type == VNET_FLOW_TYPE_IP4_GTPU)
320 vnet_flow_ip4_gtpu_t *gu = &f->ip4_gtpu;
321 gtp[0].teid = clib_host_to_net_u32 (gu->teid);
324 vec_add2 (items, item, 1);
325 item->type = RTE_FLOW_ITEM_TYPE_GTPU;
327 item->mask = gtp + 1;
329 else if ((f->type == VNET_FLOW_TYPE_IP4_GTPU_IP4) ||
330 (f->type == VNET_FLOW_TYPE_IP4_GTPU_IP6))
332 vnet_flow_ip4_gtpu_t *gu = &f->ip4_gtpu;
333 gtp[0].teid = clib_host_to_net_u32 (gu->teid);
336 vec_add2 (items, item, 1);
337 item->type = RTE_FLOW_ITEM_TYPE_GTPU;
339 item->mask = gtp + 1;
341 /* inner IP4 header */
342 if (f->type == VNET_FLOW_TYPE_IP4_GTPU_IP4)
344 vec_add2 (items, item, 1);
345 item->type = RTE_FLOW_ITEM_TYPE_IPV4;
347 vnet_flow_ip4_gtpu_ip4_t *gu4 = &f->ip4_gtpu_ip4;
348 if (!gu4->inner_src_addr.mask.as_u32 &&
349 !gu4->inner_dst_addr.mask.as_u32)
356 inner_ip4[0].hdr.src_addr = gu4->inner_src_addr.addr.as_u32;
357 inner_ip4[1].hdr.src_addr = gu4->inner_src_addr.mask.as_u32;
358 inner_ip4[0].hdr.dst_addr = gu4->inner_dst_addr.addr.as_u32;
359 inner_ip4[1].hdr.dst_addr = gu4->inner_dst_addr.mask.as_u32;
360 item->spec = inner_ip4;
361 item->mask = inner_ip4 + 1;
364 else if (f->type == VNET_FLOW_TYPE_IP4_GTPU_IP6)
366 ip6_address_t zero_addr;
367 vnet_flow_ip4_gtpu_ip6_t *gu6 = &f->ip4_gtpu_ip6;
369 clib_memset (&zero_addr, 0, sizeof (ip6_address_t));
371 vec_add2 (items, item, 1);
372 item->type = RTE_FLOW_ITEM_TYPE_IPV6;
374 if (!clib_memcmp (&gu6->inner_src_addr.mask, &zero_addr, 16) &&
375 !clib_memcmp (&gu6->inner_dst_addr.mask, &zero_addr, 16))
382 clib_memcpy_fast (inner_ip6[0].hdr.src_addr,
383 &gu6->inner_src_addr.addr, 16);
384 clib_memcpy_fast (inner_ip6[1].hdr.src_addr,
385 &gu6->inner_src_addr.mask, 16);
386 clib_memcpy_fast (inner_ip6[0].hdr.dst_addr,
387 &gu6->inner_dst_addr.addr, 16);
388 clib_memcpy_fast (inner_ip6[1].hdr.dst_addr,
389 &gu6->inner_dst_addr.mask, 16);
390 item->spec = inner_ip6;
391 item->mask = inner_ip6 + 1;
395 else if (f->type == VNET_FLOW_TYPE_IP6_GTPC)
397 vnet_flow_ip6_gtpc_t *gc = &f->ip6_gtpc;
398 gtp[0].teid = clib_host_to_net_u32 (gc->teid);
401 vec_add2 (items, item, 1);
402 item->type = RTE_FLOW_ITEM_TYPE_GTPC;
404 item->mask = gtp + 1;
406 else if (f->type == VNET_FLOW_TYPE_IP6_GTPU)
408 vnet_flow_ip6_gtpu_t *gu = &f->ip6_gtpu;
409 gtp[0].teid = clib_host_to_net_u32 (gu->teid);
412 vec_add2 (items, item, 1);
413 item->type = RTE_FLOW_ITEM_TYPE_GTPU;
415 item->mask = gtp + 1;
417 else if ((f->type == VNET_FLOW_TYPE_IP6_GTPU_IP4) ||
418 (f->type == VNET_FLOW_TYPE_IP6_GTPU_IP6))
420 vnet_flow_ip6_gtpu_t *gu = &f->ip6_gtpu;
421 gtp[0].teid = clib_host_to_net_u32 (gu->teid);
424 vec_add2 (items, item, 1);
425 item->type = RTE_FLOW_ITEM_TYPE_GTPU;
427 item->mask = gtp + 1;
429 /* inner IP4 header */
430 if (f->type == VNET_FLOW_TYPE_IP6_GTPU_IP4)
432 vec_add2 (items, item, 1);
433 item->type = RTE_FLOW_ITEM_TYPE_IPV4;
435 vnet_flow_ip6_gtpu_ip4_t *gu4 = &f->ip6_gtpu_ip4;
437 if (!gu4->inner_src_addr.mask.as_u32 &&
438 !gu4->inner_dst_addr.mask.as_u32)
445 inner_ip4[0].hdr.src_addr = gu4->inner_src_addr.addr.as_u32;
446 inner_ip4[1].hdr.src_addr = gu4->inner_src_addr.mask.as_u32;
447 inner_ip4[0].hdr.dst_addr = gu4->inner_dst_addr.addr.as_u32;
448 inner_ip4[1].hdr.dst_addr = gu4->inner_dst_addr.mask.as_u32;
449 item->spec = inner_ip4;
450 item->mask = inner_ip4 + 1;
454 if (f->type == VNET_FLOW_TYPE_IP6_GTPU_IP6)
456 ip6_address_t zero_addr;
457 vnet_flow_ip6_gtpu_ip6_t *gu6 = &f->ip6_gtpu_ip6;
459 clib_memset (&zero_addr, 0, sizeof (ip6_address_t));
461 vec_add2 (items, item, 1);
462 item->type = RTE_FLOW_ITEM_TYPE_IPV6;
464 if (!clib_memcmp (&gu6->inner_src_addr.mask, &zero_addr, 16) &&
465 !clib_memcmp (&gu6->inner_dst_addr.mask, &zero_addr, 16))
472 clib_memcpy_fast (inner_ip6[0].hdr.src_addr,
473 &gu6->inner_src_addr.addr, 16);
474 clib_memcpy_fast (inner_ip6[1].hdr.src_addr,
475 &gu6->inner_src_addr.mask, 16);
476 clib_memcpy_fast (inner_ip6[0].hdr.dst_addr,
477 &gu6->inner_dst_addr.addr, 16);
478 clib_memcpy_fast (inner_ip6[1].hdr.dst_addr,
479 &gu6->inner_dst_addr.mask, 16);
480 item->spec = inner_ip6;
481 item->mask = inner_ip6 + 1;
488 vec_add2 (items, item, 1);
489 item->type = RTE_FLOW_ITEM_TYPE_END;
492 /* Only one 'fate' can be assigned */
493 if (f->actions & VNET_FLOW_ACTION_REDIRECT_TO_QUEUE)
495 vec_add2 (actions, action, 1);
496 queue.index = f->redirect_queue;
497 action->type = RTE_FLOW_ACTION_TYPE_QUEUE;
498 action->conf = &queue;
501 if (f->actions & VNET_FLOW_ACTION_DROP)
503 vec_add2 (actions, action, 1);
504 action->type = RTE_FLOW_ACTION_TYPE_DROP;
507 rv = VNET_FLOW_ERROR_INTERNAL;
515 vec_add2 (actions, action, 1);
516 action->type = RTE_FLOW_ACTION_TYPE_PASSTHRU;
519 if (f->actions & VNET_FLOW_ACTION_MARK)
521 vec_add2 (actions, action, 1);
523 action->type = RTE_FLOW_ACTION_TYPE_MARK;
524 action->conf = &mark;
527 vec_add2 (actions, action, 1);
528 action->type = RTE_FLOW_ACTION_TYPE_END;
530 rv = rte_flow_validate (xd->device_index, &ingress, items, actions,
531 &xd->last_flow_error);
536 rv = VNET_FLOW_ERROR_NOT_SUPPORTED;
537 else if (rv == -EEXIST)
538 rv = VNET_FLOW_ERROR_ALREADY_EXISTS;
540 rv = VNET_FLOW_ERROR_INTERNAL;
544 fe->handle = rte_flow_create (xd->device_index, &ingress, items, actions,
545 &xd->last_flow_error);
548 rv = VNET_FLOW_ERROR_NOT_SUPPORTED;
557 dpdk_flow_ops_fn (vnet_main_t * vnm, vnet_flow_dev_op_t op, u32 dev_instance,
558 u32 flow_index, uword * private_data)
560 dpdk_main_t *dm = &dpdk_main;
561 vnet_flow_t *flow = vnet_get_flow (flow_index);
562 dpdk_device_t *xd = vec_elt_at_index (dm->devices, dev_instance);
563 dpdk_flow_entry_t *fe;
564 dpdk_flow_lookup_entry_t *fle = 0;
567 /* recycle old flow lookup entries only after the main loop counter
568 increases - i.e. previously DMA'ed packets were handled */
569 if (vec_len (xd->parked_lookup_indexes) > 0 &&
570 xd->parked_loop_count != dm->vlib_main->main_loop_count)
574 vec_foreach (fl_index, xd->parked_lookup_indexes)
575 pool_put_index (xd->flow_lookup_entries, *fl_index);
576 vec_reset_length (xd->flow_lookup_entries);
579 if (op == VNET_FLOW_DEV_OP_DEL_FLOW)
581 fe = vec_elt_at_index (xd->flow_entries, *private_data);
583 if ((rv = rte_flow_destroy (xd->device_index, fe->handle,
584 &xd->last_flow_error)))
585 return VNET_FLOW_ERROR_INTERNAL;
589 /* make sure no action is taken for in-flight (marked) packets */
590 fle = pool_elt_at_index (xd->flow_lookup_entries, fe->mark);
591 clib_memset (fle, -1, sizeof (*fle));
592 vec_add1 (xd->parked_lookup_indexes, fe->mark);
593 xd->parked_loop_count = dm->vlib_main->main_loop_count;
596 clib_memset (fe, 0, sizeof (*fe));
597 pool_put (xd->flow_entries, fe);
599 goto disable_rx_offload;
602 if (op != VNET_FLOW_DEV_OP_ADD_FLOW)
603 return VNET_FLOW_ERROR_NOT_SUPPORTED;
605 pool_get (xd->flow_entries, fe);
606 fe->flow_index = flow->index;
608 if (flow->actions == 0)
610 rv = VNET_FLOW_ERROR_NOT_SUPPORTED;
614 /* if we need to mark packets, assign one mark */
615 if (flow->actions & (VNET_FLOW_ACTION_MARK |
616 VNET_FLOW_ACTION_REDIRECT_TO_NODE |
617 VNET_FLOW_ACTION_BUFFER_ADVANCE))
620 if (xd->flow_lookup_entries == 0)
621 pool_get_aligned (xd->flow_lookup_entries, fle,
622 CLIB_CACHE_LINE_BYTES);
623 pool_get_aligned (xd->flow_lookup_entries, fle, CLIB_CACHE_LINE_BYTES);
624 fe->mark = fle - xd->flow_lookup_entries;
626 /* install entry in the lookup table */
627 clib_memset (fle, -1, sizeof (*fle));
628 if (flow->actions & VNET_FLOW_ACTION_MARK)
629 fle->flow_id = flow->mark_flow_id;
630 if (flow->actions & VNET_FLOW_ACTION_REDIRECT_TO_NODE)
631 fle->next_index = flow->redirect_device_input_next_index;
632 if (flow->actions & VNET_FLOW_ACTION_BUFFER_ADVANCE)
633 fle->buffer_advance = flow->buffer_advance;
638 if ((xd->flags & DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD) == 0)
640 xd->flags |= DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD;
641 dpdk_device_setup (xd);
646 case VNET_FLOW_TYPE_ETHERNET:
647 case VNET_FLOW_TYPE_IP4_N_TUPLE:
648 case VNET_FLOW_TYPE_IP6_N_TUPLE:
649 case VNET_FLOW_TYPE_IP4_VXLAN:
650 case VNET_FLOW_TYPE_IP4_GTPC:
651 case VNET_FLOW_TYPE_IP4_GTPU:
652 case VNET_FLOW_TYPE_IP4_GTPU_IP4:
653 case VNET_FLOW_TYPE_IP4_GTPU_IP6:
654 case VNET_FLOW_TYPE_IP6_GTPC:
655 case VNET_FLOW_TYPE_IP6_GTPU:
656 case VNET_FLOW_TYPE_IP6_GTPU_IP4:
657 case VNET_FLOW_TYPE_IP6_GTPU_IP6:
658 if ((rv = dpdk_flow_add (xd, flow, fe)))
662 rv = VNET_FLOW_ERROR_NOT_SUPPORTED;
666 *private_data = fe - xd->flow_entries;
671 clib_memset (fe, 0, sizeof (*fe));
672 pool_put (xd->flow_entries, fe);
675 clib_memset (fle, -1, sizeof (*fle));
676 pool_put (xd->flow_lookup_entries, fle);
680 if ((xd->flags & DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD) != 0
681 && pool_elts (xd->flow_entries) == 0)
683 xd->flags &= ~DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD;
684 dpdk_device_setup (xd);
691 format_dpdk_flow (u8 * s, va_list * args)
693 u32 dev_instance = va_arg (*args, u32);
694 u32 flow_index = va_arg (*args, u32);
695 uword private_data = va_arg (*args, uword);
696 dpdk_main_t *dm = &dpdk_main;
697 dpdk_device_t *xd = vec_elt_at_index (dm->devices, dev_instance);
698 dpdk_flow_entry_t *fe;
700 if (flow_index == ~0)
702 s = format (s, "%-25s: %U\n", "supported flow actions",
703 format_flow_actions, xd->supported_flow_actions);
704 s = format (s, "%-25s: %d\n", "last DPDK error type",
705 xd->last_flow_error.type);
706 s = format (s, "%-25s: %s\n", "last DPDK error message",
707 xd->last_flow_error.message ? xd->last_flow_error.message :
712 if (private_data >= vec_len (xd->flow_entries))
713 return format (s, "unknown flow");
715 fe = vec_elt_at_index (xd->flow_entries, private_data);
716 s = format (s, "mark %u", fe->mark);
721 * fd.io coding-style-patch-verification: ON
724 * eval: (c-set-style "gnu")