get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 100021,
    "url": "https://patches.dpdk.org/api/patches/100021/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210929205730.775-2-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-2-ivan.malov@oktetlabs.ru>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210929205730.775-2-ivan.malov@oktetlabs.ru",
    "date": "2021-09-29T20:57:21",
    "name": "[01/10] net/sfc: fence off 8 bits in Rx mark for tunnel offload",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "30f7aa46fe9affaee7097bee740d13433747a883",
    "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-2-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/100021/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/100021/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 F3F5CA0032;\n\tWed, 29 Sep 2021 22:57:50 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id CBE98410FC;\n\tWed, 29 Sep 2021 22:57:46 +0200 (CEST)",
            "from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113])\n by mails.dpdk.org (Postfix) with ESMTP id A1D9F410EF\n for <dev@dpdk.org>; Wed, 29 Sep 2021 22:57:44 +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 44CC37F5FD;\n Wed, 29 Sep 2021 23:57:44 +0300 (MSK)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 44CC37F5FD",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru;\n s=default; t=1632949064;\n bh=2PMgdsbKfxuzAYmT2PK+q9Z9jwGP5z/44yo1iyc3kc0=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References;\n b=gne/g0oH8BunDrgOdQ+5boCQA9hJHvzgktSv/lqJGXmjLSh5Kj7rgdEdISUcjZI++\n qyfSeUZZI2ez/3hrgbU7ggN3a5oFto1ZWV0a5BFMgORdcMkIQPwe9Qpq16Pxlh0Ob9\n 3f+RwKLzlGGZva5LAxjCl9MpvcJr0Dt0RT1hee5k=",
        "From": "Ivan Malov <ivan.malov@oktetlabs.ru>",
        "To": "dev@dpdk.org",
        "Cc": "Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,\n Andy Moreton <amoreton@xilinx.com>",
        "Date": "Wed, 29 Sep 2021 23:57:21 +0300",
        "Message-Id": "<20210929205730.775-2-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 01/10] net/sfc: fence off 8 bits in Rx mark for\n tunnel 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": "Later patches add support for tunnel offload on Riverhead (EF100).\nA board can host at most 254 tunnels. Partially offloaded (missed)\ntunnel packets are identified by virtue of 8 high bits in Rx mark.\n\nAdd basic definitions of the upcoming tunnel offload support and\ntake care of the dedicated bits in Rx mark across the driver.\n\nSigned-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>\nReviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>\nReviewed-by: Andy Moreton <amoreton@xilinx.com>\n---\n drivers/net/sfc/meson.build       |  1 +\n drivers/net/sfc/sfc_dp_rx.h       |  3 +++\n drivers/net/sfc/sfc_ef100_rx.c    | 14 ++++++++++--\n drivers/net/sfc/sfc_ethdev.c      |  4 ++++\n drivers/net/sfc/sfc_flow.c        |  8 ++++++-\n drivers/net/sfc/sfc_flow_tunnel.c | 29 +++++++++++++++++++++++\n drivers/net/sfc/sfc_flow_tunnel.h | 38 +++++++++++++++++++++++++++++++\n drivers/net/sfc/sfc_mae.c         |  6 +++++\n drivers/net/sfc/sfc_rx.c          | 10 +++++++-\n 9 files changed, 109 insertions(+), 4 deletions(-)\n create mode 100644 drivers/net/sfc/sfc_flow_tunnel.c\n create mode 100644 drivers/net/sfc/sfc_flow_tunnel.h",
    "diff": "diff --git a/drivers/net/sfc/meson.build b/drivers/net/sfc/meson.build\nindex 948c65968a..6a8ccd564b 100644\n--- a/drivers/net/sfc/meson.build\n+++ b/drivers/net/sfc/meson.build\n@@ -90,6 +90,7 @@ sources = files(\n         'sfc_mae.c',\n         'sfc_mae_counter.c',\n         'sfc_flow.c',\n+\t'sfc_flow_tunnel.c',\n         'sfc_dp.c',\n         'sfc_ef10_rx.c',\n         'sfc_ef10_essb_rx.c',\ndiff --git a/drivers/net/sfc/sfc_dp_rx.h b/drivers/net/sfc/sfc_dp_rx.h\nindex b6c44085ce..1be301ced6 100644\n--- a/drivers/net/sfc/sfc_dp_rx.h\n+++ b/drivers/net/sfc/sfc_dp_rx.h\n@@ -92,6 +92,9 @@ struct sfc_dp_rx_qcreate_info {\n \tefsys_dma_addr_t\tfcw_offset;\n \t/** VI window size shift */\n \tunsigned int\t\tvi_window_shift;\n+\n+\t/** Mask to extract user bits from Rx prefix mark field */\n+\tuint32_t\t\tuser_mark_mask;\n };\n \n /**\ndiff --git a/drivers/net/sfc/sfc_ef100_rx.c b/drivers/net/sfc/sfc_ef100_rx.c\nindex 7d0d6b3d00..3219c972db 100644\n--- a/drivers/net/sfc/sfc_ef100_rx.c\n+++ b/drivers/net/sfc/sfc_ef100_rx.c\n@@ -20,7 +20,9 @@\n #include \"efx_regs_ef100.h\"\n #include \"efx.h\"\n \n+#include \"sfc.h\"\n #include \"sfc_debug.h\"\n+#include \"sfc_flow_tunnel.h\"\n #include \"sfc_tweak.h\"\n #include \"sfc_dp_rx.h\"\n #include \"sfc_kvargs.h\"\n@@ -74,6 +76,7 @@ struct sfc_ef100_rxq {\n \tuint64_t\t\t\trearm_data;\n \tuint16_t\t\t\tbuf_size;\n \tuint16_t\t\t\tprefix_size;\n+\tuint32_t\t\t\tuser_mark_mask;\n \n \tunsigned int\t\t\tevq_hw_index;\n \tvolatile void\t\t\t*evq_prime;\n@@ -420,10 +423,13 @@ sfc_ef100_rx_prefix_to_offloads(const struct sfc_ef100_rxq *rxq,\n \n \tif (rxq->flags & SFC_EF100_RXQ_USER_MARK) {\n \t\tuint32_t user_mark;\n+\t\tuint32_t mark;\n \n \t\t/* EFX_OWORD_FIELD converts little-endian to CPU */\n-\t\tuser_mark = EFX_OWORD_FIELD(rx_prefix[0],\n-\t\t\t\t\t    ESF_GZ_RX_PREFIX_USER_MARK);\n+\t\tmark = EFX_OWORD_FIELD(rx_prefix[0],\n+\t\t\t\t       ESF_GZ_RX_PREFIX_USER_MARK);\n+\n+\t\tuser_mark = mark & rxq->user_mark_mask;\n \t\tif (user_mark != SFC_EF100_USER_MARK_INVALID) {\n \t\t\tol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;\n \t\t\tm->hash.fdir.hi = user_mark;\n@@ -745,6 +751,10 @@ sfc_ef100_rx_qcreate(uint16_t port_id, uint16_t queue_id,\n \trxq->max_fill_level = info->max_fill_level;\n \trxq->refill_threshold = info->refill_threshold;\n \trxq->prefix_size = info->prefix_size;\n+\n+\tSFC_ASSERT(info->user_mark_mask != 0);\n+\trxq->user_mark_mask = info->user_mark_mask;\n+\n \trxq->buf_size = info->buf_size;\n \trxq->refill_mb_pool = info->refill_mb_pool;\n \trxq->rxq_hw_ring = info->rxq_hw_ring;\ndiff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c\nindex 75c3da2e52..ab25674929 100644\n--- a/drivers/net/sfc/sfc_ethdev.c\n+++ b/drivers/net/sfc/sfc_ethdev.c\n@@ -26,6 +26,7 @@\n #include \"sfc_rx.h\"\n #include \"sfc_tx.h\"\n #include \"sfc_flow.h\"\n+#include \"sfc_flow_tunnel.h\"\n #include \"sfc_dp.h\"\n #include \"sfc_dp_rx.h\"\n #include \"sfc_sw_stats.h\"\n@@ -1873,6 +1874,9 @@ sfc_rx_meta_negotiate(struct rte_eth_dev *dev, uint64_t *features)\n \tif ((sa->priv.dp_rx->features & SFC_DP_RX_FEAT_FLOW_MARK) != 0)\n \t\tsupported |= RTE_ETH_RX_META_USER_MARK;\n \n+\tif (sfc_flow_tunnel_is_supported(sa))\n+\t\tsupported |= RTE_ETH_RX_META_TUNNEL_ID;\n+\n \tsa->negotiated_rx_meta = supported & *features;\n \t*features = sa->negotiated_rx_meta;\n \ndiff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c\nindex 57cf1ad02b..7510cbb95b 100644\n--- a/drivers/net/sfc/sfc_flow.c\n+++ b/drivers/net/sfc/sfc_flow.c\n@@ -22,6 +22,7 @@\n #include \"sfc_rx.h\"\n #include \"sfc_filter.h\"\n #include \"sfc_flow.h\"\n+#include \"sfc_flow_tunnel.h\"\n #include \"sfc_log.h\"\n #include \"sfc_dp_rx.h\"\n #include \"sfc_mae_counter.h\"\n@@ -1740,8 +1741,13 @@ sfc_flow_parse_mark(struct sfc_adapter *sa,\n \tstruct sfc_flow_spec *spec = &flow->spec;\n \tstruct sfc_flow_spec_filter *spec_filter = &spec->filter;\n \tconst efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);\n+\tuint32_t mark_max;\n \n-\tif (mark == NULL || mark->id > encp->enc_filter_action_mark_max)\n+\tmark_max = encp->enc_filter_action_mark_max;\n+\tif (sfc_flow_tunnel_is_active(sa))\n+\t\tmark_max = RTE_MIN(mark_max, SFC_FT_USER_MARK_MASK);\n+\n+\tif (mark == NULL || mark->id > mark_max)\n \t\treturn EINVAL;\n \n \tspec_filter->template.efs_flags |= EFX_FILTER_FLAG_ACTION_MARK;\ndiff --git a/drivers/net/sfc/sfc_flow_tunnel.c b/drivers/net/sfc/sfc_flow_tunnel.c\nnew file mode 100644\nindex 0000000000..06b4a27a65\n--- /dev/null\n+++ b/drivers/net/sfc/sfc_flow_tunnel.c\n@@ -0,0 +1,29 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ *\n+ * Copyright(c) 2021 Xilinx, Inc.\n+ */\n+\n+#include <stdbool.h>\n+#include <stdint.h>\n+\n+#include \"sfc.h\"\n+#include \"sfc_dp_rx.h\"\n+#include \"sfc_flow_tunnel.h\"\n+#include \"sfc_mae.h\"\n+\n+bool\n+sfc_flow_tunnel_is_supported(struct sfc_adapter *sa)\n+{\n+\tSFC_ASSERT(sfc_adapter_is_locked(sa));\n+\n+\treturn ((sa->priv.dp_rx->features & SFC_DP_RX_FEAT_FLOW_MARK) != 0 &&\n+\t\tsa->mae.status == SFC_MAE_STATUS_SUPPORTED);\n+}\n+\n+bool\n+sfc_flow_tunnel_is_active(struct sfc_adapter *sa)\n+{\n+\tSFC_ASSERT(sfc_adapter_is_locked(sa));\n+\n+\treturn ((sa->negotiated_rx_meta & RTE_ETH_RX_META_TUNNEL_ID) != 0);\n+}\ndiff --git a/drivers/net/sfc/sfc_flow_tunnel.h b/drivers/net/sfc/sfc_flow_tunnel.h\nnew file mode 100644\nindex 0000000000..fec891fdad\n--- /dev/null\n+++ b/drivers/net/sfc/sfc_flow_tunnel.h\n@@ -0,0 +1,38 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ *\n+ * Copyright(c) 2021 Xilinx, Inc.\n+ */\n+\n+#ifndef _SFC_FLOW_TUNNEL_H\n+#define _SFC_FLOW_TUNNEL_H\n+\n+#include <limits.h>\n+#include <stdbool.h>\n+#include <stdint.h>\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+/** Flow Tunnel (FT) SW entry ID */\n+typedef uint8_t sfc_ft_id_t;\n+\n+#define SFC_FT_TUNNEL_MARK_BITS \\\n+\t(sizeof(sfc_ft_id_t) * CHAR_BIT)\n+\n+#define SFC_FT_USER_MARK_BITS \\\n+\t(sizeof(uint32_t) * CHAR_BIT - SFC_FT_TUNNEL_MARK_BITS)\n+\n+#define SFC_FT_USER_MARK_MASK \\\n+\tRTE_LEN2MASK(SFC_FT_USER_MARK_BITS, uint32_t)\n+\n+struct sfc_adapter;\n+\n+bool sfc_flow_tunnel_is_supported(struct sfc_adapter *sa);\n+\n+bool sfc_flow_tunnel_is_active(struct sfc_adapter *sa);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+#endif /* _SFC_FLOW_TUNNEL_H */\ndiff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c\nindex 5ecad7347a..2b80492e59 100644\n--- a/drivers/net/sfc/sfc_mae.c\n+++ b/drivers/net/sfc/sfc_mae.c\n@@ -16,6 +16,7 @@\n #include \"efx.h\"\n \n #include \"sfc.h\"\n+#include \"sfc_flow_tunnel.h\"\n #include \"sfc_mae_counter.h\"\n #include \"sfc_log.h\"\n #include \"sfc_switch.h\"\n@@ -2793,6 +2794,11 @@ sfc_mae_rule_parse_action_mark(struct sfc_adapter *sa,\n {\n \tint rc;\n \n+\tif (conf->id > SFC_FT_USER_MARK_MASK) {\n+\t\tsfc_err(sa, \"the mark value is too large\");\n+\t\treturn EINVAL;\n+\t}\n+\n \trc = efx_mae_action_set_populate_mark(spec, conf->id);\n \tif (rc != 0)\n \t\tsfc_err(sa, \"failed to request action MARK: %s\", strerror(rc));\ndiff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c\nindex a3331c5089..3ef43d7c38 100644\n--- a/drivers/net/sfc/sfc_rx.c\n+++ b/drivers/net/sfc/sfc_rx.c\n@@ -13,6 +13,7 @@\n \n #include \"sfc.h\"\n #include \"sfc_debug.h\"\n+#include \"sfc_flow_tunnel.h\"\n #include \"sfc_log.h\"\n #include \"sfc_ev.h\"\n #include \"sfc_rx.h\"\n@@ -1181,7 +1182,8 @@ sfc_rx_qinit(struct sfc_adapter *sa, sfc_sw_index_t sw_index,\n \tif ((sa->negotiated_rx_meta & RTE_ETH_RX_META_USER_FLAG) != 0)\n \t\trxq_info->type_flags |= EFX_RXQ_FLAG_USER_FLAG;\n \n-\tif ((sa->negotiated_rx_meta & RTE_ETH_RX_META_USER_MARK) != 0)\n+\tif ((sa->negotiated_rx_meta & RTE_ETH_RX_META_USER_MARK) != 0 ||\n+\t    sfc_flow_tunnel_is_active(sa))\n \t\trxq_info->type_flags |= EFX_RXQ_FLAG_USER_MARK;\n \n \trc = sfc_ev_qinit(sa, SFC_EVQ_TYPE_RX, sw_index,\n@@ -1231,6 +1233,12 @@ sfc_rx_qinit(struct sfc_adapter *sa, sfc_sw_index_t sw_index,\n \tinfo.buf_size = buf_size;\n \tinfo.batch_max = encp->enc_rx_batch_max;\n \tinfo.prefix_size = encp->enc_rx_prefix_size;\n+\n+\tif (sfc_flow_tunnel_is_active(sa))\n+\t\tinfo.user_mark_mask = SFC_FT_USER_MARK_MASK;\n+\telse\n+\t\tinfo.user_mark_mask = UINT32_MAX;\n+\n \tinfo.flags = rxq_info->rxq_flags;\n \tinfo.rxq_entries = rxq_info->entries;\n \tinfo.rxq_hw_ring = rxq->mem.esm_base;\n",
    "prefixes": [
        "01/10"
    ]
}