net/mlx5: wrap Linux promiscuous and multicast functions
This commit adds Linux implementation of routines mlx5_os_set_promisc() and mlx5_os_set_promisc(). The routines call netlink APIs. Signed-off-by: Ophir Munk <ophirmu@mellanox.com> Acked-by: Matan Azrad <matan@mellanox.com>
This commit is contained in:
parent
ab27cdd93a
commit
4d18abd130
@ -2462,6 +2462,46 @@ mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv,
|
||||
(priv->nl_socket_route, iface_idx, mac_addr, vf_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set device promiscuous mode
|
||||
*
|
||||
* @param dev
|
||||
* Pointer to Ethernet device structure.
|
||||
* @param enable
|
||||
* 0 - promiscuous is disabled, otherwise - enabled
|
||||
*
|
||||
* @return
|
||||
* 0 on success, a negative error value otherwise
|
||||
*/
|
||||
int
|
||||
mlx5_os_set_promisc(struct rte_eth_dev *dev, int enable)
|
||||
{
|
||||
struct mlx5_priv *priv = dev->data->dev_private;
|
||||
|
||||
return mlx5_nl_promisc(priv->nl_socket_route,
|
||||
mlx5_ifindex(dev), !!enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set device promiscuous mode
|
||||
*
|
||||
* @param dev
|
||||
* Pointer to Ethernet device structure.
|
||||
* @param enable
|
||||
* 0 - all multicase is disabled, otherwise - enabled
|
||||
*
|
||||
* @return
|
||||
* 0 on success, a negative error value otherwise
|
||||
*/
|
||||
int
|
||||
mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)
|
||||
{
|
||||
struct mlx5_priv *priv = dev->data->dev_private;
|
||||
|
||||
return mlx5_nl_allmulti(priv->nl_socket_route,
|
||||
mlx5_ifindex(dev), !!enable);
|
||||
}
|
||||
|
||||
const struct eth_dev_ops mlx5_os_dev_ops = {
|
||||
.dev_configure = mlx5_dev_configure,
|
||||
.dev_start = mlx5_dev_start,
|
||||
|
@ -1031,6 +1031,8 @@ int mlx5_os_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,
|
||||
int mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv, unsigned int iface_idx,
|
||||
struct rte_ether_addr *mac_addr,
|
||||
int vf_index);
|
||||
int mlx5_os_set_promisc(struct rte_eth_dev *dev, int enable);
|
||||
int mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable);
|
||||
|
||||
/* mlx5_txpp.c */
|
||||
|
||||
|
@ -47,8 +47,7 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
|
||||
return 0;
|
||||
}
|
||||
if (priv->config.vf) {
|
||||
ret = mlx5_nl_promisc(priv->nl_socket_route, mlx5_ifindex(dev),
|
||||
1);
|
||||
ret = mlx5_os_set_promisc(dev, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
@ -81,8 +80,7 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev)
|
||||
|
||||
dev->data->promiscuous = 0;
|
||||
if (priv->config.vf) {
|
||||
ret = mlx5_nl_promisc(priv->nl_socket_route, mlx5_ifindex(dev),
|
||||
0);
|
||||
ret = mlx5_os_set_promisc(dev, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
@ -122,8 +120,7 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev)
|
||||
return 0;
|
||||
}
|
||||
if (priv->config.vf) {
|
||||
ret = mlx5_nl_allmulti(priv->nl_socket_route, mlx5_ifindex(dev),
|
||||
1);
|
||||
ret = mlx5_os_set_allmulti(dev, 1);
|
||||
if (ret)
|
||||
goto error;
|
||||
}
|
||||
@ -156,8 +153,7 @@ mlx5_allmulticast_disable(struct rte_eth_dev *dev)
|
||||
|
||||
dev->data->all_multicast = 0;
|
||||
if (priv->config.vf) {
|
||||
ret = mlx5_nl_allmulti(priv->nl_socket_route, mlx5_ifindex(dev),
|
||||
0);
|
||||
ret = mlx5_os_set_allmulti(dev, 0);
|
||||
if (ret)
|
||||
goto error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user