get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 720993,
    "url": "http://patchwork.ozlabs.org/api/patches/720993/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170128003914.30854-1-jacob.e.keller@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": "<20170128003914.30854-1-jacob.e.keller@intel.com>",
    "list_archive_url": null,
    "date": "2017-01-28T00:39:14",
    "name": "ethtool: support queue and vf fields for rxclass filters",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "42348d60406bd6e8697c1bbb959bb98620261161",
    "submitter": {
        "id": 9784,
        "url": "http://patchwork.ozlabs.org/api/people/9784/?format=api",
        "name": "Jacob Keller",
        "email": "jacob.e.keller@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/20170128003914.30854-1-jacob.e.keller@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/720993/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/720993/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 hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\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 3v9Gxs5Mspz9sxN\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 28 Jan 2017 11:39:28 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 9E818895CA;\n\tSat, 28 Jan 2017 00:39:26 +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 3H0q+vxN8ZbL; Sat, 28 Jan 2017 00:39:24 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 78058895C9;\n\tSat, 28 Jan 2017 00:39:24 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id C260B1C01A0\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 28 Jan 2017 00:39:22 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id BD2292E88E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 28 Jan 2017 00:39:22 +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 urkYyjziNeso for <intel-wired-lan@lists.osuosl.org>;\n\tSat, 28 Jan 2017 00:39:17 +0000 (UTC)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 6A11B2E796\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 28 Jan 2017 00:39:17 +0000 (UTC)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby orsmga104.jf.intel.com with ESMTP; 27 Jan 2017 16:39:16 -0800",
            "from jekeller-desk.amr.corp.intel.com (HELO\n\tjekeller-desk.jekeller.internal) ([10.166.35.174])\n\tby fmsmga004.fm.intel.com with ESMTP; 27 Jan 2017 16:39:16 -0800"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.33,298,1477983600\"; d=\"scan'208\";a=\"218555654\"",
        "From": "Jacob Keller <jacob.e.keller@intel.com>",
        "To": "Intel Wired LAN <intel-wired-lan@lists.osuosl.org>",
        "Date": "Fri, 27 Jan 2017 16:39:14 -0800",
        "Message-Id": "<20170128003914.30854-1-jacob.e.keller@intel.com>",
        "X-Mailer": "git-send-email 2.11.0.608.gb2604e8deeff",
        "Subject": "[Intel-wired-lan] [PATCH] ethtool: support queue and vf fields for\n\trxclass 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": "Recent kernels have made it possible to specify filters applying to\na virtual function by partitioning the ring_cookie (action) value. The\nlower 32bits will represent the queue, while the next 8bits represent\nthe virtual function.\n\nAdd support to view and specify the ring_cookie in this way so that\nusers do not have to manually create action values, and don't need to\nunderstand the underlying layout of the ring_cookie value.\n\nSupport using queue and vf fields which will fill in their specific bits\nof the ring_cookie value, using new customized OPT_RING_VF and\nOPT_RING_QUEUE.\n\nAdd support to display the ring cookie value as a split VF identifier\nand queue.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n ethtool.8.in |   7 ++++\n rxclass.c    | 102 +++++++++++++++++++++++++++++++++++++++++++++++++----------\n 2 files changed, 92 insertions(+), 17 deletions(-)",
    "diff": "diff --git a/ethtool.8.in b/ethtool.8.in\nindex 5c36c06385f6..738480abd5b9 100644\n--- a/ethtool.8.in\n+++ b/ethtool.8.in\n@@ -829,6 +829,13 @@ lB\tl.\n 0 or higher\tRx queue to route the flow\n .TE\n .TP\n+.BI vf \\ N\n+Specifies the Virtual Function the filter applies to. A value of 0 indicates\n+the PF, and thus the VF index is offset by 1. Not compatible with action.\n+.TP\n+.BI queue \\ N\n+Specifies the Rx queue to send packets to. Not compatible with action.\n+.TP\n .BI loc \\ N\n Specify the location/ID to insert the rule. This will overwrite\n any rule present in that location and will not go through any\ndiff --git a/rxclass.c b/rxclass.c\nindex c7bfebaf6e22..ebc3e1a59fb3 100644\n--- a/rxclass.c\n+++ b/rxclass.c\n@@ -247,11 +247,19 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp)\n \n \trxclass_print_nfc_spec_ext(fsp);\n \n-\tif (fsp->ring_cookie != RX_CLS_FLOW_DISC)\n-\t\tfprintf(stdout, \"\\tAction: Direct to queue %llu\\n\",\n-\t\t\tfsp->ring_cookie);\n-\telse\n+\tif (fsp->ring_cookie != RX_CLS_FLOW_DISC) {\n+\t\tu64 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie);\n+\t\tu64 queue = ethtool_get_flow_spec_ring(fsp->ring_cookie);\n+\n+\t\tif (vf)\n+\t\t\tfprintf(stdout, \"\\tAction: Direct to queue %llu\\n\",\n+\t\t\t\tqueue);\n+\t\telse\n+\t\t\tfprintf(stdout, \"\\tAction: Direct to VF %llu queue %llu\\n\",\n+\t\t\t\tvf, queue);\n+\t} else {\n \t\tfprintf(stdout, \"\\tAction: Drop\\n\");\n+\t}\n \n \tfprintf(stdout, \"\\n\");\n }\n@@ -600,6 +608,8 @@ typedef enum {\n \tOPT_U16,\n \tOPT_U32,\n \tOPT_U64,\n+\tOPT_RING_VF,\n+\tOPT_RING_QUEUE,\n \tOPT_BE16,\n \tOPT_BE32,\n \tOPT_BE64,\n@@ -608,19 +618,21 @@ typedef enum {\n \tOPT_MAC,\n } rule_opt_type_t;\n \n-#define NFC_FLAG_RING\t\t0x001\n-#define NFC_FLAG_LOC\t\t0x002\n-#define NFC_FLAG_SADDR\t\t0x004\n-#define NFC_FLAG_DADDR\t\t0x008\n-#define NFC_FLAG_SPORT\t\t0x010\n-#define NFC_FLAG_DPORT\t\t0x020\n-#define NFC_FLAG_SPI\t\t0x030\n-#define NFC_FLAG_TOS\t\t0x040\n-#define NFC_FLAG_PROTO\t\t0x080\n-#define NTUPLE_FLAG_VLAN\t0x100\n-#define NTUPLE_FLAG_UDEF\t0x200\n-#define NTUPLE_FLAG_VETH\t0x400\n-#define NFC_FLAG_MAC_ADDR\t0x800\n+#define NFC_FLAG_RING\t\t0x0001\n+#define NFC_FLAG_LOC\t\t0x0002\n+#define NFC_FLAG_SADDR\t\t0x0004\n+#define NFC_FLAG_DADDR\t\t0x0008\n+#define NFC_FLAG_SPORT\t\t0x0010\n+#define NFC_FLAG_DPORT\t\t0x0020\n+#define NFC_FLAG_SPI\t\t0x0030\n+#define NFC_FLAG_TOS\t\t0x0040\n+#define NFC_FLAG_PROTO\t\t0x0080\n+#define NTUPLE_FLAG_VLAN\t0x0100\n+#define NTUPLE_FLAG_UDEF\t0x0200\n+#define NTUPLE_FLAG_VETH\t0x0400\n+#define NFC_FLAG_MAC_ADDR\t0x0800\n+#define NFC_FLAG_RING_VF\t0x1000\n+#define NFC_FLAG_RING_QUEUE\t0x2000\n \n struct rule_opts {\n \tconst char\t*name;\n@@ -648,6 +660,10 @@ static const struct rule_opts rule_nfc_tcp_ip4[] = {\n \t  offsetof(struct ethtool_rx_flow_spec, m_u.tcp_ip4_spec.pdst) },\n \t{ \"action\", OPT_U64, NFC_FLAG_RING,\n \t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"vf\", OPT_RING_VF, NFC_FLAG_RING_VF,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"queue\", OPT_RING_QUEUE, NFC_FLAG_RING_QUEUE,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n \t{ \"loc\", OPT_U32, NFC_FLAG_LOC,\n \t  offsetof(struct ethtool_rx_flow_spec, location), -1 },\n \t{ \"vlan-etype\", OPT_BE16, NTUPLE_FLAG_VETH,\n@@ -679,6 +695,10 @@ static const struct rule_opts rule_nfc_esp_ip4[] = {\n \t  offsetof(struct ethtool_rx_flow_spec, m_u.esp_ip4_spec.spi) },\n \t{ \"action\", OPT_U64, NFC_FLAG_RING,\n \t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"vf\", OPT_RING_VF, NFC_FLAG_RING_VF,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"queue\", OPT_RING_QUEUE, NFC_FLAG_RING_QUEUE,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n \t{ \"loc\", OPT_U32, NFC_FLAG_LOC,\n \t  offsetof(struct ethtool_rx_flow_spec, location), -1 },\n \t{ \"vlan-etype\", OPT_BE16, NTUPLE_FLAG_VETH,\n@@ -722,6 +742,10 @@ static const struct rule_opts rule_nfc_usr_ip4[] = {\n \t  offsetof(struct ethtool_rx_flow_spec, m_u.usr_ip4_spec.l4_4_bytes) + 2 },\n \t{ \"action\", OPT_U64, NFC_FLAG_RING,\n \t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"vf\", OPT_RING_VF, NFC_FLAG_RING_VF,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"queue\", OPT_RING_QUEUE, NFC_FLAG_RING_QUEUE,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n \t{ \"loc\", OPT_U32, NFC_FLAG_LOC,\n \t  offsetof(struct ethtool_rx_flow_spec, location), -1 },\n \t{ \"vlan-etype\", OPT_BE16, NTUPLE_FLAG_VETH,\n@@ -756,6 +780,10 @@ static const struct rule_opts rule_nfc_tcp_ip6[] = {\n \t  offsetof(struct ethtool_rx_flow_spec, m_u.tcp_ip6_spec.pdst) },\n \t{ \"action\", OPT_U64, NFC_FLAG_RING,\n \t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"vf\", OPT_RING_VF, NFC_FLAG_RING_VF,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"queue\", OPT_RING_QUEUE, NFC_FLAG_RING_QUEUE,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n \t{ \"loc\", OPT_U32, NFC_FLAG_LOC,\n \t  offsetof(struct ethtool_rx_flow_spec, location), -1 },\n \t{ \"vlan-etype\", OPT_BE16, NTUPLE_FLAG_VETH,\n@@ -787,6 +815,10 @@ static const struct rule_opts rule_nfc_esp_ip6[] = {\n \t  offsetof(struct ethtool_rx_flow_spec, m_u.esp_ip6_spec.spi) },\n \t{ \"action\", OPT_U64, NFC_FLAG_RING,\n \t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"vf\", OPT_RING_VF, NFC_FLAG_RING_VF,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"queue\", OPT_RING_QUEUE, NFC_FLAG_RING_QUEUE,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n \t{ \"loc\", OPT_U32, NFC_FLAG_LOC,\n \t  offsetof(struct ethtool_rx_flow_spec, location), -1 },\n \t{ \"vlan-etype\", OPT_BE16, NTUPLE_FLAG_VETH,\n@@ -830,6 +862,10 @@ static const struct rule_opts rule_nfc_usr_ip6[] = {\n \t  offsetof(struct ethtool_rx_flow_spec, m_u.usr_ip6_spec.l4_4_bytes) + 2 },\n \t{ \"action\", OPT_U64, NFC_FLAG_RING,\n \t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"vf\", OPT_RING_VF, NFC_FLAG_RING_VF,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"queue\", OPT_RING_QUEUE, NFC_FLAG_RING_QUEUE,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n \t{ \"loc\", OPT_U32, NFC_FLAG_LOC,\n \t  offsetof(struct ethtool_rx_flow_spec, location), -1 },\n \t{ \"vlan-etype\", OPT_BE16, NTUPLE_FLAG_VETH,\n@@ -858,6 +894,10 @@ static const struct rule_opts rule_nfc_ether[] = {\n \t  offsetof(struct ethtool_rx_flow_spec, m_u.ether_spec.h_proto) },\n \t{ \"action\", OPT_U64, NFC_FLAG_RING,\n \t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"vf\", OPT_RING_VF, NFC_FLAG_RING_VF,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n+\t{ \"queue\", OPT_RING_QUEUE, NFC_FLAG_RING_QUEUE,\n+\t  offsetof(struct ethtool_rx_flow_spec, ring_cookie), -1 },\n \t{ \"loc\", OPT_U32, NFC_FLAG_LOC,\n \t  offsetof(struct ethtool_rx_flow_spec, location), -1 },\n \t{ \"vlan-etype\", OPT_BE16, NTUPLE_FLAG_VETH,\n@@ -1002,6 +1042,24 @@ static int rxclass_get_val(char *str, unsigned char *p, u32 *flags,\n \t\t\t*(u64 *)&p[opt->moffset] = (u64)mask;\n \t\tbreak;\n \t}\n+\tcase OPT_RING_VF: {\n+\t\tunsigned long long val;\n+\t\terr = rxclass_get_ulong(str, &val, 8);\n+\t\tif (err)\n+\t\t\treturn -1;\n+\t\t*(u64 *)&p[opt->offset] &= ~ETHTOOL_RX_FLOW_SPEC_RING_VF;\n+\t\t*(u64 *)&p[opt->offset] = (u64)val << ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;\n+\t\tbreak;\n+\t}\n+\tcase OPT_RING_QUEUE: {\n+\t\tunsigned long long val;\n+\t\terr = rxclass_get_ulong(str, &val, 32);\n+\t\tif (err)\n+\t\t\treturn -1;\n+\t\t*(u64 *)&p[opt->offset] &= ~ETHTOOL_RX_FLOW_SPEC_RING;\n+\t\t*(u64 *)&p[opt->offset] |= (u64)val;\n+\t\tbreak;\n+\t}\n \tcase OPT_BE16: {\n \t\tunsigned long long val;\n \t\terr = rxclass_get_ulong(str, &val, 16);\n@@ -1320,6 +1378,16 @@ int rxclass_parse_ruleopts(struct cmd_context *ctx,\n \t\t}\n \t}\n \n+\tif ((flags & NFC_FLAG_RING) && (flags & NFC_FLAG_RING_QUEUE)) {\n+\t\tfprintf(stderr, \"action and queue are not compatible\\n\");\n+\t\t\treturn -1;\n+\t}\n+\n+\tif ((flags & NFC_FLAG_RING) && (flags & NFC_FLAG_RING_VF)) {\n+\t\tfprintf(stderr, \"action and vf are not compatible\\n\");\n+\t\t\treturn -1;\n+\t}\n+\n \tif (flow_type == IPV4_USER_FLOW)\n \t\tfsp->h_u.usr_ip4_spec.ip_ver = ETH_RX_NFC_IP4;\n \tif (flags & (NTUPLE_FLAG_VLAN | NTUPLE_FLAG_UDEF | NTUPLE_FLAG_VETH))\n",
    "prefixes": []
}