get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 97427,
    "url": "http://patchwork.dpdk.org/api/patches/97427/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210827065717.1838258-8-andrew.rybchenko@oktetlabs.ru/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20210827065717.1838258-8-andrew.rybchenko@oktetlabs.ru>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210827065717.1838258-8-andrew.rybchenko@oktetlabs.ru",
    "date": "2021-08-27T06:56:46",
    "name": "[07/38] net/sfc: add representors proxy infrastructure",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "bebf510dde4bafe25216a02bc004b7412e950de3",
    "submitter": {
        "id": 2013,
        "url": "http://patchwork.dpdk.org/api/people/2013/?format=api",
        "name": "Andrew Rybchenko",
        "email": "Andrew.Rybchenko@oktetlabs.ru"
    },
    "delegate": {
        "id": 319,
        "url": "http://patchwork.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20210827065717.1838258-8-andrew.rybchenko@oktetlabs.ru/mbox/",
    "series": [
        {
            "id": 18492,
            "url": "http://patchwork.dpdk.org/api/series/18492/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=18492",
            "date": "2021-08-27T06:56:39",
            "name": "net/sfc: support port representors",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/18492/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/97427/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/97427/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 517AEA0C43;\n\tFri, 27 Aug 2021 08:58:40 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 0101C4127F;\n\tFri, 27 Aug 2021 08:58:06 +0200 (CEST)",
            "from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113])\n by mails.dpdk.org (Postfix) with ESMTP id 2330E4126B\n for <dev@dpdk.org>; Fri, 27 Aug 2021 08:58:02 +0200 (CEST)",
            "by shelob.oktetlabs.ru (Postfix, from userid 122)\n id CF00D7F6CB; Fri, 27 Aug 2021 09:58:01 +0300 (MSK)",
            "from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17])\n by shelob.oktetlabs.ru (Postfix) with ESMTP id 888F87F6D7;\n Fri, 27 Aug 2021 09:57:33 +0300 (MSK)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on shelob.oktetlabs.ru",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=0.8 required=5.0 tests=ALL_TRUSTED,\n DKIM_ADSP_DISCARD,\n URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2",
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 888F87F6D7",
        "Authentication-Results": "shelob.oktetlabs.ru/888F87F6D7; dkim=none;\n dkim-atps=neutral",
        "From": "Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>",
        "To": "dev@dpdk.org",
        "Cc": "Igor Romanov <igor.romanov@oktetlabs.ru>,\n Andy Moreton <amoreton@xilinx.com>, Ivan Malov <ivan.malov@oktetlabs.ru>",
        "Date": "Fri, 27 Aug 2021 09:56:46 +0300",
        "Message-Id": "<20210827065717.1838258-8-andrew.rybchenko@oktetlabs.ru>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20210827065717.1838258-1-andrew.rybchenko@oktetlabs.ru>",
        "References": "<20210827065717.1838258-1-andrew.rybchenko@oktetlabs.ru>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 07/38] net/sfc: add representors proxy\n infrastructure",
        "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": "From: Igor Romanov <igor.romanov@oktetlabs.ru>\n\nRepresentor proxy is a mediator between virtual functions and port\nrepresentors. It forwards traffic between virtual functions and port\nrepresentors performing base PF ethdev + VF's representor traffic\n(de-)multiplexing. The implementation will be provided by later patches.\n\nSigned-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>\nSigned-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>\nReviewed-by: Andy Moreton <amoreton@xilinx.com>\nReviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>\n---\n drivers/net/sfc/meson.build      |   1 +\n drivers/net/sfc/sfc.c            |  35 ++++++\n drivers/net/sfc/sfc.h            |   5 +\n drivers/net/sfc/sfc_repr_proxy.c | 210 +++++++++++++++++++++++++++++++\n drivers/net/sfc/sfc_repr_proxy.h |  34 +++++\n 5 files changed, 285 insertions(+)\n create mode 100644 drivers/net/sfc/sfc_repr_proxy.c\n create mode 100644 drivers/net/sfc/sfc_repr_proxy.h",
    "diff": "diff --git a/drivers/net/sfc/meson.build b/drivers/net/sfc/meson.build\nindex 948c65968a..4fc2063f7a 100644\n--- a/drivers/net/sfc/meson.build\n+++ b/drivers/net/sfc/meson.build\n@@ -97,4 +97,5 @@ sources = files(\n         'sfc_ef100_rx.c',\n         'sfc_ef100_tx.c',\n         'sfc_service.c',\n+        'sfc_repr_proxy.c',\n )\ndiff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c\nindex cd2c97f3b2..591b8971b3 100644\n--- a/drivers/net/sfc/sfc.c\n+++ b/drivers/net/sfc/sfc.c\n@@ -27,6 +27,25 @@\n #include \"sfc_sw_stats.h\"\n \n \n+bool\n+sfc_repr_supported(const struct sfc_adapter *sa)\n+{\n+\tif (!sa->switchdev)\n+\t\treturn false;\n+\n+\t/*\n+\t * Representor proxy should use service lcore on PF's socket\n+\t * (sa->socket_id) to be efficient. But the proxy will fall back\n+\t * to any socket if it is not possible to get the service core\n+\t * on the same socket. Check that at least service core on any\n+\t * socket is available.\n+\t */\n+\tif (sfc_get_service_lcore(SOCKET_ID_ANY) == RTE_MAX_LCORE)\n+\t\treturn false;\n+\n+\treturn true;\n+}\n+\n int\n sfc_dma_alloc(const struct sfc_adapter *sa, const char *name, uint16_t id,\n \t      size_t len, int socket_id, efsys_mem_t *esmp)\n@@ -434,9 +453,16 @@ sfc_try_start(struct sfc_adapter *sa)\n \tif (rc != 0)\n \t\tgoto fail_flows_insert;\n \n+\trc = sfc_repr_proxy_start(sa);\n+\tif (rc != 0)\n+\t\tgoto fail_repr_proxy_start;\n+\n \tsfc_log_init(sa, \"done\");\n \treturn 0;\n \n+fail_repr_proxy_start:\n+\tsfc_flow_stop(sa);\n+\n fail_flows_insert:\n \tsfc_tx_stop(sa);\n \n@@ -540,6 +566,7 @@ sfc_stop(struct sfc_adapter *sa)\n \n \tsa->state = SFC_ADAPTER_STOPPING;\n \n+\tsfc_repr_proxy_stop(sa);\n \tsfc_flow_stop(sa);\n \tsfc_tx_stop(sa);\n \tsfc_rx_stop(sa);\n@@ -899,6 +926,10 @@ sfc_attach(struct sfc_adapter *sa)\n \tif (rc != 0)\n \t\tgoto fail_mae_switchdev_init;\n \n+\trc = sfc_repr_proxy_attach(sa);\n+\tif (rc != 0)\n+\t\tgoto fail_repr_proxy_attach;\n+\n \tsfc_log_init(sa, \"fini nic\");\n \tefx_nic_fini(enp);\n \n@@ -927,6 +958,9 @@ sfc_attach(struct sfc_adapter *sa)\n \n fail_sw_xstats_init:\n \tsfc_flow_fini(sa);\n+\tsfc_repr_proxy_detach(sa);\n+\n+fail_repr_proxy_attach:\n \tsfc_mae_switchdev_fini(sa);\n \n fail_mae_switchdev_init:\n@@ -976,6 +1010,7 @@ sfc_detach(struct sfc_adapter *sa)\n \n \tsfc_flow_fini(sa);\n \n+\tsfc_repr_proxy_detach(sa);\n \tsfc_mae_switchdev_fini(sa);\n \tsfc_mae_detach(sa);\n \tsfc_mae_counter_rxq_detach(sa);\ndiff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h\nindex b045baca9e..8f65857f65 100644\n--- a/drivers/net/sfc/sfc.h\n+++ b/drivers/net/sfc/sfc.h\n@@ -30,6 +30,8 @@\n #include \"sfc_sriov.h\"\n #include \"sfc_mae.h\"\n #include \"sfc_dp.h\"\n+#include \"sfc_repr_proxy.h\"\n+#include \"sfc_service.h\"\n \n #ifdef __cplusplus\n extern \"C\" {\n@@ -260,6 +262,7 @@ struct sfc_adapter {\n \tstruct sfc_sw_xstats\t\tsw_xstats;\n \tstruct sfc_filter\t\tfilter;\n \tstruct sfc_mae\t\t\tmae;\n+\tstruct sfc_repr_proxy\t\trepr_proxy;\n \n \tstruct sfc_flow_list\t\tflow_list;\n \n@@ -388,6 +391,8 @@ sfc_nb_counter_rxq(const struct sfc_adapter_shared *sas)\n \treturn sas->counters_rxq_allocated ? 1 : 0;\n }\n \n+bool sfc_repr_supported(const struct sfc_adapter *sa);\n+\n /** Get the number of milliseconds since boot from the default timer */\n static inline uint64_t\n sfc_get_system_msecs(void)\ndiff --git a/drivers/net/sfc/sfc_repr_proxy.c b/drivers/net/sfc/sfc_repr_proxy.c\nnew file mode 100644\nindex 0000000000..eb29376988\n--- /dev/null\n+++ b/drivers/net/sfc/sfc_repr_proxy.c\n@@ -0,0 +1,210 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ *\n+ * Copyright(c) 2019-2021 Xilinx, Inc.\n+ * Copyright(c) 2019 Solarflare Communications Inc.\n+ *\n+ * This software was jointly developed between OKTET Labs (under contract\n+ * for Solarflare) and Solarflare Communications, Inc.\n+ */\n+\n+#include <rte_service.h>\n+#include <rte_service_component.h>\n+\n+#include \"sfc_log.h\"\n+#include \"sfc_service.h\"\n+#include \"sfc_repr_proxy.h\"\n+#include \"sfc.h\"\n+\n+static int32_t\n+sfc_repr_proxy_routine(void *arg)\n+{\n+\tstruct sfc_repr_proxy *rp = arg;\n+\n+\t/* Representor proxy boilerplate will be here */\n+\tRTE_SET_USED(rp);\n+\n+\treturn 0;\n+}\n+\n+int\n+sfc_repr_proxy_attach(struct sfc_adapter *sa)\n+{\n+\tstruct sfc_repr_proxy *rp = &sa->repr_proxy;\n+\tstruct rte_service_spec service;\n+\tuint32_t cid;\n+\tuint32_t sid;\n+\tint rc;\n+\n+\tsfc_log_init(sa, \"entry\");\n+\n+\tif (!sfc_repr_supported(sa)) {\n+\t\tsfc_log_init(sa, \"representors not supported - skip\");\n+\t\treturn 0;\n+\t}\n+\n+\tcid = sfc_get_service_lcore(sa->socket_id);\n+\tif (cid == RTE_MAX_LCORE && sa->socket_id != SOCKET_ID_ANY) {\n+\t\t/* Warn and try to allocate on any NUMA node */\n+\t\tsfc_warn(sa,\n+\t\t\t\"repr proxy: unable to get service lcore at socket %d\",\n+\t\t\tsa->socket_id);\n+\n+\t\tcid = sfc_get_service_lcore(SOCKET_ID_ANY);\n+\t}\n+\tif (cid == RTE_MAX_LCORE) {\n+\t\trc = ENOTSUP;\n+\t\tsfc_err(sa, \"repr proxy: failed to get service lcore\");\n+\t\tgoto fail_get_service_lcore;\n+\t}\n+\n+\tmemset(&service, 0, sizeof(service));\n+\tsnprintf(service.name, sizeof(service.name),\n+\t\t \"net_sfc_%hu_repr_proxy\", sfc_sa2shared(sa)->port_id);\n+\tservice.socket_id = rte_lcore_to_socket_id(cid);\n+\tservice.callback = sfc_repr_proxy_routine;\n+\tservice.callback_userdata = rp;\n+\n+\trc = rte_service_component_register(&service, &sid);\n+\tif (rc != 0) {\n+\t\trc = ENOEXEC;\n+\t\tsfc_err(sa, \"repr proxy: failed to register service component\");\n+\t\tgoto fail_register;\n+\t}\n+\n+\trc = rte_service_map_lcore_set(sid, cid, 1);\n+\tif (rc != 0) {\n+\t\trc = -rc;\n+\t\tsfc_err(sa, \"repr proxy: failed to map lcore\");\n+\t\tgoto fail_map_lcore;\n+\t}\n+\n+\trp->service_core_id = cid;\n+\trp->service_id = sid;\n+\n+\tsfc_log_init(sa, \"done\");\n+\n+\treturn 0;\n+\n+fail_map_lcore:\n+\trte_service_component_unregister(sid);\n+\n+fail_register:\n+\t/*\n+\t * No need to rollback service lcore get since\n+\t * it just makes socket_id based search and remembers it.\n+\t */\n+\n+fail_get_service_lcore:\n+\tsfc_log_init(sa, \"failed: %s\", rte_strerror(rc));\n+\treturn rc;\n+}\n+\n+void\n+sfc_repr_proxy_detach(struct sfc_adapter *sa)\n+{\n+\tstruct sfc_repr_proxy *rp = &sa->repr_proxy;\n+\n+\tsfc_log_init(sa, \"entry\");\n+\n+\tif (!sfc_repr_supported(sa)) {\n+\t\tsfc_log_init(sa, \"representors not supported - skip\");\n+\t\treturn;\n+\t}\n+\n+\trte_service_map_lcore_set(rp->service_id, rp->service_core_id, 0);\n+\trte_service_component_unregister(rp->service_id);\n+\n+\tsfc_log_init(sa, \"done\");\n+}\n+\n+int\n+sfc_repr_proxy_start(struct sfc_adapter *sa)\n+{\n+\tstruct sfc_repr_proxy *rp = &sa->repr_proxy;\n+\tint rc;\n+\n+\tsfc_log_init(sa, \"entry\");\n+\n+\t/*\n+\t * The condition to start the proxy is insufficient. It will be\n+\t * complemented with representor port start/stop support.\n+\t */\n+\tif (!sfc_repr_supported(sa)) {\n+\t\tsfc_log_init(sa, \"representors not supported - skip\");\n+\t\treturn 0;\n+\t}\n+\n+\t/* Service core may be in \"stopped\" state, start it */\n+\trc = rte_service_lcore_start(rp->service_core_id);\n+\tif (rc != 0 && rc != -EALREADY) {\n+\t\trc = -rc;\n+\t\tsfc_err(sa, \"failed to start service core for %s: %s\",\n+\t\t\trte_service_get_name(rp->service_id),\n+\t\t\trte_strerror(rc));\n+\t\tgoto fail_start_core;\n+\t}\n+\n+\t/* Run the service */\n+\trc = rte_service_component_runstate_set(rp->service_id, 1);\n+\tif (rc < 0) {\n+\t\trc = -rc;\n+\t\tsfc_err(sa, \"failed to run %s component: %s\",\n+\t\t\trte_service_get_name(rp->service_id),\n+\t\t\trte_strerror(rc));\n+\t\tgoto fail_component_runstate_set;\n+\t}\n+\trc = rte_service_runstate_set(rp->service_id, 1);\n+\tif (rc < 0) {\n+\t\trc = -rc;\n+\t\tsfc_err(sa, \"failed to run %s: %s\",\n+\t\t\trte_service_get_name(rp->service_id),\n+\t\t\trte_strerror(rc));\n+\t\tgoto fail_runstate_set;\n+\t}\n+\n+\tsfc_log_init(sa, \"done\");\n+\n+\treturn 0;\n+\n+fail_runstate_set:\n+\trte_service_component_runstate_set(rp->service_id, 0);\n+\n+fail_component_runstate_set:\n+\t/* Service lcore may be shared and we never stop it */\n+\n+fail_start_core:\n+\tsfc_log_init(sa, \"failed: %s\", rte_strerror(rc));\n+\treturn rc;\n+}\n+\n+void\n+sfc_repr_proxy_stop(struct sfc_adapter *sa)\n+{\n+\tstruct sfc_repr_proxy *rp = &sa->repr_proxy;\n+\tint rc;\n+\n+\tsfc_log_init(sa, \"entry\");\n+\n+\tif (!sfc_repr_supported(sa)) {\n+\t\tsfc_log_init(sa, \"representors not supported - skip\");\n+\t\treturn;\n+\t}\n+\n+\trc = rte_service_runstate_set(rp->service_id, 0);\n+\tif (rc < 0) {\n+\t\tsfc_err(sa, \"failed to stop %s: %s\",\n+\t\t\trte_service_get_name(rp->service_id),\n+\t\t\trte_strerror(-rc));\n+\t}\n+\n+\trc = rte_service_component_runstate_set(rp->service_id, 0);\n+\tif (rc < 0) {\n+\t\tsfc_err(sa, \"failed to stop %s component: %s\",\n+\t\t\trte_service_get_name(rp->service_id),\n+\t\t\trte_strerror(-rc));\n+\t}\n+\n+\t/* Service lcore may be shared and we never stop it */\n+\n+\tsfc_log_init(sa, \"done\");\n+}\ndiff --git a/drivers/net/sfc/sfc_repr_proxy.h b/drivers/net/sfc/sfc_repr_proxy.h\nnew file mode 100644\nindex 0000000000..40ce352335\n--- /dev/null\n+++ b/drivers/net/sfc/sfc_repr_proxy.h\n@@ -0,0 +1,34 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ *\n+ * Copyright(c) 2019-2021 Xilinx, Inc.\n+ * Copyright(c) 2019 Solarflare Communications Inc.\n+ *\n+ * This software was jointly developed between OKTET Labs (under contract\n+ * for Solarflare) and Solarflare Communications, Inc.\n+ */\n+\n+#ifndef _SFC_REPR_PROXY_H\n+#define _SFC_REPR_PROXY_H\n+\n+#include <stdint.h>\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+struct sfc_repr_proxy {\n+\tuint32_t\t\t\tservice_core_id;\n+\tuint32_t\t\t\tservice_id;\n+};\n+\n+struct sfc_adapter;\n+\n+int sfc_repr_proxy_attach(struct sfc_adapter *sa);\n+void sfc_repr_proxy_detach(struct sfc_adapter *sa);\n+int sfc_repr_proxy_start(struct sfc_adapter *sa);\n+void sfc_repr_proxy_stop(struct sfc_adapter *sa);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+#endif  /* _SFC_REPR_PROXY_H */\n",
    "prefixes": [
        "07/38"
    ]
}