Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1137054/?format=api
{ "id": 1137054, "url": "http://patchwork.ozlabs.org/api/patches/1137054/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190725095401.24590-2-anthony.l.nguyen@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": "<20190725095401.24590-2-anthony.l.nguyen@intel.com>", "list_archive_url": null, "date": "2019-07-25T09:53:51", "name": "[S25,02/12] ice: Fix issues updating VSI MAC filters", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "6035b8d413e61891243a12c89bbe7ca018aec25d", "submitter": { "id": 68875, "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api", "name": "Tony Nguyen", "email": "anthony.l.nguyen@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/20190725095401.24590-2-anthony.l.nguyen@intel.com/mbox/", "series": [ { "id": 121514, "url": "http://patchwork.ozlabs.org/api/series/121514/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=121514", "date": "2019-07-25T09:53:50", "name": "[S25,01/12] ice: update ethtool stats on-demand", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/121514/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1137054/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1137054/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@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" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.133; helo=hemlock.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com" ], "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 45vgYF5rxkz9sDQ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 26 Jul 2019 04:22:25 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 59C638818F;\n\tThu, 25 Jul 2019 18:22:24 +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 ypzY9qaRA81I; Thu, 25 Jul 2019 18:22:23 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 90053881A0;\n\tThu, 25 Jul 2019 18:22:22 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id AE3611BF2C8\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 25 Jul 2019 18:22:19 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id AB59D86582\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 25 Jul 2019 18:22:19 +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 PSh1aQM8EJeY for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 25 Jul 2019 18:22:18 +0000 (UTC)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 262978655C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 25 Jul 2019 18:22:18 +0000 (UTC)", "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Jul 2019 11:22:17 -0700", "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby fmsmga004.fm.intel.com with ESMTP; 25 Jul 2019 11:22:17 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.64,307,1559545200\"; d=\"scan'208\";a=\"193897592\"", "From": "Tony Nguyen <anthony.l.nguyen@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Thu, 25 Jul 2019 02:53:51 -0700", "Message-Id": "<20190725095401.24590-2-anthony.l.nguyen@intel.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190725095401.24590-1-anthony.l.nguyen@intel.com>", "References": "<20190725095401.24590-1-anthony.l.nguyen@intel.com>", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH S25 02/12] ice: Fix issues updating VSI\n\tMAC filters", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>", "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>", "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>" }, "content": "From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>\n\nVSI, especially VF could request to add or remove filter for another VSI,\ndriver should really guide such request and disallow it.\nHowever, instead of returning error for such malicious request, driver\ncan simply return success.\n\nIn addition, we are not tracking number of MAC filters configured per\nVF correctly - and this leads to issue updating VF MAC filters whenever\nthey were removed and re-configured via bringing VF interface down and\nup. Also, since VF could send request to update multiple MAC filters at\nonce, driver should program those filters individually in the switch, in\norder to determine which action resulted to error, and communicate\naccordingly to the VF.\n\nSo, with this changes, we now track number of filters added right from\nwhen VF resources allocation is done, and could properly add filters for\nboth trusted and non_trusted VFs, without MAC filters mis-match issue in\nthe switch...\n\nAlso refactor code, so that driver can use new function to add or remove\nMAC filters.\n\nSigned-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_lib.c | 30 +++++++++\n drivers/net/ethernet/intel/ice/ice_lib.h | 4 ++\n drivers/net/ethernet/intel/ice/ice_main.c | 64 +++++--------------\n .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 42 ++++++------\n 4 files changed, 73 insertions(+), 67 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex aff65333c302..df28597f2e52 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -3211,3 +3211,33 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc)\n \treturn ret;\n }\n #endif /* CONFIG_DCB */\n+\n+/**\n+ * ice_vsi_cfg_mac_fltr - Add or remove a MAC address filter for a VSI\n+ * @vsi: the VSI being configured MAC filter\n+ * @macaddr: the MAC address to be added.\n+ * @set: Add or delete a MAC filter\n+ *\n+ * Adds or removes MAC address filter entry for VF VSI\n+ */\n+enum ice_status\n+ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set)\n+{\n+\tLIST_HEAD(tmp_add_list);\n+\tenum ice_status status;\n+\n+\t /* Update MAC filter list to be added or removed for a VSI */\n+\tif (ice_add_mac_to_list(vsi, &tmp_add_list, macaddr)) {\n+\t\tstatus = ICE_ERR_NO_MEMORY;\n+\t\tgoto cfg_mac_fltr_exit;\n+\t}\n+\n+\tif (set)\n+\t\tstatus = ice_add_mac(&vsi->back->hw, &tmp_add_list);\n+\telse\n+\t\tstatus = ice_remove_mac(&vsi->back->hw, &tmp_add_list);\n+\n+cfg_mac_fltr_exit:\n+\tice_free_fltr_list(&vsi->back->pdev->dev, &tmp_add_list);\n+\treturn status;\n+}\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h\nindex 7409a69f631d..0ed111edb7bb 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.h\n@@ -95,4 +95,8 @@ void ice_vsi_free_tx_rings(struct ice_vsi *vsi);\n int ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena);\n \n u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran);\n+\n+enum ice_status\n+ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set);\n+\n #endif /* !_ICE_LIB_H_ */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 17358a10866d..072771543582 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -116,10 +116,9 @@ static void ice_check_for_hang_subtask(struct ice_pf *pf)\n */\n static int ice_init_mac_fltr(struct ice_pf *pf)\n {\n-\tLIST_HEAD(tmp_add_list);\n+\tenum ice_status status;\n \tu8 broadcast[ETH_ALEN];\n \tstruct ice_vsi *vsi;\n-\tint status;\n \n \tvsi = ice_find_vsi_by_type(pf, ICE_VSI_PF);\n \tif (!vsi)\n@@ -130,8 +129,7 @@ static int ice_init_mac_fltr(struct ice_pf *pf)\n \t */\n \n \t /* Add a unicast MAC filter so the VSI can get its packets */\n-\tstatus = ice_add_mac_to_list(vsi, &tmp_add_list,\n-\t\t\t\t vsi->port_info->mac.perm_addr);\n+\tstatus = ice_vsi_cfg_mac_fltr(vsi, vsi->port_info->mac.perm_addr, true);\n \tif (status)\n \t\tgoto unregister;\n \n@@ -139,18 +137,11 @@ static int ice_init_mac_fltr(struct ice_pf *pf)\n \t * MAC address to the list as well.\n \t */\n \teth_broadcast_addr(broadcast);\n-\tstatus = ice_add_mac_to_list(vsi, &tmp_add_list, broadcast);\n-\tif (status)\n-\t\tgoto free_mac_list;\n-\n-\t/* Program MAC filters for entries in tmp_add_list */\n-\tstatus = ice_add_mac(&pf->hw, &tmp_add_list);\n+\tstatus = ice_vsi_cfg_mac_fltr(vsi, broadcast, true);\n \tif (status)\n-\t\tstatus = -ENOMEM;\n-\n-free_mac_list:\n-\tice_free_fltr_list(&pf->pdev->dev, &tmp_add_list);\n+\t\tgoto unregister;\n \n+\treturn 0;\n unregister:\n \t/* We aren't useful with no MAC filters, so unregister if we\n \t * had an error\n@@ -164,7 +155,7 @@ static int ice_init_mac_fltr(struct ice_pf *pf)\n \t\tvsi->netdev = NULL;\n \t}\n \n-\treturn status;\n+\treturn -EIO;\n }\n \n /**\n@@ -2870,10 +2861,8 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)\n \tstruct ice_hw *hw = &pf->hw;\n \tstruct sockaddr *addr = pi;\n \tenum ice_status status;\n-\tLIST_HEAD(a_mac_list);\n-\tLIST_HEAD(r_mac_list);\n \tu8 flags = 0;\n-\tint err;\n+\tint err = 0;\n \tu8 *mac;\n \n \tmac = (u8 *)addr->sa_data;\n@@ -2896,42 +2885,23 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)\n \t/* When we change the MAC address we also have to change the MAC address\n \t * based filter rules that were created previously for the old MAC\n \t * address. So first, we remove the old filter rule using ice_remove_mac\n-\t * and then create a new filter rule using ice_add_mac. Note that for\n-\t * both these operations, we first need to form a \"list\" of MAC\n-\t * addresses (even though in this case, we have only 1 MAC address to be\n-\t * added/removed) and this done using ice_add_mac_to_list. Depending on\n-\t * the ensuing operation this \"list\" of MAC addresses is either to be\n-\t * added or removed from the filter.\n+\t * and then create a new filter rule using ice_add_mac via\n+\t * ice_vsi_cfg_mac_fltr function call for both add and/or remove\n+\t * filters.\n \t */\n-\terr = ice_add_mac_to_list(vsi, &r_mac_list, netdev->dev_addr);\n-\tif (err) {\n-\t\terr = -EADDRNOTAVAIL;\n-\t\tgoto free_lists;\n-\t}\n-\n-\tstatus = ice_remove_mac(hw, &r_mac_list);\n+\tstatus = ice_vsi_cfg_mac_fltr(vsi, netdev->dev_addr, false);\n \tif (status) {\n \t\terr = -EADDRNOTAVAIL;\n-\t\tgoto free_lists;\n-\t}\n-\n-\terr = ice_add_mac_to_list(vsi, &a_mac_list, mac);\n-\tif (err) {\n-\t\terr = -EADDRNOTAVAIL;\n-\t\tgoto free_lists;\n+\t\tgoto err_update_filters;\n \t}\n \n-\tstatus = ice_add_mac(hw, &a_mac_list);\n+\tstatus = ice_vsi_cfg_mac_fltr(vsi, mac, true);\n \tif (status) {\n \t\terr = -EADDRNOTAVAIL;\n-\t\tgoto free_lists;\n+\t\tgoto err_update_filters;\n \t}\n \n-free_lists:\n-\t/* free list entries */\n-\tice_free_fltr_list(&pf->pdev->dev, &r_mac_list);\n-\tice_free_fltr_list(&pf->pdev->dev, &a_mac_list);\n-\n+err_update_filters:\n \tif (err) {\n \t\tnetdev_err(netdev, \"can't set MAC %pM. filter update failed\\n\",\n \t\t\t mac);\n@@ -2947,8 +2917,8 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)\n \tflags = ICE_AQC_MAN_MAC_UPDATE_LAA_WOL;\n \tstatus = ice_aq_manage_mac_write(hw, mac, flags, NULL);\n \tif (status) {\n-\t\tnetdev_err(netdev, \"can't set MAC %pM. write to firmware failed.\\n\",\n-\t\t\t mac);\n+\t\tnetdev_err(netdev, \"can't set MAC %pM. write to firmware failed error %d\\n\",\n+\t\t\t mac, status);\n \t}\n \treturn 0;\n }\ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\nindex f86c26d0e426..377e6d495c14 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n@@ -540,7 +540,10 @@ static int ice_alloc_vsi_res(struct ice_vf *vf)\n \n \tstatus = ice_add_mac(&pf->hw, &tmp_add_list);\n \tif (status)\n-\t\tdev_err(&pf->pdev->dev, \"could not add mac filters\\n\");\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"could not add mac filters error %d\\n\", status);\n+\telse\n+\t\tvf->num_mac = 1;\n \n \t/* Clear this bit after VF initialization since we shouldn't reclaim\n \t * and reassign interrupts for synchronous or asynchronous VFR events.\n@@ -2209,7 +2212,7 @@ ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set)\n \t (struct virtchnl_ether_addr_list *)msg;\n \tstruct ice_pf *pf = vf->pf;\n \tenum virtchnl_ops vc_op;\n-\tLIST_HEAD(mac_list);\n+\tenum ice_status status;\n \tstruct ice_vsi *vsi;\n \tint mac_count = 0;\n \tint i;\n@@ -2283,33 +2286,32 @@ ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set)\n \t\t\tgoto handle_mac_exit;\n \t\t}\n \n-\t\t/* get here if maddr is multicast or if VF can change MAC */\n-\t\tif (ice_add_mac_to_list(vsi, &mac_list, al->list[i].addr)) {\n-\t\t\tv_ret = VIRTCHNL_STATUS_ERR_NO_MEMORY;\n+\t\t/* program the updated filter list */\n+\t\tstatus = ice_vsi_cfg_mac_fltr(vsi, maddr, set);\n+\t\tif (status == ICE_ERR_DOES_NOT_EXIST ||\n+\t\t status == ICE_ERR_ALREADY_EXISTS) {\n+\t\t\tdev_info(&pf->pdev->dev,\n+\t\t\t\t \"can't %s MAC filters %pM for VF %d, error %d\\n\",\n+\t\t\t\t set ? \"add\" : \"remove\", maddr, vf->vf_id,\n+\t\t\t\t status);\n+\t\t} else if (status) {\n+\t\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\t\"can't %s MAC filters for VF %d, error %d\\n\",\n+\t\t\t\tset ? \"add\" : \"remove\", vf->vf_id, status);\n+\t\t\tv_ret = ice_err_to_virt_err(status);\n \t\t\tgoto handle_mac_exit;\n \t\t}\n+\n \t\tmac_count++;\n \t}\n \n-\t/* program the updated filter list */\n+\t/* Track number of MAC filters programmed for the VF VSI */\n \tif (set)\n-\t\tv_ret = ice_err_to_virt_err(ice_add_mac(&pf->hw, &mac_list));\n+\t\tvf->num_mac += mac_count;\n \telse\n-\t\tv_ret = ice_err_to_virt_err(ice_remove_mac(&pf->hw, &mac_list));\n-\n-\tif (v_ret) {\n-\t\tdev_err(&pf->pdev->dev,\n-\t\t\t\"can't %s MAC filters for VF %d, error %d\\n\",\n-\t\t\tset ? \"add\" : \"remove\", vf->vf_id, v_ret);\n-\t} else {\n-\t\tif (set)\n-\t\t\tvf->num_mac += mac_count;\n-\t\telse\n-\t\t\tvf->num_mac -= mac_count;\n-\t}\n+\t\tvf->num_mac -= mac_count;\n \n handle_mac_exit:\n-\tice_free_fltr_list(&pf->pdev->dev, &mac_list);\n \t/* send the response to the VF */\n \treturn ice_vc_send_msg_to_vf(vf, vc_op, v_ret, NULL, 0);\n }\n", "prefixes": [ "S25", "02/12" ] }