Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/18055/?format=api
http://patches.dpdk.org/api/patches/18055/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20161216143919.4909-5-ferruh.yigit@intel.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": "<20161216143919.4909-5-ferruh.yigit@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20161216143919.4909-5-ferruh.yigit@intel.com", "date": "2016-12-16T14:38:54", "name": "[dpdk-dev,v4,04/29] net/i40e: set VF VLAN anti-spoofing from PF", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "e7b1755b6f7b1836ac486bf8c40f97a8b1c5cf19", "submitter": { "id": 324, "url": "http://patches.dpdk.org/api/people/324/?format=api", "name": "Ferruh Yigit", "email": "ferruh.yigit@intel.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/20161216143919.4909-5-ferruh.yigit@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/18055/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/18055/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 5669058C8;\n\tFri, 16 Dec 2016 15:40:24 +0100 (CET)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 55FFA58C8\n\tfor <dev@dpdk.org>; Fri, 16 Dec 2016 15:40:22 +0100 (CET)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby orsmga102.jf.intel.com with ESMTP; 16 Dec 2016 06:40:10 -0800", "from sivswdev02.ir.intel.com ([10.237.217.46])\n\tby fmsmga005.fm.intel.com with ESMTP; 16 Dec 2016 06:40:09 -0800" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.33,358,1477983600\"; d=\"scan'208\";a=\"43277142\"", "From": "Ferruh Yigit <ferruh.yigit@intel.com>", "To": "dev@dpdk.org", "Cc": "Jingjing Wu <jingjing.wu@intel.com>; Helin Zhang <helin.zhang@intel.com>,\n\tWenzhuo Lu <wenzhuo.lu@intel.com>", "Date": "Fri, 16 Dec 2016 14:38:54 +0000", "Message-Id": "<20161216143919.4909-5-ferruh.yigit@intel.com>", "X-Mailer": "git-send-email 2.8.4", "In-Reply-To": "<20161216143919.4909-1-ferruh.yigit@intel.com>", "References": "<1481835919-36488-1-git-send-email-qi.z.zhang@intel.com>\n\t<20161216143919.4909-1-ferruh.yigit@intel.com>", "Subject": "[dpdk-dev] [PATCH v4 04/29] net/i40e: set VF VLAN anti-spoofing\n\tfrom PF", "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": "From: Wenzhuo Lu <wenzhuo.lu@intel.com>\n\nSupport enabling/disabling VF VLAN anti-spoofing from\nPF.\nUser can call the API on PF to enable/disable a specific\nVF's VLAN anti-spoofing.\n\nSigned-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>\n---\n drivers/net/i40e/i40e_ethdev.c | 116 +++++++++++++++++++++++++++++-\n drivers/net/i40e/i40e_ethdev.h | 1 +\n drivers/net/i40e/rte_pmd_i40e.h | 19 +++++\n drivers/net/i40e/rte_pmd_i40e_version.map | 1 +\n 4 files changed, 135 insertions(+), 2 deletions(-)", "diff": "diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c\nindex c23e6b5..77be98b 100644\n--- a/drivers/net/i40e/i40e_ethdev.c\n+++ b/drivers/net/i40e/i40e_ethdev.c\n@@ -4418,6 +4418,7 @@ i40e_vsi_setup(struct i40e_pf *pf,\n \tvsi->max_macaddrs = I40E_NUM_MACADDR_MAX;\n \tvsi->parent_vsi = uplink_vsi ? uplink_vsi : pf->main_vsi;\n \tvsi->user_param = user_param;\n+\tvsi->vlan_anti_spoof_on = 0;\n \t/* Allocate queues */\n \tswitch (vsi->type) {\n \tcase I40E_VSI_MAIN :\n@@ -5761,17 +5762,35 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi,\n \t\t\t uint16_t vlan_id, bool on)\n {\n \tuint32_t vid_idx, vid_bit;\n+\tstruct i40e_hw *hw = I40E_VSI_TO_HW(vsi);\n+\tstruct i40e_aqc_add_remove_vlan_element_data vlan_data = {0};\n+\tint ret;\n \n \tif (vlan_id > ETH_VLAN_ID_MAX)\n \t\treturn;\n \n \tvid_idx = I40E_VFTA_IDX(vlan_id);\n \tvid_bit = I40E_VFTA_BIT(vlan_id);\n+\tvlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);\n \n-\tif (on)\n+\tif (on) {\n+\t\tif (vsi->vlan_anti_spoof_on) {\n+\t\t\tret = i40e_aq_add_vlan(hw, vsi->seid,\n+\t\t\t\t\t &vlan_data, 1, NULL);\n+\t\t\tif (ret != I40E_SUCCESS)\n+\t\t\t\tPMD_DRV_LOG(ERR, \"Failed to add vlan filter\");\n+\t\t}\n \t\tvsi->vfta[vid_idx] |= vid_bit;\n-\telse\n+\t} else {\n+\t\tif (vsi->vlan_anti_spoof_on) {\n+\t\t\tret = i40e_aq_remove_vlan(hw, vsi->seid,\n+\t\t\t\t\t\t &vlan_data, 1, NULL);\n+\t\t\tif (ret != I40E_SUCCESS)\n+\t\t\t\tPMD_DRV_LOG(ERR,\n+\t\t\t\t\t \"Failed to remove vlan filter\");\n+\t\t}\n \t\tvsi->vfta[vid_idx] &= ~vid_bit;\n+\t}\n }\n \n /**\n@@ -9786,3 +9805,96 @@ rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)\n \n \treturn ret;\n }\n+\n+static int\n+i40e_add_rm_all_vlan_filter(struct i40e_vsi *vsi, uint8_t add)\n+{\n+\tuint32_t j, k;\n+\tuint16_t vlan_id;\n+\tstruct i40e_hw *hw = I40E_VSI_TO_HW(vsi);\n+\tstruct i40e_aqc_add_remove_vlan_element_data vlan_data = {0};\n+\tint ret;\n+\n+\tfor (j = 0; j < I40E_VFTA_SIZE; j++) {\n+\t\tif (!vsi->vfta[j])\n+\t\t\tcontinue;\n+\n+\t\tfor (k = 0; k < I40E_UINT32_BIT_SIZE; k++) {\n+\t\t\tif (!(vsi->vfta[j] & (1 << k)))\n+\t\t\t\tcontinue;\n+\n+\t\t\tvlan_id = j * I40E_UINT32_BIT_SIZE + k;\n+\t\t\tvlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);\n+\t\t\tif (add)\n+\t\t\t\tret = i40e_aq_add_vlan(hw, vsi->seid,\n+\t\t\t\t\t\t &vlan_data, 1, NULL);\n+\t\t\telse\n+\t\t\t\tret = i40e_aq_remove_vlan(hw, vsi->seid,\n+\t\t\t\t\t\t\t &vlan_data, 1, NULL);\n+\t\t\tif (ret != I40E_SUCCESS) {\n+\t\t\t\tPMD_DRV_LOG(ERR,\n+\t\t\t\t\t \"Failed to add/rm vlan filter\");\n+\t\t\t\treturn ret;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\treturn I40E_SUCCESS;\n+}\n+\n+int\n+rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)\n+{\n+\tstruct rte_eth_dev *dev;\n+\tstruct rte_eth_dev_info dev_info;\n+\tstruct i40e_pf *pf;\n+\tstruct i40e_pf_vf *vf;\n+\tstruct i40e_vsi *vsi;\n+\tstruct i40e_hw *hw;\n+\tstruct i40e_vsi_context ctxt;\n+\tint ret;\n+\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);\n+\n+\tdev = &rte_eth_devices[port];\n+\trte_eth_dev_info_get(port, &dev_info);\n+\n+\tif (vf_id >= dev_info.max_vfs)\n+\t\treturn -EINVAL;\n+\n+\tpf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n+\n+\tif (vf_id > pf->vf_num - 1 || !pf->vfs) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid argument.\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tvf = &pf->vfs[vf_id];\n+\tvsi = vf->vsi;\n+\n+\t/* Check if it has been already on or off */\n+\tif (vsi->vlan_anti_spoof_on == on)\n+\t\treturn 0; /* already on or off */\n+\n+\tvsi->vlan_anti_spoof_on = on;\n+\tret = i40e_add_rm_all_vlan_filter(vsi, on);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tvsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SECURITY_VALID);\n+\tif (on)\n+\t\tvsi->info.sec_flags |= I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK;\n+\telse\n+\t\tvsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK;\n+\n+\tmemset(&ctxt, 0, sizeof(ctxt));\n+\t(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));\n+\tctxt.seid = vsi->seid;\n+\n+\thw = I40E_VSI_TO_HW(vsi);\n+\tret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);\n+\tif (ret != I40E_SUCCESS)\n+\t\tPMD_DRV_LOG(ERR, \"Failed to update VSI params\");\n+\n+\treturn ret;\n+}\ndiff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h\nindex 298cef4..0db140b 100644\n--- a/drivers/net/i40e/i40e_ethdev.h\n+++ b/drivers/net/i40e/i40e_ethdev.h\n@@ -300,6 +300,7 @@ struct i40e_vsi {\n \tuint16_t msix_intr; /* The MSIX interrupt binds to VSI */\n \tuint16_t nb_msix; /* The max number of msix vector */\n \tuint8_t enabled_tc; /* The traffic class enabled */\n+\tuint8_t vlan_anti_spoof_on; /* The VLAN anti-spoofing enabled */\n \tstruct i40e_bw_info bw_info; /* VSI bandwidth information */\n };\n \ndiff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h\nindex 52319cf..c8736c8 100644\n--- a/drivers/net/i40e/rte_pmd_i40e.h\n+++ b/drivers/net/i40e/rte_pmd_i40e.h\n@@ -95,4 +95,23 @@ int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,\n \t\t\t\t uint16_t vf_id,\n \t\t\t\t uint8_t on);\n \n+/**\n+ * Enable/Disable VF VLAN anti spoofing.\n+ *\n+ * @param port\n+ * The port identifier of the Ethernet device.\n+ * @param vf\n+ * VF on which to set VLAN anti spoofing.\n+ * @param on\n+ * 1 - Enable VFs VLAN anti spoofing.\n+ * 0 - Disable VFs VLAN anti spoofing.\n+ * @return\n+ * - (0) if successful.\n+ * - (-ENODEV) if *port* invalid.\n+ * - (-EINVAL) if bad parameter.\n+ */\n+int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,\n+\t\t\t\t\tuint16_t vf_id,\n+\t\t\t\t\tuint8_t on);\n+\n #endif /* _PMD_I40E_H_ */\ndiff --git a/drivers/net/i40e/rte_pmd_i40e_version.map b/drivers/net/i40e/rte_pmd_i40e_version.map\nindex 30efb08..fff6cf9 100644\n--- a/drivers/net/i40e/rte_pmd_i40e_version.map\n+++ b/drivers/net/i40e/rte_pmd_i40e_version.map\n@@ -8,4 +8,5 @@ DPDK_17.02 {\n \n \trte_pmd_i40e_ping_vfs;\n \trte_pmd_i40e_set_vf_mac_anti_spoof;\n+\trte_pmd_i40e_set_vf_vlan_anti_spoof;\n } DPDK_2.0;\n", "prefixes": [ "dpdk-dev", "v4", "04/29" ] }{ "id": 18055, "url": "