get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 100025,
    "url": "https://patches.dpdk.org/api/patches/100025/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210929205730.775-6-ivan.malov@oktetlabs.ru/",
    "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": "<20210929205730.775-6-ivan.malov@oktetlabs.ru>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210929205730.775-6-ivan.malov@oktetlabs.ru",
    "date": "2021-09-29T20:57:25",
    "name": "[05/10] net/sfc: support GROUP flows in tunnel offload",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e6131afcf58039d3035707437b18b5cacab6f92e",
    "submitter": {
        "id": 869,
        "url": "https://patches.dpdk.org/api/people/869/?format=api",
        "name": "Ivan Malov",
        "email": "Ivan.Malov@oktetlabs.ru"
    },
    "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/20210929205730.775-6-ivan.malov@oktetlabs.ru/mbox/",
    "series": [
        {
            "id": 19272,
            "url": "https://patches.dpdk.org/api/series/19272/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=19272",
            "date": "2021-09-29T20:57:20",
            "name": "net/sfc: add support for tunnel offload",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/19272/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/100025/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/100025/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 B0197A0032;\n\tWed, 29 Sep 2021 22:58:18 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9E7DF4113D;\n\tWed, 29 Sep 2021 22:57:52 +0200 (CEST)",
            "from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113])\n by mails.dpdk.org (Postfix) with ESMTP id A6352410EE\n for <dev@dpdk.org>; Wed, 29 Sep 2021 22:57:45 +0200 (CEST)",
            "from localhost.localdomain (unknown [5.144.122.192])\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 shelob.oktetlabs.ru (Postfix) with ESMTPSA id 4F1C67F6D3;\n Wed, 29 Sep 2021 23:57:45 +0300 (MSK)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 4F1C67F6D3",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru;\n s=default; t=1632949065;\n bh=b8rcClhjSRFMHuUIKA7LXApQ6pVqteM9C5XL5GDYIqg=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References;\n b=eGVTYmOu6H0qBmyOq0KS2M0vzGCt1yTEX4SR9xn8gjtffQELupaQdGwBxEbb3/VIK\n C5SVz5GGkUOP7PKiXgxnQ4u6ON+NsgqVRUEWqzAeJrPT7YXiplD7edgyLaS8ZBVCDj\n l5ufc5V2FyK2TfUH8p+pyYmJrWGEnpL3HM3nQEGQ=",
        "From": "Ivan Malov <ivan.malov@oktetlabs.ru>",
        "To": "dev@dpdk.org",
        "Cc": "Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>",
        "Date": "Wed, 29 Sep 2021 23:57:25 +0300",
        "Message-Id": "<20210929205730.775-6-ivan.malov@oktetlabs.ru>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20210929205730.775-1-ivan.malov@oktetlabs.ru>",
        "References": "<20210929205730.775-1-ivan.malov@oktetlabs.ru>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 05/10] net/sfc: support GROUP flows in tunnel\n offload",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "GROUP is an in-house term for so-called \"tunnel_match\" flows.\nOn parsing, they are detected by virtue of PMD-internal item\nMARK. It associates a given flow with its tunnel context.\n\nSuch a flow is represented by a MAE action rule which is\nchained with the corresponding JUMP rule's outer rule\nby virtue of matching on its recirculation ID.\n\nGROUP flows do narrower match than JUMP flows do and\ndecapsulate matching packets (full offload).\n\nSigned-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>\nReviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>\n---\n drivers/net/sfc/sfc_flow.h        |   2 +\n drivers/net/sfc/sfc_flow_tunnel.h |   6 ++\n drivers/net/sfc/sfc_mae.c         | 151 ++++++++++++++++++++++++++++++\n 3 files changed, 159 insertions(+)",
    "diff": "diff --git a/drivers/net/sfc/sfc_flow.h b/drivers/net/sfc/sfc_flow.h\nindex ada3d563ad..efdecc97ab 100644\n--- a/drivers/net/sfc/sfc_flow.h\n+++ b/drivers/net/sfc/sfc_flow.h\n@@ -69,6 +69,8 @@ enum sfc_flow_tunnel_rule_type {\n \tSFC_FT_RULE_NONE = 0,\n \t/* The flow represents a JUMP rule */\n \tSFC_FT_RULE_JUMP,\n+\t/* The flow represents a GROUP rule */\n+\tSFC_FT_RULE_GROUP,\n };\n \n /* MAE-specific flow specification */\ndiff --git a/drivers/net/sfc/sfc_flow_tunnel.h b/drivers/net/sfc/sfc_flow_tunnel.h\nindex 6a81b29438..27a8fa5ae7 100644\n--- a/drivers/net/sfc/sfc_flow_tunnel.h\n+++ b/drivers/net/sfc/sfc_flow_tunnel.h\n@@ -39,6 +39,12 @@ typedef uint8_t sfc_ft_id_t;\n #define SFC_FT_ID_TO_TUNNEL_MARK(_id) \\\n \t((_id) + 1)\n \n+#define SFC_FT_ID_TO_MARK(_id) \\\n+\t(SFC_FT_ID_TO_TUNNEL_MARK(_id) << SFC_FT_USER_MARK_BITS)\n+\n+#define SFC_FT_GET_USER_MARK(_mark) \\\n+\t((_mark) & SFC_FT_USER_MARK_MASK)\n+\n #define SFC_FT_MAX_NTUNNELS \\\n \t(RTE_LEN2MASK(SFC_FT_TUNNEL_MARK_BITS, uint8_t) - 1)\n \ndiff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c\nindex 57a999d895..63ec2b02b3 100644\n--- a/drivers/net/sfc/sfc_mae.c\n+++ b/drivers/net/sfc/sfc_mae.c\n@@ -1048,6 +1048,36 @@ sfc_mae_rule_process_pattern_data(struct sfc_mae_parse_ctx *ctx,\n \t\t\t\t  \"Failed to process pattern data\");\n }\n \n+static int\n+sfc_mae_rule_parse_item_mark(const struct rte_flow_item *item,\n+\t\t\t     struct sfc_flow_parse_ctx *ctx,\n+\t\t\t     struct rte_flow_error *error)\n+{\n+\tconst struct rte_flow_item_mark *spec = item->spec;\n+\tstruct sfc_mae_parse_ctx *ctx_mae = ctx->mae;\n+\n+\tif (spec == NULL) {\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\tRTE_FLOW_ERROR_TYPE_ITEM, item,\n+\t\t\t\t\"NULL spec in item MARK\");\n+\t}\n+\n+\t/*\n+\t * This item is used in tunnel offload support only.\n+\t * It must go before any network header items. This\n+\t * way, sfc_mae_rule_preparse_item_mark() must have\n+\t * already parsed it. Only one item MARK is allowed.\n+\t */\n+\tif (ctx_mae->ft_rule_type != SFC_FT_RULE_GROUP ||\n+\t    spec->id != (uint32_t)SFC_FT_ID_TO_MARK(ctx_mae->ft->id)) {\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t\t  item, \"invalid item MARK\");\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int\n sfc_mae_rule_parse_item_port_id(const struct rte_flow_item *item,\n \t\t\t\tstruct sfc_flow_parse_ctx *ctx,\n@@ -1996,6 +2026,14 @@ sfc_mae_rule_parse_item_tunnel(const struct rte_flow_item *item,\n }\n \n static const struct sfc_flow_item sfc_flow_items[] = {\n+\t{\n+\t\t.type = RTE_FLOW_ITEM_TYPE_MARK,\n+\t\t.name = \"MARK\",\n+\t\t.prev_layer = SFC_FLOW_ITEM_ANY_LAYER,\n+\t\t.layer = SFC_FLOW_ITEM_ANY_LAYER,\n+\t\t.ctx_type = SFC_FLOW_PARSE_CTX_MAE,\n+\t\t.parse = sfc_mae_rule_parse_item_mark,\n+\t},\n \t{\n \t\t.type = RTE_FLOW_ITEM_TYPE_PORT_ID,\n \t\t.name = \"PORT_ID\",\n@@ -2164,6 +2202,19 @@ sfc_mae_rule_process_outer(struct sfc_adapter *sa,\n \tcase SFC_FT_RULE_JUMP:\n \t\t/* No action rule */\n \t\treturn 0;\n+\tcase SFC_FT_RULE_GROUP:\n+\t\t/*\n+\t\t * Match on recirculation ID rather than\n+\t\t * on the outer rule allocation handle.\n+\t\t */\n+\t\trc = efx_mae_match_spec_recirc_id_set(ctx->match_spec_action,\n+\t\t\t\t\tSFC_FT_ID_TO_TUNNEL_MARK(ctx->ft->id));\n+\t\tif (rc != 0) {\n+\t\t\treturn rte_flow_error_set(error, rc,\n+\t\t\t\t\tRTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,\n+\t\t\t\t\t\"tunnel offload: GROUP: AR: failed to request match on RECIRC_ID\");\n+\t\t}\n+\t\treturn 0;\n \tdefault:\n \t\tSFC_ASSERT(B_FALSE);\n \t}\n@@ -2198,6 +2249,44 @@ sfc_mae_rule_process_outer(struct sfc_adapter *sa,\n \treturn 0;\n }\n \n+static int\n+sfc_mae_rule_preparse_item_mark(const struct rte_flow_item_mark *spec,\n+\t\t\t\tstruct sfc_mae_parse_ctx *ctx)\n+{\n+\tstruct sfc_flow_tunnel *ft;\n+\tuint32_t user_mark;\n+\n+\tif (spec == NULL) {\n+\t\tsfc_err(ctx->sa, \"tunnel offload: GROUP: NULL spec in item MARK\");\n+\t\treturn EINVAL;\n+\t}\n+\n+\tft = sfc_flow_tunnel_pick(ctx->sa, spec->id);\n+\tif (ft == NULL) {\n+\t\tsfc_err(ctx->sa, \"tunnel offload: GROUP: invalid tunnel\");\n+\t\treturn EINVAL;\n+\t}\n+\n+\tif (ft->refcnt == 0) {\n+\t\tsfc_err(ctx->sa, \"tunnel offload: GROUP: tunnel=%u does not exist\",\n+\t\t\tft->id);\n+\t\treturn ENOENT;\n+\t}\n+\n+\tuser_mark = SFC_FT_GET_USER_MARK(spec->id);\n+\tif (user_mark != 0) {\n+\t\tsfc_err(ctx->sa, \"tunnel offload: GROUP: invalid item MARK\");\n+\t\treturn EINVAL;\n+\t}\n+\n+\tsfc_dbg(ctx->sa, \"tunnel offload: GROUP: detected\");\n+\n+\tctx->ft_rule_type = SFC_FT_RULE_GROUP;\n+\tctx->ft = ft;\n+\n+\treturn 0;\n+}\n+\n static int\n sfc_mae_rule_encap_parse_init(struct sfc_adapter *sa,\n \t\t\t      const struct rte_flow_item pattern[],\n@@ -2217,6 +2306,16 @@ sfc_mae_rule_encap_parse_init(struct sfc_adapter *sa,\n \n \tfor (;;) {\n \t\tswitch (pattern->type) {\n+\t\tcase RTE_FLOW_ITEM_TYPE_MARK:\n+\t\t\trc = sfc_mae_rule_preparse_item_mark(pattern->spec,\n+\t\t\t\t\t\t\t     ctx);\n+\t\t\tif (rc != 0) {\n+\t\t\t\treturn rte_flow_error_set(error, rc,\n+\t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t\t\t  pattern, \"tunnel offload: GROUP: invalid item MARK\");\n+\t\t\t}\n+\t\t\t++pattern;\n+\t\t\tcontinue;\n \t\tcase RTE_FLOW_ITEM_TYPE_VXLAN:\n \t\t\tctx->encap_type = EFX_TUNNEL_PROTOCOL_VXLAN;\n \t\t\tctx->tunnel_def_mask = &rte_flow_item_vxlan_mask;\n@@ -2258,6 +2357,17 @@ sfc_mae_rule_encap_parse_init(struct sfc_adapter *sa,\n \t\t}\n \t\tctx->encap_type = ctx->ft->encap_type;\n \t\tbreak;\n+\tcase SFC_FT_RULE_GROUP:\n+\t\tif (pattern->type == RTE_FLOW_ITEM_TYPE_END) {\n+\t\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t\t\t  NULL, \"tunnel offload: GROUP: missing tunnel item\");\n+\t\t} else if (ctx->encap_type != ctx->ft->encap_type) {\n+\t\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t\t\t  pattern, \"tunnel offload: GROUP: tunnel type mismatch\");\n+\t\t}\n+\t\tbreak;\n \tdefault:\n \t\tSFC_ASSERT(B_FALSE);\n \t\tbreak;\n@@ -2306,6 +2416,14 @@ sfc_mae_rule_encap_parse_init(struct sfc_adapter *sa,\n \t\t\t\t\t\"OR: failed to initialise RECIRC_ID\");\n \t\t}\n \t\tbreak;\n+\tcase SFC_FT_RULE_GROUP:\n+\t\t/* Outermost items -> \"ENC\" match fields in the action rule. */\n+\t\tctx->field_ids_remap = field_ids_remap_to_encap;\n+\t\tctx->match_spec = ctx->match_spec_action;\n+\n+\t\t/* No own outer rule; match on JUMP OR's RECIRC_ID is used. */\n+\t\tctx->encap_type = EFX_TUNNEL_PROTOCOL_NONE;\n+\t\tbreak;\n \tdefault:\n \t\tSFC_ASSERT(B_FALSE);\n \t\tbreak;\n@@ -2345,6 +2463,8 @@ sfc_mae_rule_parse_pattern(struct sfc_adapter *sa,\n \tcase SFC_FT_RULE_JUMP:\n \t\t/* No action rule */\n \t\tbreak;\n+\tcase SFC_FT_RULE_GROUP:\n+\t\t/* FALLTHROUGH */\n \tcase SFC_FT_RULE_NONE:\n \t\trc = efx_mae_match_spec_init(sa->nic, EFX_MAE_RULE_ACTION,\n \t\t\t\t\t     spec->priority,\n@@ -2379,6 +2499,13 @@ sfc_mae_rule_parse_pattern(struct sfc_adapter *sa,\n \tif (rc != 0)\n \t\tgoto fail_encap_parse_init;\n \n+\t/*\n+\t * sfc_mae_rule_encap_parse_init() may have detected tunnel offload\n+\t * GROUP rule. Remember its properties for later use.\n+\t */\n+\tspec->ft_rule_type = ctx_mae.ft_rule_type;\n+\tspec->ft = ctx_mae.ft;\n+\n \trc = sfc_flow_parse_pattern(sa, sfc_flow_items, RTE_DIM(sfc_flow_items),\n \t\t\t\t    pattern, &ctx, error);\n \tif (rc != 0)\n@@ -3215,6 +3342,13 @@ sfc_mae_rule_parse_actions(struct sfc_adapter *sa,\n \tif (rc != 0)\n \t\tgoto fail_action_set_spec_init;\n \n+\tif (spec_mae->ft_rule_type == SFC_FT_RULE_GROUP) {\n+\t\t/* JUMP rules don't decapsulate packets. GROUP rules do. */\n+\t\trc = efx_mae_action_set_populate_decap(spec);\n+\t\tif (rc != 0)\n+\t\t\tgoto fail_enforce_ft_decap;\n+\t}\n+\n \t/* Cleanup after previous encap. header bounce buffer usage. */\n \tsfc_mae_bounce_eh_invalidate(&mae->bounce_eh);\n \n@@ -3245,6 +3379,22 @@ sfc_mae_rule_parse_actions(struct sfc_adapter *sa,\n \t\tgoto fail_nb_count;\n \t}\n \n+\tswitch (spec_mae->ft_rule_type) {\n+\tcase SFC_FT_RULE_NONE:\n+\t\tbreak;\n+\tcase SFC_FT_RULE_GROUP:\n+\t\t/*\n+\t\t * Packets that go to the rule's AR have FT mark set (from the\n+\t\t * JUMP rule OR's RECIRC_ID). Remove this mark in matching\n+\t\t * packets. The user may have provided their own action\n+\t\t * MARK above, so don't check the return value here.\n+\t\t */\n+\t\t(void)efx_mae_action_set_populate_mark(spec, 0);\n+\t\tbreak;\n+\tdefault:\n+\t\tSFC_ASSERT(B_FALSE);\n+\t}\n+\n \tspec_mae->action_set = sfc_mae_action_set_attach(sa, encap_header,\n \t\t\t\t\t\t\t n_count, spec);\n \tif (spec_mae->action_set != NULL) {\n@@ -3268,6 +3418,7 @@ sfc_mae_rule_parse_actions(struct sfc_adapter *sa,\n fail_rule_parse_action:\n \tefx_mae_action_set_spec_fini(sa->nic, spec);\n \n+fail_enforce_ft_decap:\n fail_action_set_spec_init:\n \tif (rc > 0 && rte_errno == 0) {\n \t\trc = rte_flow_error_set(error, rc,\n",
    "prefixes": [
        "05/10"
    ]
}