get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 76034,
    "url": "http://patches.dpdk.org/api/patches/76034/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200826151445.51500-40-cristian.dumitrescu@intel.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": "<20200826151445.51500-40-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200826151445.51500-40-cristian.dumitrescu@intel.com",
    "date": "2020-08-26T15:14:44",
    "name": "[39/40] examples/pipeline: add l2fwd with MAC swap example",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9c30808d2aed6b96e02119bb831be88ff0abcf17",
    "submitter": {
        "id": 19,
        "url": "http://patches.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200826151445.51500-40-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 11806,
            "url": "http://patches.dpdk.org/api/series/11806/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11806",
            "date": "2020-08-26T15:14:05",
            "name": "Pipeline alignment with the P4 language",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/11806/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/76034/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/76034/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 63963A04B1;\n\tWed, 26 Aug 2020 17:24:25 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 338C91C2DD;\n\tWed, 26 Aug 2020 17:15:57 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by dpdk.org (Postfix) with ESMTP id 303031C195\n for <dev@dpdk.org>; Wed, 26 Aug 2020 17:15:31 +0200 (CEST)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 26 Aug 2020 08:15:29 -0700",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.107])\n by orsmga004.jf.intel.com with ESMTP; 26 Aug 2020 08:15:29 -0700"
        ],
        "IronPort-SDR": [
            "\n eKB/TzKBCBZNqujk7ghOJu2Ijjm8ML8gnbKgxcddPDbsPcnGJVL+Vzj9S8R+LuyR1aTTjvOzoq\n IrX1oAOY3L8Q==",
            "\n 2hlpZI+zgsDdwHOL6ia8YMatEnlitT9W/9Ldy/Y+khfg7W/9ApTwWs65/FJJ0SF7HhmTbfEjTA\n RTtEF0qPjuuw=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9725\"; a=\"153879643\"",
            "E=Sophos;i=\"5.76,356,1592895600\"; d=\"scan'208\";a=\"153879643\"",
            "E=Sophos;i=\"5.76,356,1592895600\"; d=\"scan'208\";a=\"444081505\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed, 26 Aug 2020 16:14:44 +0100",
        "Message-Id": "<20200826151445.51500-40-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200826151445.51500-1-cristian.dumitrescu@intel.com>",
        "References": "<20200826151445.51500-1-cristian.dumitrescu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 39/40] examples/pipeline: add l2fwd with MAC swap\n\texample",
        "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": "Add L2 Forwarding example with MAC destination and source address swap\nto the pipeline application. Example command line:\n./build/pipeline -l0-1 -- -s ./examples/l2fwd_macswp.cli\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n examples/pipeline/Makefile                    |   2 +\n examples/pipeline/cli.c                       |   4 +\n examples/pipeline/example_l2fwd_macswp.c      | 146 ++++++++++++++++++\n examples/pipeline/examples/l2fwd_macswp.cli   |  25 +++\n .../pipeline/examples/l2fwd_macswp_pcap.cli   |  20 +++\n examples/pipeline/meson.build                 |   1 +\n 6 files changed, 198 insertions(+)\n create mode 100644 examples/pipeline/example_l2fwd_macswp.c\n create mode 100644 examples/pipeline/examples/l2fwd_macswp.cli\n create mode 100644 examples/pipeline/examples/l2fwd_macswp_pcap.cli",
    "diff": "diff --git a/examples/pipeline/Makefile b/examples/pipeline/Makefile\nindex 405978ced..df5176296 100644\n--- a/examples/pipeline/Makefile\n+++ b/examples/pipeline/Makefile\n@@ -11,6 +11,8 @@ SRCS-y += main.c\n SRCS-y += obj.c\n SRCS-y += thread.c\n SRCS-y += example_l2fwd.c\n+SRCS-y += example_l2fwd_macswp.c\n+\n \n # Build using pkg-config variables if possible\n ifeq ($(shell pkg-config --exists libdpdk && echo 0),0)\ndiff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c\nindex a54cd79ff..9547e1b4c 100644\n--- a/examples/pipeline/cli.c\n+++ b/examples/pipeline/cli.c\n@@ -731,6 +731,8 @@ static const char cmd_pipeline_build_help[] =\n \"pipeline <pipeline_name> build <app>\\n\";\n \n int pipeline_setup_l2fwd(struct rte_swx_pipeline *p);\n+int pipeline_setup_l2fwd_macswp(struct rte_swx_pipeline *p);\n+\n static void\n cmd_pipeline_build(char **tokens,\n \tuint32_t n_tokens,\n@@ -757,6 +759,8 @@ cmd_pipeline_build(char **tokens,\n \tapp = tokens[3];\n \tif (!strcmp(app, \"l2fwd\"))\n \t\tstatus = pipeline_setup_l2fwd(p->p);\n+\telse if (!strcmp(app, \"l2fwd_macswp\"))\n+\t\tstatus = pipeline_setup_l2fwd_macswp(p->p);\n \telse {\n \t\tsnprintf(out, out_size, MSG_ARG_INVALID, tokens[0]);\n \t\treturn;\ndiff --git a/examples/pipeline/example_l2fwd_macswp.c b/examples/pipeline/example_l2fwd_macswp.c\nnew file mode 100644\nindex 000000000..7922a75aa\n--- /dev/null\n+++ b/examples/pipeline/example_l2fwd_macswp.c\n@@ -0,0 +1,146 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2020 Intel Corporation\n+ */\n+#include <stdlib.h>\n+#include <string.h>\n+#include <stdio.h>\n+\n+#include <rte_common.h>\n+\n+#include \"rte_swx_pipeline.h\"\n+#include \"rte_swx_port_ethdev.h\"\n+#include \"rte_swx_port_source_sink.h\"\n+#include \"rte_swx_table_em.h\"\n+\n+#define CHECK(condition)                                                       \\\n+do {                                                                           \\\n+\tif (!(condition)) {                                                    \\\n+\t\tprintf(\"Error in function %s at line %d\\n\",                    \\\n+\t\t\t__FUNCTION__, __LINE__);                               \\\n+\t\treturn -1;                                                     \\\n+\t}                                                                      \\\n+} while (0)\n+\n+/*\n+ * Packet headers.\n+ */\n+static struct rte_swx_field_params ethernet_type[] = {\n+\t{\"dst_addr\", 48},\n+\t{\"src_addr\", 48},\n+\t{\"ether_type\", 16},\n+};\n+\n+/*\n+ * Packet meta-data.\n+ */\n+static struct rte_swx_field_params metadata_type[] = {\n+\t{\"port\", 32},\n+\t{\"addr\", 48},\n+};\n+\n+/*\n+ * Actions.\n+ */\n+static const char *action_macswp_instructions[] = {\n+\t\"mov m.addr h.ethernet.dst_addr\",\n+\t\"mov h.ethernet.dst_addr h.ethernet.src_addr\",\n+\t\"mov h.ethernet.src_addr m.addr\",\n+\t\"return\",\n+};\n+\n+/*\n+ * Tables.\n+ */\n+static const char *table_stub_actions[] = {\"macswp\"};\n+\n+static struct rte_swx_pipeline_table_params table_stub_params = {\n+\t/* Match. */\n+\t.fields = NULL,\n+\t.n_fields = 0,\n+\n+\t/* Action. */\n+\t.action_names = table_stub_actions,\n+\t.n_actions = RTE_DIM(table_stub_actions),\n+\t.default_action_name = \"macswp\",\n+\t.default_action_data = NULL,\n+\t.default_action_is_const = 0,\n+};\n+\n+/*\n+ * Pipeline.\n+ */\n+static const char *pipeline_instructions[] = {\n+\t\"rx m.port\",\n+\t\"extract h.ethernet\",\n+\t\"table stub\",\n+\t\"xor m.port 1\",\n+\t\"emit h.ethernet\",\n+\t\"tx m.port\",\n+};\n+\n+int\n+pipeline_setup_l2fwd_macswp(struct rte_swx_pipeline *p);\n+\n+int\n+pipeline_setup_l2fwd_macswp(struct rte_swx_pipeline *p)\n+{\n+\tint err;\n+\n+\t/*\n+\t * Packet headers.\n+\t */\n+\terr = rte_swx_pipeline_struct_type_register(p,\n+\t\t\"ethernet_type\",\n+\t\tethernet_type,\n+\t\tRTE_DIM(ethernet_type));\n+\tCHECK(!err);\n+\n+\terr = rte_swx_pipeline_packet_header_register(p,\n+\t\t\"ethernet\",\n+\t\t\"ethernet_type\");\n+\tCHECK(!err);\n+\n+\t/*\n+\t * Packet meta-data.\n+\t */\n+\terr = rte_swx_pipeline_struct_type_register(p,\n+\t\t\"metadata_type\",\n+\t\tmetadata_type,\n+\t\tRTE_DIM(metadata_type));\n+\tCHECK(!err);\n+\n+\terr = rte_swx_pipeline_packet_metadata_register(p,\n+\t\t\"metadata_type\");\n+\tCHECK(!err);\n+\n+\t/*\n+\t * Actions.\n+\t */\n+\terr = rte_swx_pipeline_action_config(p,\n+\t\t\"macswp\",\n+\t\tNULL,\n+\t\taction_macswp_instructions,\n+\t\tRTE_DIM(action_macswp_instructions));\n+\tCHECK(!err);\n+\n+\t/*\n+\t * Tables.\n+\t */\n+\terr = rte_swx_pipeline_table_config(p,\n+\t\t\"stub\",\n+\t\t&table_stub_params,\n+\t\tNULL,\n+\t\tNULL,\n+\t\t0);\n+\tCHECK(!err);\n+\n+\t/*\n+\t * Pipeline.\n+\t */\n+\terr = rte_swx_pipeline_instructions_config(p,\n+\t\tpipeline_instructions,\n+\t\tRTE_DIM(pipeline_instructions));\n+\tCHECK(!err);\n+\n+\treturn 0;\n+}\ndiff --git a/examples/pipeline/examples/l2fwd_macswp.cli b/examples/pipeline/examples/l2fwd_macswp.cli\nnew file mode 100644\nindex 000000000..c5eb23d18\n--- /dev/null\n+++ b/examples/pipeline/examples/l2fwd_macswp.cli\n@@ -0,0 +1,25 @@\n+; SPDX-License-Identifier: BSD-3-Clause\n+; Copyright(c) 2010-2020 Intel Corporation\n+\n+mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0\n+\n+link LINK0 dev 0000:18:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on\n+link LINK1 dev 0000:18:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on\n+link LINK2 dev 0000:3b:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on\n+link LINK3 dev 0000:3b:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on\n+\n+pipeline PIPELINE0 create 0\n+\n+pipeline PIPELINE0 port in 0 link LINK0 rxq 0 bsz 32\n+pipeline PIPELINE0 port in 1 link LINK1 rxq 0 bsz 32\n+pipeline PIPELINE0 port in 2 link LINK2 rxq 0 bsz 32\n+pipeline PIPELINE0 port in 3 link LINK3 rxq 0 bsz 32\n+\n+pipeline PIPELINE0 port out 0 link LINK0 txq 0 bsz 32\n+pipeline PIPELINE0 port out 1 link LINK1 txq 0 bsz 32\n+pipeline PIPELINE0 port out 2 link LINK2 txq 0 bsz 32\n+pipeline PIPELINE0 port out 3 link LINK3 txq 0 bsz 32\n+\n+pipeline PIPELINE0 build l2fwd_macswp\n+\n+thread 1 pipeline PIPELINE0 enable\ndiff --git a/examples/pipeline/examples/l2fwd_macswp_pcap.cli b/examples/pipeline/examples/l2fwd_macswp_pcap.cli\nnew file mode 100644\nindex 000000000..76c3071e3\n--- /dev/null\n+++ b/examples/pipeline/examples/l2fwd_macswp_pcap.cli\n@@ -0,0 +1,20 @@\n+; SPDX-License-Identifier: BSD-3-Clause\n+; Copyright(c) 2010-2020 Intel Corporation\n+\n+mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0\n+\n+pipeline PIPELINE0 create 0\n+\n+pipeline PIPELINE0 port in 0 source MEMPOOL0 ./examples/packet.pcap\n+pipeline PIPELINE0 port in 1 source MEMPOOL0 ./examples/packet.pcap\n+pipeline PIPELINE0 port in 2 source MEMPOOL0 ./examples/packet.pcap\n+pipeline PIPELINE0 port in 3 source MEMPOOL0 ./examples/packet.pcap\n+\n+pipeline PIPELINE0 port out 0 sink none\n+pipeline PIPELINE0 port out 1 sink none\n+pipeline PIPELINE0 port out 2 sink none\n+pipeline PIPELINE0 port out 3 sink none\n+\n+pipeline PIPELINE0 build l2fwd_macswp\n+\n+thread 1 pipeline PIPELINE0 enable\ndiff --git a/examples/pipeline/meson.build b/examples/pipeline/meson.build\nindex b16de3714..b13f04e01 100644\n--- a/examples/pipeline/meson.build\n+++ b/examples/pipeline/meson.build\n@@ -16,4 +16,5 @@ sources = files(\n \t'obj.c',\n \t'thread.c',\n \t'example_l2fwd.c',\n+\t'example_l2fwd_macswp.c',\n )\n",
    "prefixes": [
        "39/40"
    ]
}