get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/75907/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 75907,
    "url": "http://patches.dpdk.org/api/patches/75907/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200825093116.26538-14-ophirmu@nvidia.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": "<20200825093116.26538-14-ophirmu@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200825093116.26538-14-ophirmu@nvidia.com",
    "date": "2020-08-25T09:31:16",
    "name": "[v2,13/13] linux/mlx5: refactor VLAN",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "72a6bbd9872d753773b0feaf39a4306beeeccf41",
    "submitter": {
        "id": 1908,
        "url": "http://patches.dpdk.org/api/people/1908/?format=api",
        "name": "Ophir Munk",
        "email": "ophirmu@nvidia.com"
    },
    "delegate": {
        "id": 3268,
        "url": "http://patches.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200825093116.26538-14-ophirmu@nvidia.com/mbox/",
    "series": [
        {
            "id": 11773,
            "url": "http://patches.dpdk.org/api/series/11773/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11773",
            "date": "2020-08-25T09:31:06",
            "name": "mlx5 PMD multi OS support - part #4",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/11773/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/75907/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/75907/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 5854FA04B1;\n\tTue, 25 Aug 2020 11:32:55 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 570661C1F7;\n\tTue, 25 Aug 2020 11:31:43 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id D2DFD1C1BC\n for <dev@dpdk.org>; Tue, 25 Aug 2020 11:31:29 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n ophirmu@nvidia.com) with SMTP; 25 Aug 2020 12:31:25 +0300",
            "from nvidia.com (pegasus05.mtr.labs.mlnx [10.210.16.100])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 07P9VPN3030009;\n Tue, 25 Aug 2020 12:31:25 +0300"
        ],
        "From": "Ophir Munk <ophirmu@nvidia.com>",
        "To": "dev@dpdk.org",
        "Cc": "Ophir Munk <ophirmu@mellanox.com>",
        "Date": "Tue, 25 Aug 2020 09:31:16 +0000",
        "Message-Id": "<20200825093116.26538-14-ophirmu@nvidia.com>",
        "X-Mailer": "git-send-email 2.8.4",
        "In-Reply-To": "<20200825093116.26538-1-ophirmu@nvidia.com>",
        "References": "<20200820145028.4090-1-ophirmu@nvidia.com>\n <20200825093116.26538-1-ophirmu@nvidia.com>",
        "Subject": "[dpdk-dev] [PATCH v2 13/13] linux/mlx5: refactor VLAN",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Ophir Munk <ophirmu@mellanox.com>\n\nFile mlx5_vlan.c contains Netlink APIs (Linux dependent) as part of VM\nworkaround implementation. Move this implementation to file\nlinux/mlx5_vlan_os.c.  To remove Netlink dependency in header files\nchange pointer of type 'struct mlx5_nl_vlan_vmwa_context *' to 'void *'.\n\nSigned-off-by: Ophir Munk <ophirmu@mellanox.com>\nAcked-by: Matan Azrad <matan@mellanox.com>\n---\n drivers/net/mlx5/Makefile             |   1 +\n drivers/net/mlx5/linux/meson.build    |   1 +\n drivers/net/mlx5/linux/mlx5_vlan_os.c | 168 ++++++++++++++++++++++++++++++++++\n drivers/net/mlx5/mlx5.h               |   8 +-\n drivers/net/mlx5/mlx5_vlan.c          | 134 ---------------------------\n 5 files changed, 175 insertions(+), 137 deletions(-)\n create mode 100644 drivers/net/mlx5/linux/mlx5_vlan_os.c",
    "diff": "diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile\nindex 568c772..6097688 100644\n--- a/drivers/net/mlx5/Makefile\n+++ b/drivers/net/mlx5/Makefile\n@@ -36,6 +36,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += linux/mlx5_os.c\n SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += linux/mlx5_ethdev_os.c\n SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += linux/mlx5_verbs.c\n SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += linux/mlx5_mp_os.c\n+SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += linux/mlx5_vlan_os.c\n \n # Basic CFLAGS.\n CFLAGS += -O3\ndiff --git a/drivers/net/mlx5/linux/meson.build b/drivers/net/mlx5/linux/meson.build\nindex 2def8e3..6c44021 100644\n--- a/drivers/net/mlx5/linux/meson.build\n+++ b/drivers/net/mlx5/linux/meson.build\n@@ -8,5 +8,6 @@ sources += files(\n \t'mlx5_ethdev_os.c',\n \t'mlx5_verbs.c',\n \t'mlx5_mp_os.c',\n+\t'mlx5_vlan_os.c',\n )\n \ndiff --git a/drivers/net/mlx5/linux/mlx5_vlan_os.c b/drivers/net/mlx5/linux/mlx5_vlan_os.c\nnew file mode 100644\nindex 0000000..92fc17d\n--- /dev/null\n+++ b/drivers/net/mlx5/linux/mlx5_vlan_os.c\n@@ -0,0 +1,168 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2015 6WIND S.A.\n+ * Copyright 2015 Mellanox Technologies, Ltd\n+ */\n+\n+#include <stddef.h>\n+#include <errno.h>\n+#include <stdint.h>\n+#include <unistd.h>\n+\n+/*\n+ * Not needed by this file; included to work around the lack of off_t\n+ * definition for mlx5dv.h with unpatched rdma-core versions.\n+ */\n+#include <sys/types.h>\n+\n+#include <rte_ethdev_driver.h>\n+#include <rte_common.h>\n+#include <rte_malloc.h>\n+#include <rte_hypervisor.h>\n+\n+#include <mlx5.h>\n+#include <mlx5_nl.h>\n+#include <mlx5_malloc.h>\n+\n+/*\n+ * Release VLAN network device, created for VM workaround.\n+ *\n+ * @param[in] dev\n+ *   Ethernet device object, Netlink context provider.\n+ * @param[in] vlan\n+ *   Object representing the network device to release.\n+ */\n+void\n+mlx5_vlan_vmwa_release(struct rte_eth_dev *dev,\n+\t\t\t    struct mlx5_vf_vlan *vlan)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_nl_vlan_vmwa_context *vmwa = priv->vmwa_context;\n+\tstruct mlx5_nl_vlan_dev *vlan_dev = &vmwa->vlan_dev[0];\n+\n+\tMLX5_ASSERT(vlan->created);\n+\tMLX5_ASSERT(priv->vmwa_context);\n+\tif (!vlan->created || !vmwa)\n+\t\treturn;\n+\tvlan->created = 0;\n+\tMLX5_ASSERT(vlan_dev[vlan->tag].refcnt);\n+\tif (--vlan_dev[vlan->tag].refcnt == 0 &&\n+\t    vlan_dev[vlan->tag].ifindex) {\n+\t\tmlx5_nl_vlan_vmwa_delete(vmwa, vlan_dev[vlan->tag].ifindex);\n+\t\tvlan_dev[vlan->tag].ifindex = 0;\n+\t}\n+}\n+\n+/**\n+ * Acquire VLAN interface with specified tag for VM workaround.\n+ *\n+ * @param[in] dev\n+ *   Ethernet device object, Netlink context provider.\n+ * @param[in] vlan\n+ *   Object representing the network device to acquire.\n+ */\n+void\n+mlx5_vlan_vmwa_acquire(struct rte_eth_dev *dev,\n+\t\t\t    struct mlx5_vf_vlan *vlan)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_nl_vlan_vmwa_context *vmwa = priv->vmwa_context;\n+\tstruct mlx5_nl_vlan_dev *vlan_dev = &vmwa->vlan_dev[0];\n+\n+\tMLX5_ASSERT(!vlan->created);\n+\tMLX5_ASSERT(priv->vmwa_context);\n+\tif (vlan->created || !vmwa)\n+\t\treturn;\n+\tif (vlan_dev[vlan->tag].refcnt == 0) {\n+\t\tMLX5_ASSERT(!vlan_dev[vlan->tag].ifindex);\n+\t\tvlan_dev[vlan->tag].ifindex =\n+\t\t\tmlx5_nl_vlan_vmwa_create(vmwa, vmwa->vf_ifindex,\n+\t\t\t\t\t\t vlan->tag);\n+\t}\n+\tif (vlan_dev[vlan->tag].ifindex) {\n+\t\tvlan_dev[vlan->tag].refcnt++;\n+\t\tvlan->created = 1;\n+\t}\n+}\n+\n+/*\n+ * Create per ethernet device VLAN VM workaround context\n+ *\n+ * @param dev\n+ *   Pointer to Ethernet device structure.\n+ * @param ifindex\n+ *   Interface index.\n+ *\n+ * @Return\n+ *   Pointer to mlx5_nl_vlan_vmwa_context\n+ */\n+void *\n+mlx5_vlan_vmwa_init(struct rte_eth_dev *dev, uint32_t ifindex)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_dev_config *config = &priv->config;\n+\tstruct mlx5_nl_vlan_vmwa_context *vmwa;\n+\tenum rte_hypervisor hv_type;\n+\n+\t/* Do not engage workaround over PF. */\n+\tif (!config->vf)\n+\t\treturn NULL;\n+\t/* Check whether there is desired virtual environment */\n+\thv_type = rte_hypervisor_get();\n+\tswitch (hv_type) {\n+\tcase RTE_HYPERVISOR_UNKNOWN:\n+\tcase RTE_HYPERVISOR_VMWARE:\n+\t\t/*\n+\t\t * The \"white list\" of configurations\n+\t\t * to engage the workaround.\n+\t\t */\n+\t\tbreak;\n+\tdefault:\n+\t\t/*\n+\t\t * The configuration is not found in the \"white list\".\n+\t\t * We should not engage the VLAN workaround.\n+\t\t */\n+\t\treturn NULL;\n+\t}\n+\tvmwa = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*vmwa), sizeof(uint32_t),\n+\t\t\t   SOCKET_ID_ANY);\n+\tif (!vmwa) {\n+\t\tDRV_LOG(WARNING,\n+\t\t\t\"Can not allocate memory\"\n+\t\t\t\" for VLAN workaround context\");\n+\t\treturn NULL;\n+\t}\n+\tvmwa->nl_socket = mlx5_nl_init(NETLINK_ROUTE);\n+\tif (vmwa->nl_socket < 0) {\n+\t\tDRV_LOG(WARNING,\n+\t\t\t\"Can not create Netlink socket\"\n+\t\t\t\" for VLAN workaround context\");\n+\t\tmlx5_free(vmwa);\n+\t\treturn NULL;\n+\t}\n+\tvmwa->vf_ifindex = ifindex;\n+\t/* Cleanup for existing VLAN devices. */\n+\treturn vmwa;\n+}\n+\n+/*\n+ * Destroy per ethernet device VLAN VM workaround context\n+ *\n+ * @param dev\n+ *   Pointer to VM context\n+ */\n+void\n+mlx5_vlan_vmwa_exit(void *vmctx)\n+{\n+\tunsigned int i;\n+\n+\tstruct mlx5_nl_vlan_vmwa_context *vmwa = vmctx;\n+\t/* Delete all remaining VLAN devices. */\n+\tfor (i = 0; i < RTE_DIM(vmwa->vlan_dev); i++) {\n+\t\tif (vmwa->vlan_dev[i].ifindex)\n+\t\t\tmlx5_nl_vlan_vmwa_delete(vmwa,\n+\t\t\t\t\t\t vmwa->vlan_dev[i].ifindex);\n+\t}\n+\tif (vmwa->nl_socket >= 0)\n+\t\tclose(vmwa->nl_socket);\n+\tmlx5_free(vmwa);\n+}\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 431f861..f29a12c 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -853,8 +853,6 @@ void mlx5_os_stats_init(struct rte_eth_dev *dev);\n void mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);\n int mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,\n \t\t      uint32_t index, uint32_t vmdq);\n-struct mlx5_nl_vlan_vmwa_context *mlx5_vlan_vmwa_init\n-\t\t\t\t    (struct rte_eth_dev *dev, uint32_t ifindex);\n int mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr);\n int mlx5_set_mc_addr_list(struct rte_eth_dev *dev,\n \t\t\tstruct rte_ether_addr *mc_addr_set,\n@@ -897,11 +895,15 @@ int mlx5_xstats_get_names(struct rte_eth_dev *dev __rte_unused,\n int mlx5_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on);\n void mlx5_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on);\n int mlx5_vlan_offload_set(struct rte_eth_dev *dev, int mask);\n-void mlx5_vlan_vmwa_exit(struct mlx5_nl_vlan_vmwa_context *ctx);\n+\n+/* mlx5_vlan_os.c */\n+\n+void mlx5_vlan_vmwa_exit(void *ctx);\n void mlx5_vlan_vmwa_release(struct rte_eth_dev *dev,\n \t\t\t    struct mlx5_vf_vlan *vf_vlan);\n void mlx5_vlan_vmwa_acquire(struct rte_eth_dev *dev,\n \t\t\t    struct mlx5_vf_vlan *vf_vlan);\n+void *mlx5_vlan_vmwa_init(struct rte_eth_dev *dev, uint32_t ifindex);\n \n /* mlx5_trigger.c */\n \ndiff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c\nindex ea89599..4bcd3e2 100644\n--- a/drivers/net/mlx5/mlx5_vlan.c\n+++ b/drivers/net/mlx5/mlx5_vlan.c\n@@ -13,11 +13,6 @@\n #include <rte_malloc.h>\n #include <rte_hypervisor.h>\n \n-#include <mlx5_glue.h>\n-#include <mlx5_devx_cmds.h>\n-#include <mlx5_nl.h>\n-#include <mlx5_malloc.h>\n-\n #include \"mlx5.h\"\n #include \"mlx5_autoconf.h\"\n #include \"mlx5_rxtx.h\"\n@@ -162,132 +157,3 @@ mlx5_vlan_offload_set(struct rte_eth_dev *dev, int mask)\n \t}\n \treturn 0;\n }\n-\n-/*\n- * Release VLAN network device, created for VM workaround.\n- *\n- * @param[in] dev\n- *   Ethernet device object, Netlink context provider.\n- * @param[in] vlan\n- *   Object representing the network device to release.\n- */\n-void mlx5_vlan_vmwa_release(struct rte_eth_dev *dev,\n-\t\t\t    struct mlx5_vf_vlan *vlan)\n-{\n-\tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tstruct mlx5_nl_vlan_vmwa_context *vmwa = priv->vmwa_context;\n-\tstruct mlx5_nl_vlan_dev *vlan_dev = &vmwa->vlan_dev[0];\n-\n-\tMLX5_ASSERT(vlan->created);\n-\tMLX5_ASSERT(priv->vmwa_context);\n-\tif (!vlan->created || !vmwa)\n-\t\treturn;\n-\tvlan->created = 0;\n-\tMLX5_ASSERT(vlan_dev[vlan->tag].refcnt);\n-\tif (--vlan_dev[vlan->tag].refcnt == 0 &&\n-\t    vlan_dev[vlan->tag].ifindex) {\n-\t\tmlx5_nl_vlan_vmwa_delete(vmwa, vlan_dev[vlan->tag].ifindex);\n-\t\tvlan_dev[vlan->tag].ifindex = 0;\n-\t}\n-}\n-\n-/**\n- * Acquire VLAN interface with specified tag for VM workaround.\n- *\n- * @param[in] dev\n- *   Ethernet device object, Netlink context provider.\n- * @param[in] vlan\n- *   Object representing the network device to acquire.\n- */\n-void mlx5_vlan_vmwa_acquire(struct rte_eth_dev *dev,\n-\t\t\t    struct mlx5_vf_vlan *vlan)\n-{\n-\tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tstruct mlx5_nl_vlan_vmwa_context *vmwa = priv->vmwa_context;\n-\tstruct mlx5_nl_vlan_dev *vlan_dev = &vmwa->vlan_dev[0];\n-\n-\tMLX5_ASSERT(!vlan->created);\n-\tMLX5_ASSERT(priv->vmwa_context);\n-\tif (vlan->created || !vmwa)\n-\t\treturn;\n-\tif (vlan_dev[vlan->tag].refcnt == 0) {\n-\t\tMLX5_ASSERT(!vlan_dev[vlan->tag].ifindex);\n-\t\tvlan_dev[vlan->tag].ifindex =\n-\t\t\tmlx5_nl_vlan_vmwa_create(vmwa, vmwa->vf_ifindex,\n-\t\t\t\t\t\t vlan->tag);\n-\t}\n-\tif (vlan_dev[vlan->tag].ifindex) {\n-\t\tvlan_dev[vlan->tag].refcnt++;\n-\t\tvlan->created = 1;\n-\t}\n-}\n-\n-/*\n- * Create per ethernet device VLAN VM workaround context\n- */\n-struct mlx5_nl_vlan_vmwa_context *\n-mlx5_vlan_vmwa_init(struct rte_eth_dev *dev, uint32_t ifindex)\n-{\n-\tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tstruct mlx5_dev_config *config = &priv->config;\n-\tstruct mlx5_nl_vlan_vmwa_context *vmwa;\n-\tenum rte_hypervisor hv_type;\n-\n-\t/* Do not engage workaround over PF. */\n-\tif (!config->vf)\n-\t\treturn NULL;\n-\t/* Check whether there is desired virtual environment */\n-\thv_type = rte_hypervisor_get();\n-\tswitch (hv_type) {\n-\tcase RTE_HYPERVISOR_UNKNOWN:\n-\tcase RTE_HYPERVISOR_VMWARE:\n-\t\t/*\n-\t\t * The \"white list\" of configurations\n-\t\t * to engage the workaround.\n-\t\t */\n-\t\tbreak;\n-\tdefault:\n-\t\t/*\n-\t\t * The configuration is not found in the \"white list\".\n-\t\t * We should not engage the VLAN workaround.\n-\t\t */\n-\t\treturn NULL;\n-\t}\n-\tvmwa = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*vmwa), sizeof(uint32_t),\n-\t\t\t   SOCKET_ID_ANY);\n-\tif (!vmwa) {\n-\t\tDRV_LOG(WARNING,\n-\t\t\t\"Can not allocate memory\"\n-\t\t\t\" for VLAN workaround context\");\n-\t\treturn NULL;\n-\t}\n-\tvmwa->nl_socket = mlx5_nl_init(NETLINK_ROUTE);\n-\tif (vmwa->nl_socket < 0) {\n-\t\tDRV_LOG(WARNING,\n-\t\t\t\"Can not create Netlink socket\"\n-\t\t\t\" for VLAN workaround context\");\n-\t\tmlx5_free(vmwa);\n-\t\treturn NULL;\n-\t}\n-\tvmwa->vf_ifindex = ifindex;\n-\t/* Cleanup for existing VLAN devices. */\n-\treturn vmwa;\n-}\n-\n-/*\n- * Destroy per ethernet device VLAN VM workaround context\n- */\n-void mlx5_vlan_vmwa_exit(struct mlx5_nl_vlan_vmwa_context *vmwa)\n-{\n-\tunsigned int i;\n-\n-\t/* Delete all remaining VLAN devices. */\n-\tfor (i = 0; i < RTE_DIM(vmwa->vlan_dev); i++) {\n-\t\tif (vmwa->vlan_dev[i].ifindex)\n-\t\t\tmlx5_nl_vlan_vmwa_delete(vmwa,\n-\t\t\t\t\t\t vmwa->vlan_dev[i].ifindex);\n-\t}\n-\tif (vmwa->nl_socket >= 0)\n-\t\tclose(vmwa->nl_socket);\n-\tmlx5_free(vmwa);\n-}\n",
    "prefixes": [
        "v2",
        "13/13"
    ]
}