get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1527762,
    "url": "http://patchwork.ozlabs.org/api/patches/1527762/",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/1631606713-20513-5-git-send-email-nanteby@nvidia.com/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/projects/47/",
        "name": "Open vSwitch",
        "link_name": "openvswitch",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "git@github.com:openvswitch/ovs.git",
        "webscm_url": "https://github.com/openvswitch/ovs",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1631606713-20513-5-git-send-email-nanteby@nvidia.com>",
    "list_archive_url": null,
    "date": "2021-09-14T08:05:13",
    "name": "[ovs-dev,4/4] netdev-offload-dpdk: Add support for matching on gre fields",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "1185a715183f5f8ece45d7ade81a5cb4eeab9661",
    "submitter": {
        "id": 82517,
        "url": "http://patchwork.ozlabs.org/api/people/82517/",
        "name": "Nir Anteby",
        "email": "nanteby@nvidia.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/1631606713-20513-5-git-send-email-nanteby@nvidia.com/mbox/",
    "series": [
        {
            "id": 262205,
            "url": "http://patchwork.ozlabs.org/api/series/262205/",
            "web_url": "http://patchwork.ozlabs.org/project/openvswitch/list/?series=262205",
            "date": "2021-09-14T08:05:09",
            "name": "netdev datapath hardware offload support for GRE flows",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/262205/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1527762/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/1527762/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ovs-dev-bounces@openvswitch.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "dev@openvswitch.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@ozlabs.org",
            "ovs-dev@lists.linuxfoundation.org"
        ],
        "Authentication-Results": "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=140.211.166.133; helo=smtp2.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN>)",
        "Received": [
            "from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4H7wrf5BYQz9sSn\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Sep 2021 18:05:38 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp2.osuosl.org (Postfix) with ESMTP id D2B9D40394;\n\tTue, 14 Sep 2021 08:05:35 +0000 (UTC)",
            "from smtp2.osuosl.org ([127.0.0.1])\n\tby localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id nAjz0oM4M4pS; Tue, 14 Sep 2021 08:05:34 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp2.osuosl.org (Postfix) with ESMTPS id 4773540376;\n\tTue, 14 Sep 2021 08:05:33 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id C72A2C0028;\n\tTue, 14 Sep 2021 08:05:31 +0000 (UTC)",
            "from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 40406C0026\n for <dev@openvswitch.org>; Tue, 14 Sep 2021 08:05:29 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp3.osuosl.org (Postfix) with ESMTP id 777DC607D3\n for <dev@openvswitch.org>; Tue, 14 Sep 2021 08:05:28 +0000 (UTC)",
            "from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id Em93KpsYhiAk for <dev@openvswitch.org>;\n Tue, 14 Sep 2021 08:05:25 +0000 (UTC)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by smtp3.osuosl.org (Postfix) with ESMTP id D7BD3607DA\n for <dev@openvswitch.org>; Tue, 14 Sep 2021 08:05:24 +0000 (UTC)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n nanteby@nvidia.com) with SMTP; 14 Sep 2021 11:05:17 +0300",
            "from nvidia.com (pegasus27.mtr.labs.mlnx [10.213.1.140])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 18E85HxT005159;\n Tue, 14 Sep 2021 11:05:17 +0300"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.8.0",
        "To": "dev@openvswitch.org",
        "Date": "Tue, 14 Sep 2021 08:05:13 +0000",
        "Message-Id": "<1631606713-20513-5-git-send-email-nanteby@nvidia.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1631606713-20513-1-git-send-email-nanteby@nvidia.com>",
        "References": "<1631606713-20513-1-git-send-email-nanteby@nvidia.com>",
        "Cc": "elibr@nvidia.com, majd@nvidia.com",
        "Subject": "[ovs-dev] [PATCH 4/4] netdev-offload-dpdk: Add support for matching\n\ton gre fields",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>",
        "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>",
        "List-Post": "<mailto:ovs-dev@openvswitch.org>",
        "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>",
        "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "From": "Nir Anteby via dev <ovs-dev@openvswitch.org>",
        "Reply-To": "Nir Anteby <nanteby@nvidia.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "ovs-dev-bounces@openvswitch.org",
        "Sender": "\"dev\" <ovs-dev-bounces@openvswitch.org>"
    },
    "content": "Add parsing gre match fields.\n\nSigned-off-by: Nir Anteby <nanteby@nvidia.com>\n---\n NEWS                      |  2 +\n lib/netdev-offload-dpdk.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 98 insertions(+)",
    "diff": "diff --git a/NEWS b/NEWS\nindex 1f2adf7..35b71f8 100644\n--- a/NEWS\n+++ b/NEWS\n@@ -8,6 +8,8 @@ Post-v2.16.0\n        by default.  'other_config:dpdk-socket-limit' can be set equal to\n        the 'other_config:dpdk-socket-mem' to preserve the legacy memory\n        limiting behavior.\n+     * Add hardware offload support for GRE flows (experimental).\n+       Available only if DPDK experimantal APIs enabled during the build.\n \n \n v2.16.0 - 16 Aug 2021\ndiff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c\nindex d15302a..f08638f 100644\n--- a/lib/netdev-offload-dpdk.c\n+++ b/lib/netdev-offload-dpdk.c\n@@ -19,6 +19,7 @@\n #include <sys/types.h>\n #include <netinet/ip6.h>\n #include <rte_flow.h>\n+#include <rte_gre.h>\n \n #include \"cmap.h\"\n #include \"dpif-netdev.h\"\n@@ -390,6 +391,46 @@ dump_flow_pattern(struct ds *s,\n                               ntohl(spec_vni) >> 8, ntohl(mask_vni) >> 8);\n         }\n         ds_put_cstr(s, \"/ \");\n+    } else if (item->type == RTE_FLOW_ITEM_TYPE_GRE) {\n+        const struct rte_flow_item_gre *gre_spec = item->spec;\n+        const struct rte_flow_item_gre *gre_mask = item->mask;\n+        const struct rte_gre_hdr *greh_spec, *greh_mask;\n+        uint8_t c_bit_spec, c_bit_mask;\n+        uint8_t k_bit_spec, k_bit_mask;\n+\n+        ds_put_cstr(s, \"gre \");\n+        if (gre_spec) {\n+            if (!gre_mask) {\n+                gre_mask = &rte_flow_item_gre_mask;\n+            }\n+            greh_spec = (struct rte_gre_hdr *) gre_spec;\n+            greh_mask = (struct rte_gre_hdr *) gre_mask;\n+\n+            c_bit_spec = greh_spec->c;\n+            c_bit_mask = greh_mask->c ? UINT8_MAX : 0;\n+            DUMP_PATTERN_ITEM(c_bit_mask, \"c_bit\", \"%\"PRIu8,\n+                              c_bit_spec, c_bit_mask);\n+\n+            k_bit_spec = greh_spec->k;\n+            k_bit_mask = greh_mask->k ? UINT8_MAX : 0;\n+            DUMP_PATTERN_ITEM(k_bit_mask, \"k_bit\", \"%\"PRIu8,\n+                              k_bit_spec, k_bit_mask);\n+        }\n+        ds_put_cstr(s, \"/ \");\n+    } else if (item->type == RTE_FLOW_ITEM_TYPE_GRE_KEY) {\n+        const rte_be32_t gre_mask = RTE_BE32(UINT32_MAX);\n+        const rte_be32_t *key_spec = item->spec;\n+        const rte_be32_t *key_mask = item->mask;\n+\n+        ds_put_cstr(s, \"gre_key \");\n+        if (key_spec) {\n+            if (!key_mask) {\n+                key_mask = &gre_mask;\n+            }\n+            DUMP_PATTERN_ITEM(*key_mask, \"value\", \"%\"PRIu32,\n+                              ntohl(*key_spec), ntohl(*key_mask));\n+        }\n+        ds_put_cstr(s, \"/ \");\n     } else {\n         ds_put_format(s, \"unknown rte flow pattern (%d)\\n\", item->type);\n     }\n@@ -1028,6 +1069,58 @@ parse_vxlan_match(struct flow_patterns *patterns,\n     return 0;\n }\n \n+static int\n+parse_gre_match(struct flow_patterns *patterns,\n+                struct match *match)\n+{\n+    struct rte_flow_item_gre *gre_spec, *gre_mask;\n+    struct rte_gre_hdr *greh_spec, *greh_mask;\n+    rte_be32_t *key_spec, *key_mask;\n+    struct flow *consumed_masks;\n+    int ret;\n+\n+\n+    ret = parse_tnl_ip_match(patterns, match, IPPROTO_GRE);\n+    if (ret) {\n+        return -1;\n+    }\n+\n+    gre_spec = xzalloc(sizeof *gre_spec);\n+    gre_mask = xzalloc(sizeof *gre_mask);\n+    add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_GRE, gre_spec, gre_mask);\n+\n+    consumed_masks = &match->wc.masks;\n+\n+    greh_spec = (struct rte_gre_hdr *) gre_spec;\n+    greh_mask = (struct rte_gre_hdr *) gre_mask;\n+\n+    if (match->wc.masks.tunnel.flags & FLOW_TNL_F_CSUM) {\n+        greh_spec->c = !!(match->flow.tunnel.flags & FLOW_TNL_F_CSUM);\n+        greh_mask->c = 1;\n+        consumed_masks->tunnel.flags &= ~FLOW_TNL_F_CSUM;\n+    }\n+\n+    if (match->wc.masks.tunnel.flags & FLOW_TNL_F_KEY) {\n+        greh_spec->k = !!(match->flow.tunnel.flags & FLOW_TNL_F_KEY);\n+        greh_mask->k = 1;\n+\n+        key_spec = xzalloc(sizeof *key_spec);\n+        key_mask = xzalloc(sizeof *key_mask);\n+\n+        *key_spec = htonl(ntohll(match->flow.tunnel.tun_id));\n+        *key_mask = htonl(ntohll(match->wc.masks.tunnel.tun_id));\n+\n+        consumed_masks->tunnel.tun_id = 0;\n+        consumed_masks->tunnel.flags &= ~FLOW_TNL_F_KEY;\n+        add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_GRE_KEY, key_spec,\n+                         key_mask);\n+    }\n+\n+    consumed_masks->tunnel.flags &= ~FLOW_TNL_F_DONT_FRAGMENT;\n+\n+    return 0;\n+}\n+\n static int OVS_UNUSED\n parse_flow_tnl_match(struct netdev *tnldev,\n                      struct flow_patterns *patterns,\n@@ -1044,6 +1137,9 @@ parse_flow_tnl_match(struct netdev *tnldev,\n     if (!strcmp(netdev_get_type(tnldev), \"vxlan\")) {\n         ret = parse_vxlan_match(patterns, match);\n     }\n+    else if (!strcmp(netdev_get_type(tnldev), \"gre\")) {\n+        ret = parse_gre_match(patterns, match);\n+    }\n \n     return ret;\n }\n",
    "prefixes": [
        "ovs-dev",
        "4/4"
    ]
}