get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 127900,
    "url": "http://patchwork.dpdk.org/api/patches/127900/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230601195538.8265-28-ivan.malov@arknetworks.am/",
    "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": "<20230601195538.8265-28-ivan.malov@arknetworks.am>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230601195538.8265-28-ivan.malov@arknetworks.am",
    "date": "2023-06-01T19:55:31",
    "name": "[27/34] net/sfc: add support for IPv4 NAT offload to MAE backend",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "57ba0ee4956904471d6325f42dbef335fe4b085a",
    "submitter": {
        "id": 2962,
        "url": "http://patchwork.dpdk.org/api/people/2962/?format=api",
        "name": "Ivan Malov",
        "email": "ivan.malov@arknetworks.am"
    },
    "delegate": {
        "id": 319,
        "url": "http://patchwork.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20230601195538.8265-28-ivan.malov@arknetworks.am/mbox/",
    "series": [
        {
            "id": 28307,
            "url": "http://patchwork.dpdk.org/api/series/28307/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=28307",
            "date": "2023-06-01T19:55:04",
            "name": "net/sfc: support HW conntrack assistance",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/28307/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/127900/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/127900/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id ECC4042C07;\n\tThu,  1 Jun 2023 21:58:40 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 7C0A043000;\n\tThu,  1 Jun 2023 21:56:15 +0200 (CEST)",
            "from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80])\n by mails.dpdk.org (Postfix) with ESMTP id 0CA7C42D7C\n for <dev@dpdk.org>; Thu,  1 Jun 2023 21:55:56 +0200 (CEST)",
            "from localhost.localdomain (unknown [78.109.69.146])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by agw.arknetworks.am (Postfix) with ESMTPSA id 919C9E1B5B;\n Thu,  1 Jun 2023 23:55:55 +0400 (+04)"
        ],
        "From": "Ivan Malov <ivan.malov@arknetworks.am>",
        "To": "dev@dpdk.org",
        "Cc": "Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,\n Ferruh Yigit <ferruh.yigit@amd.com>, Andy Moreton <amoreton@xilinx.com>",
        "Subject": "[PATCH 27/34] net/sfc: add support for IPv4 NAT offload to MAE\n backend",
        "Date": "Thu,  1 Jun 2023 23:55:31 +0400",
        "Message-Id": "<20230601195538.8265-28-ivan.malov@arknetworks.am>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20230601195538.8265-1-ivan.malov@arknetworks.am>",
        "References": "<20230601195538.8265-1-ivan.malov@arknetworks.am>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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"
    },
    "content": "For this offload to work, the innermost pattern items must\nprovide the full set of exact match criteria, which are as\nfollows: EtherType, IP DST, IP SRC, TP protocol ID, TP DST\nand TP SRC, where the protocol types can be autodetected.\n\nThe offload requires that the IPv4 and the TP actions be\nrequested simultaneously in the same flow by the caller:\nSET_IPV4_DST + SET_TP_DST or SET_IPV4_SRC + SET_TP_SRC.\n\nThe offload operates on the outermost frame, which,\nif action VXLAN_DECAP was requested, maps to the\ninner frame of the original packet. The caller\nis responsible to request this offload only\nwhen the target header is an IPv4-based one.\n\nSigned-off-by: Ivan Malov <ivan.malov@arknetworks.am>\nReviewed-by: Andy Moreton <amoreton@xilinx.com>\n---\n doc/guides/nics/features/sfc.ini |  4 ++\n doc/guides/nics/sfc_efx.rst      |  8 ++++\n drivers/net/sfc/sfc_mae.c        | 77 ++++++++++++++++++++++++++++----\n 3 files changed, 81 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/doc/guides/nics/features/sfc.ini b/doc/guides/nics/features/sfc.ini\nindex f5ac644278..19d4935ce6 100644\n--- a/doc/guides/nics/features/sfc.ini\n+++ b/doc/guides/nics/features/sfc.ini\n@@ -75,8 +75,12 @@ port_representor     = Y\n represented_port     = Y\n queue                = Y\n rss                  = Y\n+set_ipv4_dst         = Y\n+set_ipv4_src         = Y\n set_mac_dst          = Y\n set_mac_src          = Y\n+set_tp_dst           = Y\n+set_tp_src           = Y\n vf                   = Y\n vxlan_decap          = Y\n vxlan_encap          = Y\ndiff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst\nindex de0656876b..6e974c3720 100644\n--- a/doc/guides/nics/sfc_efx.rst\n+++ b/doc/guides/nics/sfc_efx.rst\n@@ -270,10 +270,18 @@ Supported actions (***transfer*** rules):\n \n - OF_VLAN_SET_PCP\n \n+- SET_IPV4_DST\n+\n+- SET_IPV4_SRC\n+\n - SET_MAC_DST\n \n - SET_MAC_SRC\n \n+- SET_TP_DST\n+\n+- SET_TP_SRC\n+\n - OF_DEC_NW_TTL\n \n - DEC_TTL\ndiff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c\nindex 167426eaf3..c03a43c6dd 100644\n--- a/drivers/net/sfc/sfc_mae.c\n+++ b/drivers/net/sfc/sfc_mae.c\n@@ -9,6 +9,7 @@\n \n #include <stdbool.h>\n \n+#include <rte_byteorder.h>\n #include <rte_bitops.h>\n #include <rte_common.h>\n #include <rte_vxlan.h>\n@@ -3446,6 +3447,8 @@ sfc_mae_rule_parse_action_set_mac(struct sfc_adapter *sa,\n enum sfc_mae_actions_bundle_type {\n \tSFC_MAE_ACTIONS_BUNDLE_EMPTY = 0,\n \tSFC_MAE_ACTIONS_BUNDLE_VLAN_PUSH,\n+\tSFC_MAE_ACTIONS_BUNDLE_NAT_DST,\n+\tSFC_MAE_ACTIONS_BUNDLE_NAT_SRC,\n };\n \n struct sfc_mae_actions_bundle {\n@@ -3466,7 +3469,8 @@ struct sfc_mae_actions_bundle {\n  */\n static int\n sfc_mae_actions_bundle_submit(const struct sfc_mae_actions_bundle *bundle,\n-\t\t\t      efx_mae_actions_t *spec)\n+\t\t\t      struct sfc_flow_spec_mae *flow_spec,\n+\t\t\t      bool ct, efx_mae_actions_t *spec)\n {\n \tint rc = 0;\n \n@@ -3477,6 +3481,16 @@ sfc_mae_actions_bundle_submit(const struct sfc_mae_actions_bundle *bundle,\n \t\trc = efx_mae_action_set_populate_vlan_push(\n \t\t\tspec, bundle->vlan_push_tpid, bundle->vlan_push_tci);\n \t\tbreak;\n+\tcase SFC_MAE_ACTIONS_BUNDLE_NAT_DST:\n+\t\tflow_spec->ct_resp.nat.dir_is_dst = true;\n+\t\t/* FALLTHROUGH */\n+\tcase SFC_MAE_ACTIONS_BUNDLE_NAT_SRC:\n+\t\tif (ct && flow_spec->ct_resp.nat.ip_le != 0 &&\n+\t\t    flow_spec->ct_resp.nat.port_le != 0)\n+\t\t\trc = efx_mae_action_set_populate_nat(spec);\n+\t\telse\n+\t\t\trc = EINVAL;\n+\t\tbreak;\n \tdefault:\n \t\tSFC_ASSERT(B_FALSE);\n \t\tbreak;\n@@ -3493,7 +3507,8 @@ sfc_mae_actions_bundle_submit(const struct sfc_mae_actions_bundle *bundle,\n static int\n sfc_mae_actions_bundle_sync(const struct rte_flow_action *action,\n \t\t\t    struct sfc_mae_actions_bundle *bundle,\n-\t\t\t    efx_mae_actions_t *spec,\n+\t\t\t    struct sfc_flow_spec_mae *flow_spec,\n+\t\t\t    efx_mae_actions_t *spec, bool ct,\n \t\t\t    struct rte_flow_error *error)\n {\n \tenum sfc_mae_actions_bundle_type bundle_type_new;\n@@ -3505,6 +3520,14 @@ sfc_mae_actions_bundle_sync(const struct rte_flow_action *action,\n \tcase RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP:\n \t\tbundle_type_new = SFC_MAE_ACTIONS_BUNDLE_VLAN_PUSH;\n \t\tbreak;\n+\tcase RTE_FLOW_ACTION_TYPE_SET_IPV4_DST:\n+\tcase RTE_FLOW_ACTION_TYPE_SET_TP_DST:\n+\t\tbundle_type_new = SFC_MAE_ACTIONS_BUNDLE_NAT_DST;\n+\t\tbreak;\n+\tcase RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC:\n+\tcase RTE_FLOW_ACTION_TYPE_SET_TP_SRC:\n+\t\tbundle_type_new = SFC_MAE_ACTIONS_BUNDLE_NAT_SRC;\n+\t\tbreak;\n \tdefault:\n \t\t/*\n \t\t * Self-sufficient actions, including END, are handled in this\n@@ -3517,7 +3540,7 @@ sfc_mae_actions_bundle_sync(const struct rte_flow_action *action,\n \n \tif (bundle_type_new != bundle->type ||\n \t    (bundle->actions_mask & (1ULL << action->type)) != 0) {\n-\t\trc = sfc_mae_actions_bundle_submit(bundle, spec);\n+\t\trc = sfc_mae_actions_bundle_submit(bundle, flow_spec, ct, spec);\n \t\tif (rc != 0)\n \t\t\tgoto fail_submit;\n \n@@ -3534,6 +3557,20 @@ sfc_mae_actions_bundle_sync(const struct rte_flow_action *action,\n \t\t\t\"Failed to request the (group of) action(s)\");\n }\n \n+static void\n+sfc_mae_rule_parse_action_nat_addr(const struct rte_flow_action_set_ipv4 *conf,\n+\t\t\t\t   uint32_t *nat_addr_le)\n+{\n+\t*nat_addr_le = rte_bswap32(conf->ipv4_addr);\n+}\n+\n+static void\n+sfc_mae_rule_parse_action_nat_port(const struct rte_flow_action_set_tp *conf,\n+\t\t\t\t   uint16_t *nat_port_le)\n+{\n+\t*nat_port_le = rte_bswap16(conf->port);\n+}\n+\n static void\n sfc_mae_rule_parse_action_of_push_vlan(\n \t\t\t    const struct rte_flow_action_of_push_vlan *conf,\n@@ -4058,6 +4095,10 @@ static const char * const action_names[] = {\n \t[RTE_FLOW_ACTION_TYPE_SET_MAC_SRC] = \"SET_MAC_SRC\",\n \t[RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL] = \"OF_DEC_NW_TTL\",\n \t[RTE_FLOW_ACTION_TYPE_DEC_TTL] = \"DEC_TTL\",\n+\t[RTE_FLOW_ACTION_TYPE_SET_IPV4_DST] = \"SET_IPV4_DST\",\n+\t[RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC] = \"SET_IPV4_SRC\",\n+\t[RTE_FLOW_ACTION_TYPE_SET_TP_DST] = \"SET_TP_DST\",\n+\t[RTE_FLOW_ACTION_TYPE_SET_TP_SRC] = \"SET_TP_SRC\",\n \t[RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN] = \"OF_PUSH_VLAN\",\n \t[RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID] = \"OF_SET_VLAN_VID\",\n \t[RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP] = \"OF_SET_VLAN_PCP\",\n@@ -4077,12 +4118,12 @@ static const char * const action_names[] = {\n static int\n sfc_mae_rule_parse_action(struct sfc_adapter *sa,\n \t\t\t  const struct rte_flow_action *action,\n-\t\t\t  const struct rte_flow *flow,\n+\t\t\t  struct rte_flow *flow,\n \t\t\t  struct sfc_mae_actions_bundle *bundle,\n \t\t\t  struct sfc_mae_aset_ctx *ctx,\n \t\t\t  struct rte_flow_error *error)\n {\n-\tconst struct sfc_flow_spec_mae *spec_mae = &flow->spec.mae;\n+\tstruct sfc_flow_spec_mae *spec_mae = &flow->spec.mae;\n \tconst struct sfc_mae_outer_rule *outer_rule = spec_mae->outer_rule;\n \tconst uint64_t rx_metadata = sa->negotiated_rx_metadata;\n \tefx_mae_actions_t *spec = ctx->spec;\n@@ -4129,6 +4170,24 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa,\n \t\t\t\t       bundle->actions_mask);\n \t\trc = efx_mae_action_set_populate_decr_ip_ttl(spec);\n \t\tbreak;\n+\tcase RTE_FLOW_ACTION_TYPE_SET_IPV4_DST:\n+\tcase RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC:\n+\t\tSFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_SET_IPV4_DST,\n+\t\t\t\t       bundle->actions_mask);\n+\t\tSFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC,\n+\t\t\t\t       bundle->actions_mask);\n+\t\tsfc_mae_rule_parse_action_nat_addr(action->conf,\n+\t\t\t\t\t&spec_mae->ct_resp.nat.ip_le);\n+\t\tbreak;\n+\tcase RTE_FLOW_ACTION_TYPE_SET_TP_DST:\n+\tcase RTE_FLOW_ACTION_TYPE_SET_TP_SRC:\n+\t\tSFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_SET_TP_DST,\n+\t\t\t\t       bundle->actions_mask);\n+\t\tSFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_SET_TP_SRC,\n+\t\t\t\t       bundle->actions_mask);\n+\t\tsfc_mae_rule_parse_action_nat_port(action->conf,\n+\t\t\t\t\t\t&spec_mae->ct_resp.nat.port_le);\n+\t\tbreak;\n \tcase RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:\n \t\tSFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN,\n \t\t\t\t       bundle->actions_mask);\n@@ -4287,6 +4346,7 @@ sfc_mae_rule_parse_actions(struct sfc_adapter *sa,\n {\n \tstruct sfc_flow_spec_mae *spec_mae = &flow->spec.mae;\n \tstruct sfc_mae_actions_bundle bundle = {0};\n+\tbool ct = (action_rule_ctx->ct_mark != 0);\n \tconst struct rte_flow_action *action;\n \tstruct sfc_mae_aset_ctx ctx = {0};\n \tstruct sfc_mae *mae = &sa->mae;\n@@ -4337,8 +4397,8 @@ sfc_mae_rule_parse_actions(struct sfc_adapter *sa,\n \n \tfor (action = actions;\n \t     action->type != RTE_FLOW_ACTION_TYPE_END; ++action) {\n-\t\trc = sfc_mae_actions_bundle_sync(action, &bundle,\n-\t\t\t\t\t\t ctx.spec, error);\n+\t\trc = sfc_mae_actions_bundle_sync(action, &bundle, spec_mae,\n+\t\t\t\t\t\t ctx.spec, ct, error);\n \t\tif (rc != 0)\n \t\t\tgoto fail_rule_parse_action;\n \n@@ -4348,7 +4408,8 @@ sfc_mae_rule_parse_actions(struct sfc_adapter *sa,\n \t\t\tgoto fail_rule_parse_action;\n \t}\n \n-\trc = sfc_mae_actions_bundle_sync(action, &bundle, ctx.spec, error);\n+\trc = sfc_mae_actions_bundle_sync(action, &bundle, spec_mae,\n+\t\t\t\t\t ctx.spec, ct, error);\n \tif (rc != 0)\n \t\tgoto fail_rule_parse_action;\n \n",
    "prefixes": [
        "27/34"
    ]
}