Show a patch.

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

{
    "id": 42958,
    "url": "http://patches.dpdk.org/api/patches/42958/",
    "web_url": "http://patches.dpdk.org/patch/42958/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<9cb634f4990a421a9328aa1e71714a2933c8ebea.1531387413.git.nelio.laranjeiro@6wind.com>",
    "date": "2018-07-12T09:30:57",
    "name": "[v4,11/21] net/mlx5: add flow TCP item",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "bf4fee0d09673dbf59c32eb9aaa539dd503aecb4",
    "submitter": {
        "id": 243,
        "url": "http://patches.dpdk.org/api/people/243/",
        "name": "Nélio Laranjeiro",
        "email": "nelio.laranjeiro@6wind.com"
    },
    "delegate": {
        "id": 6624,
        "url": "http://patches.dpdk.org/api/users/6624/",
        "username": "shahafs",
        "first_name": "Shahaf",
        "last_name": "Shuler",
        "email": "shahafs@mellanox.com"
    },
    "mbox": "http://patches.dpdk.org/patch/42958/mbox/",
    "series": [
        {
            "id": 544,
            "url": "http://patches.dpdk.org/api/series/544/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=544",
            "date": "2018-07-12T09:30:46",
            "name": "net/mlx5: flow rework",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/544/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42958/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/42958/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "In-Reply-To": "<cover.1531387413.git.nelio.laranjeiro@6wind.com>",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 2.18.0",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 152031B5EF;\n\tThu, 12 Jul 2018 11:31:52 +0200 (CEST)",
            "from mail-wr1-f67.google.com (mail-wr1-f67.google.com\n\t[209.85.221.67]) by dpdk.org (Postfix) with ESMTP id D69A21B57B\n\tfor <dev@dpdk.org>; Thu, 12 Jul 2018 11:31:34 +0200 (CEST)",
            "by mail-wr1-f67.google.com with SMTP id c13-v6so20921669wrt.1\n\tfor <dev@dpdk.org>; Thu, 12 Jul 2018 02:31:34 -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\ts2-v6sm18717603wrn.75.2018.07.12.02.31.33\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 12 Jul 2018 02:31:33 -0700 (PDT)"
        ],
        "References": "<cover.1531293415.git.nelio.laranjeiro@6wind.com>\n\t<cover.1531387413.git.nelio.laranjeiro@6wind.com>",
        "X-Google-Smtp-Source": "AAOMgpdwKNDcFzRKnDCIMSZR1YKzQDOPFdKYl0CCZKNttIg8ErDSXLr+jJ3KxF8//DCgbt6AxLfK1Q==",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=+jIgZdPvzrOLEyYIES6ZvqCP8B4B6iee7ZK4xNloXdU=;\n\tb=y8MFaQXc7e3EnsWbK4yeU7aIKmKQhlgqYByFD8RhIG8QPoFAXqItqgYvTrEace7rSA\n\tDiwLLD5E7E+74BWqL9w5DbGuY7ZAxJEoq0E1wlvvQI4s2TV1RznGjlz71CxLUagJ0S+F\n\th5wou/W1/PLstUBsy13cG5LzZSuAvy/ehdvOO5+rsPZR5nbrXjYrr1S/rSTfH4gNNvR8\n\taHag2IXrKpwtuWSoTTB5JMbTB1fa034K9ySBDNgbLXLz30y7yFg2fSog5QdikjSwXMUD\n\tApNvJttkGuCVT3nPR8nkVwxR7+7qVY4mjKft4cvq1Oa2F+XvpFJ0bzA7+4N42MLqPm31\n\tyM7Q==",
        "X-BeenThere": "dev@dpdk.org",
        "X-Received": "by 2002:adf:8541:: with SMTP id\n\t59-v6mr1062475wrh.223.1531387894442; \n\tThu, 12 Jul 2018 02:31:34 -0700 (PDT)",
        "Message-Id": "<9cb634f4990a421a9328aa1e71714a2933c8ebea.1531387413.git.nelio.laranjeiro@6wind.com>",
        "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:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=+jIgZdPvzrOLEyYIES6ZvqCP8B4B6iee7ZK4xNloXdU=;\n\tb=Jxzi8zO+HaQXHUm1miMUiX6OdAYOUwq4hpw1mguGMRfSDZYXcTmC6nlqYhMPGBYA+3\n\tUrFBNS4Cn0lYJ1tQwc51aGSqruWISC57qEwZS+IJ3G4sf2SF0mtPE7ToElYMM8auVr8c\n\t/mBqV8JPv7J2yUhnP7UwN94A2F3GVF3PA8kYaroNW26WW9bqX2dAxAjWBTK9a3HKDMF8\n\tXTn/tJgaPF2Fglc716epHfApdiIRUBe+CMyEHjJc85BTUPG5aMGDLdwAPelcahJrv2Im\n\t/t0cpzyCtIDCoalnBk9VMT3cxTeTtjUwYHF4WifNzYZ/5CRq4gFcg5L/YWvFQf/3X5NN\n\tMs9w==",
        "Delivered-To": "patchwork@dpdk.org",
        "Precedence": "list",
        "From": "Nelio Laranjeiro <nelio.laranjeiro@6wind.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@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>",
        "To": "dev@dpdk.org,\n\tYongseok Koh <yskoh@mellanox.com>",
        "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>",
        "Date": "Thu, 12 Jul 2018 11:30:57 +0200",
        "X-Gm-Message-State": "AOUpUlEkCCBkr5i1ZqwuBDX6ASm+gJZfuPqbM0n8Yg3issbLfJhQhgmi\n\tLKE09dupoLxcuz6hzCTl19z2FqVvNA==",
        "Cc": "Adrien Mazarguil <adrien.mazarguil@6wind.com>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v4 11/21] net/mlx5: add flow TCP item"
    },
    "content": "Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>\nAcked-by: Yongseok Koh <yskoh@mellanox.com>\n---\n drivers/net/mlx5/mlx5_flow.c | 79 ++++++++++++++++++++++++++++++++++++\n 1 file changed, 79 insertions(+)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c\nindex 0096ed8a2..f646eee01 100644\n--- a/drivers/net/mlx5/mlx5_flow.c\n+++ b/drivers/net/mlx5/mlx5_flow.c\n@@ -53,6 +53,7 @@ extern const struct eth_dev_ops mlx5_dev_ops_isolate;\n #define MLX5_FLOW_FATE_QUEUE (1u << 1)\n \n /* possible L3 layers protocols filtering. */\n+#define MLX5_IP_PROTOCOL_TCP 6\n #define MLX5_IP_PROTOCOL_UDP 17\n \n /** Handles information leading to a drop fate. */\n@@ -787,6 +788,81 @@ mlx5_flow_item_udp(const struct rte_flow_item *item, struct rte_flow *flow,\n \treturn size;\n }\n \n+/**\n+ * Convert the @p item into a Verbs specification after ensuring the NIC\n+ * will understand and process it correctly.\n+ * If the necessary size for the conversion is greater than the @p flow_size,\n+ * nothing is written in @p flow, the validation is still performed.\n+ *\n+ * @param[in] item\n+ *   Item specification.\n+ * @param[in, out] flow\n+ *   Pointer to flow structure.\n+ * @param[in] flow_size\n+ *   Size in bytes of the available space in @p flow, if too small, nothing is\n+ *   written.\n+ * @param[out] error\n+ *   Pointer to error structure.\n+ *\n+ * @return\n+ *   On success the number of bytes consumed/necessary, if the returned value\n+ *   is lesser or equal to @p flow_size, the @p item has fully been converted,\n+ *   otherwise another call with this returned memory size should be done.\n+ *   On error, a negative errno value is returned and rte_errno is set.\n+ */\n+static int\n+mlx5_flow_item_tcp(const struct rte_flow_item *item, struct rte_flow *flow,\n+\t\t   const size_t flow_size, struct rte_flow_error *error)\n+{\n+\tconst struct rte_flow_item_tcp *spec = item->spec;\n+\tconst struct rte_flow_item_tcp *mask = item->mask;\n+\tunsigned int size = sizeof(struct ibv_flow_spec_tcp_udp);\n+\tstruct ibv_flow_spec_tcp_udp tcp = {\n+\t\t.type = IBV_FLOW_SPEC_TCP,\n+\t\t.size = size,\n+\t};\n+\tint ret;\n+\n+\tif (flow->l3_protocol_en && flow->l3_protocol != MLX5_IP_PROTOCOL_TCP)\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  \"protocol filtering not compatible\"\n+\t\t\t\t\t  \" with TCP layer\");\n+\tif (!(flow->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 is mandatory to filter on L4\");\n+\tif (flow->layers & MLX5_FLOW_LAYER_OUTER_L4)\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  \"L4 layer is already present\");\n+\tif (!mask)\n+\t\tmask = &rte_flow_item_tcp_mask;\n+\tret = mlx5_flow_item_acceptable\n+\t\t(item, (const uint8_t *)mask,\n+\t\t (const uint8_t *)&rte_flow_item_tcp_mask,\n+\t\t sizeof(struct rte_flow_item_tcp), error);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\tflow->layers |= MLX5_FLOW_LAYER_OUTER_L4_TCP;\n+\tif (size > flow_size)\n+\t\treturn size;\n+\tif (spec) {\n+\t\ttcp.val.dst_port = spec->hdr.dst_port;\n+\t\ttcp.val.src_port = spec->hdr.src_port;\n+\t\ttcp.mask.dst_port = mask->hdr.dst_port;\n+\t\ttcp.mask.src_port = mask->hdr.src_port;\n+\t\t/* Remove unwanted bits from values. */\n+\t\ttcp.val.src_port &= tcp.mask.src_port;\n+\t\ttcp.val.dst_port &= tcp.mask.dst_port;\n+\t}\n+\tmlx5_flow_spec_verbs_add(flow, &tcp, size);\n+\treturn size;\n+}\n+\n /**\n  * Convert the @p pattern into a Verbs specifications after ensuring the NIC\n  * will understand and process it correctly.\n@@ -841,6 +917,9 @@ mlx5_flow_items(const struct rte_flow_item pattern[],\n \t\tcase RTE_FLOW_ITEM_TYPE_UDP:\n \t\t\tret = mlx5_flow_item_udp(pattern, flow, remain, error);\n \t\t\tbreak;\n+\t\tcase RTE_FLOW_ITEM_TYPE_TCP:\n+\t\t\tret = mlx5_flow_item_tcp(pattern, 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": [
        "v4",
        "11/21"
    ]
}