get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 97438,
    "url": "http://patchwork.dpdk.org/api/patches/97438/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210827065717.1838258-23-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-23-andrew.rybchenko@oktetlabs.ru>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210827065717.1838258-23-andrew.rybchenko@oktetlabs.ru",
    "date": "2021-08-27T06:57:01",
    "name": "[22/38] net/sfc: implement representor Tx routine",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "7184fd3d887a5edefcfe44b6bb76c5f55be89511",
    "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-23-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/97438/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/97438/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 ABC4DA0C43;\n\tFri, 27 Aug 2021 08:59:53 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 458DE412A8;\n\tFri, 27 Aug 2021 08:58:46 +0200 (CEST)",
            "from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113])\n by mails.dpdk.org (Postfix) with ESMTP id 4809F41287\n for <dev@dpdk.org>; Fri, 27 Aug 2021 08:58:42 +0200 (CEST)",
            "by shelob.oktetlabs.ru (Postfix, from userid 122)\n id 1EC137F6E1; Fri, 27 Aug 2021 09:58:42 +0300 (MSK)",
            "from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17])\n by shelob.oktetlabs.ru (Postfix) with ESMTP id 382ED7F6E7;\n Fri, 27 Aug 2021 09:57:35 +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 382ED7F6E7",
        "Authentication-Results": "shelob.oktetlabs.ru/382ED7F6E7; 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:57:01 +0300",
        "Message-Id": "<20210827065717.1838258-23-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 22/38] net/sfc: implement representor Tx routine",
        "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\nForward traffic that is transmitted from a port representor to the\ncorresponding virtual function using the dedicated TxQ.\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/sfc_repr.c       | 45 ++++++++++++++++\n drivers/net/sfc/sfc_repr_proxy.c | 88 +++++++++++++++++++++++++++++++-\n drivers/net/sfc/sfc_repr_proxy.h |  8 +++\n 3 files changed, 140 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/sfc/sfc_repr.c b/drivers/net/sfc/sfc_repr.c\nindex 7a34a0a904..e7386fb480 100644\n--- a/drivers/net/sfc/sfc_repr.c\n+++ b/drivers/net/sfc/sfc_repr.c\n@@ -168,6 +168,49 @@ sfc_repr_tx_queue_stop(void *queue)\n \trte_ring_reset(txq->ring);\n }\n \n+static uint16_t\n+sfc_repr_tx_burst(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)\n+{\n+\tstruct sfc_repr_txq *txq = tx_queue;\n+\tunsigned int n_tx;\n+\tvoid **objs;\n+\tuint16_t i;\n+\n+\t/*\n+\t * mbuf is likely cache-hot. Set flag and egress m-port here instead of\n+\t * doing that in representors proxy. Also, it should help to avoid\n+\t * cache bounce. Moreover, potentially, it allows to use one\n+\t * multi-producer single-consumer ring for all representors.\n+\t *\n+\t * The only potential problem is doing so many times if enqueue\n+\t * fails and sender retries.\n+\t */\n+\tfor (i = 0; i < nb_pkts; ++i) {\n+\t\tstruct rte_mbuf *m = tx_pkts[i];\n+\n+\t\tm->ol_flags |= sfc_dp_mport_override;\n+\t\t*RTE_MBUF_DYNFIELD(m, sfc_dp_mport_offset,\n+\t\t\t\t   efx_mport_id_t *) = txq->egress_mport;\n+\t}\n+\n+\tobjs = (void *)&tx_pkts[0];\n+\tn_tx = rte_ring_sp_enqueue_burst(txq->ring, objs, nb_pkts, NULL);\n+\n+\t/*\n+\t * Remove m-port override flag from packets that were not enqueued\n+\t * Setting the flag only for enqueued packets after the burst is\n+\t * not possible since the ownership of enqueued packets is\n+\t * transferred to representor proxy.\n+\t */\n+\tfor (i = n_tx; i < nb_pkts; ++i) {\n+\t\tstruct rte_mbuf *m = tx_pkts[i];\n+\n+\t\tm->ol_flags &= ~sfc_dp_mport_override;\n+\t}\n+\n+\treturn n_tx;\n+}\n+\n static int\n sfc_repr_start(struct rte_eth_dev *dev)\n {\n@@ -782,6 +825,7 @@ sfc_repr_dev_close(struct rte_eth_dev *dev)\n \n \t(void)sfc_repr_proxy_del_port(srs->pf_port_id, srs->repr_id);\n \n+\tdev->tx_pkt_burst = NULL;\n \tdev->dev_ops = NULL;\n \n \tsfc_repr_unlock(sr);\n@@ -902,6 +946,7 @@ sfc_repr_eth_dev_init(struct rte_eth_dev *dev, void *init_params)\n \t\tgoto fail_mac_addrs;\n \t}\n \n+\tdev->tx_pkt_burst = sfc_repr_tx_burst;\n \tdev->dev_ops = &sfc_repr_dev_ops;\n \n \tsr->state = SFC_ETHDEV_INITIALIZED;\ndiff --git a/drivers/net/sfc/sfc_repr_proxy.c b/drivers/net/sfc/sfc_repr_proxy.c\nindex ea03d5afdd..d8934bab65 100644\n--- a/drivers/net/sfc/sfc_repr_proxy.c\n+++ b/drivers/net/sfc/sfc_repr_proxy.c\n@@ -25,6 +25,12 @@\n  */\n #define SFC_REPR_PROXY_MBOX_POLL_TIMEOUT_MS\t1000\n \n+/**\n+ * Amount of time to wait for the representor proxy routine (which is\n+ * running on a service core) to terminate after service core is stopped.\n+ */\n+#define SFC_REPR_PROXY_ROUTINE_TERMINATE_TIMEOUT_MS\t10000\n+\n static struct sfc_repr_proxy *\n sfc_repr_proxy_by_adapter(struct sfc_adapter *sa)\n {\n@@ -148,16 +154,71 @@ sfc_repr_proxy_mbox_handle(struct sfc_repr_proxy *rp)\n \t__atomic_store_n(&mbox->ack, true, __ATOMIC_RELEASE);\n }\n \n+static void\n+sfc_repr_proxy_handle_tx(struct sfc_repr_proxy_dp_txq *rp_txq,\n+\t\t\t struct sfc_repr_proxy_txq *repr_txq)\n+{\n+\t/*\n+\t * With multiple representor proxy queues configured it is\n+\t * possible that not all of the corresponding representor\n+\t * queues were created. Skip the queues that do not exist.\n+\t */\n+\tif (repr_txq->ring == NULL)\n+\t\treturn;\n+\n+\tif (rp_txq->available < RTE_DIM(rp_txq->tx_pkts)) {\n+\t\trp_txq->available +=\n+\t\t\trte_ring_sc_dequeue_burst(repr_txq->ring,\n+\t\t\t\t(void **)(&rp_txq->tx_pkts[rp_txq->available]),\n+\t\t\t\tRTE_DIM(rp_txq->tx_pkts) - rp_txq->available,\n+\t\t\t\tNULL);\n+\n+\t\tif (rp_txq->available == rp_txq->transmitted)\n+\t\t\treturn;\n+\t}\n+\n+\trp_txq->transmitted += rp_txq->pkt_burst(rp_txq->dp,\n+\t\t\t\t&rp_txq->tx_pkts[rp_txq->transmitted],\n+\t\t\t\trp_txq->available - rp_txq->transmitted);\n+\n+\tif (rp_txq->available == rp_txq->transmitted) {\n+\t\trp_txq->available = 0;\n+\t\trp_txq->transmitted = 0;\n+\t}\n+}\n+\n static int32_t\n sfc_repr_proxy_routine(void *arg)\n {\n+\tstruct sfc_repr_proxy_port *port;\n \tstruct sfc_repr_proxy *rp = arg;\n+\tunsigned int i;\n \n \tsfc_repr_proxy_mbox_handle(rp);\n \n+\tTAILQ_FOREACH(port, &rp->ports, entries) {\n+\t\tif (!port->started)\n+\t\t\tcontinue;\n+\n+\t\tfor (i = 0; i < rp->nb_txq; i++)\n+\t\t\tsfc_repr_proxy_handle_tx(&rp->dp_txq[i], &port->txq[i]);\n+\t}\n+\n \treturn 0;\n }\n \n+static struct sfc_txq_info *\n+sfc_repr_proxy_txq_info_get(struct sfc_adapter *sa, unsigned int repr_queue_id)\n+{\n+\tstruct sfc_adapter_shared *sas = sfc_sa2shared(sa);\n+\tstruct sfc_repr_proxy_dp_txq *dp_txq;\n+\n+\tSFC_ASSERT(repr_queue_id < sfc_repr_nb_txq(sas));\n+\tdp_txq = &sa->repr_proxy.dp_txq[repr_queue_id];\n+\n+\treturn &sas->txq_info[dp_txq->sw_index];\n+}\n+\n static int\n sfc_repr_proxy_txq_attach(struct sfc_adapter *sa)\n {\n@@ -289,11 +350,20 @@ sfc_repr_proxy_txq_fini(struct sfc_adapter *sa)\n static int\n sfc_repr_proxy_txq_start(struct sfc_adapter *sa)\n {\n+\tstruct sfc_adapter_shared * const sas = sfc_sa2shared(sa);\n \tstruct sfc_repr_proxy *rp = &sa->repr_proxy;\n+\tunsigned int i;\n \n \tsfc_log_init(sa, \"entry\");\n \n-\tRTE_SET_USED(rp);\n+\tfor (i = 0; i < sfc_repr_nb_txq(sas); i++) {\n+\t\tstruct sfc_repr_proxy_dp_txq *txq = &rp->dp_txq[i];\n+\n+\t\ttxq->dp = sfc_repr_proxy_txq_info_get(sa, i)->dp;\n+\t\ttxq->pkt_burst = sa->eth_dev->tx_pkt_burst;\n+\t\ttxq->available = 0;\n+\t\ttxq->transmitted = 0;\n+\t}\n \n \tsfc_log_init(sa, \"done\");\n \n@@ -922,6 +992,8 @@ sfc_repr_proxy_start(struct sfc_adapter *sa)\n \tif (rc != 0)\n \t\tgoto fail_txq_start;\n \n+\trp->nb_txq = sfc_repr_nb_txq(sas);\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@@ -1007,6 +1079,9 @@ sfc_repr_proxy_stop(struct sfc_adapter *sa)\n \tstruct sfc_adapter_shared * const sas = sfc_sa2shared(sa);\n \tstruct sfc_repr_proxy *rp = &sa->repr_proxy;\n \tstruct sfc_repr_proxy_port *port;\n+\tconst unsigned int wait_ms_total =\n+\t\tSFC_REPR_PROXY_ROUTINE_TERMINATE_TIMEOUT_MS;\n+\tunsigned int i;\n \tint rc;\n \n \tsfc_log_init(sa, \"entry\");\n@@ -1050,6 +1125,17 @@ sfc_repr_proxy_stop(struct sfc_adapter *sa)\n \n \t/* Service lcore may be shared and we never stop it */\n \n+\t/*\n+\t * Wait for the representor proxy routine to finish the last iteration.\n+\t * Give up on timeout.\n+\t */\n+\tfor (i = 0; i < wait_ms_total; i++) {\n+\t\tif (rte_service_may_be_active(rp->service_id) == 0)\n+\t\t\tbreak;\n+\n+\t\trte_delay_ms(1);\n+\t}\n+\n \tsfc_repr_proxy_rxq_stop(sa);\n \tsfc_repr_proxy_txq_stop(sa);\n \ndiff --git a/drivers/net/sfc/sfc_repr_proxy.h b/drivers/net/sfc/sfc_repr_proxy.h\nindex c350713a55..d47e0a431a 100644\n--- a/drivers/net/sfc/sfc_repr_proxy.h\n+++ b/drivers/net/sfc/sfc_repr_proxy.h\n@@ -79,6 +79,13 @@ struct sfc_repr_proxy_dp_rxq {\n };\n \n struct sfc_repr_proxy_dp_txq {\n+\teth_tx_burst_t\t\t\tpkt_burst;\n+\tstruct sfc_dp_txq\t\t*dp;\n+\n+\tunsigned int\t\t\tavailable;\n+\tunsigned int\t\t\ttransmitted;\n+\tstruct rte_mbuf\t\t\t*tx_pkts[SFC_REPR_PROXY_TX_BURST];\n+\n \tsfc_sw_index_t\t\t\tsw_index;\n };\n \n@@ -110,6 +117,7 @@ struct sfc_repr_proxy {\n \tstruct sfc_repr_proxy_filter\tmport_filter;\n \n \tstruct sfc_repr_proxy_mbox\tmbox;\n+\tunsigned int\t\t\tnb_txq;\n };\n \n struct sfc_adapter;\n",
    "prefixes": [
        "22/38"
    ]
}