Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1276669/?format=api
{ "id": 1276669, "url": "http://patchwork.ozlabs.org/api/patches/1276669/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200424201623.10971-14-andre.guedes@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": "<20200424201623.10971-14-andre.guedes@intel.com>", "list_archive_url": null, "date": "2020-04-24T20:16:17", "name": "[13/19] igc: Fix NFC rules restoration", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "74fbc537e5d147ab1cfb86ff38289ec7a9328177", "submitter": { "id": 72323, "url": "http://patchwork.ozlabs.org/api/people/72323/?format=api", "name": "Andre Guedes", "email": "andre.guedes@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/20200424201623.10971-14-andre.guedes@intel.com/mbox/", "series": [ { "id": 172579, "url": "http://patchwork.ozlabs.org/api/series/172579/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=172579", "date": "2020-04-24T20:16:07", "name": "igc: Fixes to NFC support code", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/172579/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1276669/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1276669/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 spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.133; helo=hemlock.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=<UNKNOWN>)", "ozlabs.org;\n dmarc=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 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 49857k11tvz9sSG\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 25 Apr 2020 06:17:38 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 825A08872E;\n\tFri, 24 Apr 2020 20:17:36 +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 hHI-WLQtBZk3; Fri, 24 Apr 2020 20:17:35 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id CD60888723;\n\tFri, 24 Apr 2020 20:17:35 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n by ash.osuosl.org (Postfix) with ESMTP id 137C31BF83C\n for <intel-wired-lan@lists.osuosl.org>; Fri, 24 Apr 2020 20:17:31 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n by fraxinus.osuosl.org (Postfix) with ESMTP id 104A0868A9\n for <intel-wired-lan@lists.osuosl.org>; Fri, 24 Apr 2020 20:17:31 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id n9GGdxYPBqjl for <intel-wired-lan@lists.osuosl.org>;\n Fri, 24 Apr 2020 20:17:29 +0000 (UTC)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by fraxinus.osuosl.org (Postfix) with ESMTPS id D8208868C9\n for <intel-wired-lan@lists.osuosl.org>; Fri, 24 Apr 2020 20:17:28 +0000 (UTC)", "from orsmga001.jf.intel.com ([10.7.209.18])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 24 Apr 2020 13:17:28 -0700", "from kleandre-mobl.amr.corp.intel.com ([10.213.164.39])\n by orsmga001.jf.intel.com with ESMTP; 24 Apr 2020 13:17:28 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "IronPort-SDR": [ "\n qzGswhDC2KaR/S/3OuvTSX8lOZugtxH0aV2R9r+OJqF+X+xn67Qe3fV4lprSM0M7aUEEDg4IrS\n 2ivHeHRt88aQ==", "\n GhZcn5qdrOJ1rfcqm8Z1Or4SoErvee5gOIn0Yx8hhtksOmGH68vgqCROPeGiE/bM0v/yXyeLWu\n KD5b9qY9N6WQ==" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.73,313,1583222400\"; d=\"scan'208\";a=\"335474518\"", "From": "Andre Guedes <andre.guedes@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Fri, 24 Apr 2020 13:16:17 -0700", "Message-Id": "<20200424201623.10971-14-andre.guedes@intel.com>", "X-Mailer": "git-send-email 2.26.0", "In-Reply-To": "<20200424201623.10971-1-andre.guedes@intel.com>", "References": "<20200424201623.10971-1-andre.guedes@intel.com>", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH 13/19] igc: Fix NFC rules restoration", "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 <intel-wired-lan.osuosl.org>", "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <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 <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": "When network interface is brought up, the driver re-enables the NFC\nrules previously configured. However, this is done in reverse order\nthe rules were added and hardware filters are configured differently.\n\nFor example, consider the following rules:\n\n$ ethtool -N eth0 flow-type ether dst 00:00:00:00:00:AA queue 0\n$ ethtool -N eth0 flow-type ether dst 00:00:00:00:00:BB queue 1\n$ ethtool -N eth0 flow-type ether dst 00:00:00:00:00:CC queue 2\n$ ethtool -N eth0 flow-type ether dst 00:00:00:00:00:DD queue 3\n\nRAL/RAH registers are configure so filter index 1 has address ending\nwith AA, filter index 2 has address ending in BB, and so on.\n\nIf we bring the interface down and up again, RAL/RAH registers are\nconfigured so filter index 1 has address ending in DD, filter index 2\nhas CC, and so on. IOW, in reverse order we had before bringing the\ninterface down.\n\nThis issue can be fixed by traversing adapter->nfc_rule_list in\nbackwards when restoring the rules. Since hlist doesn't support\nbackwards traversal, this patch replaces it by list_head and fixes\nigc_restore_nfc_rules() accordingly.\n\nSigned-off-by: Andre Guedes <andre.guedes@intel.com>\n---\n drivers/net/ethernet/intel/igc/igc.h | 4 ++--\n drivers/net/ethernet/intel/igc/igc_ethtool.c | 19 ++++++++-----------\n drivers/net/ethernet/intel/igc/igc_main.c | 16 +++++++++-------\n 3 files changed, 19 insertions(+), 20 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h\nindex ae7d48070ee2..76bc3a51ad70 100644\n--- a/drivers/net/ethernet/intel/igc/igc.h\n+++ b/drivers/net/ethernet/intel/igc/igc.h\n@@ -191,7 +191,7 @@ struct igc_adapter {\n \t * nfc_rule_lock.\n \t */\n \tspinlock_t nfc_rule_lock;\n-\tstruct hlist_head nfc_rule_list;\n+\tstruct list_head nfc_rule_list;\n \tunsigned int nfc_rule_count;\n \n \tu8 rss_indir_tbl[IGC_RETA_SIZE];\n@@ -461,7 +461,7 @@ struct igc_nfc_filter {\n };\n \n struct igc_nfc_rule {\n-\tstruct hlist_node nfc_node;\n+\tstruct list_head list;\n \tstruct igc_nfc_filter filter;\n \tu32 location;\n \tu16 action;\ndiff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c\nindex e975efea4a15..944cad748e61 100644\n--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c\n+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c\n@@ -941,7 +941,7 @@ static int igc_ethtool_get_nfc_rule(struct igc_adapter *adapter,\n \n \tspin_lock(&adapter->nfc_rule_lock);\n \n-\thlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node) {\n+\tlist_for_each_entry(rule, &adapter->nfc_rule_list, list) {\n \t\tif (fsp->location <= rule->location)\n \t\t\tbreak;\n \t}\n@@ -997,7 +997,7 @@ static int igc_ethtool_get_nfc_rules(struct igc_adapter *adapter,\n \n \tspin_lock(&adapter->nfc_rule_lock);\n \n-\thlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node) {\n+\tlist_for_each_entry(rule, &adapter->nfc_rule_list, list) {\n \t\tif (cnt == cmd->rule_cnt) {\n \t\t\tspin_unlock(&adapter->nfc_rule_lock);\n \t\t\treturn -EMSGSIZE;\n@@ -1261,7 +1261,7 @@ static int igc_ethtool_update_nfc_rule(struct igc_adapter *adapter,\n \tparent = NULL;\n \trule = NULL;\n \n-\thlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node) {\n+\tlist_for_each_entry(rule, &adapter->nfc_rule_list, list) {\n \t\t/* hash found, or no matching entry */\n \t\tif (rule->location >= location)\n \t\t\tbreak;\n@@ -1272,7 +1272,7 @@ static int igc_ethtool_update_nfc_rule(struct igc_adapter *adapter,\n \tif (rule && rule->location == location) {\n \t\terr = igc_disable_nfc_rule(adapter, rule);\n \n-\t\thlist_del(&rule->nfc_node);\n+\t\tlist_del(&rule->list);\n \t\tkfree(rule);\n \t\tadapter->nfc_rule_count--;\n \t}\n@@ -1283,11 +1283,8 @@ static int igc_ethtool_update_nfc_rule(struct igc_adapter *adapter,\n \tif (!input)\n \t\treturn err;\n \n-\t/* add filter to the list */\n-\tif (parent)\n-\t\thlist_add_behind(&input->nfc_node, &parent->nfc_node);\n-\telse\n-\t\thlist_add_head(&input->nfc_node, &adapter->nfc_rule_list);\n+\tlist_add(&input->list, parent ? &parent->list :\n+\t\t\t\t\t&adapter->nfc_rule_list);\n \n \t/* update counts */\n \tadapter->nfc_rule_count++;\n@@ -1298,7 +1295,7 @@ static int igc_ethtool_update_nfc_rule(struct igc_adapter *adapter,\n static void igc_ethtool_init_nfc_rule(struct igc_nfc_rule *rule,\n \t\t\t\t const struct ethtool_rx_flow_spec *fsp)\n {\n-\tINIT_HLIST_NODE(&rule->nfc_node);\n+\tINIT_LIST_HEAD(&rule->list);\n \n \trule->action = fsp->ring_cookie;\n \trule->location = fsp->location;\n@@ -1362,7 +1359,7 @@ static int igc_ethtool_check_nfc_rule(struct igc_adapter *adapter,\n \t\treturn -EOPNOTSUPP;\n \t}\n \n-\thlist_for_each_entry(tmp, &adapter->nfc_rule_list, nfc_node) {\n+\tlist_for_each_entry(tmp, &adapter->nfc_rule_list, list) {\n \t\tif (!memcmp(&rule->filter, &tmp->filter,\n \t\t\t sizeof(rule->filter))) {\n \t\t\tnetdev_dbg(dev, \"Rule already exists\");\ndiff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c\nindex b0c4206f9c7d..1b554b3a63c2 100644\n--- a/drivers/net/ethernet/intel/igc/igc_main.c\n+++ b/drivers/net/ethernet/intel/igc/igc_main.c\n@@ -2181,7 +2181,7 @@ static void igc_restore_nfc_rules(struct igc_adapter *adapter)\n \n \tspin_lock(&adapter->nfc_rule_lock);\n \n-\thlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node)\n+\tlist_for_each_entry_reverse(rule, &adapter->nfc_rule_list, list)\n \t\tigc_enable_nfc_rule(adapter, rule);\n \n \tspin_unlock(&adapter->nfc_rule_lock);\n@@ -3420,6 +3420,9 @@ static int igc_sw_init(struct igc_adapter *adapter)\n \tadapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;\n \n \tspin_lock_init(&adapter->nfc_rule_lock);\n+\tINIT_LIST_HEAD(&adapter->nfc_rule_list);\n+\tadapter->nfc_rule_count = 0;\n+\n \tspin_lock_init(&adapter->stats64_lock);\n \t/* Assume MSI-X interrupts, will be checked during IRQ allocation */\n \tadapter->flags |= IGC_FLAG_HAS_MSIX;\n@@ -3652,7 +3655,7 @@ static void igc_nfc_rule_exit(struct igc_adapter *adapter)\n \n \tspin_lock(&adapter->nfc_rule_lock);\n \n-\thlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node)\n+\tlist_for_each_entry(rule, &adapter->nfc_rule_list, list)\n \t\tigc_disable_nfc_rule(adapter, rule);\n \n \tspin_unlock(&adapter->nfc_rule_lock);\n@@ -3827,14 +3830,13 @@ static int igc_set_features(struct net_device *netdev,\n \t\treturn 0;\n \n \tif (!(features & NETIF_F_NTUPLE)) {\n-\t\tstruct hlist_node *node2;\n-\t\tstruct igc_nfc_rule *rule;\n+\t\tstruct igc_nfc_rule *rule, *tmp;\n \n \t\tspin_lock(&adapter->nfc_rule_lock);\n-\t\thlist_for_each_entry_safe(rule, node2,\n-\t\t\t\t\t &adapter->nfc_rule_list, nfc_node) {\n+\t\tlist_for_each_entry_safe(rule, tmp,\n+\t\t\t\t\t &adapter->nfc_rule_list, list) {\n \t\t\tigc_disable_nfc_rule(adapter, rule);\n-\t\t\thlist_del(&rule->nfc_node);\n+\t\t\tlist_del(&rule->list);\n \t\t\tkfree(rule);\n \t\t}\n \t\tspin_unlock(&adapter->nfc_rule_lock);\n", "prefixes": [ "13/19" ] }