Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1211277/?format=api
{ "id": 1211277, "url": "http://patchwork.ozlabs.org/api/patches/1211277/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20191217102923.3274961-1-sassmann@kpanic.de/", "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": "<20191217102923.3274961-1-sassmann@kpanic.de>", "list_archive_url": null, "date": "2019-12-17T10:29:23", "name": "iavf: remove current MAC address filter on VF reset", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "632f0e910a5063ebc892a26e05353c24f3f6e305", "submitter": { "id": 7508, "url": "http://patchwork.ozlabs.org/api/people/7508/?format=api", "name": "Stefan Assmann", "email": "sassmann@kpanic.de" }, "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/20191217102923.3274961-1-sassmann@kpanic.de/mbox/", "series": [ { "id": 148971, "url": "http://patchwork.ozlabs.org/api/series/148971/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=148971", "date": "2019-12-17T10:29:23", "name": "iavf: remove current MAC address filter on VF reset", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/148971/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1211277/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1211277/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; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.136;\n\thelo=silver.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=kpanic.de" ], "Received": [ "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\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 47cZMV1WmKz9sRh\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 17 Dec 2019 21:37:09 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 72C4E20353;\n\tTue, 17 Dec 2019 10:37:07 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id R0XS-fix6ToL; Tue, 17 Dec 2019 10:37:06 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id F1F822002F;\n\tTue, 17 Dec 2019 10:37:05 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 349CD1BF28E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 17 Dec 2019 10:37:05 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 271FE87877\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 17 Dec 2019 10:37:05 +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 UDFqarr8kFiJ for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 17 Dec 2019 10:37:04 +0000 (UTC)", "from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com\n\t[207.211.31.81])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id D749D87850\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 17 Dec 2019 10:37:03 +0000 (UTC)", "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n\t[209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n\tus-mta-376-7QV9dpS_PDGVEsxhTRpn8A-1; Tue, 17 Dec 2019 05:29:55 -0500", "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mimecast-mx01.redhat.com (Postfix) with ESMTPS id B75208017DF;\n\tTue, 17 Dec 2019 10:29:53 +0000 (UTC)", "from p50.redhat.com (unknown [10.36.118.71])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 1C41D51;\n\tTue, 17 Dec 2019 10:29:51 +0000 (UTC)" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "delayed 00:05:55 by SQLgrey-1.7.6", "From": "Stefan Assmann <sassmann@kpanic.de>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Tue, 17 Dec 2019 11:29:23 +0100", "Message-Id": "<20191217102923.3274961-1-sassmann@kpanic.de>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15", "X-MC-Unique": "7QV9dpS_PDGVEsxhTRpn8A-1", "X-Mimecast-Spam-Score": "0", "Subject": "[Intel-wired-lan] [PATCH] iavf: remove current MAC address filter\n\ton VF reset", "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>", "Cc": "netdev@vger.kernel.org, davem@davemloft.net, sassmann@kpanic.de", "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": "Currently MAC filters are not altered during a VF reset event. This may\nlead to a stale filter when an administratively set MAC is forced by the\nPF.\n\nFor an administratively set MAC the PF driver deletes the VFs filters,\noverwrites the VFs MAC address and triggers a VF reset. However\nthe VF driver itself is not aware of the filter removal, which is what\nthe VF reset is for.\nThe VF reset queues all filters present in the VF driver to be re-added\nto the PF filter list (including the filter for the now stale VF MAC\naddress) and triggers a VIRTCHNL_OP_GET_VF_RESOURCES event, which\nprovides the new MAC address to the VF.\n\nWhen this happens i40e will complain and reject the stale MAC filter,\nat least in the untrusted VF case.\ni40e 0000:08:00.0: Setting MAC 3c:fa:fa:fa:fa:01 on VF 0\niavf 0000:08:02.0: Reset warning received from the PF\niavf 0000:08:02.0: Scheduling reset task\ni40e 0000:08:00.0: Bring down and up the VF interface to make this change effective.\ni40e 0000:08:00.0: VF attempting to override administratively set MAC address, bring down and up the VF interface to resume normal operation\ni40e 0000:08:00.0: VF 0 failed opcode 10, retval: -1\niavf 0000:08:02.0: Failed to add MAC filter, error IAVF_ERR_NVM\n\nTo avoid re-adding the stale MAC filter it needs to be removed from the\nVF driver's filter list before queuing the existing filters. Then during\nthe VIRTCHNL_OP_GET_VF_RESOURCES event the correct filter needs to be\nadded again, at which point the MAC address has been updated.\n\nAs a bonus this change makes bringing the VF down and up again\nsuperfluous for the administratively set MAC case.\n\nSigned-off-by: Stefan Assmann <sassmann@kpanic.de>\n---\n drivers/net/ethernet/intel/iavf/iavf.h | 2 ++\n drivers/net/ethernet/intel/iavf/iavf_main.c | 17 +++++++++++++----\n drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 3 +++\n 3 files changed, 18 insertions(+), 4 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/intel/iavf/iavf.h\nindex 29de3ae96ef2..bd1b1ed323f4 100644\n--- a/drivers/net/ethernet/intel/iavf/iavf.h\n+++ b/drivers/net/ethernet/intel/iavf/iavf.h\n@@ -415,4 +415,6 @@ void iavf_enable_channels(struct iavf_adapter *adapter);\n void iavf_disable_channels(struct iavf_adapter *adapter);\n void iavf_add_cloud_filter(struct iavf_adapter *adapter);\n void iavf_del_cloud_filter(struct iavf_adapter *adapter);\n+struct iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter,\n+\t\t\t\t\tconst u8 *macaddr);\n #endif /* _IAVF_H_ */\ndiff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c\nindex 0a8824871618..62fe56ddcb6e 100644\n--- a/drivers/net/ethernet/intel/iavf/iavf_main.c\n+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c\n@@ -743,9 +743,8 @@ iavf_mac_filter *iavf_find_filter(struct iavf_adapter *adapter,\n *\n * Returns ptr to the filter object or NULL when no memory available.\n **/\n-static struct\n-iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter,\n-\t\t\t\t const u8 *macaddr)\n+struct iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter,\n+\t\t\t\t\tconst u8 *macaddr)\n {\n \tstruct iavf_mac_filter *f;\n \n@@ -2065,9 +2064,9 @@ static void iavf_reset_task(struct work_struct *work)\n \tstruct virtchnl_vf_resource *vfres = adapter->vf_res;\n \tstruct net_device *netdev = adapter->netdev;\n \tstruct iavf_hw *hw = &adapter->hw;\n+\tstruct iavf_mac_filter *f, *ftmp;\n \tstruct iavf_vlan_filter *vlf;\n \tstruct iavf_cloud_filter *cf;\n-\tstruct iavf_mac_filter *f;\n \tu32 reg_val;\n \tint i = 0, err;\n \tbool running;\n@@ -2181,6 +2180,16 @@ static void iavf_reset_task(struct work_struct *work)\n \n \tspin_lock_bh(&adapter->mac_vlan_list_lock);\n \n+\t/* Delete filter for the current MAC address, it could have\n+\t * been changed by the PF via administratively set MAC.\n+\t * Will be re-added via VIRTCHNL_OP_GET_VF_RESOURCES.\n+\t */\n+\tlist_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) {\n+\t\tif (ether_addr_equal(f->macaddr, adapter->hw.mac.addr)) {\n+\t\t\tlist_del(&f->list);\n+\t\t\tkfree(f);\n+\t\t}\n+\t}\n \t/* re-add all MAC filters */\n \tlist_for_each_entry(f, &adapter->mac_filter_list, list) {\n \t\tf->add = true;\ndiff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c\nindex c46770eba320..1ab9cb339acb 100644\n--- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c\n+++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c\n@@ -1359,6 +1359,9 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,\n \t\t\tether_addr_copy(netdev->perm_addr,\n \t\t\t\t\tadapter->hw.mac.addr);\n \t\t}\n+\t\tspin_lock_bh(&adapter->mac_vlan_list_lock);\n+\t\tiavf_add_filter(adapter, adapter->hw.mac.addr);\n+\t\tspin_unlock_bh(&adapter->mac_vlan_list_lock);\n \t\tiavf_process_config(adapter);\n \t\t}\n \t\tbreak;\n", "prefixes": [] }