get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 128316,
    "url": "http://patches.dpdk.org/api/patches/128316/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230607130245.8048-28-ivan.malov@arknetworks.am/",
    "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": "<20230607130245.8048-28-ivan.malov@arknetworks.am>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230607130245.8048-28-ivan.malov@arknetworks.am",
    "date": "2023-06-07T13:02:38",
    "name": "[v4,27/34] net/sfc: add support for IPv4 NAT offload to MAE backend",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "ea665f46655b2528e0f18d55a2d76db81e5e4d21",
    "submitter": {
        "id": 2962,
        "url": "http://patches.dpdk.org/api/people/2962/?format=api",
        "name": "Ivan Malov",
        "email": "ivan.malov@arknetworks.am"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230607130245.8048-28-ivan.malov@arknetworks.am/mbox/",
    "series": [
        {
            "id": 28390,
            "url": "http://patches.dpdk.org/api/series/28390/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=28390",
            "date": "2023-06-07T13:02:11",
            "name": "net/sfc: support HW conntrack assistance",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/28390/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/128316/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/128316/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 5C28E42C4D;\n\tWed,  7 Jun 2023 15:07:00 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 7C72642FF0;\n\tWed,  7 Jun 2023 15:03:23 +0200 (CEST)",
            "from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80])\n by mails.dpdk.org (Postfix) with ESMTP id 34B7642D7E\n for <dev@dpdk.org>; Wed,  7 Jun 2023 15:03:02 +0200 (CEST)",
            "from localhost.localdomain (unknown [78.109.69.83])\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 B4A36E1B5C;\n Wed,  7 Jun 2023 17:03:01 +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 v4 27/34] net/sfc: add support for IPv4 NAT offload to MAE\n backend",
        "Date": "Wed,  7 Jun 2023 17:02:38 +0400",
        "Message-Id": "<20230607130245.8048-28-ivan.malov@arknetworks.am>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20230607130245.8048-1-ivan.malov@arknetworks.am>",
        "References": "<20230601195538.8265-1-ivan.malov@arknetworks.am>\n <20230607130245.8048-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 doc/guides/rel_notes/release_23_07.rst | 15 +++++\n drivers/net/sfc/sfc_mae.c              | 77 +++++++++++++++++++++++---\n 4 files changed, 96 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/doc/guides/rel_notes/release_23_07.rst b/doc/guides/rel_notes/release_23_07.rst\nindex a9b1293689..6fae4eb0a7 100644\n--- a/doc/guides/rel_notes/release_23_07.rst\n+++ b/doc/guides/rel_notes/release_23_07.rst\n@@ -55,6 +55,21 @@ New Features\n      Also, make sure to start the actual text at the margin.\n      =======================================================\n \n+* **Updated Solarflare network PMD.**\n+\n+  Updated the Solarflare ``sfc_efx`` driver with changes including:\n+\n+  * Added partial support for transfer flow actions SET_IPV4_DST,\n+    SET_TP_DST, SET_IPV4_SRC and SET_TP_SRC on SN1000 SmartNICs.\n+    It is required that the innermost pattern items provide the\n+    full set of exact match criteria: EtherType, IP DST, IP SRC,\n+    TP protocol ID, TP DST and TP SRC. The IPv4 and TP actions\n+    must be requested simultaneously in the same flow. These\n+    actions operate on the outermost frame, at the point\n+    where action VXLAN_DECAP (if any) has done its job.\n+    The caller is responsible to request this offload\n+    only when the target header is an IPv4-based one.\n+\n \n Removed Items\n -------------\ndiff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c\nindex d3b4099213..c58a2520da 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@@ -3444,6 +3445,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@@ -3464,7 +3467,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@@ -3475,6 +3479,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@@ -3491,7 +3505,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@@ -3503,6 +3518,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@@ -3515,7 +3538,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@@ -3532,6 +3555,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@@ -4056,6 +4093,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@@ -4075,12 +4116,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@@ -4127,6 +4168,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@@ -4285,6 +4344,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@@ -4335,8 +4395,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@@ -4346,7 +4406,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": [
        "v4",
        "27/34"
    ]
}