Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/693948/?format=api
{ "id": 693948, "url": "http://patchwork.ozlabs.org/api/patches/693948/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1478896779-13697-7-git-send-email-bimmy.pujari@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1478896779-13697-7-git-send-email-bimmy.pujari@intel.com>", "list_archive_url": null, "date": "2016-11-11T20:39:30", "name": "[next,S54,06/15] i40e: use (add|rm)_vlan_all_mac helper functions when changing PVID", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "dd5e40e9b92b0d41dedf4ba73fe80a02e471a41b", "submitter": { "id": 68919, "url": "http://patchwork.ozlabs.org/api/people/68919/?format=api", "name": "Pujari, Bimmy", "email": "bimmy.pujari@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1478896779-13697-7-git-send-email-bimmy.pujari@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/693948/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/693948/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3tFsJn2Rqgz9t2g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 12 Nov 2016 07:41:29 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id BC71F95949;\n\tFri, 11 Nov 2016 20:41:27 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 8NSI4UzzmN2x; Fri, 11 Nov 2016 20:41:25 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 4582A959DA;\n\tFri, 11 Nov 2016 20:41:20 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 06F771CEC94\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 11 Nov 2016 20:41:17 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 018D1C2242\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 11 Nov 2016 20:41:17 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id emaUgViV_bQr for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 11 Nov 2016 20:41:14 +0000 (UTC)", "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id D3243C29C8\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 11 Nov 2016 20:41:13 +0000 (UTC)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby orsmga104.jf.intel.com with ESMTP; 11 Nov 2016 12:41:13 -0800", "from bimmy.jf.intel.com (HELO bimmy.linux1.jf.intel.com)\n\t([134.134.2.167])\n\tby fmsmga005.fm.intel.com with ESMTP; 11 Nov 2016 12:41:13 -0800" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.31,474,1473145200\"; d=\"scan'208\";a=\"30297947\"", "From": "Bimmy Pujari <bimmy.pujari@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Fri, 11 Nov 2016 12:39:30 -0800", "Message-Id": "<1478896779-13697-7-git-send-email-bimmy.pujari@intel.com>", "X-Mailer": "git-send-email 2.4.11", "In-Reply-To": "<1478896779-13697-1-git-send-email-bimmy.pujari@intel.com>", "References": "<1478896779-13697-1-git-send-email-bimmy.pujari@intel.com>", "Subject": "[Intel-wired-lan] [next PATCH S54 06/15] i40e: use\n\t(add|rm)_vlan_all_mac helper functions when changing PVID", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "From: Jacob Keller <jacob.e.keller@intel.com>\n\nThe current flow for adding or updating the PVID for a VF uses\ni40e_vsi_add_vlan and i40e_vsi_kill_vlan which each take, then release\nthe hash lock. In addition the two functions also must take special care\nthat they do not perform VLAN mode changes as this will make the code in\ni40e_ndo_set_vf_port_vlan behave incorrectly.\n\nFix these issues by using the new helper functions i40e_add_vlan_all_mac\nand i40e_rm_vlan_all_mac which expect the hash lock to already be taken.\nAdditionally these functions do not perform any state updates in regards\nto vlan mode, so they are safe to use in the PVID update flow.\n\nIt should be noted that we don't need the VLAN mode update code here,\nbecause there are only a few flows here.\n\n(a) we're adding a new PVID\n In this case, if we already had VLAN filters the VSI is knocked\n offline so we don't need to worry about pre-existing VLAN filters\n\n(b) we're replacing an existing PVID\n In this case, we can't have any VLAN filters except those with the old\n PVID which we already take care of manually.\n\n(c) we're removing an existing PVID\n Similarly to above, we can't have any existing VLAN filters except\n those with the old PVID which we already take care of correctly.\n\nBecause of this, we do not need (or even want) the special accounting\ndone in i40e_vsi_add_vlan, so use of the helpers is a saner alternative.\nIt also opens the door for a future patch which will refactor the flow\nof i40e_vsi_add_vlan now that it is not needed in this function.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\nChange-ID: Ia841f63da94e12b106f41cf7d28ce8ce92f2ad99\n---\nTesting-hints:\n Ensure that adding and removing PVID for a VF works as expected, and\n that the PVID is enforced correctly.\n\n drivers/net/ethernet/intel/i40e/i40e.h | 2 +\n drivers/net/ethernet/intel/i40e/i40e_main.c | 4 +-\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 43 ++++++++++++++--------\n 3 files changed, 32 insertions(+), 17 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex b05065c..03b95cf 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -853,7 +853,9 @@ int i40e_open(struct net_device *netdev);\n int i40e_close(struct net_device *netdev);\n int i40e_vsi_open(struct i40e_vsi *vsi);\n void i40e_vlan_stripping_disable(struct i40e_vsi *vsi);\n+int i40e_add_vlan_all_mac(struct i40e_vsi *vsi, s16 vid);\n int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid);\n+void i40e_rm_vlan_all_mac(struct i40e_vsi *vsi, s16 vid);\n void i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid);\n struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi,\n \t\t\t\t\t const u8 *macaddr);\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 8caf23c..c99e54f 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -2492,7 +2492,7 @@ static void i40e_vlan_rx_register(struct net_device *netdev, u32 features)\n * NOTE: this function expects to be called while under the\n * mac_filter_hash_lock\n **/\n-static int i40e_add_vlan_all_mac(struct i40e_vsi *vsi, s16 vid)\n+int i40e_add_vlan_all_mac(struct i40e_vsi *vsi, s16 vid)\n {\n \tstruct i40e_mac_filter *f, *add_f;\n \tstruct hlist_node *h;\n@@ -2583,7 +2583,7 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid)\n * NOTE: this function expects to be called while under the\n * mac_filter_hash_lock\n */\n-static void i40e_rm_vlan_all_mac(struct i40e_vsi *vsi, s16 vid)\n+void i40e_rm_vlan_all_mac(struct i40e_vsi *vsi, s16 vid)\n {\n \tstruct i40e_mac_filter *f;\n \tstruct hlist_node *h;\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex d28b684..a6198b7 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -2766,7 +2766,6 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,\n \tu16 vlanprio = vlan_id | (qos << I40E_VLAN_PRIORITY_SHIFT);\n \tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n \tstruct i40e_pf *pf = np->vsi->back;\n-\tbool is_vsi_in_vlan = false;\n \tstruct i40e_vsi *vsi;\n \tstruct i40e_vf *vf;\n \tint ret = 0;\n@@ -2803,11 +2802,10 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,\n \t\t/* duplicate request, so just return success */\n \t\tgoto error_pvid;\n \n+\t/* Locked once because multiple functions below iterate list */\n \tspin_lock_bh(&vsi->mac_filter_hash_lock);\n-\tis_vsi_in_vlan = i40e_is_vsi_in_vlan(vsi);\n-\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n \n-\tif (le16_to_cpu(vsi->info.pvid) == 0 && is_vsi_in_vlan) {\n+\tif (le16_to_cpu(vsi->info.pvid) == 0 && i40e_is_vsi_in_vlan(vsi)) {\n \t\tdev_err(&pf->pdev->dev,\n \t\t\t\"VF %d has already configured VLAN filters and the administrator is requesting a port VLAN override.\\nPlease unload and reload the VF driver for this change to take effect.\\n\",\n \t\t\tvf_id);\n@@ -2830,14 +2828,23 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,\n \t */\n \tif ((!(vlan_id || qos) ||\n \t vlanprio != le16_to_cpu(vsi->info.pvid)) &&\n-\t vsi->info.pvid)\n-\t\tret = i40e_vsi_add_vlan(vsi, I40E_VLAN_ANY);\n+\t vsi->info.pvid) {\n+\t\tret = i40e_add_vlan_all_mac(vsi, I40E_VLAN_ANY);\n+\t\tif (ret) {\n+\t\t\tdev_info(&vsi->back->pdev->dev,\n+\t\t\t\t \"add VF VLAN failed, ret=%d aq_err=%d\\n\", ret,\n+\t\t\t\t vsi->back->hw.aq.asq_last_status);\n+\t\t\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n+\t\t\tgoto error_pvid;\n+\t\t}\n+\t}\n \n \tif (vsi->info.pvid) {\n-\t\t/* kill old VLAN */\n-\t\ti40e_vsi_kill_vlan(vsi, (le16_to_cpu(vsi->info.pvid) &\n-\t\t\t\t\t VLAN_VID_MASK));\n+\t\t/* remove all filters on the old VLAN */\n+\t\ti40e_rm_vlan_all_mac(vsi, (le16_to_cpu(vsi->info.pvid) &\n+\t\t\t\t\t VLAN_VID_MASK));\n \t}\n+\n \tif (vlan_id || qos)\n \t\tret = i40e_vsi_add_pvid(vsi, vlanprio);\n \telse\n@@ -2847,24 +2854,30 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,\n \t\tdev_info(&pf->pdev->dev, \"Setting VLAN %d, QOS 0x%x on VF %d\\n\",\n \t\t\t vlan_id, qos, vf_id);\n \n-\t\t/* add new VLAN filter */\n-\t\tret = i40e_vsi_add_vlan(vsi, vlan_id);\n+\t\t/* add new VLAN filter for each MAC */\n+\t\tret = i40e_add_vlan_all_mac(vsi, vlan_id);\n \t\tif (ret) {\n \t\t\tdev_info(&vsi->back->pdev->dev,\n \t\t\t\t \"add VF VLAN failed, ret=%d aq_err=%d\\n\", ret,\n \t\t\t\t vsi->back->hw.aq.asq_last_status);\n+\t\t\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n \t\t\tgoto error_pvid;\n \t\t}\n-\t\t/* Kill non-vlan MAC filters - ignore error return since\n-\t\t * there might not be any non-vlan MAC filters.\n-\t\t */\n-\t\ti40e_vsi_kill_vlan(vsi, I40E_VLAN_ANY);\n+\n+\t\t/* remove the previously added non-VLAN MAC filters */\n+\t\ti40e_rm_vlan_all_mac(vsi, I40E_VLAN_ANY);\n \t}\n \n+\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n+\n+\t/* Schedule the worker thread to take care of applying changes */\n+\ti40e_service_event_schedule(vsi->back);\n+\n \tif (ret) {\n \t\tdev_err(&pf->pdev->dev, \"Unable to update VF vsi context\\n\");\n \t\tgoto error_pvid;\n \t}\n+\n \t/* The Port VLAN needs to be saved across resets the same as the\n \t * default LAN MAC address.\n \t */\n", "prefixes": [ "next", "S54", "06/15" ] }