1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2015 6WIND S.A.
3 * Copyright 2015 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_ethdev_driver.h>
23 #include "mlx5_rxtx.h"
24 #include "mlx5_utils.h"
27 * DPDK callback to enable promiscuous mode.
30 * Pointer to Ethernet device structure.
33 mlx5_promiscuous_enable(struct rte_eth_dev *dev)
35 struct mlx5_priv *priv = dev->data->dev_private;
38 dev->data->promiscuous = 1;
41 "port %u cannot enable promiscuous mode"
42 " in flow isolation mode",
47 mlx5_nl_promisc(dev, 1);
48 ret = mlx5_traffic_restart(dev);
50 DRV_LOG(ERR, "port %u cannot enable promiscuous mode: %s",
51 dev->data->port_id, strerror(rte_errno));
55 * DPDK callback to disable promiscuous mode.
58 * Pointer to Ethernet device structure.
61 mlx5_promiscuous_disable(struct rte_eth_dev *dev)
63 struct mlx5_priv *priv = dev->data->dev_private;
66 dev->data->promiscuous = 0;
68 mlx5_nl_promisc(dev, 0);
69 ret = mlx5_traffic_restart(dev);
71 DRV_LOG(ERR, "port %u cannot disable promiscuous mode: %s",
72 dev->data->port_id, strerror(rte_errno));
76 * DPDK callback to enable allmulti mode.
79 * Pointer to Ethernet device structure.
82 mlx5_allmulticast_enable(struct rte_eth_dev *dev)
84 struct mlx5_priv *priv = dev->data->dev_private;
87 dev->data->all_multicast = 1;
90 "port %u cannot enable allmulticast mode"
91 " in flow isolation mode",
96 mlx5_nl_allmulti(dev, 1);
97 ret = mlx5_traffic_restart(dev);
99 DRV_LOG(ERR, "port %u cannot enable allmulicast mode: %s",
100 dev->data->port_id, strerror(rte_errno));
104 * DPDK callback to disable allmulti mode.
107 * Pointer to Ethernet device structure.
110 mlx5_allmulticast_disable(struct rte_eth_dev *dev)
112 struct mlx5_priv *priv = dev->data->dev_private;
115 dev->data->all_multicast = 0;
117 mlx5_nl_allmulti(dev, 0);
118 ret = mlx5_traffic_restart(dev);
120 DRV_LOG(ERR, "port %u cannot disable allmulicast mode: %s",
121 dev->data->port_id, strerror(rte_errno));