get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 81504,
    "url": "https://patches.dpdk.org/api/patches/81504/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1603183709-23420-50-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": "<1603183709-23420-50-git-send-email-arybchenko@solarflare.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1603183709-23420-50-git-send-email-arybchenko@solarflare.com",
    "date": "2020-10-20T08:48:16",
    "name": "[49/62] net/sfc: support flow item IPV4 in transfer rules",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "49af84bf8c6108b05944a741a855cec60ca362da",
    "submitter": {
        "id": 607,
        "url": "https://patches.dpdk.org/api/people/607/?format=api",
        "name": "Andrew Rybchenko",
        "email": "arybchenko@solarflare.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1603183709-23420-50-git-send-email-arybchenko@solarflare.com/mbox/",
    "series": [
        {
            "id": 13132,
            "url": "https://patches.dpdk.org/api/series/13132/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=13132",
            "date": "2020-10-20T08:47:30",
            "name": "net/sfc: support flow API transfer rules",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/13132/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/81504/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/81504/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 DED51A04DD;\n\tTue, 20 Oct 2020 11:11:46 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 102DBE24B;\n\tTue, 20 Oct 2020 10:50:38 +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 C6987BBBC\n for <dev@dpdk.org>; Tue, 20 Oct 2020 10:49:09 +0200 (CEST)",
            "from mx1-us1.ppe-hosted.com (unknown [10.7.65.60])\n by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id\n 91E6A6007A for <dev@dpdk.org>; Tue, 20 Oct 2020 08:49:09 +0000 (UTC)",
            "from us4-mdac16-52.ut7.mdlocal (unknown [10.7.66.23])\n by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 911142009A\n for <dev@dpdk.org>; Tue, 20 Oct 2020 08:49:09 +0000 (UTC)",
            "from mx1-us1.ppe-hosted.com (unknown [10.7.65.199])\n by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id\n 12FB61C0051\n for <dev@dpdk.org>; Tue, 20 Oct 2020 08:49:09 +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 BC81418005B\n for <dev@dpdk.org>; Tue, 20 Oct 2020 08:49:08 +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 09:48:50 +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 09:48:50 +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 09K8mo3x030900;\n Tue, 20 Oct 2020 09:48:50 +0100",
            "from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1])\n by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 5838F1613A9;\n Tue, 20 Oct 2020 09:48:50 +0100 (BST)"
        ],
        "X-Virus-Scanned": "Proofpoint Essentials engine",
        "From": "Andrew Rybchenko <arybchenko@solarflare.com>",
        "To": "<y@solarflare.com>",
        "CC": "<dev@dpdk.org>, Ivan Malov <ivan.malov@oktetlabs.ru>",
        "Date": "Tue, 20 Oct 2020 09:48:16 +0100",
        "Message-ID": "<1603183709-23420-50-git-send-email-arybchenko@solarflare.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1603183709-23420-1-git-send-email-arybchenko@solarflare.com>",
        "References": "<1603183709-23420-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-0.972300-8.000000-10",
        "X-TMASE-MatchedRID": "U43vBdnEpjofKML5AJtfLS2416nc3bQleouvej40T4gd0WOKRkwsh3Io\n zGa69omdrdoLblq9S5oV+ztbPoSlM0jn8cIz0h4xHl2pJS1lPFvbODDlFP8GtiGD+Fp3vZHUiM6\n fF5HaiokeiFQL2XCGlEbCbdi0X6BUxz6opuAAUJJX7UpJhGB2YqIik2/euMx1f8xg+JfAY9BNnt\n 9EGqgbbPCro3RI5LoRHbgNvtI8fLxfHIrW6stOkz5g6d8RSIIzovA/6ONsv0rmQJUUegCCexZKi\n SC+7/NsOPAJR2VDC9/c7RafwK18CoP+zEDQnRb6+ACG5oWJ7tICn5QffvZFle4utY8dkDDy5Bit\n m2A0oi+iMobsOo19soAy6p60ZV62fJ5/bZ6npdiujVRFkkVsmx8lAh96RVPPUNv5At92pCH3Qva\n JB5wFpXwsCPATzCTsd5f4wKG8PlXdyppfK383wBBrUiiKoDjaA9Lcdcpe5r9wZ/9f5Xj1/fDsnH\n BTQS9kyoRE4tv/7I7j/Qm+fSvAAma0vgPD7M1vQP8wh/06uR0=",
        "X-TM-AS-User-Approved-Sender": "Yes",
        "X-TM-AS-User-Blocked-Sender": "No",
        "X-TMASE-Result": "10-0.972300-8.000000",
        "X-TMASE-Version": "SMEX-12.5.0.1300-8.6.1012-25736.003",
        "X-MDID": "1603183749-Tx1wuV6-Td6V",
        "X-PPE-DISP": "1603183749;Tx1wuV6-Td6V",
        "Subject": "[dpdk-dev] [PATCH 49/62] net/sfc: support flow item IPV4 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\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 |   3 +\n drivers/net/sfc/sfc_mae.c   | 121 ++++++++++++++++++++++++++++++++++++\n drivers/net/sfc/sfc_mae.h   |  20 ++++++\n 3 files changed, 144 insertions(+)",
    "diff": "diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst\nindex adee0cd670..e687e1cac3 100644\n--- a/doc/guides/nics/sfc_efx.rst\n+++ b/doc/guides/nics/sfc_efx.rst\n@@ -202,6 +202,9 @@ Supported pattern items (***transfer*** rules):\n \n - VLAN (double-tagging is supported)\n \n+- IPV4 (source/destination addresses, IP transport protocol,\n+  type of service, time to live)\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 cc22fee6fe..d7c1cd784f 100644\n--- a/drivers/net/sfc/sfc_mae.c\n+++ b/drivers/net/sfc/sfc_mae.c\n@@ -312,6 +312,7 @@ 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+\tefx_mae_match_spec_t *efx_spec = ctx->match_spec_action;\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@@ -326,8 +327,19 @@ sfc_mae_rule_process_pattern_data(struct sfc_mae_parse_ctx *ctx,\n \t};\n \tunsigned int nb_supported_tpids = RTE_DIM(supported_tpids);\n \tunsigned int ethertype_idx;\n+\tconst uint8_t *valuep;\n+\tconst uint8_t *maskp;\n \tint rc;\n \n+\tif (pdata->innermost_ethertype_restriction.mask != 0 &&\n+\t    pdata->nb_vlan_tags < SFC_MAE_MATCH_VLAN_MAX_NTAGS) {\n+\t\t/*\n+\t\t * If a single item VLAN is followed by a L3 item, value\n+\t\t * of \"type\" in item ETH can't be a double-tagging TPID.\n+\t\t */\n+\t\tnb_supported_tpids = 1;\n+\t}\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@@ -359,6 +371,21 @@ sfc_mae_rule_process_pattern_data(struct sfc_mae_parse_ctx *ctx,\n \t\tnb_supported_tpids = 1;\n \t}\n \n+\tif (pdata->innermost_ethertype_restriction.mask == RTE_BE16(0xffff)) {\n+\t\tstruct sfc_mae_ethertype *et = &ethertypes[ethertype_idx];\n+\n+\t\tif (et->mask == 0) {\n+\t\t\tet->mask = RTE_BE16(0xffff);\n+\t\t\tet->value =\n+\t\t\t    pdata->innermost_ethertype_restriction.value;\n+\t\t} else if (et->mask != RTE_BE16(0xffff) ||\n+\t\t\t   et->value !=\n+\t\t\t   pdata->innermost_ethertype_restriction.value) {\n+\t\t\trc = EINVAL;\n+\t\t\tgoto fail;\n+\t\t}\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@@ -369,6 +396,16 @@ sfc_mae_rule_process_pattern_data(struct sfc_mae_parse_ctx *ctx,\n \tif (rc != 0)\n \t\tgoto fail;\n \n+\tvaluep = (const uint8_t *)&pdata->l3_next_proto_value;\n+\tmaskp = (const uint8_t *)&pdata->l3_next_proto_mask;\n+\trc = efx_mae_match_spec_field_set(efx_spec, EFX_MAE_FIELD_IP_PROTO,\n+\t\t\t\t\t  sizeof(pdata->l3_next_proto_value),\n+\t\t\t\t\t  valuep,\n+\t\t\t\t\t  sizeof(pdata->l3_next_proto_mask),\n+\t\t\t\t\t  maskp);\n+\tif (rc != 0)\n+\t\tgoto fail;\n+\n \treturn 0;\n \n fail:\n@@ -832,6 +869,83 @@ sfc_mae_rule_parse_item_vlan(const struct rte_flow_item *item,\n \t\t\t\t  ctx_mae->match_spec_action, error);\n }\n \n+static const struct sfc_mae_field_locator flocs_ipv4[] = {\n+\t{\n+\t\tEFX_MAE_FIELD_SRC_IP4_BE,\n+\t\tRTE_SIZEOF_FIELD(struct rte_flow_item_ipv4, hdr.src_addr),\n+\t\toffsetof(struct rte_flow_item_ipv4, hdr.src_addr),\n+\t},\n+\t{\n+\t\tEFX_MAE_FIELD_DST_IP4_BE,\n+\t\tRTE_SIZEOF_FIELD(struct rte_flow_item_ipv4, hdr.dst_addr),\n+\t\toffsetof(struct rte_flow_item_ipv4, hdr.dst_addr),\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_ipv4, hdr.next_proto_id),\n+\t\toffsetof(struct rte_flow_item_ipv4, hdr.next_proto_id),\n+\t},\n+\t{\n+\t\tEFX_MAE_FIELD_IP_TOS,\n+\t\tRTE_SIZEOF_FIELD(struct rte_flow_item_ipv4,\n+\t\t\t\t hdr.type_of_service),\n+\t\toffsetof(struct rte_flow_item_ipv4, hdr.type_of_service),\n+\t},\n+\t{\n+\t\tEFX_MAE_FIELD_IP_TTL,\n+\t\tRTE_SIZEOF_FIELD(struct rte_flow_item_ipv4, hdr.time_to_live),\n+\t\toffsetof(struct rte_flow_item_ipv4, hdr.time_to_live),\n+\t},\n+};\n+\n+static int\n+sfc_mae_rule_parse_item_ipv4(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+\trte_be16_t ethertype_ipv4_be = RTE_BE16(RTE_ETHER_TYPE_IPV4);\n+\tstruct sfc_mae_parse_ctx *ctx_mae = ctx->mae;\n+\tstruct sfc_mae_pattern_data *pdata = &ctx_mae->pattern_data;\n+\tstruct rte_flow_item_ipv4 supp_mask;\n+\tconst uint8_t *spec = NULL;\n+\tconst uint8_t *mask = NULL;\n+\tint rc;\n+\n+\tsfc_mae_item_build_supp_mask(flocs_ipv4, RTE_DIM(flocs_ipv4),\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_ipv4_mask,\n+\t\t\t\t sizeof(struct rte_flow_item_ipv4), error);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\tpdata->innermost_ethertype_restriction.value = ethertype_ipv4_be;\n+\tpdata->innermost_ethertype_restriction.mask = RTE_BE16(0xffff);\n+\n+\tif (spec != NULL) {\n+\t\tconst struct rte_flow_item_ipv4 *item_spec;\n+\t\tconst struct rte_flow_item_ipv4 *item_mask;\n+\n+\t\titem_spec = (const struct rte_flow_item_ipv4 *)spec;\n+\t\titem_mask = (const struct rte_flow_item_ipv4 *)mask;\n+\n+\t\tpdata->l3_next_proto_value = item_spec->hdr.next_proto_id;\n+\t\tpdata->l3_next_proto_mask = item_mask->hdr.next_proto_id;\n+\t} else {\n+\t\treturn 0;\n+\t}\n+\n+\treturn sfc_mae_parse_item(flocs_ipv4, RTE_DIM(flocs_ipv4), 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@@ -891,6 +1005,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_vlan,\n \t},\n+\t{\n+\t\t.type = RTE_FLOW_ITEM_TYPE_IPV4,\n+\t\t.prev_layer = SFC_FLOW_ITEM_L2,\n+\t\t.layer = SFC_FLOW_ITEM_L3,\n+\t\t.ctx_type = SFC_FLOW_PARSE_CTX_MAE,\n+\t\t.parse = sfc_mae_rule_parse_item_ipv4,\n+\t},\n };\n \n int\ndiff --git a/drivers/net/sfc/sfc_mae.h b/drivers/net/sfc/sfc_mae.h\nindex e4e8ab67a5..56be8bf917 100644\n--- a/drivers/net/sfc/sfc_mae.h\n+++ b/drivers/net/sfc/sfc_mae.h\n@@ -90,6 +90,10 @@ struct sfc_mae_pattern_data {\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 * - If a L2 item is followed by a L3 one, the former must\n+\t *   indicate \"type\" (\"inner_type\") which corresponds to\n+\t *   the protocol used in the L3 item, or 0x0000/0x0000.\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@@ -106,6 +110,22 @@ struct sfc_mae_pattern_data {\n \t */\n \tstruct sfc_mae_ethertype\tethertypes[SFC_MAE_L2_MAX_NITEMS];\n \tunsigned int\t\t\tnb_vlan_tags;\n+\n+\t/**\n+\t * L3 requirement for the innermost L2 item's \"type\" (\"inner_type\").\n+\t * This contains one of:\n+\t * - 0x0800/0xffff: IPV4\n+\t * - 0x0000/0x0000: no L3 item\n+\t */\n+\tstruct sfc_mae_ethertype\tinnermost_ethertype_restriction;\n+\n+\t/**\n+\t * The following two fields keep track of L3 \"proto\" mask and value.\n+\t * The corresponding fields get filled in MAE match specification\n+\t * at the end of parsing.\n+\t */\n+\tuint8_t\t\t\t\tl3_next_proto_value;\n+\tuint8_t\t\t\t\tl3_next_proto_mask;\n };\n \n struct sfc_mae_parse_ctx {\n",
    "prefixes": [
        "49/62"
    ]
}