get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 74357,
    "url": "http://patchwork.dpdk.org/api/patches/74357/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1594989070-27063-1-git-send-email-adwivedi@marvell.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<1594989070-27063-1-git-send-email-adwivedi@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1594989070-27063-1-git-send-email-adwivedi@marvell.com",
    "date": "2020-07-17T12:31:10",
    "name": "[v3] examples/ipsec-secgw: enable rte_flow based packet distribution",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "82ebdc1d39c249d8142de0431538c5d0223e7c88",
    "submitter": {
        "id": 1561,
        "url": "http://patchwork.dpdk.org/api/people/1561/?format=api",
        "name": "Ankur Dwivedi",
        "email": "adwivedi@marvell.com"
    },
    "delegate": {
        "id": 6690,
        "url": "http://patchwork.dpdk.org/api/users/6690/?format=api",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "gakhil@marvell.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1594989070-27063-1-git-send-email-adwivedi@marvell.com/mbox/",
    "series": [
        {
            "id": 11132,
            "url": "http://patchwork.dpdk.org/api/series/11132/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=11132",
            "date": "2020-07-17T12:31:10",
            "name": "[v3] examples/ipsec-secgw: enable rte_flow based packet distribution",
            "version": 3,
            "mbox": "http://patchwork.dpdk.org/series/11132/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/74357/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/74357/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 5A32FA053B;\n\tFri, 17 Jul 2020 14:31:42 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 032111C10A;\n\tFri, 17 Jul 2020 14:31:42 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id ABCF21C0D5\n for <dev@dpdk.org>; Fri, 17 Jul 2020 14:31:39 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n 06HCP9cS003395; Fri, 17 Jul 2020 05:31:38 -0700",
            "from sc-exch03.marvell.com ([199.233.58.183])\n by mx0b-0016f401.pphosted.com with ESMTP id 328mmj4d6q-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Fri, 17 Jul 2020 05:31:38 -0700",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH03.marvell.com\n (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Fri, 17 Jul 2020 05:31:36 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Fri, 17 Jul 2020 05:31:37 -0700",
            "from hyd1349.t110.caveonetworks.com (unknown [10.29.45.13])\n by maili.marvell.com (Postfix) with ESMTP id E45A63F703F;\n Fri, 17 Jul 2020 05:31:34 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-type; s=pfpt0818; bh=qXQq+1p+gvbVJ5UY7OkBm+vO1Gi8JfnQYTpdzzpEyeg=;\n b=sK8WMefoWPTiTFUlZb+GjjKri46eUWSzBHa5vPzRJkHzjbltBfyrF4yig2vO6kP2/WAq\n pelVs6bpqqQ+hVEOecGlrD0ICl3O78RK7yZtJ7Zncz2UUeGF9YAL93zq6yIYtmRADgU8\n 6m7vjgICVTBVy/ln+HshS5FAbY5Hjce6q1hpxnmwmhPrIVGEwWTqsxxcjkqEUGyFCCE3\n Gm/LyCOZJw4izcdRd7rp5/fVgm6WLVtdYDYEmwA9yKOjefalRCJqKrNI0CuO7rdkPcLV\n URrf1HKQ/pbj0KknWfInHkYpBf+dDPAdBQpQYyK4UkoviKz8vie3Tp4Q0c1xai78Vw1m 1w==",
        "From": "Ankur Dwivedi <adwivedi@marvell.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<akhil.goyal@nxp.com>, <praveen.shetty@intel.com>,\n <konstantin.ananyev@intel.com>, <radu.nicolau@intel.com>,\n <anoobj@marvell.com>",
        "Date": "Fri, 17 Jul 2020 18:01:10 +0530",
        "Message-ID": "<1594989070-27063-1-git-send-email-adwivedi@marvell.com>",
        "X-Mailer": "git-send-email 1.9.3",
        "In-Reply-To": "<1591780136-15113-1-git-send-email-adwivedi@marvell.com>",
        "References": "<1591780136-15113-1-git-send-email-adwivedi@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687\n definitions=2020-07-17_06:2020-07-17,\n 2020-07-17 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v3] examples/ipsec-secgw: enable rte_flow based\n\tpacket distribution",
        "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Anoob Joseph <anoobj@marvell.com>\n\nRTE_FLOW API allows hardware parsing and steering of packets to specific\nqueues which helps in distributing ingress traffic across various cores.\nAdding 'flow' rules allows user to specify the distribution required.\n\nSigned-off-by: Anoob Joseph <anoobj@marvell.com>\nAcked-by: Akhil Goyal <akhil.goyal@nxp.com>\n---\nv3:\n* Updated the release note with feature.\n* Rebased on recent dpdk-next-crypto.\n\nv2:\n* Removed Change-Id\n\n doc/guides/rel_notes/release_20_08.rst   |   5 +\n doc/guides/sample_app_ug/ipsec_secgw.rst |  78 ++++++++-\n examples/ipsec-secgw/Makefile            |   1 +\n examples/ipsec-secgw/flow.c              | 285 +++++++++++++++++++++++++++++++\n examples/ipsec-secgw/flow.h              |  15 ++\n examples/ipsec-secgw/ipsec-secgw.c       |   3 +\n examples/ipsec-secgw/ipsec-secgw.h       |   7 +\n examples/ipsec-secgw/ipsec.h             |   7 -\n examples/ipsec-secgw/meson.build         |  15 +-\n examples/ipsec-secgw/parser.c            |  46 +++++\n examples/ipsec-secgw/parser.h            |   7 +-\n 11 files changed, 455 insertions(+), 14 deletions(-)\n create mode 100644 examples/ipsec-secgw/flow.c\n create mode 100644 examples/ipsec-secgw/flow.h",
    "diff": "diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst\nindex 4883de34..f9c1213 100644\n--- a/doc/guides/rel_notes/release_20_08.rst\n+++ b/doc/guides/rel_notes/release_20_08.rst\n@@ -228,6 +228,11 @@ New Features\n   See the :doc:`../sample_app_ug/l2_forward_real_virtual` for more\n   details of this parameter usage.\n \n+* **Updated ipsec-secgw sample application.**\n+\n+  Added ``rte_flow`` based rules, which allows hardware parsing and steering\n+  of ingress packets to specific NIC queues.\n+  See the :doc:`../sample_app_ug/ipsec_secgw` for more details.\n \n Removed Items\n -------------\ndiff --git a/doc/guides/sample_app_ug/ipsec_secgw.rst b/doc/guides/sample_app_ug/ipsec_secgw.rst\nindex 81c5d43..434f484 100644\n--- a/doc/guides/sample_app_ug/ipsec_secgw.rst\n+++ b/doc/guides/sample_app_ug/ipsec_secgw.rst\n@@ -348,7 +348,7 @@ Configurations\n --------------\n \n The following sections provide the syntax of configurations to initialize\n-your SP, SA, Routing and Neighbour tables.\n+your SP, SA, Routing, Flow and Neighbour tables.\n Configurations shall be specified in the configuration file to be passed to\n the application. The file is then parsed by the application. The successful\n parsing will result in the appropriate rules being applied to the tables\n@@ -369,7 +369,7 @@ General rule syntax\n \n The parse treats one line in the configuration file as one configuration\n item (unless the line concatenation symbol exists). Every configuration\n-item shall follow the syntax of either SP, SA, Routing or Neighbour\n+item shall follow the syntax of either SP, SA, Routing, Flow or Neighbour\n rules specified below.\n \n The configuration parser supports the following special symbols:\n@@ -808,6 +808,80 @@ Example SP rules:\n \n     rt ipv6 dst 1111:1111:1111:1111:1111:1111:1111:5555/116 port 0\n \n+Flow rule syntax\n+^^^^^^^^^^^^^^^^\n+\n+Flow rule enables the usage of hardware classification capabilities to match specific\n+ingress traffic and redirect the packets to the specified queue. This feature is\n+optional and relies on hardware ``rte_flow`` support.\n+\n+The flow rule syntax is shown as follows:\n+\n+.. code-block:: console\n+\n+    flow <ip_ver> <src_ip> <dst_ip> <port> <queue>\n+\n+\n+where each options means:\n+\n+``<ip_ver>``\n+\n+ * IP protocol version\n+\n+ * Optional: No\n+\n+ * Available options:\n+\n+   * *ipv4*: IP protocol version 4\n+   * *ipv6*: IP protocol version 6\n+\n+``<src_ip>``\n+\n+ * The source IP address and mask\n+\n+ * Optional: Yes, default address 0.0.0.0 and mask of 0 will be used\n+\n+ * Syntax:\n+\n+   * *src X.X.X.X/Y* for IPv4\n+   * *src XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/Y* for IPv6\n+\n+``<dst_ip>``\n+\n+ * The destination IP address and mask\n+\n+ * Optional: Yes, default address 0.0.0.0 and mask of 0 will be used\n+\n+ * Syntax:\n+\n+   * *dst X.X.X.X/Y* for IPv4\n+   * *dst XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/Y* for IPv6\n+\n+``<port>``\n+\n+ * The traffic input port id\n+\n+ * Optional: yes, default input port 0 will be used\n+\n+ * Syntax: *port X*\n+\n+``<queue>``\n+\n+ * The traffic input queue id\n+\n+ * Optional: yes, default input queue 0 will be used\n+\n+ * Syntax: *queue X*\n+\n+Example flow rules:\n+\n+.. code-block:: console\n+\n+    flow ipv4 dst 172.16.1.5/32 port 0 queue 0\n+\n+    flow ipv6 dst 1111:1111:1111:1111:1111:1111:1111:5555/116 port 1 queue 0\n+\n+\n Neighbour rule syntax\n ^^^^^^^^^^^^^^^^^^^^^\n \ndiff --git a/examples/ipsec-secgw/Makefile b/examples/ipsec-secgw/Makefile\nindex ab15fca..b5ccbca 100644\n--- a/examples/ipsec-secgw/Makefile\n+++ b/examples/ipsec-secgw/Makefile\n@@ -18,6 +18,7 @@ SRCS-y += ipsec_process.c\n SRCS-y += ipsec-secgw.c\n SRCS-y += ipsec_worker.c\n SRCS-y += event_helper.c\n+SRCS-y += flow.c\n \n CFLAGS += -gdwarf-2\n \ndiff --git a/examples/ipsec-secgw/flow.c b/examples/ipsec-secgw/flow.c\nnew file mode 100644\nindex 0000000..69f8405\n--- /dev/null\n+++ b/examples/ipsec-secgw/flow.c\n@@ -0,0 +1,285 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (C) 2020 Marvell International Ltd.\n+ */\n+\n+#include <stdio.h>\n+\n+#include <rte_common.h>\n+#include <rte_flow.h>\n+#include <rte_ip.h>\n+\n+#include \"flow.h\"\n+#include \"ipsec-secgw.h\"\n+#include \"parser.h\"\n+\n+#define FLOW_RULES_MAX 128\n+\n+struct flow_rule_entry {\n+\tuint8_t is_ipv4;\n+\tRTE_STD_C11\n+\tunion {\n+\t\tstruct {\n+\t\t\tstruct rte_flow_item_ipv4 spec;\n+\t\t\tstruct rte_flow_item_ipv4 mask;\n+\t\t} ipv4;\n+\t\tstruct {\n+\t\t\tstruct rte_flow_item_ipv6 spec;\n+\t\t\tstruct rte_flow_item_ipv6 mask;\n+\t\t} ipv6;\n+\t};\n+\tuint16_t port;\n+\tuint16_t queue;\n+\tstruct rte_flow *flow;\n+} flow_rule_tbl[FLOW_RULES_MAX];\n+\n+int nb_flow_rule;\n+\n+static void\n+ipv4_hdr_print(struct rte_ipv4_hdr *hdr)\n+{\n+\tchar a, b, c, d;\n+\n+\tuint32_t_to_char(rte_bswap32(hdr->src_addr), &a, &b, &c, &d);\n+\tprintf(\"src: %3hhu.%3hhu.%3hhu.%3hhu \\t\", a, b, c, d);\n+\n+\tuint32_t_to_char(rte_bswap32(hdr->dst_addr), &a, &b, &c, &d);\n+\tprintf(\"dst: %3hhu.%3hhu.%3hhu.%3hhu\", a, b, c, d);\n+}\n+\n+static int\n+ipv4_addr_cpy(rte_be32_t *spec, rte_be32_t *mask, char *token,\n+\t      struct parse_status *status)\n+{\n+\tstruct in_addr ip;\n+\tuint32_t depth;\n+\n+\tAPP_CHECK(parse_ipv4_addr(token, &ip, &depth) == 0, status,\n+\t\t \"unrecognized input \\\"%s\\\", expect valid ipv4 addr\", token);\n+\tif (status->status < 0)\n+\t\treturn -1;\n+\n+\tif (depth > 32)\n+\t\treturn -1;\n+\n+\tmemcpy(mask, &rte_flow_item_ipv4_mask.hdr.src_addr, sizeof(ip));\n+\n+\t*spec = ip.s_addr;\n+\tif (depth < 32)\n+\t\t*mask = *mask << (32-depth);\n+\n+\treturn 0;\n+}\n+\n+static void\n+ipv6_hdr_print(struct rte_ipv6_hdr *hdr)\n+{\n+\tuint8_t *addr;\n+\n+\taddr = hdr->src_addr;\n+\tprintf(\"src: %4hx:%4hx:%4hx:%4hx:%4hx:%4hx:%4hx:%4hx \\t\",\n+\t       (uint16_t)((addr[0] << 8) | addr[1]),\n+\t       (uint16_t)((addr[2] << 8) | addr[3]),\n+\t       (uint16_t)((addr[4] << 8) | addr[5]),\n+\t       (uint16_t)((addr[6] << 8) | addr[7]),\n+\t       (uint16_t)((addr[8] << 8) | addr[9]),\n+\t       (uint16_t)((addr[10] << 8) | addr[11]),\n+\t       (uint16_t)((addr[12] << 8) | addr[13]),\n+\t       (uint16_t)((addr[14] << 8) | addr[15]));\n+\n+\taddr = hdr->dst_addr;\n+\tprintf(\"dst: %4hx:%4hx:%4hx:%4hx:%4hx:%4hx:%4hx:%4hx\",\n+\t       (uint16_t)((addr[0] << 8) | addr[1]),\n+\t       (uint16_t)((addr[2] << 8) | addr[3]),\n+\t       (uint16_t)((addr[4] << 8) | addr[5]),\n+\t       (uint16_t)((addr[6] << 8) | addr[7]),\n+\t       (uint16_t)((addr[8] << 8) | addr[9]),\n+\t       (uint16_t)((addr[10] << 8) | addr[11]),\n+\t       (uint16_t)((addr[12] << 8) | addr[13]),\n+\t       (uint16_t)((addr[14] << 8) | addr[15]));\n+}\n+\n+static int\n+ipv6_addr_cpy(uint8_t *spec, uint8_t *mask, char *token,\n+\t      struct parse_status *status)\n+{\n+\tstruct in6_addr ip;\n+\tuint32_t depth, i;\n+\n+\tAPP_CHECK(parse_ipv6_addr(token, &ip, &depth) == 0, status,\n+\t\t\"unrecognized input \\\"%s\\\", expect valid ipv6 address\", token);\n+\tif (status->status < 0)\n+\t\treturn -1;\n+\n+\tmemcpy(mask, &rte_flow_item_ipv6_mask.hdr.src_addr, sizeof(ip));\n+\tmemcpy(spec, ip.s6_addr, sizeof(struct in6_addr));\n+\n+\tfor (i = 0; i < depth && (i%8 <= sizeof(struct in6_addr)); i++)\n+\t\tmask[i/8] &= ~(1 << (7-i%8));\n+\n+\treturn 0;\n+}\n+\n+void\n+parse_flow_tokens(char **tokens, uint32_t n_tokens,\n+\t\t  struct parse_status *status)\n+{\n+\tstruct flow_rule_entry *rule;\n+\tuint32_t ti;\n+\n+\tif (nb_flow_rule >= FLOW_RULES_MAX) {\n+\t\tprintf(\"Too many flow rules\\n\");\n+\t\treturn;\n+\t}\n+\n+\trule = &flow_rule_tbl[nb_flow_rule];\n+\tmemset(rule, 0, sizeof(*rule));\n+\n+\tif (strcmp(tokens[0], \"ipv4\") == 0) {\n+\t\trule->is_ipv4 = 1;\n+\t} else if (strcmp(tokens[0], \"ipv6\") == 0) {\n+\t\trule->is_ipv4 = 0;\n+\t} else {\n+\t\tAPP_CHECK(0, status, \"unrecognized input \\\"%s\\\"\", tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tfor (ti = 1; ti < n_tokens; ti++) {\n+\t\tif (strcmp(tokens[ti], \"src\") == 0) {\n+\t\t\tINCREMENT_TOKEN_INDEX(ti, n_tokens, status);\n+\t\t\tif (status->status < 0)\n+\t\t\t\treturn;\n+\n+\t\t\tif (rule->is_ipv4) {\n+\t\t\t\tif (ipv4_addr_cpy(&rule->ipv4.spec.hdr.src_addr,\n+\t\t\t\t\t\t  &rule->ipv4.mask.hdr.src_addr,\n+\t\t\t\t\t\t  tokens[ti], status))\n+\t\t\t\t\treturn;\n+\t\t\t} else {\n+\t\t\t\tif (ipv6_addr_cpy(rule->ipv6.spec.hdr.src_addr,\n+\t\t\t\t\t\t  rule->ipv6.mask.hdr.src_addr,\n+\t\t\t\t\t\t  tokens[ti], status))\n+\t\t\t\t\treturn;\n+\t\t\t}\n+\t\t}\n+\t\tif (strcmp(tokens[ti], \"dst\") == 0) {\n+\t\t\tINCREMENT_TOKEN_INDEX(ti, n_tokens, status);\n+\t\t\tif (status->status < 0)\n+\t\t\t\treturn;\n+\n+\t\t\tif (rule->is_ipv4) {\n+\t\t\t\tif (ipv4_addr_cpy(&rule->ipv4.spec.hdr.dst_addr,\n+\t\t\t\t\t\t  &rule->ipv4.mask.hdr.dst_addr,\n+\t\t\t\t\t\t  tokens[ti], status))\n+\t\t\t\t\treturn;\n+\t\t\t} else {\n+\t\t\t\tif (ipv6_addr_cpy(rule->ipv6.spec.hdr.dst_addr,\n+\t\t\t\t\t\t  rule->ipv6.mask.hdr.dst_addr,\n+\t\t\t\t\t\t  tokens[ti], status))\n+\t\t\t\t\treturn;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (strcmp(tokens[ti], \"port\") == 0) {\n+\t\t\tINCREMENT_TOKEN_INDEX(ti, n_tokens, status);\n+\t\t\tif (status->status < 0)\n+\t\t\t\treturn;\n+\t\t\tAPP_CHECK_TOKEN_IS_NUM(tokens, ti, status);\n+\t\t\tif (status->status < 0)\n+\t\t\t\treturn;\n+\n+\t\t\trule->port = atoi(tokens[ti]);\n+\n+\t\t\tINCREMENT_TOKEN_INDEX(ti, n_tokens, status);\n+\t\t\tif (status->status < 0)\n+\t\t\t\treturn;\n+\t\t\tAPP_CHECK_TOKEN_IS_NUM(tokens, ti, status);\n+\t\t\tif (status->status < 0)\n+\t\t\t\treturn;\n+\n+\t\t\trule->queue = atoi(tokens[ti]);\n+\t\t}\n+\t}\n+\n+\tnb_flow_rule++;\n+}\n+\n+#define MAX_RTE_FLOW_PATTERN (3)\n+#define MAX_RTE_FLOW_ACTIONS (2)\n+\n+static void\n+flow_init_single(struct flow_rule_entry *rule)\n+{\n+\tstruct rte_flow_item pattern[MAX_RTE_FLOW_PATTERN] = {};\n+\tstruct rte_flow_action action[MAX_RTE_FLOW_ACTIONS] = {};\n+\tstruct rte_flow_attr attr = {};\n+\tstruct rte_flow_error err;\n+\tint ret;\n+\n+\tattr.egress = 0;\n+\tattr.ingress = 1;\n+\n+\taction[0].type = RTE_FLOW_ACTION_TYPE_QUEUE;\n+\taction[0].conf = &(struct rte_flow_action_queue) {\n+\t\t\t\t.index = rule->queue,\n+\t};\n+\taction[1].type = RTE_FLOW_ACTION_TYPE_END;\n+\n+\tpattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;\n+\n+\tif (rule->is_ipv4) {\n+\t\tpattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4;\n+\t\tpattern[1].spec = &rule->ipv4.spec;\n+\t\tpattern[1].mask = &rule->ipv4.mask;\n+\t} else {\n+\t\tpattern[1].type = RTE_FLOW_ITEM_TYPE_IPV6;\n+\t\tpattern[1].spec = &rule->ipv6.spec;\n+\t\tpattern[1].mask = &rule->ipv6.mask;\n+\t}\n+\n+\tpattern[2].type = RTE_FLOW_ITEM_TYPE_END;\n+\n+\tret = rte_flow_validate(rule->port, &attr, pattern, action, &err);\n+\tif (ret < 0) {\n+\t\tRTE_LOG(ERR, IPSEC, \"Flow validation failed %s\\n\", err.message);\n+\t\treturn;\n+\t}\n+\n+\trule->flow = rte_flow_create(rule->port, &attr, pattern, action, &err);\n+\tif (rule->flow == NULL)\n+\t\tRTE_LOG(ERR, IPSEC, \"Flow creation return %s\\n\", err.message);\n+}\n+\n+void\n+flow_init(void)\n+{\n+\tstruct flow_rule_entry *rule;\n+\tint i;\n+\n+\tfor (i = 0; i < nb_flow_rule; i++) {\n+\t\trule = &flow_rule_tbl[i];\n+\t\tflow_init_single(rule);\n+\t}\n+\n+\tfor (i = 0; i < nb_flow_rule; i++) {\n+\t\trule = &flow_rule_tbl[i];\n+\t\tif (rule->is_ipv4) {\n+\t\t\tprintf(\"Flow #%3d: spec ipv4 \", i);\n+\t\t\tipv4_hdr_print(&rule->ipv4.spec.hdr);\n+\t\t\tprintf(\"\\n\");\n+\t\t\tprintf(\"           mask ipv4 \");\n+\t\t\tipv4_hdr_print(&rule->ipv4.mask.hdr);\n+\t\t} else {\n+\t\t\tprintf(\"Flow #%3d: spec ipv6 \", i);\n+\t\t\tipv6_hdr_print(&rule->ipv6.spec.hdr);\n+\t\t\tprintf(\"\\n\");\n+\t\t\tprintf(\"           mask ipv6 \");\n+\t\t\tipv6_hdr_print(&rule->ipv6.mask.hdr);\n+\t\t}\n+\n+\t\tprintf(\"\\tPort: %d, Queue: %d\", rule->port, rule->queue);\n+\n+\t\tif (rule->flow == NULL)\n+\t\t\tprintf(\" [UNSUPPORTED]\");\n+\t\tprintf(\"\\n\");\n+\t}\n+}\ndiff --git a/examples/ipsec-secgw/flow.h b/examples/ipsec-secgw/flow.h\nnew file mode 100644\nindex 0000000..1b1b477\n--- /dev/null\n+++ b/examples/ipsec-secgw/flow.h\n@@ -0,0 +1,15 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (C) 2020 Marvell International Ltd.\n+ */\n+\n+#ifndef _FLOW_H_\n+#define _FLOW_H_\n+\n+#include \"parser.h\"\n+\n+void parse_flow_tokens(char **tokens, uint32_t n_tokens,\n+\t\t       struct parse_status *status);\n+\n+void flow_init(void);\n+\n+#endif /* _FLOW_H_ */\ndiff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c\nindex 6f6abac..8ba15d2 100644\n--- a/examples/ipsec-secgw/ipsec-secgw.c\n+++ b/examples/ipsec-secgw/ipsec-secgw.c\n@@ -50,6 +50,7 @@\n #include <rte_alarm.h>\n \n #include \"event_helper.h\"\n+#include \"flow.h\"\n #include \"ipsec.h\"\n #include \"ipsec_worker.h\"\n #include \"parser.h\"\n@@ -2980,6 +2981,8 @@ struct lcore_conf {\n \t\t}\n \t}\n \n+\tflow_init();\n+\n \tcheck_all_ports_link_status(enabled_port_mask);\n \n #if (STATS_INTERVAL > 0)\ndiff --git a/examples/ipsec-secgw/ipsec-secgw.h b/examples/ipsec-secgw/ipsec-secgw.h\nindex 572a930..f2281e7 100644\n--- a/examples/ipsec-secgw/ipsec-secgw.h\n+++ b/examples/ipsec-secgw/ipsec-secgw.h\n@@ -38,6 +38,13 @@\n \t((uint64_t)(a) & 0xff))\n #endif\n \n+#define uint32_t_to_char(ip, a, b, c, d) do {\\\n+\t\t*a = (uint8_t)(ip >> 24 & 0xff);\\\n+\t\t*b = (uint8_t)(ip >> 16 & 0xff);\\\n+\t\t*c = (uint8_t)(ip >> 8 & 0xff);\\\n+\t\t*d = (uint8_t)(ip & 0xff);\\\n+\t} while (0)\n+\n #define ETHADDR(a, b, c, d, e, f) (__BYTES_TO_UINT64(a, b, c, d, e, f, 0, 0))\n \n struct traffic_type {\ndiff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h\nindex 2f69199..7031e28 100644\n--- a/examples/ipsec-secgw/ipsec.h\n+++ b/examples/ipsec-secgw/ipsec.h\n@@ -28,13 +28,6 @@\n #define IV_OFFSET\t\t(sizeof(struct rte_crypto_op) + \\\n \t\t\t\tsizeof(struct rte_crypto_sym_op))\n \n-#define uint32_t_to_char(ip, a, b, c, d) do {\\\n-\t\t*a = (uint8_t)(ip >> 24 & 0xff);\\\n-\t\t*b = (uint8_t)(ip >> 16 & 0xff);\\\n-\t\t*c = (uint8_t)(ip >> 8 & 0xff);\\\n-\t\t*d = (uint8_t)(ip & 0xff);\\\n-\t} while (0)\n-\n #define DEFAULT_MAX_CATEGORIES\t1\n \n #define INVALID_SPI (0)\ndiff --git a/examples/ipsec-secgw/meson.build b/examples/ipsec-secgw/meson.build\nindex f9ba2a2..d0373da 100644\n--- a/examples/ipsec-secgw/meson.build\n+++ b/examples/ipsec-secgw/meson.build\n@@ -9,6 +9,17 @@\n deps += ['security', 'lpm', 'acl', 'hash', 'ip_frag', 'ipsec', 'eventdev']\n allow_experimental_apis = true\n sources = files(\n-\t'esp.c', 'event_helper.c', 'ipsec.c', 'ipsec_process.c', 'ipsec-secgw.c',\n-\t'ipsec_worker.c', 'parser.c', 'rt.c', 'sa.c', 'sad.c', 'sp4.c', 'sp6.c'\n+\t'esp.c',\n+\t'event_helper.c',\n+\t'flow.c',\n+\t'ipsec.c',\n+\t'ipsec_process.c',\n+\t'ipsec-secgw.c',\n+\t'ipsec_worker.c',\n+\t'parser.c',\n+\t'rt.c',\n+\t'sa.c',\n+\t'sad.c',\n+\t'sp4.c',\n+\t'sp6.c'\n )\ndiff --git a/examples/ipsec-secgw/parser.c b/examples/ipsec-secgw/parser.c\nindex 65eb7e9..8f66660 100644\n--- a/examples/ipsec-secgw/parser.c\n+++ b/examples/ipsec-secgw/parser.c\n@@ -11,6 +11,7 @@\n #include <cmdline_socket.h>\n #include <cmdline.h>\n \n+#include \"flow.h\"\n #include \"ipsec.h\"\n #include \"parser.h\"\n \n@@ -484,6 +485,49 @@ struct cfg_rt_add_cfg_item {\n \t},\n };\n \n+/* flow add parse */\n+struct cfg_flow_add_cfg_item {\n+\tcmdline_fixed_string_t flow_keyword;\n+\tcmdline_multi_string_t multi_string;\n+};\n+\n+static void\n+cfg_flow_add_cfg_item_parsed(void *parsed_result,\n+\t__rte_unused struct cmdline *cl, void *data)\n+{\n+\tstruct cfg_flow_add_cfg_item *params = parsed_result;\n+\tchar *tokens[32];\n+\tuint32_t n_tokens = RTE_DIM(tokens);\n+\tstruct parse_status *status = (struct parse_status *)data;\n+\n+\tAPP_CHECK(parse_tokenize_string(\n+\t\tparams->multi_string, tokens, &n_tokens) == 0,\n+\t\tstatus, \"too many arguments\\n\");\n+\tif (status->status < 0)\n+\t\treturn;\n+\n+\tparse_flow_tokens(tokens, n_tokens, status);\n+}\n+\n+static cmdline_parse_token_string_t cfg_flow_add_flow_str =\n+\tTOKEN_STRING_INITIALIZER(struct cfg_flow_add_cfg_item,\n+\t\tflow_keyword, \"flow\");\n+\n+static cmdline_parse_token_string_t cfg_flow_add_multi_str =\n+\tTOKEN_STRING_INITIALIZER(struct cfg_flow_add_cfg_item, multi_string,\n+\t\tTOKEN_STRING_MULTI);\n+\n+cmdline_parse_inst_t cfg_flow_add_rule = {\n+\t.f = cfg_flow_add_cfg_item_parsed,\n+\t.data = NULL,\n+\t.help_str = \"\",\n+\t.tokens = {\n+\t\t(void *) &cfg_flow_add_flow_str,\n+\t\t(void *) &cfg_flow_add_multi_str,\n+\t\tNULL,\n+\t},\n+};\n+\n /* neigh add parse */\n struct cfg_neigh_add_item {\n \tcmdline_fixed_string_t neigh;\n@@ -538,6 +582,7 @@ struct cfg_neigh_add_item {\n \t(cmdline_parse_inst_t *)&cfg_sp_add_rule,\n \t(cmdline_parse_inst_t *)&cfg_sa_add_rule,\n \t(cmdline_parse_inst_t *)&cfg_rt_add_rule,\n+\t(cmdline_parse_inst_t *)&cfg_flow_add_rule,\n \t(cmdline_parse_inst_t *)&cfg_neigh_add_rule,\n \tNULL,\n };\n@@ -564,6 +609,7 @@ struct cfg_neigh_add_item {\n \tcfg_sp_add_rule.data = &status;\n \tcfg_sa_add_rule.data = &status;\n \tcfg_rt_add_rule.data = &status;\n+\tcfg_flow_add_rule.data = &status;\n \tcfg_neigh_add_rule.data = &status;\n \n \tdo {\ndiff --git a/examples/ipsec-secgw/parser.h b/examples/ipsec-secgw/parser.h\nindex 6e764fe..a0ff7e1 100644\n--- a/examples/ipsec-secgw/parser.h\n+++ b/examples/ipsec-secgw/parser.h\n@@ -2,12 +2,13 @@\n  * Copyright(c) 2016 Intel Corporation\n  */\n \n+#ifndef __PARSER_H\n+#define __PARSER_H\n+\n #include <sys/types.h>\n #include <netinet/in.h>\n #include <netinet/ip.h>\n-\n-#ifndef __PARSER_H\n-#define __PARSER_H\n+#include <string.h>\n \n struct parse_status {\n \tint status;\n",
    "prefixes": [
        "v3"
    ]
}