Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1276664/?format=api
{ "id": 1276664, "url": "http://patchwork.ozlabs.org/api/patches/1276664/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200424201623.10971-8-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-8-andre.guedes@intel.com>", "list_archive_url": null, "date": "2020-04-24T20:16:11", "name": "[07/19] igc: Change byte order in struct igc_nfc_filter", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "5914ee0a595ab7c754c4d0e8b1636838115dbb83", "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-8-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/1276664/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1276664/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.136; helo=silver.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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\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 49857g6TFJz9sSd\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 25 Apr 2020 06:17:35 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 86235204DC;\n\tFri, 24 Apr 2020 20:17:33 +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 hUf2Zpf+-dnW; Fri, 24 Apr 2020 20:17:32 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 1DCE420448;\n\tFri, 24 Apr 2020 20:17:32 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n by ash.osuosl.org (Postfix) with ESMTP id 474E61BF83C\n for <intel-wired-lan@lists.osuosl.org>; Fri, 24 Apr 2020 20:17:27 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n by fraxinus.osuosl.org (Postfix) with ESMTP id 4468C86B89\n for <intel-wired-lan@lists.osuosl.org>; Fri, 24 Apr 2020 20:17:27 +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 0948LTtFIDAv for <intel-wired-lan@lists.osuosl.org>;\n Fri, 24 Apr 2020 20:17:26 +0000 (UTC)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by fraxinus.osuosl.org (Postfix) with ESMTPS id 981E386B59\n for <intel-wired-lan@lists.osuosl.org>; Fri, 24 Apr 2020 20:17:26 +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:26 -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:26 -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 Jz8+mX6z1qKhtV8hQ7RdqwAFmFqNhiO2kpRLhJTEZsNCT97jm3ZZtwPkWeq3qPeKEQabFFOYlk\n ofbdxtIAzAnA==", "\n NY/Bwas+hU8RxitxSlSz9+PSU5PGhekae3k250NT95KYbiaCGYsTMUpEutOzducVcbUYsGPDwt\n OmePds16K12g==" ], "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=\"335474508\"", "From": "Andre Guedes <andre.guedes@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Fri, 24 Apr 2020 13:16:11 -0700", "Message-Id": "<20200424201623.10971-8-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 07/19] igc: Change byte order in struct\n igc_nfc_filter", "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": "Every time we access the 'etype' and 'vlan_tci' fields from struct\nigc_nfc_filter to enable or disable filters in hardware we have to\nconvert them from big endian to host order so it makes more sense to\nsimply have these fields in host order.\n\nThe byte order conversion should take place in igc_ethtool_get_nfc_\nrule() and igc_ethtool_add_nfc_rule(), which are called by .get_rxnfc\nand .set_rxnfc ethtool ops, since ethtool subsystem is the one who deals\nwith them in big endian order.\n\nSigned-off-by: Andre Guedes <andre.guedes@intel.com>\n---\n drivers/net/ethernet/intel/igc/igc.h | 10 ++------\n drivers/net/ethernet/intel/igc/igc_ethtool.c | 25 +++++++++-----------\n 2 files changed, 13 insertions(+), 22 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h\nindex 7124ba254b89..fcc6261d7f67 100644\n--- a/drivers/net/ethernet/intel/igc/igc.h\n+++ b/drivers/net/ethernet/intel/igc/igc.h\n@@ -452,16 +452,10 @@ enum igc_filter_match_flags {\n \tIGC_FILTER_FLAG_DST_MAC_ADDR =\t0x8,\n };\n \n-/* RX network flow classification data structure */\n struct igc_nfc_filter {\n-\t/* Byte layout in order, all values with MSB first:\n-\t * match_flags - 1 byte\n-\t * etype - 2 bytes\n-\t * vlan_tci - 2 bytes\n-\t */\n \tu8 match_flags;\n-\t__be16 etype;\n-\t__be16 vlan_tci;\n+\tu16 etype;\n+\tu16 vlan_tci;\n \tu8 src_addr[ETH_ALEN];\n \tu8 dst_addr[ETH_ALEN];\n };\ndiff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c\nindex 46599ee7f0b9..f9518aa1375b 100644\n--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c\n+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c\n@@ -954,13 +954,13 @@ static int igc_ethtool_get_nfc_rule(struct igc_adapter *adapter,\n \tfsp->ring_cookie = rule->action;\n \n \tif (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {\n-\t\tfsp->h_u.ether_spec.h_proto = rule->filter.etype;\n+\t\tfsp->h_u.ether_spec.h_proto = htons(rule->filter.etype);\n \t\tfsp->m_u.ether_spec.h_proto = ETHER_TYPE_FULL_MASK;\n \t}\n \n \tif (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {\n \t\tfsp->flow_type |= FLOW_EXT;\n-\t\tfsp->h_ext.vlan_tci = rule->filter.vlan_tci;\n+\t\tfsp->h_ext.vlan_tci = htons(rule->filter.vlan_tci);\n \t\tfsp->m_ext.vlan_tci = htons(VLAN_PRIO_MASK);\n \t}\n \n@@ -1183,9 +1183,8 @@ int igc_enable_nfc_rule(struct igc_adapter *adapter,\n \tint err = -EINVAL;\n \n \tif (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {\n-\t\tu16 etype = ntohs(rule->filter.etype);\n-\n-\t\terr = igc_add_etype_filter(adapter, etype, rule->action);\n+\t\terr = igc_add_etype_filter(adapter, rule->filter.etype,\n+\t\t\t\t\t rule->action);\n \t\tif (err)\n \t\t\treturn err;\n \t}\n@@ -1205,8 +1204,9 @@ int igc_enable_nfc_rule(struct igc_adapter *adapter,\n \t}\n \n \tif (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {\n-\t\tint prio = (ntohs(rule->filter.vlan_tci) & VLAN_PRIO_MASK)\n+\t\tint prio = (rule->filter.vlan_tci & VLAN_PRIO_MASK)\n \t\t\t\t>> VLAN_PRIO_SHIFT;\n+\n \t\terr = igc_add_vlan_prio_filter(adapter, prio, rule->action);\n \t\tif (err)\n \t\t\treturn err;\n@@ -1218,14 +1218,11 @@ int igc_enable_nfc_rule(struct igc_adapter *adapter,\n int igc_disable_nfc_rule(struct igc_adapter *adapter,\n \t\t\t const struct igc_nfc_rule *rule)\n {\n-\tif (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {\n-\t\tu16 etype = ntohs(rule->filter.etype);\n-\n-\t\tigc_del_etype_filter(adapter, etype);\n-\t}\n+\tif (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE)\n+\t\tigc_del_etype_filter(adapter, rule->filter.etype);\n \n \tif (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {\n-\t\tint prio = (ntohs(rule->filter.vlan_tci) & VLAN_PRIO_MASK)\n+\t\tint prio = (rule->filter.vlan_tci & VLAN_PRIO_MASK)\n \t\t\t\t>> VLAN_PRIO_SHIFT;\n \t\tigc_del_vlan_prio_filter(adapter, prio);\n \t}\n@@ -1325,7 +1322,7 @@ static int igc_ethtool_add_nfc_rule(struct igc_adapter *adapter,\n \t\treturn -ENOMEM;\n \n \tif (fsp->m_u.ether_spec.h_proto == ETHER_TYPE_FULL_MASK) {\n-\t\trule->filter.etype = fsp->h_u.ether_spec.h_proto;\n+\t\trule->filter.etype = ntohs(fsp->h_u.ether_spec.h_proto);\n \t\trule->filter.match_flags = IGC_FILTER_FLAG_ETHER_TYPE;\n \t}\n \n@@ -1357,7 +1354,7 @@ static int igc_ethtool_add_nfc_rule(struct igc_adapter *adapter,\n \t\t\terr = -EOPNOTSUPP;\n \t\t\tgoto err_out;\n \t\t}\n-\t\trule->filter.vlan_tci = fsp->h_ext.vlan_tci;\n+\t\trule->filter.vlan_tci = ntohs(fsp->h_ext.vlan_tci);\n \t\trule->filter.match_flags |= IGC_FILTER_FLAG_VLAN_TCI;\n \t}\n \n", "prefixes": [ "07/19" ] }