1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2016 6WIND S.A.
3 * Copyright 2016 Mellanox Technologies, Ltd
11 /* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */
13 #pragma GCC diagnostic ignored "-Wpedantic"
15 #include <infiniband/verbs.h>
17 #pragma GCC diagnostic error "-Wpedantic"
20 #include <rte_common.h>
21 #include <rte_ether.h>
22 #include <rte_eth_ctrl.h>
23 #include <rte_ethdev_driver.h>
25 #include <rte_flow_driver.h>
26 #include <rte_malloc.h>
30 #include "mlx5_defs.h"
32 #include "mlx5_glue.h"
34 /* Dev ops structure defined in mlx5.c */
35 extern const struct eth_dev_ops mlx5_dev_ops;
36 extern const struct eth_dev_ops mlx5_dev_ops_isolate;
38 /* Pattern Layer bits. */
39 #define MLX5_FLOW_LAYER_OUTER_L2 (1u << 0)
40 #define MLX5_FLOW_LAYER_OUTER_L3_IPV4 (1u << 1)
41 #define MLX5_FLOW_LAYER_OUTER_L3_IPV6 (1u << 2)
42 #define MLX5_FLOW_LAYER_OUTER_L4_UDP (1u << 3)
43 #define MLX5_FLOW_LAYER_OUTER_L4_TCP (1u << 4)
44 #define MLX5_FLOW_LAYER_OUTER_VLAN (1u << 5)
46 #define MLX5_FLOW_LAYER_OUTER_L3 \
47 (MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
48 #define MLX5_FLOW_LAYER_OUTER_L4 \
49 (MLX5_FLOW_LAYER_OUTER_L4_UDP | MLX5_FLOW_LAYER_OUTER_L4_TCP)
51 /* Actions that modify the fate of matching traffic. */
52 #define MLX5_FLOW_FATE_DROP (1u << 0)
53 #define MLX5_FLOW_FATE_QUEUE (1u << 1)
55 /** Handles information leading to a drop fate. */
56 struct mlx5_flow_verbs {
57 unsigned int size; /**< Size of the attribute. */
59 struct ibv_flow_attr *attr;
60 /**< Pointer to the Specification buffer. */
61 uint8_t *specs; /**< Pointer to the specifications. */
63 struct ibv_flow *flow; /**< Verbs flow pointer. */
64 struct mlx5_hrxq *hrxq; /**< Hash Rx queue object. */
69 TAILQ_ENTRY(rte_flow) next; /**< Pointer to the next flow structure. */
70 struct rte_flow_attr attributes; /**< User flow attribute. */
72 /**< Bit-fields of present layers see MLX5_FLOW_LAYER_*. */
74 /**< Bit-fields of present fate see MLX5_FLOW_FATE_*. */
75 struct mlx5_flow_verbs verbs; /* Verbs flow. */
76 uint16_t queue; /**< Destination queue to redirect traffic to. */
79 static const struct rte_flow_ops mlx5_flow_ops = {
80 .validate = mlx5_flow_validate,
81 .create = mlx5_flow_create,
82 .destroy = mlx5_flow_destroy,
83 .flush = mlx5_flow_flush,
84 .isolate = mlx5_flow_isolate,
87 /* Convert FDIR request to Generic flow. */
89 struct rte_flow_attr attr;
90 struct rte_flow_action actions[2];
91 struct rte_flow_item items[4];
92 struct rte_flow_item_eth l2;
93 struct rte_flow_item_eth l2_mask;
95 struct rte_flow_item_ipv4 ipv4;
96 struct rte_flow_item_ipv6 ipv6;
99 struct rte_flow_item_ipv4 ipv4;
100 struct rte_flow_item_ipv6 ipv6;
103 struct rte_flow_item_udp udp;
104 struct rte_flow_item_tcp tcp;
107 struct rte_flow_item_udp udp;
108 struct rte_flow_item_tcp tcp;
110 struct rte_flow_action_queue queue;
113 /* Verbs specification header. */
114 struct ibv_spec_header {
115 enum ibv_flow_spec_type type;
120 * Discover the maximum number of priority available.
123 * Pointer to Ethernet device.
126 * number of supported flow priority on success, a negative errno value
127 * otherwise and rte_errno is set.
130 mlx5_flow_discover_priorities(struct rte_eth_dev *dev)
133 struct ibv_flow_attr attr;
134 struct ibv_flow_spec_eth eth;
135 struct ibv_flow_spec_action_drop drop;
141 .type = IBV_FLOW_SPEC_ETH,
142 .size = sizeof(struct ibv_flow_spec_eth),
145 .size = sizeof(struct ibv_flow_spec_action_drop),
146 .type = IBV_FLOW_SPEC_ACTION_DROP,
149 struct ibv_flow *flow;
150 struct mlx5_hrxq *drop = mlx5_hrxq_drop_new(dev);
151 uint16_t vprio[] = { 8, 16 };
158 for (i = 0; i != RTE_DIM(vprio); i++) {
159 flow_attr.attr.priority = vprio[i] - 1;
160 flow = mlx5_glue->create_flow(drop->qp, &flow_attr.attr);
163 claim_zero(mlx5_glue->destroy_flow(flow));
165 mlx5_hrxq_drop_release(dev);
166 DRV_LOG(INFO, "port %u flow maximum priority: %d",
167 dev->data->port_id, vprio[i - 1]);
172 * Verify the @p attributes will be correctly understood by the NIC and store
173 * them in the @p flow if everything is correct.
176 * Pointer to Ethernet device.
177 * @param[in] attributes
178 * Pointer to flow attributes
179 * @param[in, out] flow
180 * Pointer to the rte_flow structure.
182 * Pointer to error structure.
185 * 0 on success, a negative errno value otherwise and rte_errno is set.
188 mlx5_flow_attributes(struct rte_eth_dev *dev,
189 const struct rte_flow_attr *attributes,
190 struct rte_flow *flow,
191 struct rte_flow_error *error)
193 uint32_t priority_max =
194 ((struct priv *)dev->data->dev_private)->config.flow_prio;
196 if (attributes->group)
197 return rte_flow_error_set(error, ENOTSUP,
198 RTE_FLOW_ERROR_TYPE_ATTR_GROUP,
200 "groups is not supported");
201 if (attributes->priority >= priority_max)
202 return rte_flow_error_set(error, ENOTSUP,
203 RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,
205 "priority out of range");
206 if (attributes->egress)
207 return rte_flow_error_set(error, ENOTSUP,
208 RTE_FLOW_ERROR_TYPE_ATTR_EGRESS,
210 "egress is not supported");
211 if (attributes->transfer)
212 return rte_flow_error_set(error, ENOTSUP,
213 RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER,
215 "transfer is not supported");
216 if (!attributes->ingress)
217 return rte_flow_error_set(error, ENOTSUP,
218 RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,
220 "ingress attribute is mandatory");
221 flow->attributes = *attributes;
226 * Verify the @p item specifications (spec, last, mask) are compatible with the
230 * Item specification.
232 * @p item->mask or flow default bit-masks.
233 * @param[in] nic_mask
234 * Bit-masks covering supported fields by the NIC to compare with user mask.
236 * Bit-masks size in bytes.
238 * Pointer to error structure.
241 * 0 on success, a negative errno value otherwise and rte_errno is set.
244 mlx5_flow_item_acceptable(const struct rte_flow_item *item,
246 const uint8_t *nic_mask,
248 struct rte_flow_error *error)
253 for (i = 0; i < size; ++i)
254 if ((nic_mask[i] | mask[i]) != nic_mask[i])
255 return rte_flow_error_set(error, ENOTSUP,
256 RTE_FLOW_ERROR_TYPE_ITEM,
258 "mask enables non supported"
260 if (!item->spec && (item->mask || item->last))
261 return rte_flow_error_set(error, EINVAL,
262 RTE_FLOW_ERROR_TYPE_ITEM,
264 "mask/last without a spec is not"
266 if (item->spec && item->last) {
272 for (i = 0; i < size; ++i) {
273 spec[i] = ((const uint8_t *)item->spec)[i] & mask[i];
274 last[i] = ((const uint8_t *)item->last)[i] & mask[i];
276 ret = memcmp(spec, last, size);
278 return rte_flow_error_set(error, ENOTSUP,
279 RTE_FLOW_ERROR_TYPE_ITEM,
281 "range is not supported");
287 * Add a verbs specification into @p flow.
289 * @param[in, out] flow
290 * Pointer to flow structure.
292 * Create specification.
294 * Size in bytes of the specification to copy.
297 mlx5_flow_spec_verbs_add(struct rte_flow *flow, void *src, unsigned int size)
299 if (flow->verbs.specs) {
302 dst = (void *)(flow->verbs.specs + flow->verbs.size);
303 memcpy(dst, src, size);
304 ++flow->verbs.attr->num_of_specs;
306 flow->verbs.size += size;
310 * Convert the @p item into a Verbs specification after ensuring the NIC
311 * will understand and process it correctly.
312 * If the necessary size for the conversion is greater than the @p flow_size,
313 * nothing is written in @p flow, the validation is still performed.
316 * Item specification.
317 * @param[in, out] flow
318 * Pointer to flow structure.
319 * @param[in] flow_size
320 * Size in bytes of the available space in @p flow, if too small, nothing is
323 * Pointer to error structure.
326 * On success the number of bytes consumed/necessary, if the returned value
327 * is lesser or equal to @p flow_size, the @p item has fully been converted,
328 * otherwise another call with this returned memory size should be done.
329 * On error, a negative errno value is returned and rte_errno is set.
332 mlx5_flow_item_eth(const struct rte_flow_item *item, struct rte_flow *flow,
333 const size_t flow_size, struct rte_flow_error *error)
335 const struct rte_flow_item_eth *spec = item->spec;
336 const struct rte_flow_item_eth *mask = item->mask;
337 const struct rte_flow_item_eth nic_mask = {
338 .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
339 .src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
340 .type = RTE_BE16(0xffff),
342 const unsigned int size = sizeof(struct ibv_flow_spec_eth);
343 struct ibv_flow_spec_eth eth = {
344 .type = IBV_FLOW_SPEC_ETH,
349 if (flow->layers & MLX5_FLOW_LAYER_OUTER_L2)
350 return rte_flow_error_set(error, ENOTSUP,
351 RTE_FLOW_ERROR_TYPE_ITEM,
353 "L2 layers already configured");
355 mask = &rte_flow_item_eth_mask;
356 ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
357 (const uint8_t *)&nic_mask,
358 sizeof(struct rte_flow_item_eth),
362 flow->layers |= MLX5_FLOW_LAYER_OUTER_L2;
363 if (size > flow_size)
368 memcpy(ð.val.dst_mac, spec->dst.addr_bytes, ETHER_ADDR_LEN);
369 memcpy(ð.val.src_mac, spec->src.addr_bytes, ETHER_ADDR_LEN);
370 eth.val.ether_type = spec->type;
371 memcpy(ð.mask.dst_mac, mask->dst.addr_bytes, ETHER_ADDR_LEN);
372 memcpy(ð.mask.src_mac, mask->src.addr_bytes, ETHER_ADDR_LEN);
373 eth.mask.ether_type = mask->type;
374 /* Remove unwanted bits from values. */
375 for (i = 0; i < ETHER_ADDR_LEN; ++i) {
376 eth.val.dst_mac[i] &= eth.mask.dst_mac[i];
377 eth.val.src_mac[i] &= eth.mask.src_mac[i];
379 eth.val.ether_type &= eth.mask.ether_type;
381 mlx5_flow_spec_verbs_add(flow, ð, size);
386 * Update the VLAN tag in the Verbs Ethernet specification.
388 * @param[in, out] attr
389 * Pointer to Verbs attributes structure.
391 * Verbs structure containing the VLAN information to copy.
394 mlx5_flow_item_vlan_update(struct ibv_flow_attr *attr,
395 struct ibv_flow_spec_eth *eth)
398 enum ibv_flow_spec_type search = IBV_FLOW_SPEC_ETH;
399 struct ibv_spec_header *hdr = (struct ibv_spec_header *)
400 ((uint8_t *)attr + sizeof(struct ibv_flow_attr));
402 for (i = 0; i != attr->num_of_specs; ++i) {
403 if (hdr->type == search) {
404 struct ibv_flow_spec_eth *e =
405 (struct ibv_flow_spec_eth *)hdr;
407 e->val.vlan_tag = eth->val.vlan_tag;
408 e->mask.vlan_tag = eth->mask.vlan_tag;
409 e->val.ether_type = eth->val.ether_type;
410 e->mask.ether_type = eth->mask.ether_type;
413 hdr = (struct ibv_spec_header *)((uint8_t *)hdr + hdr->size);
418 * Convert the @p item into @p flow (or by updating the already present
419 * Ethernet Verbs) specification after ensuring the NIC will understand and
420 * process it correctly.
421 * If the necessary size for the conversion is greater than the @p flow_size,
422 * nothing is written in @p flow, the validation is still performed.
425 * Item specification.
426 * @param[in, out] flow
427 * Pointer to flow structure.
428 * @param[in] flow_size
429 * Size in bytes of the available space in @p flow, if too small, nothing is
432 * Pointer to error structure.
435 * On success the number of bytes consumed/necessary, if the returned value
436 * is lesser or equal to @p flow_size, the @p item has fully been converted,
437 * otherwise another call with this returned memory size should be done.
438 * On error, a negative errno value is returned and rte_errno is set.
441 mlx5_flow_item_vlan(const struct rte_flow_item *item, struct rte_flow *flow,
442 const size_t flow_size, struct rte_flow_error *error)
444 const struct rte_flow_item_vlan *spec = item->spec;
445 const struct rte_flow_item_vlan *mask = item->mask;
446 const struct rte_flow_item_vlan nic_mask = {
447 .tci = RTE_BE16(0x0fff),
448 .inner_type = RTE_BE16(0xffff),
450 unsigned int size = sizeof(struct ibv_flow_spec_eth);
451 struct ibv_flow_spec_eth eth = {
452 .type = IBV_FLOW_SPEC_ETH,
456 const uint32_t l34m = MLX5_FLOW_LAYER_OUTER_L3 |
457 MLX5_FLOW_LAYER_OUTER_L4;
458 const uint32_t vlanm = MLX5_FLOW_LAYER_OUTER_VLAN;
459 const uint32_t l2m = MLX5_FLOW_LAYER_OUTER_L2;
461 if (flow->layers & vlanm)
462 return rte_flow_error_set(error, ENOTSUP,
463 RTE_FLOW_ERROR_TYPE_ITEM,
465 "VLAN layer already configured");
466 else if ((flow->layers & l34m) != 0)
467 return rte_flow_error_set(error, ENOTSUP,
468 RTE_FLOW_ERROR_TYPE_ITEM,
470 "L2 layer cannot follow L3/L4 layer");
472 mask = &rte_flow_item_vlan_mask;
473 ret = mlx5_flow_item_acceptable
474 (item, (const uint8_t *)mask,
475 (const uint8_t *)&nic_mask,
476 sizeof(struct rte_flow_item_vlan), error);
480 eth.val.vlan_tag = spec->tci;
481 eth.mask.vlan_tag = mask->tci;
482 eth.val.vlan_tag &= eth.mask.vlan_tag;
483 eth.val.ether_type = spec->inner_type;
484 eth.mask.ether_type = mask->inner_type;
485 eth.val.ether_type &= eth.mask.ether_type;
488 * From verbs perspective an empty VLAN is equivalent
489 * to a packet without VLAN layer.
491 if (!eth.mask.vlan_tag)
492 return rte_flow_error_set(error, EINVAL,
493 RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
495 "VLAN cannot be empty");
496 if (!(flow->layers & l2m)) {
497 if (size <= flow_size)
498 mlx5_flow_spec_verbs_add(flow, ð, size);
500 if (flow->verbs.attr)
501 mlx5_flow_item_vlan_update(flow->verbs.attr, ð);
502 size = 0; /* Only an update is done in eth specification. */
504 flow->layers |= MLX5_FLOW_LAYER_OUTER_L2 |
505 MLX5_FLOW_LAYER_OUTER_VLAN;
510 * Convert the @p pattern into a Verbs specifications after ensuring the NIC
511 * will understand and process it correctly.
512 * The conversion is performed item per item, each of them is written into
513 * the @p flow if its size is lesser or equal to @p flow_size.
514 * Validation and memory consumption computation are still performed until the
515 * end of @p pattern, unless an error is encountered.
519 * @param[in, out] flow
520 * Pointer to the rte_flow structure.
521 * @param[in] flow_size
522 * Size in bytes of the available space in @p flow, if too small some
523 * garbage may be present.
525 * Pointer to error structure.
528 * On success the number of bytes consumed/necessary, if the returned value
529 * is lesser or equal to @p flow_size, the @pattern has fully been
530 * converted, otherwise another call with this returned memory size should
532 * On error, a negative errno value is returned and rte_errno is set.
535 mlx5_flow_items(const struct rte_flow_item pattern[],
536 struct rte_flow *flow, const size_t flow_size,
537 struct rte_flow_error *error)
539 int remain = flow_size;
542 for (; pattern->type != RTE_FLOW_ITEM_TYPE_END; pattern++) {
545 switch (pattern->type) {
546 case RTE_FLOW_ITEM_TYPE_VOID:
548 case RTE_FLOW_ITEM_TYPE_ETH:
549 ret = mlx5_flow_item_eth(pattern, flow, remain, error);
551 case RTE_FLOW_ITEM_TYPE_VLAN:
552 ret = mlx5_flow_item_vlan(pattern, flow, remain, error);
555 return rte_flow_error_set(error, ENOTSUP,
556 RTE_FLOW_ERROR_TYPE_ITEM,
558 "item not supported");
569 const struct rte_flow_item item = {
570 .type = RTE_FLOW_ITEM_TYPE_ETH,
573 return mlx5_flow_item_eth(&item, flow, flow_size, error);
579 * Convert the @p action into a Verbs specification after ensuring the NIC
580 * will understand and process it correctly.
581 * If the necessary size for the conversion is greater than the @p flow_size,
582 * nothing is written in @p flow, the validation is still performed.
585 * Action configuration.
586 * @param[in, out] flow
587 * Pointer to flow structure.
588 * @param[in] flow_size
589 * Size in bytes of the available space in @p flow, if too small, nothing is
592 * Pointer to error structure.
595 * On success the number of bytes consumed/necessary, if the returned value
596 * is lesser or equal to @p flow_size, the @p action has fully been
597 * converted, otherwise another call with this returned memory size should
599 * On error, a negative errno value is returned and rte_errno is set.
602 mlx5_flow_action_drop(const struct rte_flow_action *action,
603 struct rte_flow *flow, const size_t flow_size,
604 struct rte_flow_error *error)
606 unsigned int size = sizeof(struct ibv_flow_spec_action_drop);
607 struct ibv_flow_spec_action_drop drop = {
608 .type = IBV_FLOW_SPEC_ACTION_DROP,
613 return rte_flow_error_set(error, ENOTSUP,
614 RTE_FLOW_ERROR_TYPE_ACTION,
616 "multiple fate actions are not"
618 if (size < flow_size)
619 mlx5_flow_spec_verbs_add(flow, &drop, size);
620 flow->fate |= MLX5_FLOW_FATE_DROP;
625 * Convert the @p action into @p flow after ensuring the NIC will understand
626 * and process it correctly.
629 * Pointer to Ethernet device structure.
631 * Action configuration.
632 * @param[in, out] flow
633 * Pointer to flow structure.
635 * Pointer to error structure.
638 * 0 on success, a negative errno value otherwise and rte_errno is set.
641 mlx5_flow_action_queue(struct rte_eth_dev *dev,
642 const struct rte_flow_action *action,
643 struct rte_flow *flow,
644 struct rte_flow_error *error)
646 struct priv *priv = dev->data->dev_private;
647 const struct rte_flow_action_queue *queue = action->conf;
650 return rte_flow_error_set(error, ENOTSUP,
651 RTE_FLOW_ERROR_TYPE_ACTION,
653 "multiple fate actions are not"
655 if (queue->index >= priv->rxqs_n)
656 return rte_flow_error_set(error, EINVAL,
657 RTE_FLOW_ERROR_TYPE_ACTION_CONF,
659 "queue index out of range");
660 if (!(*priv->rxqs)[queue->index])
661 return rte_flow_error_set(error, EINVAL,
662 RTE_FLOW_ERROR_TYPE_ACTION_CONF,
664 "queue is not configured");
665 flow->queue = queue->index;
666 flow->fate |= MLX5_FLOW_FATE_QUEUE;
671 * Convert the @p action into @p flow after ensuring the NIC will understand
672 * and process it correctly.
673 * The conversion is performed action per action, each of them is written into
674 * the @p flow if its size is lesser or equal to @p flow_size.
675 * Validation and memory consumption computation are still performed until the
676 * end of @p action, unless an error is encountered.
679 * Pointer to Ethernet device structure.
681 * Pointer to flow actions array.
682 * @param[in, out] flow
683 * Pointer to the rte_flow structure.
684 * @param[in] flow_size
685 * Size in bytes of the available space in @p flow, if too small some
686 * garbage may be present.
688 * Pointer to error structure.
691 * On success the number of bytes consumed/necessary, if the returned value
692 * is lesser or equal to @p flow_size, the @p actions has fully been
693 * converted, otherwise another call with this returned memory size should
695 * On error, a negative errno value is returned and rte_errno is set.
698 mlx5_flow_actions(struct rte_eth_dev *dev,
699 const struct rte_flow_action actions[],
700 struct rte_flow *flow, const size_t flow_size,
701 struct rte_flow_error *error)
704 int remain = flow_size;
707 for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
708 switch (actions->type) {
709 case RTE_FLOW_ACTION_TYPE_VOID:
711 case RTE_FLOW_ACTION_TYPE_DROP:
712 ret = mlx5_flow_action_drop(actions, flow, remain,
715 case RTE_FLOW_ACTION_TYPE_QUEUE:
716 ret = mlx5_flow_action_queue(dev, actions, flow, error);
719 return rte_flow_error_set(error, ENOTSUP,
720 RTE_FLOW_ERROR_TYPE_ACTION,
722 "action not supported");
733 return rte_flow_error_set(error, ENOTSUP,
734 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
736 "no fate action found");
741 * Convert the @p attributes, @p pattern, @p action, into an flow for the NIC
742 * after ensuring the NIC will understand and process it correctly.
743 * The conversion is only performed item/action per item/action, each of
744 * them is written into the @p flow if its size is lesser or equal to @p
746 * Validation and memory consumption computation are still performed until the
747 * end, unless an error is encountered.
750 * Pointer to Ethernet device.
751 * @param[in, out] flow
752 * Pointer to flow structure.
753 * @param[in] flow_size
754 * Size in bytes of the available space in @p flow, if too small some
755 * garbage may be present.
756 * @param[in] attributes
757 * Flow rule attributes.
759 * Pattern specification (list terminated by the END pattern item).
761 * Associated actions (list terminated by the END action).
763 * Perform verbose error reporting if not NULL.
766 * On success the number of bytes consumed/necessary, if the returned value
767 * is lesser or equal to @p flow_size, the flow has fully been converted and
768 * can be applied, otherwise another call with this returned memory size
770 * On error, a negative errno value is returned and rte_errno is set.
773 mlx5_flow_merge(struct rte_eth_dev *dev, struct rte_flow *flow,
774 const size_t flow_size,
775 const struct rte_flow_attr *attributes,
776 const struct rte_flow_item pattern[],
777 const struct rte_flow_action actions[],
778 struct rte_flow_error *error)
780 struct rte_flow local_flow = { .layers = 0, };
781 size_t size = sizeof(*flow) + sizeof(struct ibv_flow_attr);
782 int remain = (flow_size > size) ? flow_size - size : 0;
787 ret = mlx5_flow_attributes(dev, attributes, flow, error);
790 ret = mlx5_flow_items(pattern, flow, remain, error);
794 remain = (flow_size > size) ? flow_size - size : 0;
795 ret = mlx5_flow_actions(dev, actions, flow, remain, error);
799 if (size <= flow_size)
800 flow->verbs.attr->priority = flow->attributes.priority;
805 * Validate a flow supported by the NIC.
807 * @see rte_flow_validate()
811 mlx5_flow_validate(struct rte_eth_dev *dev,
812 const struct rte_flow_attr *attr,
813 const struct rte_flow_item items[],
814 const struct rte_flow_action actions[],
815 struct rte_flow_error *error)
817 int ret = mlx5_flow_merge(dev, NULL, 0, attr, items, actions, error);
828 * Pointer to Ethernet device.
829 * @param[in, out] flow
830 * Pointer to flow structure.
833 mlx5_flow_remove(struct rte_eth_dev *dev, struct rte_flow *flow)
835 if (flow->fate & MLX5_FLOW_FATE_DROP) {
836 if (flow->verbs.flow) {
837 claim_zero(mlx5_glue->destroy_flow(flow->verbs.flow));
838 flow->verbs.flow = NULL;
841 if (flow->verbs.hrxq) {
842 if (flow->fate & MLX5_FLOW_FATE_DROP)
843 mlx5_hrxq_drop_release(dev);
844 else if (flow->fate & MLX5_FLOW_FATE_QUEUE)
845 mlx5_hrxq_release(dev, flow->verbs.hrxq);
846 flow->verbs.hrxq = NULL;
854 * Pointer to Ethernet device structure.
855 * @param[in, out] flow
856 * Pointer to flow structure.
858 * Pointer to error structure.
861 * 0 on success, a negative errno value otherwise and rte_errno is set.
864 mlx5_flow_apply(struct rte_eth_dev *dev, struct rte_flow *flow,
865 struct rte_flow_error *error)
867 if (flow->fate & MLX5_FLOW_FATE_DROP) {
868 flow->verbs.hrxq = mlx5_hrxq_drop_new(dev);
869 if (!flow->verbs.hrxq)
870 return rte_flow_error_set
872 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
874 "cannot allocate Drop queue");
875 } else if (flow->fate & MLX5_FLOW_FATE_QUEUE) {
876 struct mlx5_hrxq *hrxq;
878 hrxq = mlx5_hrxq_get(dev, rss_hash_default_key,
879 rss_hash_default_key_len, 0,
880 &flow->queue, 1, 0, 0);
882 hrxq = mlx5_hrxq_new(dev, rss_hash_default_key,
883 rss_hash_default_key_len, 0,
884 &flow->queue, 1, 0, 0);
886 return rte_flow_error_set(error, rte_errno,
887 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
889 "cannot create flow");
890 flow->verbs.hrxq = hrxq;
893 mlx5_glue->create_flow(flow->verbs.hrxq->qp, flow->verbs.attr);
894 if (!flow->verbs.flow) {
895 if (flow->fate & MLX5_FLOW_FATE_DROP)
896 mlx5_hrxq_drop_release(dev);
898 mlx5_hrxq_release(dev, flow->verbs.hrxq);
899 flow->verbs.hrxq = NULL;
900 return rte_flow_error_set(error, errno,
901 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
903 "kernel module refuses to create"
910 * Create a flow and add it to @p list.
913 * Pointer to Ethernet device.
915 * Pointer to a TAILQ flow list.
917 * Flow rule attributes.
919 * Pattern specification (list terminated by the END pattern item).
921 * Associated actions (list terminated by the END action).
923 * Perform verbose error reporting if not NULL.
926 * A flow on success, NULL otherwise and rte_errno is set.
928 static struct rte_flow *
929 mlx5_flow_list_create(struct rte_eth_dev *dev,
930 struct mlx5_flows *list,
931 const struct rte_flow_attr *attr,
932 const struct rte_flow_item items[],
933 const struct rte_flow_action actions[],
934 struct rte_flow_error *error)
936 struct rte_flow *flow;
940 ret = mlx5_flow_merge(dev, NULL, 0, attr, items, actions, error);
944 flow = rte_zmalloc(__func__, size, 0);
946 rte_flow_error_set(error, ENOMEM,
947 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
949 "cannot allocate memory");
952 flow->verbs.attr = (struct ibv_flow_attr *)(flow + 1);
953 flow->verbs.specs = (uint8_t *)(flow->verbs.attr + 1);
954 ret = mlx5_flow_merge(dev, flow, size, attr, items, actions, error);
957 assert((size_t)ret == size);
958 if (dev->data->dev_started) {
959 ret = mlx5_flow_apply(dev, flow, error);
963 TAILQ_INSERT_TAIL(list, flow, next);
966 ret = rte_errno; /* Save rte_errno before cleanup. */
967 mlx5_flow_remove(dev, flow);
969 rte_errno = ret; /* Restore rte_errno. */
976 * @see rte_flow_create()
980 mlx5_flow_create(struct rte_eth_dev *dev,
981 const struct rte_flow_attr *attr,
982 const struct rte_flow_item items[],
983 const struct rte_flow_action actions[],
984 struct rte_flow_error *error)
986 return mlx5_flow_list_create
987 (dev, &((struct priv *)dev->data->dev_private)->flows,
988 attr, items, actions, error);
992 * Destroy a flow in a list.
995 * Pointer to Ethernet device.
997 * Pointer to a TAILQ flow list.
1002 mlx5_flow_list_destroy(struct rte_eth_dev *dev, struct mlx5_flows *list,
1003 struct rte_flow *flow)
1005 mlx5_flow_remove(dev, flow);
1006 TAILQ_REMOVE(list, flow, next);
1011 * Destroy all flows.
1014 * Pointer to Ethernet device.
1016 * Pointer to a TAILQ flow list.
1019 mlx5_flow_list_flush(struct rte_eth_dev *dev, struct mlx5_flows *list)
1021 while (!TAILQ_EMPTY(list)) {
1022 struct rte_flow *flow;
1024 flow = TAILQ_FIRST(list);
1025 mlx5_flow_list_destroy(dev, list, flow);
1033 * Pointer to Ethernet device.
1035 * Pointer to a TAILQ flow list.
1038 mlx5_flow_stop(struct rte_eth_dev *dev, struct mlx5_flows *list)
1040 struct rte_flow *flow;
1042 TAILQ_FOREACH_REVERSE(flow, list, mlx5_flows, next)
1043 mlx5_flow_remove(dev, flow);
1050 * Pointer to Ethernet device.
1052 * Pointer to a TAILQ flow list.
1055 * 0 on success, a negative errno value otherwise and rte_errno is set.
1058 mlx5_flow_start(struct rte_eth_dev *dev, struct mlx5_flows *list)
1060 struct rte_flow *flow;
1061 struct rte_flow_error error;
1064 TAILQ_FOREACH(flow, list, next) {
1065 ret = mlx5_flow_apply(dev, flow, &error);
1071 ret = rte_errno; /* Save rte_errno before cleanup. */
1072 mlx5_flow_stop(dev, list);
1073 rte_errno = ret; /* Restore rte_errno. */
1078 * Verify the flow list is empty
1081 * Pointer to Ethernet device.
1083 * @return the number of flows not released.
1086 mlx5_flow_verify(struct rte_eth_dev *dev)
1088 struct priv *priv = dev->data->dev_private;
1089 struct rte_flow *flow;
1092 TAILQ_FOREACH(flow, &priv->flows, next) {
1093 DRV_LOG(DEBUG, "port %u flow %p still referenced",
1094 dev->data->port_id, (void *)flow);
1101 * Enable a control flow configured from the control plane.
1104 * Pointer to Ethernet device.
1106 * An Ethernet flow spec to apply.
1108 * An Ethernet flow mask to apply.
1110 * A VLAN flow spec to apply.
1112 * A VLAN flow mask to apply.
1115 * 0 on success, a negative errno value otherwise and rte_errno is set.
1118 mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev,
1119 struct rte_flow_item_eth *eth_spec,
1120 struct rte_flow_item_eth *eth_mask,
1121 struct rte_flow_item_vlan *vlan_spec,
1122 struct rte_flow_item_vlan *vlan_mask)
1124 struct priv *priv = dev->data->dev_private;
1125 const struct rte_flow_attr attr = {
1127 .priority = priv->config.flow_prio - 1,
1129 struct rte_flow_item items[] = {
1131 .type = RTE_FLOW_ITEM_TYPE_ETH,
1137 .type = (vlan_spec) ? RTE_FLOW_ITEM_TYPE_VLAN :
1138 RTE_FLOW_ITEM_TYPE_END,
1144 .type = RTE_FLOW_ITEM_TYPE_END,
1147 uint16_t queue[priv->reta_idx_n];
1148 struct rte_flow_action_rss action_rss = {
1149 .func = RTE_ETH_HASH_FUNCTION_DEFAULT,
1151 .types = priv->rss_conf.rss_hf,
1152 .key_len = priv->rss_conf.rss_key_len,
1153 .queue_num = priv->reta_idx_n,
1154 .key = priv->rss_conf.rss_key,
1157 struct rte_flow_action actions[] = {
1159 .type = RTE_FLOW_ACTION_TYPE_RSS,
1160 .conf = &action_rss,
1163 .type = RTE_FLOW_ACTION_TYPE_END,
1166 struct rte_flow *flow;
1167 struct rte_flow_error error;
1170 if (!priv->reta_idx_n) {
1174 for (i = 0; i != priv->reta_idx_n; ++i)
1175 queue[i] = (*priv->reta_idx)[i];
1176 flow = mlx5_flow_list_create(dev, &priv->ctrl_flows, &attr, items,
1184 * Enable a flow control configured from the control plane.
1187 * Pointer to Ethernet device.
1189 * An Ethernet flow spec to apply.
1191 * An Ethernet flow mask to apply.
1194 * 0 on success, a negative errno value otherwise and rte_errno is set.
1197 mlx5_ctrl_flow(struct rte_eth_dev *dev,
1198 struct rte_flow_item_eth *eth_spec,
1199 struct rte_flow_item_eth *eth_mask)
1201 return mlx5_ctrl_flow_vlan(dev, eth_spec, eth_mask, NULL, NULL);
1207 * @see rte_flow_destroy()
1211 mlx5_flow_destroy(struct rte_eth_dev *dev,
1212 struct rte_flow *flow,
1213 struct rte_flow_error *error __rte_unused)
1215 struct priv *priv = dev->data->dev_private;
1217 mlx5_flow_list_destroy(dev, &priv->flows, flow);
1222 * Destroy all flows.
1224 * @see rte_flow_flush()
1228 mlx5_flow_flush(struct rte_eth_dev *dev,
1229 struct rte_flow_error *error __rte_unused)
1231 struct priv *priv = dev->data->dev_private;
1233 mlx5_flow_list_flush(dev, &priv->flows);
1240 * @see rte_flow_isolate()
1244 mlx5_flow_isolate(struct rte_eth_dev *dev,
1246 struct rte_flow_error *error)
1248 struct priv *priv = dev->data->dev_private;
1250 if (dev->data->dev_started) {
1251 rte_flow_error_set(error, EBUSY,
1252 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
1254 "port must be stopped first");
1257 priv->isolated = !!enable;
1259 dev->dev_ops = &mlx5_dev_ops_isolate;
1261 dev->dev_ops = &mlx5_dev_ops;
1266 * Convert a flow director filter to a generic flow.
1269 * Pointer to Ethernet device.
1270 * @param fdir_filter
1271 * Flow director filter to add.
1273 * Generic flow parameters structure.
1276 * 0 on success, a negative errno value otherwise and rte_errno is set.
1279 mlx5_fdir_filter_convert(struct rte_eth_dev *dev,
1280 const struct rte_eth_fdir_filter *fdir_filter,
1281 struct mlx5_fdir *attributes)
1283 struct priv *priv = dev->data->dev_private;
1284 const struct rte_eth_fdir_input *input = &fdir_filter->input;
1285 const struct rte_eth_fdir_masks *mask =
1286 &dev->data->dev_conf.fdir_conf.mask;
1288 /* Validate queue number. */
1289 if (fdir_filter->action.rx_queue >= priv->rxqs_n) {
1290 DRV_LOG(ERR, "port %u invalid queue number %d",
1291 dev->data->port_id, fdir_filter->action.rx_queue);
1295 attributes->attr.ingress = 1;
1296 attributes->items[0] = (struct rte_flow_item) {
1297 .type = RTE_FLOW_ITEM_TYPE_ETH,
1298 .spec = &attributes->l2,
1299 .mask = &attributes->l2_mask,
1301 switch (fdir_filter->action.behavior) {
1302 case RTE_ETH_FDIR_ACCEPT:
1303 attributes->actions[0] = (struct rte_flow_action){
1304 .type = RTE_FLOW_ACTION_TYPE_QUEUE,
1305 .conf = &attributes->queue,
1308 case RTE_ETH_FDIR_REJECT:
1309 attributes->actions[0] = (struct rte_flow_action){
1310 .type = RTE_FLOW_ACTION_TYPE_DROP,
1314 DRV_LOG(ERR, "port %u invalid behavior %d",
1316 fdir_filter->action.behavior);
1317 rte_errno = ENOTSUP;
1320 attributes->queue.index = fdir_filter->action.rx_queue;
1322 switch (fdir_filter->input.flow_type) {
1323 case RTE_ETH_FLOW_NONFRAG_IPV4_UDP:
1324 case RTE_ETH_FLOW_NONFRAG_IPV4_TCP:
1325 case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
1326 attributes->l3.ipv4.hdr = (struct ipv4_hdr){
1327 .src_addr = input->flow.ip4_flow.src_ip,
1328 .dst_addr = input->flow.ip4_flow.dst_ip,
1329 .time_to_live = input->flow.ip4_flow.ttl,
1330 .type_of_service = input->flow.ip4_flow.tos,
1331 .next_proto_id = input->flow.ip4_flow.proto,
1333 attributes->l3_mask.ipv4.hdr = (struct ipv4_hdr){
1334 .src_addr = mask->ipv4_mask.src_ip,
1335 .dst_addr = mask->ipv4_mask.dst_ip,
1336 .time_to_live = mask->ipv4_mask.ttl,
1337 .type_of_service = mask->ipv4_mask.tos,
1338 .next_proto_id = mask->ipv4_mask.proto,
1340 attributes->items[1] = (struct rte_flow_item){
1341 .type = RTE_FLOW_ITEM_TYPE_IPV4,
1342 .spec = &attributes->l3,
1343 .mask = &attributes->l3_mask,
1346 case RTE_ETH_FLOW_NONFRAG_IPV6_UDP:
1347 case RTE_ETH_FLOW_NONFRAG_IPV6_TCP:
1348 case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER:
1349 attributes->l3.ipv6.hdr = (struct ipv6_hdr){
1350 .hop_limits = input->flow.ipv6_flow.hop_limits,
1351 .proto = input->flow.ipv6_flow.proto,
1354 memcpy(attributes->l3.ipv6.hdr.src_addr,
1355 input->flow.ipv6_flow.src_ip,
1356 RTE_DIM(attributes->l3.ipv6.hdr.src_addr));
1357 memcpy(attributes->l3.ipv6.hdr.dst_addr,
1358 input->flow.ipv6_flow.dst_ip,
1359 RTE_DIM(attributes->l3.ipv6.hdr.src_addr));
1360 memcpy(attributes->l3_mask.ipv6.hdr.src_addr,
1361 mask->ipv6_mask.src_ip,
1362 RTE_DIM(attributes->l3_mask.ipv6.hdr.src_addr));
1363 memcpy(attributes->l3_mask.ipv6.hdr.dst_addr,
1364 mask->ipv6_mask.dst_ip,
1365 RTE_DIM(attributes->l3_mask.ipv6.hdr.src_addr));
1366 attributes->items[1] = (struct rte_flow_item){
1367 .type = RTE_FLOW_ITEM_TYPE_IPV6,
1368 .spec = &attributes->l3,
1369 .mask = &attributes->l3_mask,
1373 DRV_LOG(ERR, "port %u invalid flow type%d",
1374 dev->data->port_id, fdir_filter->input.flow_type);
1375 rte_errno = ENOTSUP;
1379 switch (fdir_filter->input.flow_type) {
1380 case RTE_ETH_FLOW_NONFRAG_IPV4_UDP:
1381 attributes->l4.udp.hdr = (struct udp_hdr){
1382 .src_port = input->flow.udp4_flow.src_port,
1383 .dst_port = input->flow.udp4_flow.dst_port,
1385 attributes->l4_mask.udp.hdr = (struct udp_hdr){
1386 .src_port = mask->src_port_mask,
1387 .dst_port = mask->dst_port_mask,
1389 attributes->items[2] = (struct rte_flow_item){
1390 .type = RTE_FLOW_ITEM_TYPE_UDP,
1391 .spec = &attributes->l4,
1392 .mask = &attributes->l4_mask,
1395 case RTE_ETH_FLOW_NONFRAG_IPV4_TCP:
1396 attributes->l4.tcp.hdr = (struct tcp_hdr){
1397 .src_port = input->flow.tcp4_flow.src_port,
1398 .dst_port = input->flow.tcp4_flow.dst_port,
1400 attributes->l4_mask.tcp.hdr = (struct tcp_hdr){
1401 .src_port = mask->src_port_mask,
1402 .dst_port = mask->dst_port_mask,
1404 attributes->items[2] = (struct rte_flow_item){
1405 .type = RTE_FLOW_ITEM_TYPE_TCP,
1406 .spec = &attributes->l4,
1407 .mask = &attributes->l4_mask,
1410 case RTE_ETH_FLOW_NONFRAG_IPV6_UDP:
1411 attributes->l4.udp.hdr = (struct udp_hdr){
1412 .src_port = input->flow.udp6_flow.src_port,
1413 .dst_port = input->flow.udp6_flow.dst_port,
1415 attributes->l4_mask.udp.hdr = (struct udp_hdr){
1416 .src_port = mask->src_port_mask,
1417 .dst_port = mask->dst_port_mask,
1419 attributes->items[2] = (struct rte_flow_item){
1420 .type = RTE_FLOW_ITEM_TYPE_UDP,
1421 .spec = &attributes->l4,
1422 .mask = &attributes->l4_mask,
1425 case RTE_ETH_FLOW_NONFRAG_IPV6_TCP:
1426 attributes->l4.tcp.hdr = (struct tcp_hdr){
1427 .src_port = input->flow.tcp6_flow.src_port,
1428 .dst_port = input->flow.tcp6_flow.dst_port,
1430 attributes->l4_mask.tcp.hdr = (struct tcp_hdr){
1431 .src_port = mask->src_port_mask,
1432 .dst_port = mask->dst_port_mask,
1434 attributes->items[2] = (struct rte_flow_item){
1435 .type = RTE_FLOW_ITEM_TYPE_TCP,
1436 .spec = &attributes->l4,
1437 .mask = &attributes->l4_mask,
1440 case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
1441 case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER:
1444 DRV_LOG(ERR, "port %u invalid flow type%d",
1445 dev->data->port_id, fdir_filter->input.flow_type);
1446 rte_errno = ENOTSUP;
1453 * Add new flow director filter and store it in list.
1456 * Pointer to Ethernet device.
1457 * @param fdir_filter
1458 * Flow director filter to add.
1461 * 0 on success, a negative errno value otherwise and rte_errno is set.
1464 mlx5_fdir_filter_add(struct rte_eth_dev *dev,
1465 const struct rte_eth_fdir_filter *fdir_filter)
1467 struct priv *priv = dev->data->dev_private;
1468 struct mlx5_fdir attributes = {
1471 .dst.addr_bytes = "\x00\x00\x00\x00\x00\x00",
1472 .src.addr_bytes = "\x00\x00\x00\x00\x00\x00",
1476 struct rte_flow_error error;
1477 struct rte_flow *flow;
1480 ret = mlx5_fdir_filter_convert(dev, fdir_filter, &attributes);
1483 flow = mlx5_flow_list_create(dev, &priv->flows, &attributes.attr,
1484 attributes.items, attributes.actions,
1487 DRV_LOG(DEBUG, "port %u FDIR created %p", dev->data->port_id,
1495 * Delete specific filter.
1498 * Pointer to Ethernet device.
1499 * @param fdir_filter
1500 * Filter to be deleted.
1503 * 0 on success, a negative errno value otherwise and rte_errno is set.
1506 mlx5_fdir_filter_delete(struct rte_eth_dev *dev __rte_unused,
1507 const struct rte_eth_fdir_filter *fdir_filter
1510 rte_errno = ENOTSUP;
1515 * Update queue for specific filter.
1518 * Pointer to Ethernet device.
1519 * @param fdir_filter
1520 * Filter to be updated.
1523 * 0 on success, a negative errno value otherwise and rte_errno is set.
1526 mlx5_fdir_filter_update(struct rte_eth_dev *dev,
1527 const struct rte_eth_fdir_filter *fdir_filter)
1531 ret = mlx5_fdir_filter_delete(dev, fdir_filter);
1534 return mlx5_fdir_filter_add(dev, fdir_filter);
1538 * Flush all filters.
1541 * Pointer to Ethernet device.
1544 mlx5_fdir_filter_flush(struct rte_eth_dev *dev)
1546 struct priv *priv = dev->data->dev_private;
1548 mlx5_flow_list_flush(dev, &priv->flows);
1552 * Get flow director information.
1555 * Pointer to Ethernet device.
1556 * @param[out] fdir_info
1557 * Resulting flow director information.
1560 mlx5_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info)
1562 struct rte_eth_fdir_masks *mask =
1563 &dev->data->dev_conf.fdir_conf.mask;
1565 fdir_info->mode = dev->data->dev_conf.fdir_conf.mode;
1566 fdir_info->guarant_spc = 0;
1567 rte_memcpy(&fdir_info->mask, mask, sizeof(fdir_info->mask));
1568 fdir_info->max_flexpayload = 0;
1569 fdir_info->flow_types_mask[0] = 0;
1570 fdir_info->flex_payload_unit = 0;
1571 fdir_info->max_flex_payload_segment_num = 0;
1572 fdir_info->flex_payload_limit = 0;
1573 memset(&fdir_info->flex_conf, 0, sizeof(fdir_info->flex_conf));
1577 * Deal with flow director operations.
1580 * Pointer to Ethernet device.
1582 * Operation to perform.
1584 * Pointer to operation-specific structure.
1587 * 0 on success, a negative errno value otherwise and rte_errno is set.
1590 mlx5_fdir_ctrl_func(struct rte_eth_dev *dev, enum rte_filter_op filter_op,
1593 enum rte_fdir_mode fdir_mode =
1594 dev->data->dev_conf.fdir_conf.mode;
1596 if (filter_op == RTE_ETH_FILTER_NOP)
1598 if (fdir_mode != RTE_FDIR_MODE_PERFECT &&
1599 fdir_mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
1600 DRV_LOG(ERR, "port %u flow director mode %d not supported",
1601 dev->data->port_id, fdir_mode);
1605 switch (filter_op) {
1606 case RTE_ETH_FILTER_ADD:
1607 return mlx5_fdir_filter_add(dev, arg);
1608 case RTE_ETH_FILTER_UPDATE:
1609 return mlx5_fdir_filter_update(dev, arg);
1610 case RTE_ETH_FILTER_DELETE:
1611 return mlx5_fdir_filter_delete(dev, arg);
1612 case RTE_ETH_FILTER_FLUSH:
1613 mlx5_fdir_filter_flush(dev);
1615 case RTE_ETH_FILTER_INFO:
1616 mlx5_fdir_info_get(dev, arg);
1619 DRV_LOG(DEBUG, "port %u unknown operation %u",
1620 dev->data->port_id, filter_op);
1628 * Manage filter operations.
1631 * Pointer to Ethernet device structure.
1632 * @param filter_type
1635 * Operation to perform.
1637 * Pointer to operation-specific structure.
1640 * 0 on success, a negative errno value otherwise and rte_errno is set.
1643 mlx5_dev_filter_ctrl(struct rte_eth_dev *dev,
1644 enum rte_filter_type filter_type,
1645 enum rte_filter_op filter_op,
1648 switch (filter_type) {
1649 case RTE_ETH_FILTER_GENERIC:
1650 if (filter_op != RTE_ETH_FILTER_GET) {
1654 *(const void **)arg = &mlx5_flow_ops;
1656 case RTE_ETH_FILTER_FDIR:
1657 return mlx5_fdir_ctrl_func(dev, filter_op, arg);
1659 DRV_LOG(ERR, "port %u filter type (%d) not supported",
1660 dev->data->port_id, filter_type);
1661 rte_errno = ENOTSUP;