[dpdk-dev,v2,50/51] net/mlx4: remove isolated mode constraint

Message ID d6f79c1b4cd84896db1f806bb6dd7061ed5914ff.1504252977.git.adrien.mazarguil@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Adrien Mazarguil Sept. 1, 2017, 8:07 a.m. UTC
  Considering the remaining functionality, the only difference between
isolated and non-isolated mode is that a default MAC flow rule is present
with the latter.

The restriction on enabling isolated mode before creating any queues can
therefore be lifted.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 drivers/net/mlx4/mlx4_flow.c | 33 +++++++++++++--------------------
 1 file changed, 13 insertions(+), 20 deletions(-)
  

Patch

diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c
index e2798f6..e177545 100644
--- a/drivers/net/mlx4/mlx4_flow.c
+++ b/drivers/net/mlx4/mlx4_flow.c
@@ -935,20 +935,10 @@  mlx4_flow_create(struct rte_eth_dev *dev,
 }
 
 /**
- * @see rte_flow_isolate()
- *
- * Must be done before calling dev_configure().
+ * Configure isolated mode.
  *
- * @param dev
- *   Pointer to the ethernet device structure.
- * @param enable
- *   Nonzero to enter isolated mode, attempt to leave it otherwise.
- * @param[out] error
- *   Perform verbose error reporting if not NULL. PMDs initialize this
- *   structure in case of error only.
- *
- * @return
- *   0 on success, a negative value on error.
+ * @see rte_flow_isolate()
+ * @see rte_flow_ops
  */
 static int
 mlx4_flow_isolate(struct rte_eth_dev *dev,
@@ -957,14 +947,17 @@  mlx4_flow_isolate(struct rte_eth_dev *dev,
 {
 	struct priv *priv = dev->data->dev_private;
 
-	if (priv->rxqs) {
-		rte_flow_error_set(error, ENOTSUP,
-				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
-				   NULL, "isolated mode must be set"
-				   " before configuring the device");
-		return -rte_errno;
-	}
+	if (!!enable == !!priv->isolated)
+		return 0;
 	priv->isolated = !!enable;
+	if (enable) {
+		mlx4_mac_addr_del(priv);
+	} else if (mlx4_mac_addr_add(priv) < 0) {
+		priv->isolated = 1;
+		return -rte_flow_error_set(error, rte_errno,
+					   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+					   NULL, "cannot leave isolated mode");
+	}
 	return 0;
 }