get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 41692,
    "url": "http://patches.dpdk.org/api/patches/41692/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/6190b2d787d3a9d2095e2eed17db1c20b2e3c4e1.1530111623.git.nelio.laranjeiro@6wind.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<6190b2d787d3a9d2095e2eed17db1c20b2e3c4e1.1530111623.git.nelio.laranjeiro@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/6190b2d787d3a9d2095e2eed17db1c20b2e3c4e1.1530111623.git.nelio.laranjeiro@6wind.com",
    "date": "2018-06-27T15:07:50",
    "name": "[v2,18/20] net/mlx5: add flow GRE item",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "af42524abfe0d794b1f58feac4e1c8f5311b5be0",
    "submitter": {
        "id": 243,
        "url": "http://patches.dpdk.org/api/people/243/?format=api",
        "name": "Nélio Laranjeiro",
        "email": "nelio.laranjeiro@6wind.com"
    },
    "delegate": {
        "id": 6624,
        "url": "http://patches.dpdk.org/api/users/6624/?format=api",
        "username": "shahafs",
        "first_name": "Shahaf",
        "last_name": "Shuler",
        "email": "shahafs@mellanox.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/6190b2d787d3a9d2095e2eed17db1c20b2e3c4e1.1530111623.git.nelio.laranjeiro@6wind.com/mbox/",
    "series": [
        {
            "id": 268,
            "url": "http://patches.dpdk.org/api/series/268/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=268",
            "date": "2018-06-27T15:07:32",
            "name": "net/mlx5: flow rework",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/268/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41692/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/41692/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 2E5EC1C021;\n\tWed, 27 Jun 2018 17:08:13 +0200 (CEST)",
            "from mail-wr0-f194.google.com (mail-wr0-f194.google.com\n\t[209.85.128.194]) by dpdk.org (Postfix) with ESMTP id 99F2A1BFCC\n\tfor <dev@dpdk.org>; Wed, 27 Jun 2018 17:07:50 +0200 (CEST)",
            "by mail-wr0-f194.google.com with SMTP id h10-v6so2402009wrq.8\n\tfor <dev@dpdk.org>; Wed, 27 Jun 2018 08:07:50 -0700 (PDT)",
            "from laranjeiro-vm.dev.6wind.com\n\t(host.78.145.23.62.rev.coltfrance.com. [62.23.145.78])\n\tby smtp.gmail.com with ESMTPSA id\n\tk17-v6sm4872513wrp.19.2018.06.27.08.07.49\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 27 Jun 2018 08:07:49 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:subject:date:message-id:in-reply-to:references;\n\tbh=MmXU0N2J9XQdaqzbqt7S9MQnihgDYkriac/MPePP/0o=;\n\tb=dsa9NbYwVgFzHwtQT0ZMJHwRmdkzsgKjW99rC3gg1itbzHLJk3+9ohlMkbRQhsLhAt\n\tlfsiJ2yBFDDYeqHobtOb6/OEUr0PwXLJhUxy4y9gJRfy566K8YQjG4FiuTjMQ5gC13Ru\n\teBCP3j3Kz7UCKiKqp5F3uS/21VpaBxLepSjcgmedKwZOp0wNpEzI92buWf7gen4Ozpb1\n\trsK21A0QL/s9wjpPIGijJ/USMXV8tdW8GY2tUAsgMpwOTB8RBerNFDqzpjzuVBNtvhgS\n\t+PiDBDU0MAjSEX4y+1SJkNDT7NQm3zeqtwpVIraMftvEDyZ8H1iCVDDQCuHDpJ4BtRwT\n\tNBaQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=MmXU0N2J9XQdaqzbqt7S9MQnihgDYkriac/MPePP/0o=;\n\tb=sB8yym7ovyWim4zb9EMAPiQA31LOCGb3rTCDC9jCUMsWSxi6uXD8gMaPXnJaq/EWUw\n\tiWXva0+lZK/kxT92DVPkI/v0G+VPaKT0nQzDJ91jcYVQS8DZP27IuE+4B77IebZCfXHk\n\t5AJPJgTe/a/1wjiwbFimHNSYBtybsFnrAgVrf14Gsd4tXKMW21aOKTdB/5kFlr50vVsG\n\tsmS4Ly2PZjLcskDax6hy+NgP0BpwDme+QJCj8uax39ukHZgLwuTz3RoR56SbyuztEmNT\n\txHIBeRTreRWxCGSKoKYSvSy4aU22VgAs4oTvD+B/VfMEvb54D02rZeoGXxtcvOQOZWW+\n\twF9g==",
        "X-Gm-Message-State": "APt69E176J3/1CgXmOromR65dIqOkVudjOUE/CmSOIWnQfN5Nu7JYGXJ\n\td9vECOsy3A7qbDzWT0yMg5huTANo0Q==",
        "X-Google-Smtp-Source": "AAOMgpep4v16lVLopZPF+qgEgUUUEEAV2lUe99vlR6epMIxmItnHquVlBchlSDmGb+LUikD3quT9nQ==",
        "X-Received": "by 2002:adf:c892:: with SMTP id\n\tk18-v6mr5831789wrh.6.1530112070029; \n\tWed, 27 Jun 2018 08:07:50 -0700 (PDT)",
        "From": "Nelio Laranjeiro <nelio.laranjeiro@6wind.com>",
        "To": "dev@dpdk.org, Adrien Mazarguil <adrien.mazarguil@6wind.com>,\n\tYongseok Koh <yskoh@mellanox.com>",
        "Date": "Wed, 27 Jun 2018 17:07:50 +0200",
        "Message-Id": "<6190b2d787d3a9d2095e2eed17db1c20b2e3c4e1.1530111623.git.nelio.laranjeiro@6wind.com>",
        "X-Mailer": "git-send-email 2.18.0",
        "In-Reply-To": "<cover.1530111623.git.nelio.laranjeiro@6wind.com>",
        "References": "<cover.1527506071.git.nelio.laranjeiro@6wind.com>\n\t<cover.1530111623.git.nelio.laranjeiro@6wind.com>",
        "Subject": "[dpdk-dev] [PATCH v2 18/20] net/mlx5: add flow GRE item",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>\n---\n drivers/net/mlx5/mlx5_flow.c | 191 ++++++++++++++++++++++++++++++++++-\n 1 file changed, 186 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c\nindex 47c55b426..636aaabe8 100644\n--- a/drivers/net/mlx5/mlx5_flow.c\n+++ b/drivers/net/mlx5/mlx5_flow.c\n@@ -54,6 +54,7 @@ extern const struct eth_dev_ops mlx5_dev_ops_isolate;\n /* Pattern tunnel Layer bits. */\n #define MLX5_FLOW_LAYER_VXLAN (1u << 12)\n #define MLX5_FLOW_LAYER_VXLAN_GPE (1u << 13)\n+#define MLX5_FLOW_LAYER_GRE (1u << 14)\n \n /* Outer Masks. */\n #define MLX5_FLOW_LAYER_OUTER_L3 \\\n@@ -66,7 +67,8 @@ extern const struct eth_dev_ops mlx5_dev_ops_isolate;\n \n /* Tunnel masks. */\n #define MLX5_FLOW_LAYER_TUNNEL \\\n-\t(MLX5_FLOW_LAYER_VXLAN | MLX5_FLOW_LAYER_VXLAN_GPE)\n+\t(MLX5_FLOW_LAYER_VXLAN | MLX5_FLOW_LAYER_VXLAN_GPE | \\\n+\t MLX5_FLOW_LAYER_GRE)\n \n /* Inner Masks. */\n #define MLX5_FLOW_LAYER_INNER_L3 \\\n@@ -215,6 +217,9 @@ static const struct rte_flow_expand_node mlx5_support_expansion[] = {\n \t},\n };\n \n+/* Tunnel protocol values. */\n+#define MLX5_PROTOCOL_GRE 47\n+\n /** Handles information leading to a drop fate. */\n struct mlx5_flow_verbs {\n \tLIST_ENTRY(mlx5_flow_verbs) next;\n@@ -1005,12 +1010,23 @@ mlx5_flow_item_ipv6(const struct rte_flow_item *item, struct rte_flow *flow,\n \t\t\t\t\t\t  item,\n \t\t\t\t\t\t  \"L3 cannot follow an L4\"\n \t\t\t\t\t\t  \" layer\");\n+\t\t/*\n+\t\t * IPv6 is not recognised by the NIC inside a GRE tunnel.\n+\t\t * Such support has to be disabled as the rule will be\n+\t\t * accepted.  Tested with Mellanox OFED 4.3-3.0.2.1\n+\t\t */\n+\t\tif (tunnel && layers & MLX5_FLOW_LAYER_GRE)\n+\t\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t\t\t  item,\n+\t\t\t\t\t\t  \"IPv6 inside a GRE tunnel is\"\n+\t\t\t\t\t\t  \" not recognised.\");\n \t\tif (!mask)\n \t\t\tmask = &rte_flow_item_ipv6_mask;\n-\t\tret = mlx5_flow_item_validate(item, (const uint8_t *)mask,\n-\t\t\t\t\t      (const uint8_t *)&nic_mask,\n-\t\t\t\t\t      sizeof(struct rte_flow_item_ipv6),\n-\t\t\t\t\t      error);\n+\t\tret = mlx5_flow_item_validate\n+\t\t\t(item, (const uint8_t *)mask,\n+\t\t\t (const uint8_t *)&nic_mask,\n+\t\t\t sizeof(struct rte_flow_item_ipv6), error);\n \t\tif (ret < 0)\n \t\t\treturn ret;\n \t}\n@@ -1411,6 +1427,168 @@ mlx5_flow_item_vxlan_gpe(struct rte_eth_dev *dev,\n \treturn size;\n }\n \n+/**\n+ * Update the protocol in Verbs IPv4 spec.\n+ *\n+ * @param attr[in, out]\n+ *   Pointer to Verbs attributes structure.\n+ * @param protocol[in]\n+ *   Protocol value to set if none is present in the specification.\n+ */\n+static void\n+mlx5_flow_item_gre_ipv4_protocol_update(struct ibv_flow_attr *attr,\n+\t\t\t\t\tuint8_t protocol)\n+{\n+\tunsigned int i;\n+\tconst enum ibv_flow_spec_type search = IBV_FLOW_SPEC_IPV4_EXT;\n+\tstruct ibv_spec_header *hdr = (struct ibv_spec_header *)\n+\t\t((uint8_t *)attr + sizeof(struct ibv_flow_attr));\n+\n+\tif (!attr)\n+\t\treturn;\n+\tfor (i = 0; i != attr->num_of_specs; ++i) {\n+\t\tif (hdr->type == search) {\n+\t\t\tstruct ibv_flow_spec_ipv4_ext *ip =\n+\t\t\t\t(struct ibv_flow_spec_ipv4_ext *)hdr;\n+\n+\t\t\tif (!ip->val.proto) {\n+\t\t\t\tip->val.proto = protocol;\n+\t\t\t\tip->mask.proto = 0xff;\n+\t\t\t}\n+\t\t\tbreak;\n+\t\t}\n+\t\thdr = (struct ibv_spec_header *)((uint8_t *)hdr + hdr->size);\n+\t}\n+}\n+\n+/**\n+ * Update the protocol in Verbs IPv6 spec.\n+ *\n+ * @param attr[in, out]\n+ *   Pointer to Verbs attributes structure.\n+ * @param protocol[in]\n+ *   Protocol value to set if none is present in the specification.\n+ */\n+static void\n+mlx5_flow_item_gre_ipv6_protocol_update(struct ibv_flow_attr *attr,\n+\t\t\t\t\tuint8_t protocol)\n+{\n+\tunsigned int i;\n+\tconst enum ibv_flow_spec_type search = IBV_FLOW_SPEC_IPV6;\n+\tstruct ibv_spec_header *hdr = (struct ibv_spec_header *)\n+\t\t((uint8_t *)attr + sizeof(struct ibv_flow_attr));\n+\n+\tif (!attr)\n+\t\treturn;\n+\tfor (i = 0; i != attr->num_of_specs; ++i) {\n+\t\tif (hdr->type == search) {\n+\t\t\tstruct ibv_flow_spec_ipv6 *ip =\n+\t\t\t\t(struct ibv_flow_spec_ipv6 *)hdr;\n+\n+\t\t\tif (!ip->val.next_hdr) {\n+\t\t\t\tip->val.next_hdr = protocol;\n+\t\t\t\tip->mask.next_hdr = 0xff;\n+\t\t\t}\n+\t\t\tbreak;\n+\t\t}\n+\t\thdr = (struct ibv_spec_header *)((uint8_t *)hdr + hdr->size);\n+\t}\n+}\n+\n+/**\n+ * Validate GRE layer and possibly create the Verbs specification.\n+ *\n+ * @param dev\n+ *   Pointer to Ethernet device.\n+ * @param item[in]\n+ *   Item specification.\n+ * @param flow[in, out]\n+ *   Pointer to flow structure.\n+ * @param flow_size[in]\n+ *   Size in bytes of the available space for to store the flow information.\n+ * @param error\n+ *   Pointer to error structure.\n+ *\n+ * @return\n+ *   size in bytes necessary for the conversion, a negative errno value\n+ *   otherwise and rte_errno is set.\n+ */\n+static int\n+mlx5_flow_item_gre(const struct rte_flow_item *item,\n+\t\t   struct rte_flow *flow, const size_t flow_size,\n+\t\t   struct rte_flow_error *error)\n+{\n+\tstruct mlx5_flow_verbs *verbs = flow->cur_verbs;\n+\tconst struct rte_flow_item_gre *spec = item->spec;\n+\tconst struct rte_flow_item_gre *mask = item->mask;\n+\tconst uint32_t layers = mlx5_flow_layers(flow);\n+#ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT\n+\tunsigned int size = sizeof(struct ibv_flow_spec_gre);\n+\tstruct ibv_flow_spec_gre tunnel = {\n+\t\t.type = IBV_FLOW_SPEC_GRE,\n+\t\t.size = size,\n+\t};\n+#else\n+\tunsigned int size = sizeof(struct ibv_flow_spec_tunnel);\n+\tstruct ibv_flow_spec_tunnel tunnel = {\n+\t\t.type = IBV_FLOW_SPEC_VXLAN_TUNNEL,\n+\t\t.size = size,\n+\t};\n+#endif\n+\tint ret;\n+\n+\tif (layers & MLX5_FLOW_LAYER_TUNNEL)\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t\t  item,\n+\t\t\t\t\t  \"a tunnel is already present\");\n+\tif (!(layers & MLX5_FLOW_LAYER_OUTER_L3))\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t\t  item,\n+\t\t\t\t\t  \"L3 Layer is missing\");\n+\tif (!mask)\n+\t\tmask = &rte_flow_item_gre_mask;\n+\tret = mlx5_flow_item_validate\n+\t\t(item, (const uint8_t *)mask,\n+\t\t (const uint8_t *)&rte_flow_item_gre_mask,\n+\t\t sizeof(struct rte_flow_item_gre), error);\n+\tif (ret < 0)\n+\t\treturn ret;\n+#ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT\n+\tif (spec) {\n+\t\ttunnel.val.c_ks_res0_ver = spec->c_rsvd0_ver;\n+\t\ttunnel.val.protocol = spec->protocol;\n+\t\ttunnel.mask.c_ks_res0_ver = mask->c_rsvd0_ver;\n+\t\ttunnel.mask.protocol = mask->protocol;\n+\t\t/* Remove unwanted bits from values. */\n+\t\ttunnel.val.c_ks_res0_ver &= tunnel.mask.c_ks_res0_ver;\n+\t\ttunnel.val.protocol &= tunnel.mask.protocol;\n+\t\ttunnel.val.key &= tunnel.mask.key;\n+\t}\n+#else\n+\tif (spec && (spec->protocol & mask->protocol))\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t\t  item,\n+\t\t\t\t\t  \"without MPLS support the\"\n+\t\t\t\t\t  \" specification cannot be used for\"\n+\t\t\t\t\t  \" filtering\");\n+#endif /* !HAVE_IBV_DEVICE_MPLS_SUPPORT */\n+\tif (size <= flow_size) {\n+\t\tif (layers & MLX5_FLOW_LAYER_OUTER_L3_IPV4)\n+\t\t\tmlx5_flow_item_gre_ipv4_protocol_update\n+\t\t\t\t(verbs->attr, MLX5_PROTOCOL_GRE);\n+\t\telse\n+\t\t\tmlx5_flow_item_gre_ipv6_protocol_update\n+\t\t\t\t(verbs->attr, MLX5_PROTOCOL_GRE);\n+\t\tmlx5_flow_spec_verbs_add(flow, &tunnel, size);\n+\t}\n+\tmlx5_flow_layers_update(flow, MLX5_FLOW_LAYER_GRE);\n+\tflow->ptype = RTE_PTYPE_TUNNEL_GRE;\n+\treturn size;\n+}\n+\n /**\n  * Validate items provided by the user.\n  *\n@@ -1469,6 +1647,9 @@ mlx5_flow_items(struct rte_eth_dev *dev,\n \t\t\tret = mlx5_flow_item_vxlan_gpe(dev, items, flow,\n \t\t\t\t\t\t       remain, error);\n \t\t\tbreak;\n+\t\tcase RTE_FLOW_ITEM_TYPE_GRE:\n+\t\t\tret = mlx5_flow_item_gre(items, flow, remain, error);\n+\t\t\tbreak;\n \t\tdefault:\n \t\t\treturn rte_flow_error_set(error, ENOTSUP,\n \t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ITEM,\n",
    "prefixes": [
        "v2",
        "18/20"
    ]
}