Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/645097/?format=api
{ "id": 645097, "url": "http://patchwork.ozlabs.org/api/patches/645097/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1467782577-25659-4-git-send-email-gangfeng.huang@ni.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": "<1467782577-25659-4-git-send-email-gangfeng.huang@ni.com>", "list_archive_url": null, "date": "2016-07-06T05:22:56", "name": "[net-next,v6,3/4] igb: support RX flow classification by VLAN priority", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "12f1d9fc965b69299204428dc8f52d02a79f9c34", "submitter": { "id": 67513, "url": "http://patchwork.ozlabs.org/api/people/67513/?format=api", "name": "Gangfeng Huang", "email": "gangfeng.huang@ni.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/1467782577-25659-4-git-send-email-gangfeng.huang@ni.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/645097/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/645097/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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\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 3rkq121nQLz9sDb\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 6 Jul 2016 15:23:50 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id B843530E95;\n\tWed, 6 Jul 2016 05:23:48 +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 evJoXN7J1Gyl; Wed, 6 Jul 2016 05:23:45 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 41DA030E98;\n\tWed, 6 Jul 2016 05:23:43 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id AC9661C0D7B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 6 Jul 2016 05:23:41 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id A90BE89862\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 6 Jul 2016 05:23:41 +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 goxA86QZlVHL for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 6 Jul 2016 05:23:40 +0000 (UTC)", "from ni.com (skprod3.natinst.com [130.164.80.24])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id AEBC4895E0\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 6 Jul 2016 05:23:40 +0000 (UTC)", "from us-aus-mgwout2.amer.corp.natinst.com\n\t(nb-snip2-1338.natinst.com [130.164.19.135])\n\tby us-aus-skprod3.natinst.com (8.15.0.59/8.15.0.59) with ESMTP id\n\tu665NdN8026833\n\tfor <intel-wired-lan@lists.osuosl.org>; Wed, 6 Jul 2016 00:23:39 -0500", "from ni.com ([130.164.14.198])\n\tby us-aus-mgwout2.amer.corp.natinst.com (Lotus Domino Release\n\t8.5.3FP6 HF1218) with ESMTP id 2016070600233943-562917 ;\n\tWed, 6 Jul 2016 00:23:39 -0500 " ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "From": "Gangfeng <gangfeng.huang@ni.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 6 Jul 2016 13:22:56 +0800", "Message-Id": "<1467782577-25659-4-git-send-email-gangfeng.huang@ni.com>", "X-Mailer": "git-send-email 2.7.2", "In-Reply-To": "<1467782577-25659-1-git-send-email-gangfeng.huang@ni.com>", "References": "<1467782577-25659-1-git-send-email-gangfeng.huang@ni.com>", "X-MIMETrack": "Itemize by SMTP Server on US-AUS-MGWOut2/AUS/H/NIC(Release\n\t8.5.3FP6 HF1218|December 12, 2014) at 07/06/2016 12:23:39 AM,\n\tSerialize by Router on US-AUS-MGWOut2/AUS/H/NIC(Release 8.5.3FP6\n\tHF1218|December 12, 2014) at 07/06/2016 12:23:40 AM,\n\tSerialize complete at 07/06/2016 12:23:40 AM", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2016-07-06_03:, , signatures=0", "Cc": "Gangfeng Huang <gangfeng.huang@ni.com>, Ruhao Gao <ruhao.gao@ni.com>", "Subject": "[Intel-wired-lan] [net-next v6 3/4] igb: support RX flow\n\tclassification by VLAN priority", "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: Gangfeng Huang <gangfeng.huang@ni.com>\n\nThis patch is meant to allow for RX network flow classification to insert\nand remove VLAN priority filter by ethtool\n\nExample:\nAdd an VLAN priority filter:\n$ ethtool -N eth0 flow-type ether vlan 0x6000 vlan-mask 0x1FFF action 2 loc 1\n\nShow all filters:\n$ ethtool -n eth0\n4 RX rings available\nTotal 1 rules\n\nFilter: 1\n\tFlow Type: Raw Ethernet\n\tSrc MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF\n\tDest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF\n\tEthertype: 0x0 mask: 0xFFFF\n\tVLAN EtherType: 0x0 mask: 0xffff\n\tVLAN: 0x6000 mask: 0x1fff\n\tUser-defined: 0x0 mask: 0xffffffffffffffff\n\tAction: Direct to queue 2\n\nDelete the filter by location:\n$ ethtool -N delete 1\n\nSigned-off-by: Ruhao Gao <ruhao.gao@ni.com>\nSigned-off-by: Gangfeng Huang <gangfeng.huang@ni.com>\n---\n drivers/net/ethernet/intel/igb/e1000_defines.h | 4 ++\n drivers/net/ethernet/intel/igb/e1000_regs.h | 1 +\n drivers/net/ethernet/intel/igb/igb.h | 3 +\n drivers/net/ethernet/intel/igb/igb_ethtool.c | 91 ++++++++++++++++++++++++--\n 4 files changed, 92 insertions(+), 7 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h\nindex 2997c44..cf3846b 100644\n--- a/drivers/net/ethernet/intel/igb/e1000_defines.h\n+++ b/drivers/net/ethernet/intel/igb/e1000_defines.h\n@@ -1024,4 +1024,8 @@\n #define E1000_RTTBCNRC_RF_INT_MASK\t\\\n \t(E1000_RTTBCNRC_RF_DEC_MASK << E1000_RTTBCNRC_RF_INT_SHIFT)\n \n+#define E1000_VLAPQF_QUEUE_SEL(_n, q_idx) (q_idx << ((_n) * 4))\n+#define E1000_VLAPQF_P_VALID(_n) (0x1 << (3 + (_n) * 4))\n+#define E1000_VLAPQF_QUEUE_MASK 0x03\n+\n #endif\ndiff --git a/drivers/net/ethernet/intel/igb/e1000_regs.h b/drivers/net/ethernet/intel/igb/e1000_regs.h\nindex 21d9d02..9b66b6f 100644\n--- a/drivers/net/ethernet/intel/igb/e1000_regs.h\n+++ b/drivers/net/ethernet/intel/igb/e1000_regs.h\n@@ -309,6 +309,7 @@\n \t\t\t\t\t(0x054E0 + ((_i - 16) * 8)))\n #define E1000_RAH(_i) (((_i) <= 15) ? (0x05404 + ((_i) * 8)) : \\\n \t\t\t\t\t(0x054E4 + ((_i - 16) * 8)))\n+#define E1000_VLAPQF 0x055B0 /* VLAN Priority Queue Filter VLAPQF */\n #define E1000_IP4AT_REG(_i) (0x05840 + ((_i) * 8))\n #define E1000_IP6AT_REG(_i) (0x05880 + ((_i) * 4))\n #define E1000_WUPM_REG(_i) (0x05A00 + ((_i) * 4))\ndiff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h\nindex c2d2dac..3e24e92 100644\n--- a/drivers/net/ethernet/intel/igb/igb.h\n+++ b/drivers/net/ethernet/intel/igb/igb.h\n@@ -371,6 +371,7 @@ struct hwmon_buff {\n \n enum igb_filter_match_flags {\n \tIGB_FILTER_FLAG_ETHER_TYPE = 0x1,\n+\tIGB_FILTER_FLAG_VLAN_TCI = 0x2,\n };\n \n #define IGB_MAX_RXNFC_FILTERS 16\n@@ -380,9 +381,11 @@ struct igb_nfc_input {\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 };\n \n struct igb_nfc_filter {\ndiff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c\nindex 00e3387..5ebaca8 100644\n--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c\n+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c\n@@ -2449,11 +2449,18 @@ static int igb_get_ethtool_nfc_entry(struct igb_adapter *adapter,\n \tif (!rule || fsp->location != rule->sw_idx)\n \t\treturn -EINVAL;\n \n-\tif (rule->filter.match_flags & IGB_FILTER_FLAG_ETHER_TYPE) {\n+\tif (rule->filter.match_flags) {\n \t\tfsp->flow_type = ETHER_FLOW;\n \t\tfsp->ring_cookie = rule->action;\n-\t\tfsp->h_u.ether_spec.h_proto = rule->filter.etype;\n-\t\tfsp->m_u.ether_spec.h_proto = ETHER_TYPE_FULL_MASK;\n+\t\tif (rule->filter.match_flags & IGB_FILTER_FLAG_ETHER_TYPE) {\n+\t\t\tfsp->h_u.ether_spec.h_proto = rule->filter.etype;\n+\t\t\tfsp->m_u.ether_spec.h_proto = ETHER_TYPE_FULL_MASK;\n+\t\t}\n+\t\tif (rule->filter.match_flags & IGB_FILTER_FLAG_VLAN_TCI) {\n+\t\t\tfsp->flow_type |= FLOW_EXT;\n+\t\t\tfsp->h_ext.vlan_tci = rule->filter.vlan_tci;\n+\t\t\tfsp->m_ext.vlan_tci = htons(VLAN_PRIO_MASK);\n+\t\t}\n \t\treturn 0;\n \t}\n \treturn -EINVAL;\n@@ -2697,12 +2704,46 @@ static int igb_rxnfc_write_etype_filter(struct igb_adapter *adapter,\n \treturn 0;\n }\n \n+int igb_rxnfc_write_vlan_prio_filter(struct igb_adapter *adapter,\n+\t\t\t\t struct igb_nfc_filter *input)\n+{\n+\tstruct e1000_hw *hw = &adapter->hw;\n+\tu32 vlapqf;\n+\tu8 vlan_priority;\n+\tu16 queue_index;\n+\n+\tvlapqf = rd32(E1000_VLAPQF);\n+\tvlan_priority = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK)\n+\t\t\t\t>> VLAN_PRIO_SHIFT;\n+\tqueue_index = (vlapqf >> (vlan_priority * 4)) & E1000_VLAPQF_QUEUE_MASK;\n+\n+\t/* check whether this vlan prio is already set */\n+\tif ((vlapqf & E1000_VLAPQF_P_VALID(vlan_priority)) &&\n+\t (queue_index != input->action)) {\n+\t\tdev_err(&adapter->pdev->dev, \"ethtool rxnfc set vlan prio filter failed.\\n\");\n+\t\treturn -EEXIST;\n+\t}\n+\n+\tvlapqf |= E1000_VLAPQF_P_VALID(vlan_priority);\n+\tvlapqf |= E1000_VLAPQF_QUEUE_SEL(vlan_priority, input->action);\n+\n+\twr32(E1000_VLAPQF, vlapqf);\n+\n+\treturn 0;\n+}\n+\n int igb_add_filter(struct igb_adapter *adapter, struct igb_nfc_filter *input)\n {\n \tint err = -EINVAL;\n \n-\tif (input->filter.match_flags & IGB_FILTER_FLAG_ETHER_TYPE)\n+\tif (input->filter.match_flags & IGB_FILTER_FLAG_ETHER_TYPE) {\n \t\terr = igb_rxnfc_write_etype_filter(adapter, input);\n+\t\tif (err)\n+\t\t\treturn err;\n+\t}\n+\n+\tif (input->filter.match_flags & IGB_FILTER_FLAG_VLAN_TCI)\n+\t\terr = igb_rxnfc_write_vlan_prio_filter(adapter, input);\n \n \treturn err;\n }\n@@ -2722,11 +2763,33 @@ static void igb_clear_etype_filter_regs(struct igb_adapter *adapter,\n \tadapter->etype_bitmap[reg_index] = false;\n }\n \n+static void igb_clear_vlan_prio_filter(struct igb_adapter *adapter,\n+\t\t\t\t u16 vlan_tci)\n+{\n+\tstruct e1000_hw *hw = &adapter->hw;\n+\tu32 vlapqf;\n+\tu8 vlan_priority;\n+\n+\tvlan_priority = (vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;\n+\n+\tvlapqf = rd32(E1000_VLAPQF);\n+\tvlapqf &= ~E1000_VLAPQF_P_VALID(vlan_priority);\n+\tvlapqf &= ~E1000_VLAPQF_QUEUE_SEL(vlan_priority,\n+\t\t\t\t\t\tE1000_VLAPQF_QUEUE_MASK);\n+\n+\twr32(E1000_VLAPQF, vlapqf);\n+}\n+\n int igb_erase_filter(struct igb_adapter *adapter, struct igb_nfc_filter *input)\n {\n \tif (input->filter.match_flags & IGB_FILTER_FLAG_ETHER_TYPE)\n \t\tigb_clear_etype_filter_regs(adapter,\n \t\t\t\t\t input->etype_reg_index);\n+\n+\tif (input->filter.match_flags & IGB_FILTER_FLAG_VLAN_TCI)\n+\t\tigb_clear_vlan_prio_filter(adapter,\n+\t\t\t\t\t ntohs(input->filter.vlan_tci));\n+\n \treturn 0;\n }\n \n@@ -2808,15 +2871,28 @@ static int igb_add_ethtool_nfc_entry(struct igb_adapter *adapter,\n \tif ((fsp->flow_type & ~FLOW_EXT) != ETHER_FLOW)\n \t\treturn -EINVAL;\n \n-\tif (fsp->m_u.ether_spec.h_proto != ETHER_TYPE_FULL_MASK)\n+\tif (fsp->m_u.ether_spec.h_proto != ETHER_TYPE_FULL_MASK &&\n+\t fsp->m_ext.vlan_tci != htons(VLAN_PRIO_MASK))\n \t\treturn -EINVAL;\n \n \tinput = kzalloc(sizeof(*input), GFP_KERNEL);\n \tif (!input)\n \t\treturn -ENOMEM;\n \n-\tinput->filter.etype = fsp->h_u.ether_spec.h_proto;\n-\tinput->filter.match_flags = IGB_FILTER_FLAG_ETHER_TYPE;\n+\tif (fsp->m_u.ether_spec.h_proto == ETHER_TYPE_FULL_MASK) {\n+\t\tinput->filter.etype = fsp->h_u.ether_spec.h_proto;\n+\t\tinput->filter.match_flags = IGB_FILTER_FLAG_ETHER_TYPE;\n+\t}\n+\n+\tif ((fsp->flow_type & FLOW_EXT) && fsp->m_ext.vlan_tci) {\n+\t\tif (fsp->m_ext.vlan_tci != htons(VLAN_PRIO_MASK)) {\n+\t\t\terr = -EINVAL;\n+\t\t\tgoto err_out;\n+\t\t}\n+\t\tinput->filter.vlan_tci = fsp->h_ext.vlan_tci;\n+\t\tinput->filter.match_flags |= IGB_FILTER_FLAG_VLAN_TCI;\n+\t}\n+\n \tinput->action = fsp->ring_cookie;\n \tinput->sw_idx = fsp->location;\n \n@@ -2843,6 +2919,7 @@ static int igb_add_ethtool_nfc_entry(struct igb_adapter *adapter,\n \n err_out_w_lock:\n \tspin_unlock(&adapter->nfc_lock);\n+err_out:\n \tkfree(input);\n \treturn err;\n }\n", "prefixes": [ "net-next", "v6", "3/4" ] }