get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/645095/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 645095,
    "url": "http://patchwork.ozlabs.org/api/patches/645095/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1467782577-25659-3-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-3-git-send-email-gangfeng.huang@ni.com>",
    "list_archive_url": null,
    "date": "2016-07-06T05:22:55",
    "name": "[net-next,v6,2/4] igb: support RX flow classification by ethertype",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "476760801d837dc0d105208a496dc284fed9d6fd",
    "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-3-git-send-email-gangfeng.huang@ni.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/645095/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/645095/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 3rkq0z2hmbz9sDb\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  6 Jul 2016 15:23:47 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id E665930EAE;\n\tWed,  6 Jul 2016 05:23:45 +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 1JI6PYq0nLPy; Wed,  6 Jul 2016 05:23:41 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id E2EC030E8A;\n\tWed,  6 Jul 2016 05:23:41 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 614421C0D7B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  6 Jul 2016 05:23:40 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 5CECB85CC5\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  6 Jul 2016 05:23:40 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id kYateo7RV1Og for <intel-wired-lan@lists.osuosl.org>;\n\tWed,  6 Jul 2016 05:23:39 +0000 (UTC)",
            "from ni.com (skprod2.natinst.com [130.164.80.23])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 481B185C46\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  6 Jul 2016 05:23:39 +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-skprod2.natinst.com (8.15.0.59/8.15.0.59) with ESMTP id\n\tu665NcfU022773\n\tfor <intel-wired-lan@lists.osuosl.org>; Wed, 6 Jul 2016 00:23:38 -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 2016070600233791-562916 ;\n\tWed, 6 Jul 2016 00:23:37 -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:55 +0800",
        "Message-Id": "<1467782577-25659-3-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:38 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:38 AM,\n\tSerialize complete at 07/06/2016 12:23:38 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 2/4] igb: support RX flow\n\tclassification by ethertype",
        "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 ethertype filter by 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 199ff98..acf0605 100644\n--- a/drivers/net/ethernet/intel/igb/e1000_82575.h\n+++ b/drivers/net/ethernet/intel/igb/e1000_82575.h\n@@ -188,6 +188,11 @@ struct e1000_adv_tx_context_desc {\n /* ETQF register bit definitions */\n #define E1000_ETQF_FILTER_ENABLE   BIT(26)\n #define E1000_ETQF_1588            BIT(30)\n+#define E1000_ETQF_IMM_INT         BIT(29)\n+#define E1000_ETQF_QUEUE_ENABLE    BIT(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 042467a..c2d2dac 100644\n--- a/drivers/net/ethernet/intel/igb/igb.h\n+++ b/drivers/net/ethernet/intel/igb/igb.h\n@@ -350,13 +350,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@@ -365,13 +379,16 @@ 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 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 };\n@@ -500,6 +517,7 @@ struct igb_adapter {\n \tunsigned int nfc_filter_count;\n \t/* lock for RX network flow classification filter */\n \tspinlock_t nfc_lock;\n+\tbool etype_bitmap[MAX_ETYPE_FILTER];\n };\n \n /* flags controlling PTP/1588 function */\ndiff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c\nindex 2599826..00e3387 100644\n--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c\n+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c\n@@ -2431,6 +2431,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@@ -2448,6 +2449,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@@ -2650,13 +2658,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@@ -2738,10 +2808,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 e61b647..ee87a57 100644\n--- a/drivers/net/ethernet/intel/igb/igb_ptp.c\n+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c\n@@ -978,12 +978,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": [
        "net-next",
        "v6",
        "2/4"
    ]
}