Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/561700/?format=api
{ "id": 561700, "url": "http://patchwork.ozlabs.org/api/patches/561700/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1451456399-13353-2-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": "<1451456399-13353-2-git-send-email-gangfeng.huang@ni.com>", "list_archive_url": null, "date": "2015-12-30T06:19:58", "name": "[next-queue,2/3] igb: add support of ethertype RX filters", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "de8bdb9ca4c1fe769188ff43ba2b32f2b82d279a", "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/1451456399-13353-2-git-send-email-gangfeng.huang@ni.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/561700/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/561700/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\tby ozlabs.org (Postfix) with ESMTP id 6C30C140BE0\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Dec 2015 17:20:48 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id AFA2532235;\n\tWed, 30 Dec 2015 06:20:47 +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 rf8vDChD4bsr; Wed, 30 Dec 2015 06:20:44 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 20DA23227C;\n\tWed, 30 Dec 2015 06:20:44 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 42AED1C113E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 30 Dec 2015 06:20:43 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 3D398A5B37\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 30 Dec 2015 06:20:43 +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 Io4qwWXbH6oa for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 30 Dec 2015 06:20:39 +0000 (UTC)", "from ni.com (skprod2.natinst.com [130.164.80.23])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id CC854A5B3A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 30 Dec 2015 06:20:39 +0000 (UTC)", "from us-aus-mgwout1.amer.corp.natinst.com\n\t(nb-snip2-1338.natinst.com [130.164.19.135])\n\tby us-aus-skprod2.natinst.com (8.15.0.59/8.15.0.59) with ESMTP id\n\ttBU6Kciv024959 for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 30 Dec 2015 00:20:38 -0600", "from ni.com ([130.164.14.198])\n\tby us-aus-mgwout1.amer.corp.natinst.com (Lotus Domino Release\n\t8.5.3FP6 HF1218) with ESMTP id 2015123000203865-1568946 ;\n\tWed, 30 Dec 2015 00:20:38 -0600 " ], "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, 30 Dec 2015 14:19:58 +0800", "Message-Id": "<1451456399-13353-2-git-send-email-gangfeng.huang@ni.com>", "X-Mailer": "git-send-email 1.7.9.5", "In-Reply-To": "<1451456399-13353-1-git-send-email-gangfeng.huang@ni.com>", "References": "<1451456399-13353-1-git-send-email-gangfeng.huang@ni.com>", "X-MIMETrack": "Itemize by SMTP Server on US-AUS-MGWOut1/AUS/H/NIC(Release\n\t8.5.3FP6 HF1218|December 12, 2014) at 12/30/2015 12:20:38 AM,\n\tSerialize by Router on US-AUS-MGWOut1/AUS/H/NIC(Release 8.5.3FP6\n\tHF1218|December 12, 2014) at 12/30/2015 12:20:38 AM,\n\tSerialize complete at 12/30/2015 12:20:38 AM", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2015-12-30_05:, , signatures=0", "Cc": "Gangfeng Huang <gangfeng.huang@ni.com>, Ruhao Gao <ruhao.gao@ni.com>", "Subject": "[Intel-wired-lan] [PATCH next-queue 2/3] igb: add support of\n\tethertype RX filters", "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 nfc to insert and remove ethertype filter\nby ethtool\n\nExample:\nAdd an ethertype filter:\n$ ethtool -N eth0 flow-type ether proto 0x88F8 action 2\n\nShow all filters:\n$ ethtool -n eth0\n4 RX rings available\nTotal 1 rules\n\nFilter: 15\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: 0x88F8 mask: 0x0\n\tAction: Direct to queue 2\n\nDelete the filter by location:\n$ ethtool -N delete 15\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_82575.h | 5 ++\n drivers/net/ethernet/intel/igb/igb.h | 20 ++++++-\n drivers/net/ethernet/intel/igb/igb_ethtool.c | 77 +++++++++++++++++++++++++-\n drivers/net/ethernet/intel/igb/igb_ptp.c | 4 +-\n 4 files changed, 102 insertions(+), 4 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.h b/drivers/net/ethernet/intel/igb/e1000_82575.h\nindex 2154aea..c4a34e1 100644\n--- a/drivers/net/ethernet/intel/igb/e1000_82575.h\n+++ b/drivers/net/ethernet/intel/igb/e1000_82575.h\n@@ -187,7 +187,12 @@ struct e1000_adv_tx_context_desc {\n \n /* ETQF register bit definitions */\n #define E1000_ETQF_FILTER_ENABLE (1 << 26)\n+#define E1000_ETQF_IMM_INT (1 << 29)\n #define E1000_ETQF_1588 (1 << 30)\n+#define E1000_ETQF_QUEUE_ENABLE (1 << 31)\n+#define E1000_ETQF_QUEUE_SHIFT 16\n+#define E1000_ETQF_QUEUE_MASK 0x00070000\n+#define E1000_ETQF_ETYPE_MASK 0x0000FFFF\n \n /* FTQF register bit definitions */\n #define E1000_FTQF_VF_BP 0x00008000\ndiff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h\nindex af39404..186128f 100644\n--- a/drivers/net/ethernet/intel/igb/igb.h\n+++ b/drivers/net/ethernet/intel/igb/igb.h\n@@ -348,13 +348,27 @@ struct hwmon_buff {\n \t};\n #endif\n \n+/* The number of L2 ether-type filter registers, Index 3 is reserved\n+ * for PTP 1588 timestamp\n+ */\n+#define MAX_ETYPE_FILTER (4 - 1)\n+\n+/* ETQF filter list: one static filter per filter consumer. This is\n+ * to avoid filter collisions later. Add new filters\n+ * here!!\n+ *\n+ * Current filters:\n+ * 1588 (0x88f7): Filter 3\n+ */\n+#define IGB_ETQF_FILTER_1588 3\n+\n #define IGB_N_EXTTS\t2\n #define IGB_N_PEROUT\t2\n #define IGB_N_SDP\t4\n #define IGB_RETA_SIZE\t128\n \n enum igb_filter_match_flags {\n-\tIGB_FILTER_FLAG_NONE = 0x0,\n+\tIGB_FILTER_FLAG_ETHER_TYPE = 0x1,\n };\n \n #define IGB_MAX_RXNFC_FILTERS 16\n@@ -362,8 +376,10 @@ enum igb_filter_match_flags {\n 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*/\n \tu8 match_flags;\n+\t__be16 etype;\n };\n \n /* board specific private data structure */\n@@ -499,11 +515,13 @@ struct igb_adapter {\n \tunsigned int nfc_filter_count;\n \t/* lock for nfc filter */\n \tspinlock_t nfc_lock;\n+\tbool etype_bitmap[MAX_ETYPE_FILTER];\n };\n \n struct igb_nfc_filter {\n \tstruct hlist_node nfc_node;\n \tstruct igb_nfc_input filter;\n+\tu16 etype_reg_index;\n \tu16 sw_idx;\n \tu16 action;\n };\ndiff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c\nindex 7d8827b..01c044a 100644\n--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c\n+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c\n@@ -2607,6 +2607,7 @@ static int igb_get_ts_info(struct net_device *dev,\n \t}\n }\n \n+#define ETHER_TYPE_FULL_MASK ((__force __be16)~0)\n static int igb_get_ethtool_nfc_entry(struct igb_adapter *adapter,\n \t\t\t\t struct ethtool_rxnfc *cmd)\n {\n@@ -2624,6 +2625,13 @@ 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+\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\treturn 0;\n+\t}\n \treturn -EINVAL;\n }\n \n@@ -2826,13 +2834,75 @@ static int igb_set_rss_hash_opt(struct igb_adapter *adapter,\n \treturn 0;\n }\n \n+static int igb_rxnfc_write_etype_filter(struct igb_adapter *adapter,\n+\t\t\t\t\tstruct igb_nfc_filter *input)\n+{\n+\tstruct e1000_hw *hw = &adapter->hw;\n+\tu8 i;\n+\tu32 etqf;\n+\tu16 etype;\n+\n+\t/* find an empty etype filter register */\n+\tfor (i = 0; i < MAX_ETYPE_FILTER; ++i) {\n+\t\tif (!adapter->etype_bitmap[i])\n+\t\t\tbreak;\n+\t}\n+\tif (i == MAX_ETYPE_FILTER) {\n+\t\tdev_err(&adapter->pdev->dev, \"ethtool -N: etype filters are all used.\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tadapter->etype_bitmap[i] = true;\n+\n+\tetqf = rd32(E1000_ETQF(i));\n+\tetype = ntohs(input->filter.etype & ETHER_TYPE_FULL_MASK);\n+\n+\tetqf |= E1000_ETQF_FILTER_ENABLE;\n+\tetqf &= ~E1000_ETQF_ETYPE_MASK;\n+\tetqf |= (etype & E1000_ETQF_ETYPE_MASK);\n+\n+\tetqf &= ~E1000_ETQF_QUEUE_MASK;\n+\tetqf |= ((input->action << E1000_ETQF_QUEUE_SHIFT)\n+\t\t& E1000_ETQF_QUEUE_MASK);\n+\tetqf |= E1000_ETQF_QUEUE_ENABLE;\n+\n+\twr32(E1000_ETQF(i), etqf);\n+\n+\tinput->etype_reg_index = i;\n+\n+\treturn 0;\n+}\n+\n int igb_add_filter(struct igb_adapter *adapter, struct igb_nfc_filter *input)\n {\n-\treturn -EINVAL;\n+\tint err = -EINVAL;\n+\n+\tif (input->filter.match_flags & IGB_FILTER_FLAG_ETHER_TYPE)\n+\t\terr = igb_rxnfc_write_etype_filter(adapter, input);\n+\n+\treturn err;\n+}\n+\n+static void igb_clear_etype_filter_regs(struct igb_adapter *adapter,\n+\t\t\t\t\tu16 reg_index)\n+{\n+\tstruct e1000_hw *hw = &adapter->hw;\n+\tu32 etqf = rd32(E1000_ETQF(reg_index));\n+\n+\tetqf &= ~E1000_ETQF_QUEUE_ENABLE;\n+\tetqf &= ~E1000_ETQF_QUEUE_MASK;\n+\tetqf &= ~E1000_ETQF_FILTER_ENABLE;\n+\n+\twr32(E1000_ETQF(reg_index), etqf);\n+\n+\tadapter->etype_bitmap[reg_index] = false;\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 \treturn 0;\n }\n \n@@ -2914,10 +2984,15 @@ 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+\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 \tinput->action = fsp->ring_cookie;\n \tinput->sw_idx = fsp->location;\n \ndiff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c\nindex c44df87..84c4943 100644\n--- a/drivers/net/ethernet/intel/igb/igb_ptp.c\n+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c\n@@ -940,12 +940,12 @@ static int igb_ptp_set_timestamp_mode(struct igb_adapter *adapter,\n \n \t/* define ethertype filter for timestamped packets */\n \tif (is_l2)\n-\t\twr32(E1000_ETQF(3),\n+\t\twr32(E1000_ETQF(IGB_ETQF_FILTER_1588),\n \t\t (E1000_ETQF_FILTER_ENABLE | /* enable filter */\n \t\t E1000_ETQF_1588 | /* enable timestamping */\n \t\t ETH_P_1588)); /* 1588 eth protocol type */\n \telse\n-\t\twr32(E1000_ETQF(3), 0);\n+\t\twr32(E1000_ETQF(IGB_ETQF_FILTER_1588), 0);\n \n \t/* L4 Queue Filter[3]: filter by destination port and protocol */\n \tif (is_l4) {\n", "prefixes": [ "next-queue", "2/3" ] }