* [dpdk-dev] [PATCH 1/2] net/mlx5: preserve promisc flag for flow isolation mode
@ 2018-08-02 1:05 Yongseok Koh
2018-08-02 1:05 ` [dpdk-dev] [PATCH 2/2] net/mlx5: preserve allmulti " Yongseok Koh
2018-08-02 21:06 ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: preserve promisc " Yongseok Koh
0 siblings, 2 replies; 5+ messages in thread
From: Yongseok Koh @ 2018-08-02 1:05 UTC (permalink / raw)
To: shahafs; +Cc: dev, Yongseok Koh, stable
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). Also, there's need to
preserve promiscuous mode setting when toggling flow isolation mode.
Promiscuous mode, if enabled, should be disabled when switching to flow
isolation mode and vice versa.
Fixes: 0887aa7f27f3 ("net/mlx5: add new operations for isolated mode")
Cc: stable@dpdk.org
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
drivers/net/mlx5/mlx5.c | 2 ++
drivers/net/mlx5/mlx5_flow.c | 16 ++++++++++++++--
drivers/net/mlx5/mlx5_rxmode.c | 8 ++++++--
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index e3e2a181ac..83b82f11ab 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -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,
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 6c3021abac..268d1f056c 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3335,10 +3335,22 @@ mlx5_flow_isolate(struct rte_eth_dev *dev,
return -rte_errno;
}
priv->isolated = !!enable;
- if (enable)
+ if (enable) {
dev->dev_ops = &mlx5_dev_ops_isolate;
- else
+ /*
+ * Disable unsupported features. Need to restore flag so that it
+ * can be re-enabled when switching out of isolated mode.
+ */
+ if (dev->data->promiscuous) {
+ mlx5_promiscuous_disable(dev);
+ dev->data->promiscuous = 1;
+ }
+ } else {
dev->dev_ops = &mlx5_dev_ops;
+ /* Take back disabled features if needed. */
+ if (dev->data->promiscuous)
+ mlx5_promiscuous_enable(dev);
+ }
return 0;
}
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index 80824bc43b..0ed4c1a174 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -32,10 +32,13 @@
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)
+ return;
+ if (priv->config.vf)
mlx5_nl_promisc(dev, 1);
ret = mlx5_traffic_restart(dev);
if (ret)
@@ -52,10 +55,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)
--
2.11.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH 2/2] net/mlx5: preserve allmulti flag for flow isolation mode
2018-08-02 1:05 [dpdk-dev] [PATCH 1/2] net/mlx5: preserve promisc flag for flow isolation mode Yongseok Koh
@ 2018-08-02 1:05 ` Yongseok Koh
2018-08-02 21:06 ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: preserve promisc " Yongseok Koh
1 sibling, 0 replies; 5+ messages in thread
From: Yongseok Koh @ 2018-08-02 1:05 UTC (permalink / raw)
To: shahafs; +Cc: dev, Yongseok Koh, stable
mlx5_dev_ops_isolate doesn't have APIs for enabling/disabling allmulti
mode as it can't be enabled in flow isolation mode. If the function
pointers are null, librte APIs such as
rte_eth_allmulticast_enable/disable() fail to set the flag
(dev->data->all_multicast). Also, there's need to preserve allmulti mode
setting when toggling flow isolation mode. Allmulti mode, if enabled,
should be disabled when switching to flow isolation mode and vice versa.
Fixes: 0887aa7f27f3 ("net/mlx5: add new operations for isolated mode")
Cc: stable@dpdk.org
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
drivers/net/mlx5/mlx5.c | 2 ++
drivers/net/mlx5/mlx5_flow.c | 6 ++++++
drivers/net/mlx5/mlx5_rxmode.c | 8 ++++++--
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 83b82f11ab..ec63bc6e22 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -401,6 +401,8 @@ const struct eth_dev_ops mlx5_dev_ops_isolate = {
.dev_close = mlx5_dev_close,
.promiscuous_enable = mlx5_promiscuous_enable,
.promiscuous_disable = mlx5_promiscuous_disable,
+ .allmulticast_enable = mlx5_allmulticast_enable,
+ .allmulticast_disable = mlx5_allmulticast_disable,
.link_update = mlx5_link_update,
.stats_get = mlx5_stats_get,
.stats_reset = mlx5_stats_reset,
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 268d1f056c..fcaa7ddfc3 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3345,11 +3345,17 @@ mlx5_flow_isolate(struct rte_eth_dev *dev,
mlx5_promiscuous_disable(dev);
dev->data->promiscuous = 1;
}
+ if (dev->data->all_multicast) {
+ mlx5_allmulticast_disable(dev);
+ dev->data->all_multicast = 1;
+ }
} else {
dev->dev_ops = &mlx5_dev_ops;
/* Take back disabled features if needed. */
if (dev->data->promiscuous)
mlx5_promiscuous_enable(dev);
+ if (dev->data->all_multicast)
+ mlx5_allmulticast_enable(dev);
}
return 0;
}
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index 0ed4c1a174..5b73f3eb8b 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -76,10 +76,13 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev)
void
mlx5_allmulticast_enable(struct rte_eth_dev *dev)
{
+ struct priv *priv = dev->data->dev_private;
int ret;
dev->data->all_multicast = 1;
- if (((struct priv *)dev->data->dev_private)->config.vf)
+ if (priv->isolated)
+ return;
+ if (priv->config.vf)
mlx5_nl_allmulti(dev, 1);
ret = mlx5_traffic_restart(dev);
if (ret)
@@ -96,10 +99,11 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev)
void
mlx5_allmulticast_disable(struct rte_eth_dev *dev)
{
+ struct priv *priv = dev->data->dev_private;
int ret;
dev->data->all_multicast = 0;
- if (((struct priv *)dev->data->dev_private)->config.vf)
+ if (priv->config.vf)
mlx5_nl_allmulti(dev, 0);
ret = mlx5_traffic_restart(dev);
if (ret)
--
2.11.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v2 1/2] net/mlx5: preserve promisc flag for flow isolation mode
2018-08-02 1:05 [dpdk-dev] [PATCH 1/2] net/mlx5: preserve promisc flag for flow isolation mode Yongseok Koh
2018-08-02 1:05 ` [dpdk-dev] [PATCH 2/2] net/mlx5: preserve allmulti " Yongseok Koh
@ 2018-08-02 21:06 ` Yongseok Koh
2018-08-02 21:06 ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: preserve allmulti " Yongseok Koh
2018-08-05 10:42 ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: preserve promisc " Shahaf Shuler
1 sibling, 2 replies; 5+ messages in thread
From: Yongseok Koh @ 2018-08-02 21:06 UTC (permalink / raw)
To: shahafs; +Cc: dev, Yongseok Koh, stable
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(-)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index e3e2a181ac..83b82f11ab 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -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,
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index 80824bc43b..3c0373bb4d 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -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)
--
2.11.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v2 2/2] net/mlx5: preserve allmulti flag for flow isolation mode
2018-08-02 21:06 ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: preserve promisc " Yongseok Koh
@ 2018-08-02 21:06 ` Yongseok Koh
2018-08-05 10:42 ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: preserve promisc " Shahaf Shuler
1 sibling, 0 replies; 5+ messages in thread
From: Yongseok Koh @ 2018-08-02 21:06 UTC (permalink / raw)
To: shahafs; +Cc: dev, Yongseok Koh, stable
mlx5_dev_ops_isolate doesn't have APIs for enabling/disabling allmulti
mode as it can't be enabled in flow isolation mode. If the function
pointers are null, librte APIs such as
rte_eth_allmulticast_enable/disable() fail to set the flag
(dev->data->all_multicast). The flag is used when starting traffic by
mlx5_traffic_enable(). When switching out of flow isolation mode, allmulti
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 allmulti mode when switching flow isolation mode
* add warning message when attempting to enable allmulti in flow isolation mode
drivers/net/mlx5/mlx5.c | 2 ++
drivers/net/mlx5/mlx5_rxmode.c | 13 +++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 83b82f11ab..ec63bc6e22 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -401,6 +401,8 @@ const struct eth_dev_ops mlx5_dev_ops_isolate = {
.dev_close = mlx5_dev_close,
.promiscuous_enable = mlx5_promiscuous_enable,
.promiscuous_disable = mlx5_promiscuous_disable,
+ .allmulticast_enable = mlx5_allmulticast_enable,
+ .allmulticast_disable = mlx5_allmulticast_disable,
.link_update = mlx5_link_update,
.stats_get = mlx5_stats_get,
.stats_reset = mlx5_stats_reset,
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index 3c0373bb4d..e74fdef8b9 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -81,10 +81,18 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev)
void
mlx5_allmulticast_enable(struct rte_eth_dev *dev)
{
+ struct priv *priv = dev->data->dev_private;
int ret;
dev->data->all_multicast = 1;
- if (((struct priv *)dev->data->dev_private)->config.vf)
+ if (priv->isolated) {
+ DRV_LOG(WARNING,
+ "port %u cannot enable allmulticast mode"
+ " in flow isolation mode",
+ dev->data->port_id);
+ return;
+ }
+ if (priv->config.vf)
mlx5_nl_allmulti(dev, 1);
ret = mlx5_traffic_restart(dev);
if (ret)
@@ -101,10 +109,11 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev)
void
mlx5_allmulticast_disable(struct rte_eth_dev *dev)
{
+ struct priv *priv = dev->data->dev_private;
int ret;
dev->data->all_multicast = 0;
- if (((struct priv *)dev->data->dev_private)->config.vf)
+ if (priv->config.vf)
mlx5_nl_allmulti(dev, 0);
ret = mlx5_traffic_restart(dev);
if (ret)
--
2.11.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] net/mlx5: preserve promisc flag for flow isolation mode
2018-08-02 21:06 ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: preserve promisc " Yongseok Koh
2018-08-02 21:06 ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: preserve allmulti " Yongseok Koh
@ 2018-08-05 10:42 ` Shahaf Shuler
1 sibling, 0 replies; 5+ messages in thread
From: Shahaf Shuler @ 2018-08-05 10:42 UTC (permalink / raw)
To: Yongseok Koh; +Cc: dev, stable
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-08-05 10:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-02 1:05 [dpdk-dev] [PATCH 1/2] net/mlx5: preserve promisc flag for flow isolation mode Yongseok Koh
2018-08-02 1:05 ` [dpdk-dev] [PATCH 2/2] net/mlx5: preserve allmulti " Yongseok Koh
2018-08-02 21:06 ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: preserve promisc " Yongseok Koh
2018-08-02 21:06 ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: preserve allmulti " Yongseok Koh
2018-08-05 10:42 ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: preserve promisc " Shahaf Shuler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).