get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 116098,
    "url": "https://patches.dpdk.org/api/patches/116098/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220908171242.3804375-1-s.v.naga.harish.k@intel.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": "<20220908171242.3804375-1-s.v.naga.harish.k@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220908171242.3804375-1-s.v.naga.harish.k@intel.com",
    "date": "2022-09-08T17:12:40",
    "name": "[1/3] eventdev/eth_tx: add queue start stop API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "6ad82827b9747394e8ad59fb837c5c7658266d93",
    "submitter": {
        "id": 2280,
        "url": "https://patches.dpdk.org/api/people/2280/?format=api",
        "name": "Naga Harish K, S V",
        "email": "s.v.naga.harish.k@intel.com"
    },
    "delegate": {
        "id": 310,
        "url": "https://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220908171242.3804375-1-s.v.naga.harish.k@intel.com/mbox/",
    "series": [
        {
            "id": 24610,
            "url": "https://patches.dpdk.org/api/series/24610/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=24610",
            "date": "2022-09-08T17:12:40",
            "name": "[1/3] eventdev/eth_tx: add queue start stop API",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/24610/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/116098/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/116098/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 3AC2EA0548;\n\tThu,  8 Sep 2022 19:12:50 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 0B3B440DDC;\n\tThu,  8 Sep 2022 19:12:49 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by mails.dpdk.org (Postfix) with ESMTP id C04E34021F\n for <dev@dpdk.org>; Thu,  8 Sep 2022 19:12:46 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 Sep 2022 10:12:45 -0700",
            "from txandevlnx322.an.intel.com ([10.123.117.44])\n by fmsmga005.fm.intel.com with ESMTP; 08 Sep 2022 10:12:45 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1662657166; x=1694193166;\n h=from:to:cc:subject:date:message-id:mime-version:\n content-transfer-encoding;\n bh=as0046BZ1o8/Xz30r+2I+p+BXnvVm2y6LxSqDytNJeM=;\n b=HLa022fl3PBgDObqNZ3nEfopupXtC32G9nswJHcPJnhNV8ajMgbTU8ck\n g4T7dGeYFDRk6pJrwTdAKIalKBtdCPpnCy2f23hk6TvU3dkaI4UcFk5EB\n t5LwPyAbzvq9LDttg9XTCePpSs/qJFb5IAVAuF7qMM7FCFflEoGN3ahUC\n R+++YxfHU23hQQdHOaR491VrZNNhKL1bVwvdikrowo+ki8BJ7vpDmJi6Y\n 3WQwDcZmHFxd/CIkYAo2Bib06HBy86/ST66i06wnbZGENmDL9ial/5rjz\n RgykBxWOEAbakVJIb+KojrqGrYfvN7zXLxO77XTFw1UHHKSRS1XVBDAyf A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10464\"; a=\"295999001\"",
            "E=Sophos;i=\"5.93,300,1654585200\"; d=\"scan'208\";a=\"295999001\"",
            "E=Sophos;i=\"5.93,300,1654585200\"; d=\"scan'208\";a=\"943433068\""
        ],
        "X-ExtLoop1": "1",
        "From": "Naga Harish K S V <s.v.naga.harish.k@intel.com>",
        "To": "jay.jayatheerthan@intel.com,\n\tjerinj@marvell.com",
        "Cc": "dev@dpdk.org",
        "Subject": "[PATCH 1/3] eventdev/eth_tx: add queue start stop API",
        "Date": "Thu,  8 Sep 2022 12:12:40 -0500",
        "Message-Id": "<20220908171242.3804375-1-s.v.naga.harish.k@intel.com>",
        "X-Mailer": "git-send-email 2.23.0",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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"
    },
    "content": "This patch adds support to start or stop a particular queue\nthat is associated with the adapter.\n\nStart function enables the Tx Adapter to start enqueueing\npackets to the Tx queue.\n\nStop function stops the Tx Adapter from transmitting any\nmbufs to the Tx queue. The Tx Adapter also frees any mbufs\nthat it may have buffered for this queue. All inflight packets\ndestined to the queue are freed until the queue is started again.\n\nSigned-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>\n---\n lib/eventdev/eventdev_pmd.h             |  41 +++++++++\n lib/eventdev/rte_event_eth_tx_adapter.c | 113 +++++++++++++++++++++++-\n lib/eventdev/rte_event_eth_tx_adapter.h |  39 ++++++++\n lib/eventdev/version.map                |   2 +\n 4 files changed, 191 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h\nindex f514a37575..a27c0883c6 100644\n--- a/lib/eventdev/eventdev_pmd.h\n+++ b/lib/eventdev/eventdev_pmd.h\n@@ -1294,6 +1294,43 @@ typedef int (*eventdev_eth_tx_adapter_stats_reset_t)(uint8_t id,\n typedef int (*eventdev_eth_tx_adapter_instance_get_t)\n \t(uint16_t eth_dev_id, uint16_t tx_queue_id, uint8_t *txa_inst_id);\n \n+/**\n+ * Start a Tx queue that is assigned to TX adapter instance\n+ *\n+ * @param id\n+ *  Adapter identifier\n+ *\n+ * @param eth_dev_id\n+ *  Port identifier of Ethernet device\n+ *\n+ * @param tx_queue_id\n+ *  Ethernet device TX queue index\n+ *\n+ * @return\n+ *  -  0: Success\n+ *  - <0: Error code on failure\n+ */\n+typedef int (*eventdev_eth_tx_adapter_queue_start)\n+\t(uint8_t id, uint16_t eth_dev_id, uint16_t tx_queue_id);\n+\n+/**\n+ * Stop a Tx queue that is assigned to TX adapter instance\n+ *\n+ * @param id\n+ *  Adapter identifier\n+ *\n+ * @param eth_dev_id\n+ *  Port identifier of Ethernet device\n+ *\n+ * @param tx_queue_id\n+ *  Ethernet device TX queue index\n+ *\n+ * @return\n+ *  -  0: Success\n+ *  - <0: Error code on failure\n+ */\n+typedef int (*eventdev_eth_tx_adapter_queue_stop)\n+\t(uint8_t id, uint16_t eth_dev_id, uint16_t tx_queue_id);\n \n /** Event device operations function pointer table */\n struct eventdev_ops {\n@@ -1409,6 +1446,10 @@ struct eventdev_ops {\n \t/**< Reset eth Tx adapter statistics */\n \teventdev_eth_tx_adapter_instance_get_t eth_tx_adapter_instance_get;\n \t/**< Get Tx adapter instance id for Tx queue */\n+\teventdev_eth_tx_adapter_queue_start eth_tx_adapter_queue_start;\n+\t/**< Start Tx queue assigned to Tx adapter instance */\n+\teventdev_eth_tx_adapter_queue_stop eth_tx_adapter_queue_stop;\n+\t/**< Stop Tx queue assigned to Tx adapter instance */\n \n \teventdev_selftest dev_selftest;\n \t/**< Start eventdev Selftest */\ndiff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c\nindex aaef352f5c..d0ed11ade5 100644\n--- a/lib/eventdev/rte_event_eth_tx_adapter.c\n+++ b/lib/eventdev/rte_event_eth_tx_adapter.c\n@@ -47,6 +47,12 @@\n #define txa_dev_instance_get(id) \\\n \t\t\ttxa_evdev(id)->dev_ops->eth_tx_adapter_instance_get\n \n+#define txa_dev_queue_start(id) \\\n+\t\t\ttxa_evdev(id)->dev_ops->eth_tx_adapter_queue_start\n+\n+#define txa_dev_queue_stop(id) \\\n+\t\t\ttxa_evdev(id)->dev_ops->eth_tx_adapter_queue_stop\n+\n #define RTE_EVENT_ETH_TX_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) \\\n do { \\\n \tif (!txa_valid_id(id)) { \\\n@@ -94,6 +100,8 @@ struct txa_retry {\n struct txa_service_queue_info {\n \t/* Queue has been added */\n \tuint8_t added;\n+\t/* Queue is stopped */\n+\tbool stopped;\n \t/* Retry callback argument */\n \tstruct txa_retry txa_retry;\n \t/* Tx buffer */\n@@ -557,7 +565,7 @@ txa_process_event_vector(struct txa_service_data *txa,\n \t\tport = vec->port;\n \t\tqueue = vec->queue;\n \t\ttqi = txa_service_queue(txa, port, queue);\n-\t\tif (unlikely(tqi == NULL || !tqi->added)) {\n+\t\tif (unlikely(tqi == NULL || !tqi->added || tqi->stopped)) {\n \t\t\trte_pktmbuf_free_bulk(mbufs, vec->nb_elem);\n \t\t\trte_mempool_put(rte_mempool_from_obj(vec), vec);\n \t\t\treturn 0;\n@@ -571,7 +579,8 @@ txa_process_event_vector(struct txa_service_data *txa,\n \t\t\tport = mbufs[i]->port;\n \t\t\tqueue = rte_event_eth_tx_adapter_txq_get(mbufs[i]);\n \t\t\ttqi = txa_service_queue(txa, port, queue);\n-\t\t\tif (unlikely(tqi == NULL || !tqi->added)) {\n+\t\t\tif (unlikely(tqi == NULL || !tqi->added ||\n+\t\t\t\t     tqi->stopped)) {\n \t\t\t\trte_pktmbuf_free(mbufs[i]);\n \t\t\t\tcontinue;\n \t\t\t}\n@@ -608,7 +617,8 @@ txa_service_tx(struct txa_service_data *txa, struct rte_event *ev,\n \t\t\tqueue = rte_event_eth_tx_adapter_txq_get(m);\n \n \t\t\ttqi = txa_service_queue(txa, port, queue);\n-\t\t\tif (unlikely(tqi == NULL || !tqi->added)) {\n+\t\t\tif (unlikely(tqi == NULL || !tqi->added ||\n+\t\t\t\t     tqi->stopped)) {\n \t\t\t\trte_pktmbuf_free(m);\n \t\t\t\tcontinue;\n \t\t\t}\n@@ -672,7 +682,8 @@ txa_service_func(void *args)\n \t\t\tfor (q = 0; q < dev->data->nb_tx_queues; q++) {\n \n \t\t\t\ttqi = txa_service_queue(txa, i, q);\n-\t\t\t\tif (unlikely(tqi == NULL || !tqi->added))\n+\t\t\t\tif (unlikely(tqi == NULL || !tqi->added ||\n+\t\t\t\t\t     tqi->stopped))\n \t\t\t\t\tcontinue;\n \n \t\t\t\tnb_tx += rte_eth_tx_buffer_flush(i, q,\n@@ -867,6 +878,7 @@ txa_service_queue_add(uint8_t id,\n \n \ttqi->tx_buf = tb;\n \ttqi->added = 1;\n+\ttqi->stopped = false;\n \ttdi->nb_queues++;\n \ttxa->nb_queues++;\n \n@@ -885,6 +897,20 @@ txa_service_queue_add(uint8_t id,\n \treturn -1;\n }\n \n+static inline void\n+txa_txq_buffer_drain(struct txa_service_queue_info *tqi)\n+{\n+\tstruct rte_eth_dev_tx_buffer *b;\n+\tuint16_t i;\n+\n+\tb = tqi->tx_buf;\n+\n+\tfor (i = 0; i < b->length; i++)\n+\t\trte_pktmbuf_free(b->pkts[i]);\n+\n+\tb->length = 0;\n+}\n+\n static int\n txa_service_queue_del(uint8_t id,\n \t\tconst struct rte_eth_dev *dev,\n@@ -930,6 +956,8 @@ txa_service_queue_del(uint8_t id,\n \tif (tqi == NULL || !tqi->added)\n \t\tgoto ret_unlock;\n \n+\t/* Drain the buffered mbufs */\n+\ttxa_txq_buffer_drain(tqi);\n \ttb = tqi->tx_buf;\n \ttqi->added = 0;\n \ttqi->tx_buf = NULL;\n@@ -1320,3 +1348,80 @@ rte_event_eth_tx_adapter_instance_get(uint16_t eth_dev_id,\n \n \treturn -EINVAL;\n }\n+\n+static int\n+txa_queue_state_set(uint16_t eth_dev_id, uint16_t tx_queue_id, bool state)\n+{\n+\tstruct txa_service_data *txa;\n+\tstruct txa_service_queue_info *tqi;\n+\tuint8_t txa_inst_id;\n+\tint ret;\n+\tuint32_t caps = 0;\n+\n+\t/* Below API already does validation of input parameters.\n+\t * Hence skipping the validation here.\n+\t */\n+\tret = rte_event_eth_tx_adapter_instance_get(eth_dev_id,\n+\t\t\t\t      tx_queue_id,\n+\t\t\t\t      &txa_inst_id);\n+\tif (ret < 0)\n+\t\treturn -EINVAL;\n+\n+\tTXA_CHECK_OR_ERR_RET(txa_inst_id);\n+\n+\ttxa = txa_service_id_to_data(txa_inst_id);\n+\tret = rte_event_eth_tx_adapter_caps_get(txa->eventdev_id,\n+\t\t\t\t\t\t      eth_dev_id,\n+\t\t\t\t\t\t      &caps);\n+\tif (state == true) {\n+\t\tif (caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {\n+\t\t\tret = txa_dev_queue_start(txa_inst_id) ?\n+\t\t\t\ttxa_dev_queue_start(txa_inst_id)(txa_inst_id,\n+\t\t\t\t\t\t\teth_dev_id,\n+\t\t\t\t\t\t\ttx_queue_id)\n+\t\t\t\t\t\t: -EINVAL;\n+\t\t\tif (ret == 0)\n+\t\t\t\treturn ret;\n+\t\t}\n+\t\trte_spinlock_lock(&txa->tx_lock);\n+\t\ttqi = txa_service_queue(txa, eth_dev_id, tx_queue_id);\n+\t\tif (unlikely(tqi == NULL || !tqi->added)) {\n+\t\t\trte_spinlock_unlock(&txa->tx_lock);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\ttqi->stopped = false;\n+\t\trte_spinlock_unlock(&txa->tx_lock);\n+\t} else {\n+\t\tif (caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) {\n+\t\t\tret = txa_dev_queue_stop(txa_inst_id) ?\n+\t\t\t\ttxa_dev_queue_stop(txa_inst_id)(txa_inst_id,\n+\t\t\t\t\t\t\teth_dev_id,\n+\t\t\t\t\t\t\ttx_queue_id)\n+\t\t\t\t\t\t: -EINVAL;\n+\t\t\tif (ret == 0)\n+\t\t\t\treturn ret;\n+\t\t}\n+\t\trte_spinlock_lock(&txa->tx_lock);\n+\t\ttqi = txa_service_queue(txa, eth_dev_id, tx_queue_id);\n+\t\tif (unlikely(tqi == NULL || !tqi->added)) {\n+\t\t\trte_spinlock_unlock(&txa->tx_lock);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\ttxa_txq_buffer_drain(tqi);\n+\t\ttqi->stopped = true;\n+\t\trte_spinlock_unlock(&txa->tx_lock);\n+\t}\n+\treturn 0;\n+}\n+\n+int\n+rte_event_eth_tx_adapter_queue_start(uint16_t eth_dev_id, uint16_t tx_queue_id)\n+{\n+\treturn txa_queue_state_set(eth_dev_id, tx_queue_id, true);\n+}\n+\n+int\n+rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id)\n+{\n+\treturn txa_queue_state_set(eth_dev_id, tx_queue_id, false);\n+}\ndiff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h\nindex 9432b740e8..77e394e1ac 100644\n--- a/lib/eventdev/rte_event_eth_tx_adapter.h\n+++ b/lib/eventdev/rte_event_eth_tx_adapter.h\n@@ -35,6 +35,8 @@\n  *  - rte_event_eth_tx_adapter_event_port_get()\n  *  - rte_event_eth_tx_adapter_service_id_get()\n  *  - rte_event_eth_tx_adapter_instance_get()\n+ *  - rte_event_eth_tx_adapter_queue_start()\n+ *  - rte_event_eth_tx_adapter_queue_stop()\n  *\n  * The application creates the adapter using\n  * rte_event_eth_tx_adapter_create() or rte_event_eth_tx_adapter_create_ext().\n@@ -446,6 +448,43 @@ int\n rte_event_eth_tx_adapter_instance_get(uint16_t eth_dev_id,\n \t\t\t\t      uint16_t tx_queue_id,\n \t\t\t\t      uint8_t *txa_inst_id);\n+/**\n+ * Enables the Tx Adapter to start enqueueing packets to the\n+ * Tx queue.\n+ *\n+ * This function is provided so that the application can\n+ * resuming enqueueing events that reference packets for\n+ * <eth_dev_id, tx_queue_id> after calling\n+ * rte_event_eth_tx_adapter_queue_stop()\n+ *\n+ * @param eth_dev_id\n+ *  Port identifier of Ethernet device.\n+ * @param tx_queue_id\n+ *  Ethernet device transmit queue index.\n+ * @return\n+ *   - 0: Success\n+ *   - <0: Error code on failure\n+ */\n+__rte_experimental\n+int\n+rte_event_eth_tx_adapter_queue_start(uint16_t eth_dev_id, uint16_t tx_queue_id);\n+\n+/**\n+ * Stops the Tx Adapter from transmitting any mbufs to the\n+ * <eth_dev_id, tx_queue_id>. The Tx Adapter also frees any mbufs\n+ * that it may have buffered for this queue.\n+ *\n+ * @param eth_dev_id\n+ *  Port identifier of Ethernet device.\n+ * @param tx_queue_id\n+ *  Ethernet device transmit queue index.\n+ * @return\n+ *   - 0: Success\n+ *   - <0: Error code on failure\n+ */\n+__rte_experimental\n+int\n+rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id);\n \n #ifdef __cplusplus\n }\ndiff --git a/lib/eventdev/version.map b/lib/eventdev/version.map\nindex 9a71cf3f8f..dd63ec6f68 100644\n--- a/lib/eventdev/version.map\n+++ b/lib/eventdev/version.map\n@@ -116,6 +116,8 @@ EXPERIMENTAL {\n \t# added in 22.11\n \trte_event_eth_rx_adapter_instance_get;\n \trte_event_eth_tx_adapter_instance_get;\n+\trte_event_eth_tx_adapter_queue_start;\n+\trte_event_eth_tx_adapter_queue_stop;\n };\n \n INTERNAL {\n",
    "prefixes": [
        "1/3"
    ]
}