get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 80908,
    "url": "https://patches.dpdk.org/api/patches/80908/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1602767335-433464-5-git-send-email-bingz@nvidia.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": "<1602767335-433464-5-git-send-email-bingz@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1602767335-433464-5-git-send-email-bingz@nvidia.com",
    "date": "2020-10-15T13:08:54",
    "name": "[v6,4/5] ethdev: add APIs for hairpin queue operation",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "e8133a0fd133bc4e248e7914bb1ae079369ee9bb",
    "submitter": {
        "id": 1976,
        "url": "https://patches.dpdk.org/api/people/1976/?format=api",
        "name": "Bing Zhao",
        "email": "bingz@nvidia.com"
    },
    "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/1602767335-433464-5-git-send-email-bingz@nvidia.com/mbox/",
    "series": [
        {
            "id": 13010,
            "url": "https://patches.dpdk.org/api/series/13010/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=13010",
            "date": "2020-10-15T13:08:50",
            "name": "introduce support for hairpin between two ports",
            "version": 6,
            "mbox": "https://patches.dpdk.org/series/13010/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/80908/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/80908/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 D276CA04DB;\n\tThu, 15 Oct 2020 15:10:27 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 268A61E911;\n\tThu, 15 Oct 2020 15:09:42 +0200 (CEST)",
            "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n by dpdk.org (Postfix) with ESMTP id BA05D1E904\n for <dev@dpdk.org>; Thu, 15 Oct 2020 15:09:37 +0200 (CEST)"
        ],
        "From": "Bing Zhao <bingz@nvidia.com>",
        "To": "thomas@monjalon.net, orika@nvidia.com, ferruh.yigit@intel.com,\n arybchenko@solarflare.com, mdr@ashroe.eu, nhorman@tuxdriver.com,\n bernard.iremonger@intel.com, beilei.xing@intel.com, wenzhuo.lu@intel.com",
        "Cc": "dev@dpdk.org",
        "Date": "Thu, 15 Oct 2020 21:08:54 +0800",
        "Message-Id": "<1602767335-433464-5-git-send-email-bingz@nvidia.com>",
        "X-Mailer": "git-send-email 2.5.5",
        "In-Reply-To": "<1602767335-433464-1-git-send-email-bingz@nvidia.com>",
        "References": "<1601511962-21532-1-git-send-email-bingz@nvidia.com>\n <1602767335-433464-1-git-send-email-bingz@nvidia.com>",
        "Subject": "[dpdk-dev] [PATCH v6 4/5] ethdev: add APIs for hairpin queue\n\toperation",
        "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": "Every hairpin queue pair should be configured properly and the\nconnection between Tx and Rx queues should be established, before\nhairpin function works. In single port hairpin mode, the queues of\neach pair belong to the same device. It is easy to get the hardware\nand software information of each queue and configure the hairpin\nconnection with such information. In two ports hairpin mode, it is\nnot easy or inappropriate to access one queue's information from\nanother device.\n\nSince hairpin is configured per queue pair, three new APIs are\nintroduced and they are internal for the PMD using.\n\nThe peer update API helps to pass one queue's information to the\npeer queue and get the peer's information back for the next step.\nThe peer bind API configures the current queue with the peer's\ninformation. For each hairpin queue pair, this API may need to be\ncalled twice to configure the Tx, Rx queues separately.\nThe peer unbind API resets the current queue configuration and state\nto disconnect it from the peer queue. Also, it may need to be called\ntwice to disconnect Tx, Rx queues from each other.\n\nSome parameter of the above APIs might not be mandatory, and it\ndepends on the PMD implementation.\n\nThe structure of `rte_hairpin_peer_info` is only a declaration and\nthe actual members will be defined in each PMD when being used.\n\nSigned-off-by: Bing Zhao <bingz@nvidia.com>\nAcked-by: Ori Kam <orika@nvidia.com>\n---\nv6: Using \"Rx\" & \"Tx\"\nv5: commnets update\nv3: change the direction from bool to unsigned int type\n---\n lib/librte_ethdev/rte_ethdev.c           |  55 +++++++++++++++++\n lib/librte_ethdev/rte_ethdev_driver.h    | 101 +++++++++++++++++++++++++++++++\n lib/librte_ethdev/rte_ethdev_version.map |   3 +\n 3 files changed, 159 insertions(+)",
    "diff": "diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c\nindex 80907b2..a6d2579 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -5643,6 +5643,61 @@ enum rte_eth_switch_domain_state {\n \treturn 0;\n }\n \n+int\n+rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue,\n+\t\t\t\t  struct rte_hairpin_peer_info *cur_info,\n+\t\t\t\t  struct rte_hairpin_peer_info *peer_info,\n+\t\t\t\t  uint32_t direction)\n+{\n+\tstruct rte_eth_dev *dev;\n+\n+\t/* Current queue information is not mandatory. */\n+\tif (peer_info == NULL)\n+\t\treturn -EINVAL;\n+\n+\t/* No need to check the validity again. */\n+\tdev = &rte_eth_devices[peer_port];\n+\tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_update,\n+\t\t\t\t-ENOTSUP);\n+\n+\treturn (*dev->dev_ops->hairpin_queue_peer_update)(dev, peer_queue,\n+\t\t\t\t\tcur_info, peer_info, direction);\n+}\n+\n+int\n+rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,\n+\t\t\t\tstruct rte_hairpin_peer_info *peer_info,\n+\t\t\t\tuint32_t direction)\n+{\n+\tstruct rte_eth_dev *dev;\n+\n+\tif (peer_info == NULL)\n+\t\treturn -EINVAL;\n+\n+\t/* No need to check the validity again. */\n+\tdev = &rte_eth_devices[cur_port];\n+\tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_bind,\n+\t\t\t\t-ENOTSUP);\n+\n+\treturn (*dev->dev_ops->hairpin_queue_peer_bind)(dev, cur_queue,\n+\t\t\t\t\t\t\tpeer_info, direction);\n+}\n+\n+int\n+rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,\n+\t\t\t\t  uint32_t direction)\n+{\n+\tstruct rte_eth_dev *dev;\n+\n+\t/* No need to check the validity again. */\n+\tdev = &rte_eth_devices[cur_port];\n+\tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_unbind,\n+\t\t\t\t-ENOTSUP);\n+\n+\treturn (*dev->dev_ops->hairpin_queue_peer_unbind)(dev, cur_queue,\n+\t\t\t\t\t\t\t  direction);\n+}\n+\n RTE_LOG_REGISTER(rte_eth_dev_logtype, lib.ethdev, INFO);\n \n RTE_INIT(ethdev_init_telemetry)\ndiff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h\nindex 03e00d5..23a1454 100644\n--- a/lib/librte_ethdev/rte_ethdev_driver.h\n+++ b/lib/librte_ethdev/rte_ethdev_driver.h\n@@ -21,6 +21,9 @@\n extern \"C\" {\n #endif\n \n+/**< @internal Declaration of the hairpin peer queue information structure. */\n+struct rte_hairpin_peer_info;\n+\n /*\n  * Definitions of all functions exported by an Ethernet driver through the\n  * generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*\n@@ -734,6 +737,21 @@ typedef int (*eth_hairpin_bind_t)(struct rte_eth_dev *dev,\n typedef int (*eth_hairpin_unbind_t)(struct rte_eth_dev *dev,\n \t\t\t\t  uint16_t rx_port);\n \n+typedef int (*eth_hairpin_queue_peer_update_t)\n+\t(struct rte_eth_dev *dev, uint16_t peer_queue,\n+\t struct rte_hairpin_peer_info *current_info,\n+\t struct rte_hairpin_peer_info *peer_info, uint32_t direction);\n+/**< @internal Update and fetch peer queue information. */\n+\n+typedef int (*eth_hairpin_queue_peer_bind_t)\n+\t(struct rte_eth_dev *dev, uint16_t cur_queue,\n+\t struct rte_hairpin_peer_info *peer_info, uint32_t direction);\n+/**< @internal Bind peer queue to the current queue with fetched information. */\n+\n+typedef int (*eth_hairpin_queue_peer_unbind_t)\n+\t(struct rte_eth_dev *dev, uint16_t cur_queue, uint32_t direction);\n+/**< @internal Unbind peer queue from the current queue. */\n+\n /**\n  * @internal A structure containing the functions exported by an Ethernet driver.\n  */\n@@ -886,6 +904,12 @@ struct eth_dev_ops {\n \t/**< Bind all hairpin Tx queues of device to the peer port Rx queues. */\n \teth_hairpin_unbind_t hairpin_unbind;\n \t/**< Unbind all hairpin Tx queues from the peer port Rx queues. */\n+\teth_hairpin_queue_peer_update_t hairpin_queue_peer_update;\n+\t/**< Pass the current queue info and get the peer queue info. */\n+\teth_hairpin_queue_peer_bind_t hairpin_queue_peer_bind;\n+\t/**< Set up the connection between the pair of hairpin queues. */\n+\teth_hairpin_queue_peer_unbind_t hairpin_queue_peer_unbind;\n+\t/**< Disconnect the hairpin queues of a pair from each other. */\n };\n \n /**\n@@ -1241,6 +1265,83 @@ typedef int (*ethdev_bus_specific_init)(struct rte_eth_dev *ethdev,\n int\n rte_eth_dev_destroy(struct rte_eth_dev *ethdev, ethdev_uninit_t ethdev_uninit);\n \n+/**\n+ * @internal\n+ * Pass the current hairpin queue HW and/or SW information to the peer queue\n+ * and fetch back the information of the peer queue.\n+ *\n+ * @param peer_port\n+ *  Peer port identifier of the Ethernet device.\n+ * @param peer_queue\n+ *  Peer queue index of the port.\n+ * @param cur_info\n+ *  Pointer to the current information structure.\n+ * @param peer_info\n+ *  Pointer to the peer information, output.\n+ * @param direction\n+ *  Direction to pass the information.\n+ *  positive - pass Tx queue information and get peer Rx queue information\n+ *  zero - pass Rx queue information and get peer Tx queue information\n+ *\n+ * @return\n+ *  Negative errno value on error, 0 on success.\n+ */\n+__rte_internal\n+int\n+rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue,\n+\t\t\t\t  struct rte_hairpin_peer_info *cur_info,\n+\t\t\t\t  struct rte_hairpin_peer_info *peer_info,\n+\t\t\t\t  uint32_t direction);\n+\n+/**\n+ * @internal\n+ * Configure current hairpin queue with the peer information fetched to create\n+ * the connection (bind) with peer queue in the specified direction.\n+ * This function might need to be called twice to fully create the connections.\n+ *\n+ * @param cur_port\n+ *  Current port identifier of the Ethernet device.\n+ * @param cur_queue\n+ *  Current queue index of the port.\n+ * @param peer_info\n+ *  Pointer to the peer information, input.\n+ * @param direction\n+ *  Direction to create the connection.\n+ *  positive - bind current Tx queue to peer Rx queue\n+ *  zero - bind current Rx queue to peer Tx queue\n+ *\n+ * @return\n+ *  Negative errno value on error, 0 on success.\n+ */\n+__rte_internal\n+int\n+rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,\n+\t\t\t\tstruct rte_hairpin_peer_info *peer_info,\n+\t\t\t\tuint32_t direction);\n+\n+/**\n+ * @internal\n+ * Reset the current queue state and configuration to disconnect (unbind) it\n+ * from the peer queue.\n+ * This function might need to be called twice to disconnect each other.\n+ *\n+ * @param cur_port\n+ *  Current port identifier of the Ethernet device.\n+ * @param cur_queue\n+ *  Current queue index of the port.\n+ * @param direction\n+ *  Direction to destroy the connection.\n+ *  positive - unbind current Tx queue from peer Rx queue\n+ *  zero - unbind current Rx queue from peer Tx queue\n+ *\n+ * @return\n+ *  Negative errno value on error, 0 on success.\n+ */\n+__rte_internal\n+int\n+rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,\n+\t\t\t\t  uint32_t direction);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map\nindex a1e6897..f64c379 100644\n--- a/lib/librte_ethdev/rte_ethdev_version.map\n+++ b/lib/librte_ethdev/rte_ethdev_version.map\n@@ -258,6 +258,9 @@ INTERNAL {\n \trte_eth_devargs_parse;\n \trte_eth_dma_zone_free;\n \trte_eth_dma_zone_reserve;\n+\trte_eth_hairpin_queue_peer_bind;\n+\trte_eth_hairpin_queue_peer_unbind;\n+\trte_eth_hairpin_queue_peer_update;\n \trte_eth_switch_domain_alloc;\n \trte_eth_switch_domain_free;\n };\n",
    "prefixes": [
        "v6",
        "4/5"
    ]
}