[v2,1/2] net/mlx5: preserve promisc flag for flow isolation mode
Checks
Commit Message
mlx5_dev_ops_isolate doesn't have APIs for enabling/disabling promiscuous
mode as it can't be enabled in flow isolation mode. If the function
pointers are null, librte APIs such as rte_eth_promiscuous_enable/disable()
fail to set the flag (dev->data->promiscuous). The flag is used when
starting traffic by mlx5_traffic_enable(). When switching out of flow
isolation mode, promiscuous mode will not be set even though it has been
enabled.
Fixes: 0887aa7f27f3 ("net/mlx5: add new operations for isolated mode")
Cc: stable@dpdk.org
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
v2:
* do not toggle promisc mode when switching flow isolation mode
* add warning message when attempting to enable promisc in flow isolation mode
drivers/net/mlx5/mlx5.c | 2 ++
drivers/net/mlx5/mlx5_rxmode.c | 13 +++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
Comments
Friday, August 3, 2018 12:07 AM, Yongseok Koh:
> Subject: [PATCH v2 1/2] net/mlx5: preserve promisc flag for flow isolation
> mode
>
> mlx5_dev_ops_isolate doesn't have APIs for enabling/disabling promiscuous
> mode as it can't be enabled in flow isolation mode. If the function pointers
> are null, librte APIs such as rte_eth_promiscuous_enable/disable()
> fail to set the flag (dev->data->promiscuous). The flag is used when starting
> traffic by mlx5_traffic_enable(). When switching out of flow isolation mode,
> promiscuous mode will not be set even though it has been enabled.
>
> Fixes: 0887aa7f27f3 ("net/mlx5: add new operations for isolated mode")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Series applied to next-net-mlx, thanks.
@@ -399,6 +399,8 @@ const struct eth_dev_ops mlx5_dev_ops_isolate = {
.dev_set_link_down = mlx5_set_link_down,
.dev_set_link_up = mlx5_set_link_up,
.dev_close = mlx5_dev_close,
+ .promiscuous_enable = mlx5_promiscuous_enable,
+ .promiscuous_disable = mlx5_promiscuous_disable,
.link_update = mlx5_link_update,
.stats_get = mlx5_stats_get,
.stats_reset = mlx5_stats_reset,
@@ -32,10 +32,18 @@
void
mlx5_promiscuous_enable(struct rte_eth_dev *dev)
{
+ struct priv *priv = dev->data->dev_private;
int ret;
dev->data->promiscuous = 1;
- if (((struct priv *)dev->data->dev_private)->config.vf)
+ if (priv->isolated) {
+ DRV_LOG(WARNING,
+ "port %u cannot enable promiscuous mode"
+ " in flow isolation mode",
+ dev->data->port_id);
+ return;
+ }
+ if (priv->config.vf)
mlx5_nl_promisc(dev, 1);
ret = mlx5_traffic_restart(dev);
if (ret)
@@ -52,10 +60,11 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
void
mlx5_promiscuous_disable(struct rte_eth_dev *dev)
{
+ struct priv *priv = dev->data->dev_private;
int ret;
dev->data->promiscuous = 0;
- if (((struct priv *)dev->data->dev_private)->config.vf)
+ if (priv->config.vf)
mlx5_nl_promisc(dev, 0);
ret = mlx5_traffic_restart(dev);
if (ret)