get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 81563,
    "url": "https://patches.dpdk.org/api/patches/81563/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1603185222-14831-48-git-send-email-arybchenko@solarflare.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": "<1603185222-14831-48-git-send-email-arybchenko@solarflare.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1603185222-14831-48-git-send-email-arybchenko@solarflare.com",
    "date": "2020-10-20T09:13:27",
    "name": "[v2,47/62] net/sfc: support flow item VLAN in transfer rules",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "683dd3a22e921f990aaf1d7175bba41da472be9e",
    "submitter": {
        "id": 607,
        "url": "https://patches.dpdk.org/api/people/607/?format=api",
        "name": "Andrew Rybchenko",
        "email": "arybchenko@solarflare.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/1603185222-14831-48-git-send-email-arybchenko@solarflare.com/mbox/",
    "series": [
        {
            "id": 13137,
            "url": "https://patches.dpdk.org/api/series/13137/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=13137",
            "date": "2020-10-20T09:12:44",
            "name": "net/sfc: support flow API transfer rules",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/13137/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/81563/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/81563/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 A4CDFA04DD;\n\tTue, 20 Oct 2020 11:38:28 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id C77DEFCB6;\n\tTue, 20 Oct 2020 11:15:57 +0200 (CEST)",
            "from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com\n [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 1F010C84E\n for <dev@dpdk.org>; Tue, 20 Oct 2020 11:14:20 +0200 (CEST)",
            "from mx1-us1.ppe-hosted.com (unknown [10.7.65.61])\n by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id\n A22A860074 for <dev@dpdk.org>; Tue, 20 Oct 2020 09:14:18 +0000 (UTC)",
            "from us4-mdac16-56.ut7.mdlocal (unknown [10.7.64.50])\n by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id A15ED8009E\n for <dev@dpdk.org>; Tue, 20 Oct 2020 09:14:18 +0000 (UTC)",
            "from mx1-us1.ppe-hosted.com (unknown [10.7.66.41])\n by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 17EAE80052\n for <dev@dpdk.org>; Tue, 20 Oct 2020 09:14:18 +0000 (UTC)",
            "from webmail.solarflare.com (uk.solarflare.com [193.34.186.16])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))\n (No client certificate requested)\n by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id\n BE88E4C0071\n for <dev@dpdk.org>; Tue, 20 Oct 2020 09:14:17 +0000 (UTC)",
            "from ukex01.SolarFlarecom.com (10.17.10.4) by\n ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id\n 15.0.1497.2; Tue, 20 Oct 2020 10:14:02 +0100",
            "from opal.uk.solarflarecom.com (10.17.10.1) by\n ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id\n 15.0.1497.2 via Frontend Transport; Tue, 20 Oct 2020 10:14:01 +0100",
            "from ukv-loginhost.uk.solarflarecom.com\n (ukv-loginhost.uk.solarflarecom.com [10.17.10.39])\n by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 09K9E1GQ028513;\n Tue, 20 Oct 2020 10:14:01 +0100",
            "from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1])\n by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 5EC851613A9;\n Tue, 20 Oct 2020 10:14:01 +0100 (BST)"
        ],
        "X-Virus-Scanned": "Proofpoint Essentials engine",
        "From": "Andrew Rybchenko <arybchenko@solarflare.com>",
        "To": "<dev@dpdk.org>",
        "CC": "Ivan Malov <ivan.malov@oktetlabs.ru>",
        "Date": "Tue, 20 Oct 2020 10:13:27 +0100",
        "Message-ID": "<1603185222-14831-48-git-send-email-arybchenko@solarflare.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1603185222-14831-1-git-send-email-arybchenko@solarflare.com>",
        "References": "<1603183709-23420-1-git-send-email-arybchenko@solarflare.com>\n <1603185222-14831-1-git-send-email-arybchenko@solarflare.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-TM-AS-Product-Ver": "SMEX-12.5.0.1300-8.6.1012-25736.003",
        "X-TM-AS-Result": "No-3.751500-8.000000-10",
        "X-TMASE-MatchedRID": "EsGFgrCrGksfKML5AJtfLTdpb/tuXpJnmXYQ9W53Np2ZfDRE1uqSgoz1\n bq8bIdDvSLZYGytM40BLG6rghpHL98kzkqzY5vbYqJSK+HSPY+/pVMb1xnESMgaYevV4zG3ZQBz\n oPKhLasjuo3YBjUsFh8LrkAU++Mn8WlEpRu0HDirnvg/SfqXd/dnLANiJ9J62VWQnHKxp38gkKy\n HF/43GXiBPsqyaFx8lXl9v5CQ2BAF6Icg4A21ScsebIMlISwjbyWxPa/RwSU9psnGGIgWMmXEzs\n NpqhJDMq1SffpAHzg7ExXUw9J4h+qB11RkmaqHealRqQPhHMT4TuzedwPfr/VHpIy6wt5Uw33pX\n Y2CsQeI9XuH79CQNgLAsMJewrCQMniXiio3lwpHM0ihsfYPMYQoXSOLC5a44kEuRYev4ZM9ZeMX\n 00rN0KXlX3Ord7p8AYcTwAY0stzWp+3FLcueO9UmSRRbSc9s3GwKs3RUcsbh/zGD4l8Bj0OcMSM\n soUYnjiZNHeXaejyaAMuqetGVetnyef22ep6XYxlblqLlYqXIMw01Q9OppbC3M/7j+0Q17/PbGa\n wOwxugH0RKBLzgCPgquMtctL7FEmWfmTG0oYXFNz+ENdQhnUgXoUv3pQ3u2Ri2QV0pCBB7w7Jxw\n U0EvZMqEROLb/+yO4/0Jvn0rwAJmtL4Dw+zNb9T2H03zzU1J",
        "X-TM-AS-User-Approved-Sender": "Yes",
        "X-TM-AS-User-Blocked-Sender": "No",
        "X-TMASE-Result": "10--3.751500-8.000000",
        "X-TMASE-Version": "SMEX-12.5.0.1300-8.6.1012-25736.003",
        "X-MDID": "1603185258-uizVNig01x9U",
        "X-PPE-DISP": "1603185258;uizVNig01x9U",
        "Subject": "[dpdk-dev] [PATCH v2 47/62] net/sfc: support flow item VLAN in\n\ttransfer rules",
        "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": "From: Ivan Malov <ivan.malov@oktetlabs.ru>\n\nAdd support for this flow item to MAE-specific RTE flow implementation.\n\nIn a pattern, a L2 item preceding an item VLAN must have\ncorrect \"type\" (\"inner_type\") set depending on the total\nnumber of VLAN tags (double-tagging is supported):\n\n\"pattern eth type is X / vlan / end\",\nX = 0x8100, or 0x88a8, or 0x9100, or 0x9200, or 0x9300\n\n\"pattern eth type is X / vlan inner_type is 0x8100 / vlan / end\"\nX = 0x88a8, or 0x9100, or 0x9200, or 0x9300\n\nSigned-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>\nSigned-off-by: Andrew Rybchenko <arybchenko@solarflare.com>\nReviewed-by: Andy Moreton <amoreton@xilinx.com>\n---\n doc/guides/nics/sfc_efx.rst |   2 +\n drivers/net/sfc/sfc_mae.c   | 265 +++++++++++++++++++++++++++++++++++-\n drivers/net/sfc/sfc_mae.h   |  47 +++++++\n 3 files changed, 311 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst\nindex e1cacf55ff..adee0cd670 100644\n--- a/doc/guides/nics/sfc_efx.rst\n+++ b/doc/guides/nics/sfc_efx.rst\n@@ -200,6 +200,8 @@ Supported pattern items (***transfer*** rules):\n \n - ETH\n \n+- VLAN (double-tagging is supported)\n+\n Supported actions (***transfer*** rules):\n \n - OF_POP_VLAN\ndiff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c\nindex 14e6d33c55..cc22fee6fe 100644\n--- a/drivers/net/sfc/sfc_mae.c\n+++ b/drivers/net/sfc/sfc_mae.c\n@@ -260,6 +260,122 @@ sfc_mae_flow_cleanup(struct sfc_adapter *sa,\n \t\tefx_mae_match_spec_fini(sa->nic, spec_mae->match_spec);\n }\n \n+static int\n+sfc_mae_set_ethertypes(struct sfc_mae_parse_ctx *ctx)\n+{\n+\tefx_mae_match_spec_t *efx_spec = ctx->match_spec_action;\n+\tstruct sfc_mae_pattern_data *pdata = &ctx->pattern_data;\n+\tconst efx_mae_field_id_t field_ids[] = {\n+\t\tEFX_MAE_FIELD_VLAN0_PROTO_BE,\n+\t\tEFX_MAE_FIELD_VLAN1_PROTO_BE,\n+\t};\n+\tconst struct sfc_mae_ethertype *et;\n+\tunsigned int i;\n+\tint rc;\n+\n+\t/*\n+\t * In accordance with RTE flow API convention, the innermost L2\n+\t * item's \"type\" (\"inner_type\") is a L3 EtherType. If there is\n+\t * no L3 item, it's 0x0000/0x0000.\n+\t */\n+\tet = &pdata->ethertypes[pdata->nb_vlan_tags];\n+\trc = efx_mae_match_spec_field_set(efx_spec, EFX_MAE_FIELD_ETHER_TYPE_BE,\n+\t\t\t\t\t  sizeof(et->value),\n+\t\t\t\t\t  (const uint8_t *)&et->value,\n+\t\t\t\t\t  sizeof(et->mask),\n+\t\t\t\t\t  (const uint8_t *)&et->mask);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\t/*\n+\t * sfc_mae_rule_parse_item_vlan() has already made sure\n+\t * that pdata->nb_vlan_tags does not exceed this figure.\n+\t */\n+\tRTE_BUILD_BUG_ON(SFC_MAE_MATCH_VLAN_MAX_NTAGS != 2);\n+\n+\tfor (i = 0; i < pdata->nb_vlan_tags; ++i) {\n+\t\tet = &pdata->ethertypes[i];\n+\n+\t\trc = efx_mae_match_spec_field_set(efx_spec, field_ids[i],\n+\t\t\t\t\t\t  sizeof(et->value),\n+\t\t\t\t\t\t  (const uint8_t *)&et->value,\n+\t\t\t\t\t\t  sizeof(et->mask),\n+\t\t\t\t\t\t  (const uint8_t *)&et->mask);\n+\t\tif (rc != 0)\n+\t\t\treturn rc;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+sfc_mae_rule_process_pattern_data(struct sfc_mae_parse_ctx *ctx,\n+\t\t\t\t  struct rte_flow_error *error)\n+{\n+\tstruct sfc_mae_pattern_data *pdata = &ctx->pattern_data;\n+\tstruct sfc_mae_ethertype *ethertypes = pdata->ethertypes;\n+\tconst rte_be16_t supported_tpids[] = {\n+\t\t/* VLAN standard TPID (always the first element) */\n+\t\tRTE_BE16(RTE_ETHER_TYPE_VLAN),\n+\n+\t\t/* Double-tagging TPIDs */\n+\t\tRTE_BE16(RTE_ETHER_TYPE_QINQ),\n+\t\tRTE_BE16(RTE_ETHER_TYPE_QINQ1),\n+\t\tRTE_BE16(RTE_ETHER_TYPE_QINQ2),\n+\t\tRTE_BE16(RTE_ETHER_TYPE_QINQ3),\n+\t};\n+\tunsigned int nb_supported_tpids = RTE_DIM(supported_tpids);\n+\tunsigned int ethertype_idx;\n+\tint rc;\n+\n+\t/*\n+\t * sfc_mae_rule_parse_item_vlan() has already made sure\n+\t * that pdata->nb_vlan_tags does not exceed this figure.\n+\t */\n+\tRTE_BUILD_BUG_ON(SFC_MAE_MATCH_VLAN_MAX_NTAGS != 2);\n+\n+\tfor (ethertype_idx = 0;\n+\t     ethertype_idx < pdata->nb_vlan_tags; ++ethertype_idx) {\n+\t\tunsigned int tpid_idx;\n+\n+\t\t/* Exact match is supported only. */\n+\t\tif (ethertypes[ethertype_idx].mask != RTE_BE16(0xffff)) {\n+\t\t\trc = EINVAL;\n+\t\t\tgoto fail;\n+\t\t}\n+\n+\t\tfor (tpid_idx = pdata->nb_vlan_tags - ethertype_idx - 1;\n+\t\t     tpid_idx < nb_supported_tpids; ++tpid_idx) {\n+\t\t\tif (ethertypes[ethertype_idx].value ==\n+\t\t\t    supported_tpids[tpid_idx])\n+\t\t\t\tbreak;\n+\t\t}\n+\n+\t\tif (tpid_idx == nb_supported_tpids) {\n+\t\t\trc = EINVAL;\n+\t\t\tgoto fail;\n+\t\t}\n+\n+\t\tnb_supported_tpids = 1;\n+\t}\n+\n+\t/*\n+\t * Now, when the number of VLAN tags is known, set fields\n+\t * ETHER_TYPE, VLAN0_PROTO and VLAN1_PROTO so that the first\n+\t * one is either a valid L3 EtherType (or 0x0000/0x0000),\n+\t * and the last two are valid TPIDs (or 0x0000/0x0000).\n+\t */\n+\trc = sfc_mae_set_ethertypes(ctx);\n+\tif (rc != 0)\n+\t\tgoto fail;\n+\n+\treturn 0;\n+\n+fail:\n+\treturn rte_flow_error_set(error, rc, RTE_FLOW_ERROR_TYPE_ITEM, NULL,\n+\t\t\t\t  \"Failed to process pattern data\");\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@@ -486,6 +602,16 @@ sfc_mae_rule_parse_item_vf(const struct rte_flow_item *item,\n \treturn 0;\n }\n \n+/*\n+ * Having this field ID in a field locator means that this\n+ * locator cannot be used to actually set the field at the\n+ * time when the corresponding item gets encountered. Such\n+ * fields get stashed in the parsing context instead. This\n+ * is required to resolve dependencies between the stashed\n+ * fields. See sfc_mae_rule_process_pattern_data().\n+ */\n+#define SFC_MAE_FIELD_HANDLING_DEFERRED\tEFX_MAE_FIELD_NIDS\n+\n struct sfc_mae_field_locator {\n \tefx_mae_field_id_t\t\tfield_id;\n \tsize_t\t\t\t\tsize;\n@@ -522,6 +648,9 @@ sfc_mae_parse_item(const struct sfc_mae_field_locator *field_locators,\n \tfor (i = 0; i < nb_field_locators; ++i) {\n \t\tconst struct sfc_mae_field_locator *fl = &field_locators[i];\n \n+\t\tif (fl->field_id == SFC_MAE_FIELD_HANDLING_DEFERRED)\n+\t\t\tcontinue;\n+\n \t\trc = efx_mae_match_spec_field_set(efx_spec, fl->field_id,\n \t\t\t\t\t\t  fl->size, spec + fl->ofst,\n \t\t\t\t\t\t  fl->size, mask + fl->ofst);\n@@ -539,7 +668,11 @@ sfc_mae_parse_item(const struct sfc_mae_field_locator *field_locators,\n \n static const struct sfc_mae_field_locator flocs_eth[] = {\n \t{\n-\t\tEFX_MAE_FIELD_ETHER_TYPE_BE,\n+\t\t/*\n+\t\t * This locator is used only for building supported fields mask.\n+\t\t * The field is handled by sfc_mae_rule_process_pattern_data().\n+\t\t */\n+\t\tSFC_MAE_FIELD_HANDLING_DEFERRED,\n \t\tRTE_SIZEOF_FIELD(struct rte_flow_item_eth, type),\n \t\toffsetof(struct rte_flow_item_eth, type),\n \t},\n@@ -577,14 +710,128 @@ sfc_mae_rule_parse_item_eth(const struct rte_flow_item *item,\n \tif (rc != 0)\n \t\treturn rc;\n \n-\t/* If \"spec\" is not set, could be any Ethernet */\n-\tif (spec == NULL)\n+\tif (spec != NULL) {\n+\t\tstruct sfc_mae_pattern_data *pdata = &ctx_mae->pattern_data;\n+\t\tstruct sfc_mae_ethertype *ethertypes = pdata->ethertypes;\n+\t\tconst struct rte_flow_item_eth *item_spec;\n+\t\tconst struct rte_flow_item_eth *item_mask;\n+\n+\t\titem_spec = (const struct rte_flow_item_eth *)spec;\n+\t\titem_mask = (const struct rte_flow_item_eth *)mask;\n+\n+\t\tethertypes[0].value = item_spec->type;\n+\t\tethertypes[0].mask = item_mask->type;\n+\t} else {\n+\t\t/*\n+\t\t * The specification is empty. This is wrong in the case\n+\t\t * when there are more network patterns in line. Other\n+\t\t * than that, any Ethernet can match. All of that is\n+\t\t * checked at the end of parsing.\n+\t\t */\n \t\treturn 0;\n+\t}\n \n \treturn sfc_mae_parse_item(flocs_eth, RTE_DIM(flocs_eth), spec, mask,\n \t\t\t\t  ctx_mae->match_spec_action, error);\n }\n \n+static const struct sfc_mae_field_locator flocs_vlan[] = {\n+\t/* Outermost tag */\n+\t{\n+\t\tEFX_MAE_FIELD_VLAN0_TCI_BE,\n+\t\tRTE_SIZEOF_FIELD(struct rte_flow_item_vlan, tci),\n+\t\toffsetof(struct rte_flow_item_vlan, tci),\n+\t},\n+\t{\n+\t\t/*\n+\t\t * This locator is used only for building supported fields mask.\n+\t\t * The field is handled by sfc_mae_rule_process_pattern_data().\n+\t\t */\n+\t\tSFC_MAE_FIELD_HANDLING_DEFERRED,\n+\t\tRTE_SIZEOF_FIELD(struct rte_flow_item_vlan, inner_type),\n+\t\toffsetof(struct rte_flow_item_vlan, inner_type),\n+\t},\n+\n+\t/* Innermost tag */\n+\t{\n+\t\tEFX_MAE_FIELD_VLAN1_TCI_BE,\n+\t\tRTE_SIZEOF_FIELD(struct rte_flow_item_vlan, tci),\n+\t\toffsetof(struct rte_flow_item_vlan, tci),\n+\t},\n+\t{\n+\t\t/*\n+\t\t * This locator is used only for building supported fields mask.\n+\t\t * The field is handled by sfc_mae_rule_process_pattern_data().\n+\t\t */\n+\t\tSFC_MAE_FIELD_HANDLING_DEFERRED,\n+\t\tRTE_SIZEOF_FIELD(struct rte_flow_item_vlan, inner_type),\n+\t\toffsetof(struct rte_flow_item_vlan, inner_type),\n+\t},\n+};\n+\n+static int\n+sfc_mae_rule_parse_item_vlan(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+\tstruct sfc_mae_parse_ctx *ctx_mae = ctx->mae;\n+\tstruct sfc_mae_pattern_data *pdata = &ctx_mae->pattern_data;\n+\tconst struct sfc_mae_field_locator *flocs;\n+\tstruct rte_flow_item_vlan supp_mask;\n+\tconst uint8_t *spec = NULL;\n+\tconst uint8_t *mask = NULL;\n+\tunsigned int nb_flocs;\n+\tint rc;\n+\n+\tRTE_BUILD_BUG_ON(SFC_MAE_MATCH_VLAN_MAX_NTAGS != 2);\n+\n+\tif (pdata->nb_vlan_tags == SFC_MAE_MATCH_VLAN_MAX_NTAGS) {\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\tRTE_FLOW_ERROR_TYPE_ITEM, item,\n+\t\t\t\t\"Can't match that many VLAN tags\");\n+\t}\n+\n+\tnb_flocs = RTE_DIM(flocs_vlan) / SFC_MAE_MATCH_VLAN_MAX_NTAGS;\n+\tflocs = flocs_vlan + pdata->nb_vlan_tags * nb_flocs;\n+\n+\t/* If parsing fails, this can remain incremented. */\n+\t++pdata->nb_vlan_tags;\n+\n+\tsfc_mae_item_build_supp_mask(flocs, nb_flocs,\n+\t\t\t\t     &supp_mask, sizeof(supp_mask));\n+\n+\trc = sfc_flow_parse_init(item,\n+\t\t\t\t (const void **)&spec, (const void **)&mask,\n+\t\t\t\t (const void *)&supp_mask,\n+\t\t\t\t &rte_flow_item_vlan_mask,\n+\t\t\t\t sizeof(struct rte_flow_item_vlan), error);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\tif (spec != NULL) {\n+\t\tstruct sfc_mae_ethertype *ethertypes = pdata->ethertypes;\n+\t\tconst struct rte_flow_item_vlan *item_spec;\n+\t\tconst struct rte_flow_item_vlan *item_mask;\n+\n+\t\titem_spec = (const struct rte_flow_item_vlan *)spec;\n+\t\titem_mask = (const struct rte_flow_item_vlan *)mask;\n+\n+\t\tethertypes[pdata->nb_vlan_tags].value = item_spec->inner_type;\n+\t\tethertypes[pdata->nb_vlan_tags].mask = item_mask->inner_type;\n+\t} else {\n+\t\t/*\n+\t\t * The specification is empty. This is wrong in the case\n+\t\t * when there are more network patterns in line. Other\n+\t\t * than that, any Ethernet can match. All of that is\n+\t\t * checked at the end of parsing.\n+\t\t */\n+\t\treturn 0;\n+\t}\n+\n+\treturn sfc_mae_parse_item(flocs, nb_flocs, spec, mask,\n+\t\t\t\t  ctx_mae->match_spec_action, error);\n+}\n+\n static const struct sfc_flow_item sfc_flow_items[] = {\n \t{\n \t\t.type = RTE_FLOW_ITEM_TYPE_PORT_ID,\n@@ -637,6 +884,13 @@ static const struct sfc_flow_item sfc_flow_items[] = {\n \t\t.ctx_type = SFC_FLOW_PARSE_CTX_MAE,\n \t\t.parse = sfc_mae_rule_parse_item_eth,\n \t},\n+\t{\n+\t\t.type = RTE_FLOW_ITEM_TYPE_VLAN,\n+\t\t.prev_layer = SFC_FLOW_ITEM_L2,\n+\t\t.layer = SFC_FLOW_ITEM_L2,\n+\t\t.ctx_type = SFC_FLOW_PARSE_CTX_MAE,\n+\t\t.parse = sfc_mae_rule_parse_item_vlan,\n+\t},\n };\n \n int\n@@ -670,6 +924,10 @@ sfc_mae_rule_parse_pattern(struct sfc_adapter *sa,\n \tif (rc != 0)\n \t\tgoto fail_parse_pattern;\n \n+\trc = sfc_mae_rule_process_pattern_data(&ctx_mae, error);\n+\tif (rc != 0)\n+\t\tgoto fail_process_pattern_data;\n+\n \tif (!efx_mae_match_spec_is_valid(sa->nic, ctx_mae.match_spec_action)) {\n \t\trc = rte_flow_error_set(error, ENOTSUP,\n \t\t\t\t\tRTE_FLOW_ERROR_TYPE_ITEM, NULL,\n@@ -682,6 +940,7 @@ sfc_mae_rule_parse_pattern(struct sfc_adapter *sa,\n \treturn 0;\n \n fail_validate_match_spec_action:\n+fail_process_pattern_data:\n fail_parse_pattern:\n \tefx_mae_match_spec_fini(sa->nic, ctx_mae.match_spec_action);\n \ndiff --git a/drivers/net/sfc/sfc_mae.h b/drivers/net/sfc/sfc_mae.h\nindex f92e62dcbe..e4e8ab67a5 100644\n--- a/drivers/net/sfc/sfc_mae.h\n+++ b/drivers/net/sfc/sfc_mae.h\n@@ -62,10 +62,57 @@ struct sfc_mae {\n struct sfc_adapter;\n struct sfc_flow_spec;\n \n+/** This implementation supports double-tagging */\n+#define SFC_MAE_MATCH_VLAN_MAX_NTAGS\t(2)\n+\n+/** It is possible to keep track of one item ETH and two items VLAN */\n+#define SFC_MAE_L2_MAX_NITEMS\t\t(SFC_MAE_MATCH_VLAN_MAX_NTAGS + 1)\n+\n+/** Auxiliary entry format to keep track of L2 \"type\" (\"inner_type\") */\n+struct sfc_mae_ethertype {\n+\trte_be16_t\tvalue;\n+\trte_be16_t\tmask;\n+};\n+\n+struct sfc_mae_pattern_data {\n+\t/**\n+\t * Keeps track of \"type\" (\"inner_type\") mask and value for each\n+\t * parsed L2 item in a pattern. These values/masks get filled\n+\t * in MAE match specification at the end of parsing. Also, this\n+\t * information is used to conduct consistency checks:\n+\t *\n+\t * - If an item ETH is followed by a single item VLAN,\n+\t *   the former must have \"type\" set to one of supported\n+\t *   TPID values (0x8100, 0x88a8, 0x9100, 0x9200, 0x9300).\n+\t *\n+\t * - If an item ETH is followed by two items VLAN, the\n+\t *   item ETH must have \"type\" set to one of supported TPID\n+\t *   values (0x88a8, 0x9100, 0x9200, 0x9300), and the outermost\n+\t *   VLAN item must have \"inner_type\" set to TPID value 0x8100.\n+\t *\n+\t * In turn, mapping between RTE convention (above requirements) and\n+\t * MAE fields is non-trivial. The following scheme indicates\n+\t * which item EtherTypes go to which MAE fields in the case\n+\t * of single tag:\n+\t *\n+\t * ETH\t(0x8100)\t--> VLAN0_PROTO_BE\n+\t * VLAN\t(L3 EtherType)\t--> ETHER_TYPE_BE\n+\t *\n+\t * Similarly, in the case of double tagging:\n+\t *\n+\t * ETH\t(0x88a8)\t--> VLAN0_PROTO_BE\n+\t * VLAN\t(0x8100)\t--> VLAN1_PROTO_BE\n+\t * VLAN\t(L3 EtherType)\t--> ETHER_TYPE_BE\n+\t */\n+\tstruct sfc_mae_ethertype\tethertypes[SFC_MAE_L2_MAX_NITEMS];\n+\tunsigned int\t\t\tnb_vlan_tags;\n+};\n+\n struct sfc_mae_parse_ctx {\n \tstruct sfc_adapter\t\t*sa;\n \tefx_mae_match_spec_t\t\t*match_spec_action;\n \tbool\t\t\t\tmatch_mport_set;\n+\tstruct sfc_mae_pattern_data\tpattern_data;\n };\n \n int sfc_mae_attach(struct sfc_adapter *sa);\n",
    "prefixes": [
        "v2",
        "47/62"
    ]
}