get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 45195,
    "url": "https://patches.dpdk.org/api/patches/45195/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1537777765-16798-1-git-send-email-rahul.lakkireddy@chelsio.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1537777765-16798-1-git-send-email-rahul.lakkireddy@chelsio.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1537777765-16798-1-git-send-email-rahul.lakkireddy@chelsio.com",
    "date": "2018-09-24T08:29:25",
    "name": "ethdev: add action to swap source and destination MAC to flow API",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "1ddc48202053f5f09668d99f120aa6df9541e1f4",
    "submitter": {
        "id": 241,
        "url": "https://patches.dpdk.org/api/people/241/?format=api",
        "name": "Rahul Lakkireddy",
        "email": "rahul.lakkireddy@chelsio.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1537777765-16798-1-git-send-email-rahul.lakkireddy@chelsio.com/mbox/",
    "series": [
        {
            "id": 1461,
            "url": "https://patches.dpdk.org/api/series/1461/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=1461",
            "date": "2018-09-24T08:29:25",
            "name": "ethdev: add action to swap source and destination MAC to flow API",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/1461/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/45195/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/45195/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 9E55D4C8B;\n\tMon, 24 Sep 2018 10:29:48 +0200 (CEST)",
            "from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8])\n\tby dpdk.org (Postfix) with ESMTP id 7EEEB2C15\n\tfor <dev@dpdk.org>; Mon, 24 Sep 2018 10:29:47 +0200 (CEST)",
            "from localhost (scalar.blr.asicdesigners.com [10.193.185.94])\n\tby stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id w8O8Theg027428; \n\tMon, 24 Sep 2018 01:29:44 -0700"
        ],
        "From": "Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>",
        "To": "dev@dpdk.org",
        "Cc": "indranil@chelsio.com, nirranjan@chelsio.com",
        "Date": "Mon, 24 Sep 2018 13:59:25 +0530",
        "Message-Id": "<1537777765-16798-1-git-send-email-rahul.lakkireddy@chelsio.com>",
        "X-Mailer": "git-send-email 2.5.3",
        "Subject": "[dpdk-dev] [PATCH] ethdev: add action to swap source and\n\tdestination MAC to flow API",
        "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": "This action is useful for offloading loopback mode, where the hardware\nwill swap source and destination MAC addresses in the outermost Ethernet\nheader before looping back the packet. This action can be used in\nconjunction with other rewrite actions to achieve MAC layer transparent\nNAT where the MAC addresses are swapped before either the source or\ndestination MAC address is rewritten and NAT is performed.\n\nMust be used with a valid RTE_FLOW_ITEM_TYPE_ETH flow pattern item.\nOtherwise, RTE_FLOW_ERROR_TYPE_ACTION error should be returned by the\nPMDs.\n\nOriginal work by Shagun Agrawal\n\nSigned-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>\n---\nRFC v1: http://mails.dpdk.org/archives/dev/2018-August/110232.html\nRFC v2: http://mails.dpdk.org/archives/dev/2018-August/110355.html\n\nChanges since RFC v2:\n- Updated release notes.\n\n app/test-pmd/cmdline_flow.c                 | 10 ++++++++++\n app/test-pmd/config.c                       |  1 +\n doc/guides/prog_guide/rte_flow.rst          | 19 +++++++++++++++++++\n doc/guides/rel_notes/release_18_11.rst      |  5 +++++\n doc/guides/testpmd_app_ug/testpmd_funcs.rst |  3 +++\n lib/librte_ethdev/rte_flow.c                |  1 +\n lib/librte_ethdev/rte_flow.h                | 11 +++++++++++\n 7 files changed, 50 insertions(+)",
    "diff": "diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c\nindex f9260600e..196c76de1 100644\n--- a/app/test-pmd/cmdline_flow.c\n+++ b/app/test-pmd/cmdline_flow.c\n@@ -243,6 +243,7 @@ enum index {\n \tACTION_VXLAN_DECAP,\n \tACTION_NVGRE_ENCAP,\n \tACTION_NVGRE_DECAP,\n+\tACTION_MAC_SWAP,\n };\n \n /** Maximum size for pattern in struct rte_flow_item_raw. */\n@@ -816,6 +817,7 @@ static const enum index next_action[] = {\n \tACTION_VXLAN_DECAP,\n \tACTION_NVGRE_ENCAP,\n \tACTION_NVGRE_DECAP,\n+\tACTION_MAC_SWAP,\n \tZERO,\n };\n \n@@ -2470,6 +2472,14 @@ static const struct token token_list[] = {\n \t\t.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),\n \t\t.call = parse_vc,\n \t},\n+\t[ACTION_MAC_SWAP] = {\n+\t\t.name = \"mac_swap\",\n+\t\t.help = \"Swap the source and destination MAC addresses\"\n+\t\t\t\" in the outermost Ethernet header\",\n+\t\t.priv = PRIV_ACTION(MAC_SWAP, 0),\n+\t\t.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),\n+\t\t.call = parse_vc,\n+\t},\n };\n \n /** Remove and return last entry from argument stack. */\ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex 794aa5268..43d803abb 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -1172,6 +1172,7 @@ static const struct {\n \t\t       sizeof(struct rte_flow_action_of_pop_mpls)),\n \tMK_FLOW_ACTION(OF_PUSH_MPLS,\n \t\t       sizeof(struct rte_flow_action_of_push_mpls)),\n+\tMK_FLOW_ACTION(MAC_SWAP, 0),\n };\n \n /** Compute storage space needed by action configuration and copy it. */\ndiff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst\nindex b305a72a5..d09806d38 100644\n--- a/doc/guides/prog_guide/rte_flow.rst\n+++ b/doc/guides/prog_guide/rte_flow.rst\n@@ -2076,6 +2076,25 @@ RTE_FLOW_ERROR_TYPE_ACTION error should be returned.\n \n This action modifies the payload of matched flows.\n \n+Action: ``MAC_SWAP``\n+^^^^^^^^^^^^^^^^^^^^^^^^^\n+\n+Swap the source and destination MAC addresses in the outermost Ethernet\n+header.\n+\n+It must be used with a valid RTE_FLOW_ITEM_TYPE_ETH flow pattern item.\n+Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.\n+\n+.. _table_rte_flow_action_mac_swap:\n+\n+.. table:: MAC_SWAP\n+\n+   +---------------+\n+   | Field         |\n+   +===============+\n+   | no properties |\n+   +---------------+\n+\n Negative types\n ~~~~~~~~~~~~~~\n \ndiff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst\nindex f39cb15d2..83de90bcf 100644\n--- a/doc/guides/rel_notes/release_18_11.rst\n+++ b/doc/guides/rel_notes/release_18_11.rst\n@@ -87,6 +87,11 @@ New Features\n   the specified port. The port must be stopped before the command call in order\n   to reconfigure queues.\n \n+* **Added new Flow API action to swap MAC addresses in Ethernet header.**\n+\n+  Added new Flow API action to swap the source and destination MAC\n+  addresses in the outermost Ethernet header.\n+\n \n API Changes\n -----------\ndiff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\nindex 3a73000a6..c58b18e1a 100644\n--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n@@ -3704,6 +3704,9 @@ This section lists supported actions and their attributes, if any.\n - ``nvgre_decap``: Performs a decapsulation action by stripping all headers of\n   the NVGRE tunnel network overlay from the matched flow.\n \n+- ``mac_swap``: Swap the source and destination MAC addresses in the outermost\n+  Ethernet header.\n+\n Destroying flow rules\n ~~~~~~~~~~~~~~~~~~~~~\n \ndiff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c\nindex cff4b5209..04b0b40ea 100644\n--- a/lib/librte_ethdev/rte_flow.c\n+++ b/lib/librte_ethdev/rte_flow.c\n@@ -109,6 +109,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {\n \t\t       sizeof(struct rte_flow_action_of_pop_mpls)),\n \tMK_FLOW_ACTION(OF_PUSH_MPLS,\n \t\t       sizeof(struct rte_flow_action_of_push_mpls)),\n+\tMK_FLOW_ACTION(MAC_SWAP, 0),\n };\n \n static int\ndiff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h\nindex f8ba71cdb..c743f818e 100644\n--- a/lib/librte_ethdev/rte_flow.h\n+++ b/lib/librte_ethdev/rte_flow.h\n@@ -1505,6 +1505,17 @@ enum rte_flow_action_type {\n \t * error.\n \t */\n \tRTE_FLOW_ACTION_TYPE_NVGRE_DECAP,\n+\n+\t/**\n+\t * Swap the source and destination MAC addresses in the outermost\n+\t * Ethernet header.\n+\t *\n+\t * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,\n+\t * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.\n+\t *\n+\t * No associated configuration structure.\n+\t */\n+\tRTE_FLOW_ACTION_TYPE_MAC_SWAP,\n };\n \n /**\n",
    "prefixes": []
}