Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/26483/?format=api
http://patches.dpdk.org/api/patches/26483/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/2d1e72d0efa775a05318c6489416bf7329e36b4a.1499242343.git.vasilyf@mellanox.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<2d1e72d0efa775a05318c6489416bf7329e36b4a.1499242343.git.vasilyf@mellanox.com>", "list_archive_url": "https://inbox.dpdk.org/dev/2d1e72d0efa775a05318c6489416bf7329e36b4a.1499242343.git.vasilyf@mellanox.com", "date": "2017-07-05T08:14:09", "name": "[dpdk-dev,v8,2/4] net/mlx4: implement isolated mode from flow API", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "70766116fff87e82fc2ee0591195560b8b93b729", "submitter": { "id": 615, "url": "http://patches.dpdk.org/api/people/615/?format=api", "name": "Vasily Philipov", "email": "vasilyf@mellanox.com" }, "delegate": { "id": 319, "url": "http://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/2d1e72d0efa775a05318c6489416bf7329e36b4a.1499242343.git.vasilyf@mellanox.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/26483/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/26483/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 6B309568A;\n\tWed, 5 Jul 2017 10:14:25 +0200 (CEST)", "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n\tby dpdk.org (Postfix) with ESMTP id EAA143772\n\tfor <dev@dpdk.org>; Wed, 5 Jul 2017 10:14:20 +0200 (CEST)", "from Internal Mail-Server by MTLPINE1 (envelope-from\n\tvasilyf@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 5 Jul 2017 11:14:16 +0300", "from hpchead.mtr.labs.mlnx. (hpchead.mtr.labs.mlnx [10.209.44.59])\n\tby labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v658EFEG010256;\n\tWed, 5 Jul 2017 11:14:15 +0300", "from hpchead.mtr.labs.mlnx. (localhost.localdomain [127.0.0.1])\n\tby hpchead.mtr.labs.mlnx. (8.14.7/8.14.7) with ESMTP id\n\tv658EFnU007122; Wed, 5 Jul 2017 11:14:15 +0300", "(from vasilyf@localhost)\n\tby hpchead.mtr.labs.mlnx. (8.14.7/8.14.7/Submit) id v658EFI4007121;\n\tWed, 5 Jul 2017 11:14:15 +0300" ], "From": "Vasily Philipov <vasilyf@mellanox.com>", "To": "dev@dpdk.org", "Cc": "Vasily Philipov <vasilyf@mellanox.com>,\n\tAdrien Mazarguil <adrien.mazarguil@6wind.com>,\n\tNelio Laranjeiro <nelio.laranjeiro@6wind.com>", "Date": "Wed, 5 Jul 2017 11:14:09 +0300", "Message-Id": "<2d1e72d0efa775a05318c6489416bf7329e36b4a.1499242343.git.vasilyf@mellanox.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": [ "<225679c202aa0bae5c61882aef6c8117a9074029.1499242343.git.vasilyf@mellanox.com>", "<0dca86aa1372d6ff09d0aff01d522c580e0e24ab.1495717153.git.vasilyf@mellanox.com>" ], "References": [ "<225679c202aa0bae5c61882aef6c8117a9074029.1499242343.git.vasilyf@mellanox.com>", "<0dca86aa1372d6ff09d0aff01d522c580e0e24ab.1495717153.git.vasilyf@mellanox.com>" ], "Subject": "[dpdk-dev] [PATCH v8 2/4] net/mlx4: implement isolated mode from\n\tflow API", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "The user must request isolated mode before device configuration.\n\nSigned-off-by: Vasily Philipov <vasilyf@mellanox.com>\n---\n drivers/net/mlx4/mlx4.c | 57 +++++++++++++++++++++++++++++++++++---------\n drivers/net/mlx4/mlx4.h | 1 +\n drivers/net/mlx4/mlx4_flow.c | 37 ++++++++++++++++++++++++++++\n drivers/net/mlx4/mlx4_flow.h | 5 ++++\n 4 files changed, 89 insertions(+), 11 deletions(-)", "diff": "diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c\nindex 16cafae..fdd9cce 100644\n--- a/drivers/net/mlx4/mlx4.c\n+++ b/drivers/net/mlx4/mlx4.c\n@@ -588,7 +588,7 @@ void priv_unlock(struct priv *priv)\n \t}\n \tif (rxqs_n == priv->rxqs_n)\n \t\treturn 0;\n-\tif (!rte_is_power_of_2(rxqs_n)) {\n+\tif (!rte_is_power_of_2(rxqs_n) && !priv->isolated) {\n \t\tunsigned n_active;\n \n \t\tn_active = rte_align32pow2(rxqs_n + 1) >> 1;\n@@ -2518,6 +2518,7 @@ struct txq_mp2mr_mbuf_check_data {\n {\n \tunsigned int i;\n \n+\tassert(!priv->isolated);\n \tassert(mac_index < elemof(priv->mac));\n \tif (!BITFIELD_ISSET(priv->mac_configured, mac_index))\n \t\treturn;\n@@ -2767,12 +2768,13 @@ struct txq_mp2mr_mbuf_check_data {\n \t\t\t\t\t\trxq->if_cq,\n \t\t\t\t\t\t¶ms));\n \t}\n-\tif (rxq->qp != NULL) {\n+\tif (rxq->qp != NULL && !rxq->priv->isolated) {\n \t\trxq_promiscuous_disable(rxq);\n \t\trxq_allmulticast_disable(rxq);\n \t\trxq_mac_addrs_del(rxq);\n-\t\tclaim_zero(ibv_destroy_qp(rxq->qp));\n \t}\n+\tif (rxq->qp != NULL)\n+\t\tclaim_zero(ibv_destroy_qp(rxq->qp));\n \tif (rxq->cq != NULL)\n \t\tclaim_zero(ibv_destroy_cq(rxq->cq));\n \tif (rxq->channel != NULL)\n@@ -3472,7 +3474,7 @@ struct txq_mp2mr_mbuf_check_data {\n \t\treturn 0;\n \t}\n \t/* Remove attached flows if RSS is disabled (no parent queue). */\n-\tif (!priv->rss) {\n+\tif (!priv->rss && !priv->isolated) {\n \t\trxq_allmulticast_disable(&tmpl);\n \t\trxq_promiscuous_disable(&tmpl);\n \t\trxq_mac_addrs_del(&tmpl);\n@@ -3517,7 +3519,7 @@ struct txq_mp2mr_mbuf_check_data {\n \t\treturn err;\n \t};\n \t/* Reconfigure flows. Do not care for errors. */\n-\tif (!priv->rss) {\n+\tif (!priv->rss && !priv->isolated) {\n \t\trxq_mac_addrs_add(&tmpl);\n \t\tif (priv->promisc)\n \t\t\trxq_promiscuous_enable(&tmpl);\n@@ -3773,7 +3775,7 @@ struct txq_mp2mr_mbuf_check_data {\n \t\t (void *)dev, strerror(ret));\n \t\tgoto error;\n \t}\n-\tif ((parent) || (!priv->rss)) {\n+\tif (!priv->isolated && (parent || !priv->rss)) {\n \t\t/* Configure MAC and broadcast addresses. */\n \t\tret = rxq_mac_addrs_add(&tmpl);\n \t\tif (ret) {\n@@ -4002,7 +4004,10 @@ struct txq_mp2mr_mbuf_check_data {\n \t}\n \tDEBUG(\"%p: attaching configured flows to all RX queues\", (void *)dev);\n \tpriv->started = 1;\n-\tif (priv->rss) {\n+\tif (priv->isolated) {\n+\t\trxq = NULL;\n+\t\tr = 1;\n+\t} else if (priv->rss) {\n \t\trxq = &priv->rxq_parent;\n \t\tr = 1;\n \t} else {\n@@ -4090,7 +4095,10 @@ struct txq_mp2mr_mbuf_check_data {\n \t}\n \tDEBUG(\"%p: detaching flows from all RX queues\", (void *)dev);\n \tpriv->started = 0;\n-\tif (priv->rss) {\n+\tif (priv->isolated) {\n+\t\trxq = NULL;\n+\t\tr = 1;\n+\t} else if (priv->rss) {\n \t\trxq = &priv->rxq_parent;\n \t\tr = 1;\n \t} else {\n@@ -4522,6 +4530,8 @@ struct txq_mp2mr_mbuf_check_data {\n \tif (mlx4_is_secondary())\n \t\treturn;\n \tpriv_lock(priv);\n+\tif (priv->isolated)\n+\t\tgoto end;\n \tDEBUG(\"%p: removing MAC address from index %\" PRIu32,\n \t (void *)dev, index);\n \t/* Last array entry is reserved for broadcast. */\n@@ -4555,6 +4565,12 @@ struct txq_mp2mr_mbuf_check_data {\n \t\treturn -ENOTSUP;\n \t(void)vmdq;\n \tpriv_lock(priv);\n+\tif (priv->isolated) {\n+\t\tDEBUG(\"%p: cannot add MAC address, \"\n+\t\t \"device is in isolated mode\", (void *)dev);\n+\t\tre = EPERM;\n+\t\tgoto end;\n+\t}\n \tDEBUG(\"%p: adding MAC address at index %\" PRIu32,\n \t (void *)dev, index);\n \t/* Last array entry is reserved for broadcast. */\n@@ -4602,6 +4618,12 @@ struct txq_mp2mr_mbuf_check_data {\n \tif (mlx4_is_secondary())\n \t\treturn;\n \tpriv_lock(priv);\n+\tif (priv->isolated) {\n+\t\tDEBUG(\"%p: cannot enable promiscuous, \"\n+\t\t \"device is in isolated mode\", (void *)dev);\n+\t\tpriv_unlock(priv);\n+\t\treturn;\n+\t}\n \tif (priv->promisc) {\n \t\tpriv_unlock(priv);\n \t\treturn;\n@@ -4650,7 +4672,7 @@ struct txq_mp2mr_mbuf_check_data {\n \tif (mlx4_is_secondary())\n \t\treturn;\n \tpriv_lock(priv);\n-\tif (!priv->promisc) {\n+\tif (!priv->promisc || priv->isolated) {\n \t\tpriv_unlock(priv);\n \t\treturn;\n \t}\n@@ -4682,6 +4704,12 @@ struct txq_mp2mr_mbuf_check_data {\n \tif (mlx4_is_secondary())\n \t\treturn;\n \tpriv_lock(priv);\n+\tif (priv->isolated) {\n+\t\tDEBUG(\"%p: cannot enable allmulticast, \"\n+\t\t \"device is in isolated mode\", (void *)dev);\n+\t\tpriv_unlock(priv);\n+\t\treturn;\n+\t}\n \tif (priv->allmulti) {\n \t\tpriv_unlock(priv);\n \t\treturn;\n@@ -4730,7 +4758,7 @@ struct txq_mp2mr_mbuf_check_data {\n \tif (mlx4_is_secondary())\n \t\treturn;\n \tpriv_lock(priv);\n-\tif (!priv->allmulti) {\n+\tif (!priv->allmulti || priv->isolated) {\n \t\tpriv_unlock(priv);\n \t\treturn;\n \t}\n@@ -4873,7 +4901,7 @@ struct txq_mp2mr_mbuf_check_data {\n \t\t}\n \t\t/* Reenable non-RSS queue attributes. No need to check\n \t\t * for errors at this stage. */\n-\t\tif (!priv->rss) {\n+\t\tif (!priv->rss && !priv->isolated) {\n \t\t\trxq_mac_addrs_add(rxq);\n \t\t\tif (priv->promisc)\n \t\t\t\trxq_promiscuous_enable(rxq);\n@@ -5108,6 +5136,12 @@ struct txq_mp2mr_mbuf_check_data {\n \tif (mlx4_is_secondary())\n \t\treturn -E_RTE_SECONDARY;\n \tpriv_lock(priv);\n+\tif (priv->isolated) {\n+\t\tDEBUG(\"%p: cannot set vlan filter, \"\n+\t\t \"device is in isolated mode\", (void *)dev);\n+\t\tpriv_unlock(priv);\n+\t\treturn -EINVAL;\n+\t}\n \tret = vlan_filter_set(dev, vlan_id, on);\n \tpriv_unlock(priv);\n \tassert(ret >= 0);\n@@ -5120,6 +5154,7 @@ struct txq_mp2mr_mbuf_check_data {\n \t.destroy = mlx4_flow_destroy,\n \t.flush = mlx4_flow_flush,\n \t.query = NULL,\n+\t.isolate = mlx4_flow_isolate,\n };\n \n /**\ndiff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h\nindex c46fc23..1119525 100644\n--- a/drivers/net/mlx4/mlx4.h\n+++ b/drivers/net/mlx4/mlx4.h\n@@ -335,6 +335,7 @@ struct priv {\n \tunsigned int rss:1; /* RSS is enabled. */\n \tunsigned int vf:1; /* This is a VF device. */\n \tunsigned int pending_alarm:1; /* An alarm is pending. */\n+\tunsigned int isolated:1; /* Toggle isolated mode. */\n #ifdef INLINE_RECV\n \tunsigned int inl_recv_size; /* Inline recv size */\n #endif\ndiff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c\nindex edfac03..5ad50bd 100644\n--- a/drivers/net/mlx4/mlx4_flow.c\n+++ b/drivers/net/mlx4/mlx4_flow.c\n@@ -957,6 +957,43 @@ struct rte_flow *\n }\n \n /**\n+ * @see rte_flow_isolate()\n+ *\n+ * Must be done before calling dev_configure().\n+ *\n+ * @param dev\n+ * Pointer to the ethernet device structure.\n+ * @param enable\n+ * Nonzero to enter isolated mode, attempt to leave it otherwise.\n+ * @param[out] error\n+ * Perform verbose error reporting if not NULL. PMDs initialize this\n+ * structure in case of error only.\n+ *\n+ * @return\n+ * 0 on success, a negative value on error.\n+ */\n+int\n+mlx4_flow_isolate(struct rte_eth_dev *dev,\n+\t\t int enable,\n+\t\t struct rte_flow_error *error)\n+{\n+\tstruct priv *priv = dev->data->dev_private;\n+\n+\tpriv_lock(priv);\n+\tif (priv->rxqs) {\n+\t\trte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t NULL, \"isolated mode must be set\"\n+\t\t\t\t \" before configuring the device\");\n+\t\tpriv_unlock(priv);\n+\t\treturn -rte_errno;\n+\t}\n+\tpriv->isolated = !!enable;\n+\tpriv_unlock(priv);\n+\treturn 0;\n+}\n+\n+/**\n * Destroy a flow.\n *\n * @param priv\ndiff --git a/drivers/net/mlx4/mlx4_flow.h b/drivers/net/mlx4/mlx4_flow.h\nindex 12a293e..4d007da 100644\n--- a/drivers/net/mlx4/mlx4_flow.h\n+++ b/drivers/net/mlx4/mlx4_flow.h\n@@ -90,6 +90,11 @@ struct mlx4_flow {\n \tunsigned int offset; /**< Offset in bytes in the ibv_attr buffer. */\n };\n \n+int\n+mlx4_flow_isolate(struct rte_eth_dev *dev,\n+\t\t int enable,\n+\t\t struct rte_flow_error *error);\n+\n struct mlx4_flow_action {\n \tuint32_t drop:1; /**< Target is a drop queue. */\n \tuint32_t queue:1; /**< Target is a receive queue. */\n", "prefixes": [ "dpdk-dev", "v8", "2/4" ] }{ "id": 26483, "url": "