X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fnet%2Fmlx5%2Fmlx5_rxmode.c;h=7613ff770d77190e69cbe35f5630cc414024f432;hb=6db1fde3891c493b9d352487fc8b6384cc6d06f3;hp=56fc1b636de7cda0afd0052603fd64a3d4128bfe;hpb=9039c8125730adfd46b8c891e7f205eb4ac43c67;p=dpdk.git diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c index 56fc1b636d..7613ff770d 100644 --- a/drivers/net/mlx5/mlx5_rxmode.c +++ b/drivers/net/mlx5/mlx5_rxmode.c @@ -7,18 +7,9 @@ #include #include -/* Verbs header. */ -/* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */ -#ifdef PEDANTIC -#pragma GCC diagnostic ignored "-Wpedantic" -#endif -#include -#ifdef PEDANTIC -#pragma GCC diagnostic error "-Wpedantic" -#endif - #include +#include #include "mlx5.h" #include "mlx5_rxtx.h" #include "mlx5_utils.h" @@ -47,7 +38,7 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev) return 0; } if (priv->config.vf) { - ret = mlx5_nl_promisc(dev, 1); + ret = mlx5_os_set_promisc(dev, 1); if (ret) return ret; } @@ -80,7 +71,7 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev) dev->data->promiscuous = 0; if (priv->config.vf) { - ret = mlx5_nl_promisc(dev, 0); + ret = mlx5_os_set_promisc(dev, 0); if (ret) return ret; } @@ -101,8 +92,11 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev) * * @param dev * Pointer to Ethernet device structure. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. */ -void +int mlx5_allmulticast_enable(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -114,14 +108,23 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev) "port %u cannot enable allmulticast mode" " in flow isolation mode", dev->data->port_id); - return; + return 0; + } + if (priv->config.vf) { + ret = mlx5_os_set_allmulti(dev, 1); + if (ret) + goto error; } - if (priv->config.vf) - mlx5_nl_allmulti(dev, 1); ret = mlx5_traffic_restart(dev); if (ret) DRV_LOG(ERR, "port %u cannot enable allmulicast mode: %s", dev->data->port_id, strerror(rte_errno)); +error: + /* + * rte_eth_allmulticast_enable() rollback + * dev->data->all_multicast in the case of failure. + */ + return ret; } /** @@ -129,18 +132,30 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev) * * @param dev * Pointer to Ethernet device structure. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. */ -void +int mlx5_allmulticast_disable(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; int ret; dev->data->all_multicast = 0; - if (priv->config.vf) - mlx5_nl_allmulti(dev, 0); + if (priv->config.vf) { + ret = mlx5_os_set_allmulti(dev, 0); + if (ret) + goto error; + } ret = mlx5_traffic_restart(dev); if (ret) DRV_LOG(ERR, "port %u cannot disable allmulicast mode: %s", dev->data->port_id, strerror(rte_errno)); +error: + /* + * rte_eth_allmulticast_disable() rollback + * dev->data->all_multicast in the case of failure. + */ + return ret; }