get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 80907,
    "url": "https://patches.dpdk.org/api/patches/80907/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1602767335-433464-4-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-4-git-send-email-bingz@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1602767335-433464-4-git-send-email-bingz@nvidia.com",
    "date": "2020-10-15T13:08:53",
    "name": "[v6,3/5] ethdev: add API to get hairpin peer ports list",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "4450c99b44f4682c7c641cb2f1e0f08266801989",
    "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-4-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/80907/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/80907/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 6DE2BA04DB;\n\tThu, 15 Oct 2020 15:10:11 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 98F8C1E907;\n\tThu, 15 Oct 2020 15:09:40 +0200 (CEST)",
            "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n by dpdk.org (Postfix) with ESMTP id 7082D1E8F8\n for <dev@dpdk.org>; Thu, 15 Oct 2020 15:09:33 +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:53 +0800",
        "Message-Id": "<1602767335-433464-4-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 3/5] ethdev: add API to get hairpin peer ports\n\tlist",
        "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": "After hairpin queues are configured, in general, the application will\nmaintain the ports topology and even the queues configuration for\nthe hairpin. But sometimes it will not.\n\nIf there is no hot-plug, it is easy to bind and unbind hairpin among\nall the ports. The application can just connect or disconnect the\nhairpin egress ports to/from all the probed ingress ports. Then all\nthe connections could be handled properly.\n\nBut with hot-plug / hot-unplug, one port could be probed and removed\ndynamically. With two ports hairpin, all the connections from and to\nthis port should be handled after start(bind) or before stop(unbind).\nIt is necessary to know the hairpin topology with this port.\n\nThis function will return the ports list with the actual peer ports\nnumber after configuration. Either peer Rx or Tx ports will be\ngotten with this function call.\n\nSigned-off-by: Bing Zhao <bingz@nvidia.com>\nAcked-by: Ori Kam <orika@nvidia.com>\n---\nv6:\n  * Coding style updates\n  * Using \"Rx\" & \"Tx\"\nv5:\n  * change EINVAL to ENODEV\n  * add newline character\nv4: add release notes update\nv3:\n  * change the direction from bool to unsigned int type\n  * add length to protect the array from getting corrupted\n---\n doc/guides/rel_notes/release_20_11.rst   |  1 +\n lib/librte_ethdev/rte_ethdev.c           | 24 +++++++++++++++++++++++\n lib/librte_ethdev/rte_ethdev.h           | 30 +++++++++++++++++++++++++++++\n lib/librte_ethdev/rte_ethdev_driver.h    | 33 ++++++++++++++++++++++++++++++++\n lib/librte_ethdev/rte_ethdev_version.map |  1 +\n 5 files changed, 89 insertions(+)",
    "diff": "diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst\nindex 2f23e6f..7b8e3ee 100644\n--- a/doc/guides/rel_notes/release_20_11.rst\n+++ b/doc/guides/rel_notes/release_20_11.rst\n@@ -93,6 +93,7 @@ New Features\n \n   New APIs are introduced to support binding / unbinding 2 ports hairpin.\n   Hairpin Tx part flow rules can be inserted explicitly.\n+  New API is added to get the hairpin peer ports list.\n \n * **Updated Broadcom bnxt driver.**\n \ndiff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c\nindex bcbee30..80907b2 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -2257,6 +2257,30 @@ struct rte_eth_dev *\n \treturn ret;\n }\n \n+int\n+rte_eth_hairpin_get_peer_ports(uint16_t port_id, uint16_t *peer_ports,\n+\t\t\t       size_t len, uint32_t direction)\n+{\n+\tstruct rte_eth_dev *dev;\n+\tint ret;\n+\n+\tif (peer_ports == NULL || len == 0)\n+\t\treturn -EINVAL;\n+\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n+\tdev = &rte_eth_devices[port_id];\n+\tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_get_peer_ports,\n+\t\t\t\t-ENOTSUP);\n+\n+\tret = (*dev->dev_ops->hairpin_get_peer_ports)(dev, peer_ports,\n+\t\t\t\t\t\t      len, direction);\n+\tif (ret < 0)\n+\t\tRTE_ETHDEV_LOG(ERR, \"Failed to get %d hairpin peer %s ports\\n\",\n+\t\t\t       port_id, direction ? \"Rx\" : \"Tx\");\n+\n+\treturn ret;\n+}\n+\n void\n rte_eth_tx_buffer_drop_callback(struct rte_mbuf **pkts, uint16_t unsent,\n \t\tvoid *userdata __rte_unused)\ndiff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h\nindex a8e5cdc..f02acdc 100644\n--- a/lib/librte_ethdev/rte_ethdev.h\n+++ b/lib/librte_ethdev/rte_ethdev.h\n@@ -2186,6 +2186,36 @@ int rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,\n  * @warning\n  * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n  *\n+ * Get all the hairpin peer Rx / Tx ports of the current port.\n+ * The caller should ensure that the array is large enough to save the ports\n+ * list.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param peer_ports\n+ *   Pointer to the array to store the peer ports list.\n+ * @param len\n+ *   Length of the array to store the port identifiers.\n+ * @param direction\n+ *   Current port to peer port direction\n+ *   positive - current used as Tx to get all peer Rx ports.\n+ *   zero - current used as Rx to get all peer Tx ports.\n+ *\n+ * @return\n+ *   - (0 or positive) actual peer ports number.\n+ *   - (-EINVAL) if bad parameter.\n+ *   - (-ENODEV) if *port_id* invalid\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - Others detailed errors from PMD drivers.\n+ */\n+__rte_experimental\n+int rte_eth_hairpin_get_peer_ports(uint16_t port_id, uint16_t *peer_ports,\n+\t\t\t\t   size_t len, uint32_t direction);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n  * Bind all hairpin Tx queues of one port to the Rx queues of the peer port.\n  * It is only allowed to call this function after all hairpin queues are\n  * configured properly and the devices are in started state.\ndiff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h\nindex 9a65bd5..03e00d5 100644\n--- a/lib/librte_ethdev/rte_ethdev_driver.h\n+++ b/lib/librte_ethdev/rte_ethdev_driver.h\n@@ -657,6 +657,37 @@ typedef int (*eth_fec_get_t)(struct rte_eth_dev *dev,\n \n /**\n  * @internal\n+ * Get all hairpin Tx/Rx peer ports of the current device, if any.\n+ *\n+ * @param dev\n+ *   ethdev handle of port.\n+ * @param peer_ports\n+ *   array to save the ports list.\n+ * @param len\n+ *   array length.\n+ * @param direction\n+ *   value to decide the current to peer direction\n+ *   positive - used as Tx to get all peer Rx ports.\n+ *   zero - used as Rx to get all peer Tx ports.\n+ *\n+ * @return\n+ *   Negative errno value on error, 0 or positive on success.\n+ *\n+ * @retval 0\n+ *   Success, no peer ports.\n+ * @retval >0\n+ *   Actual number of the peer ports.\n+ * @retval -ENOTSUP\n+ *   Get peer ports API is not supported.\n+ * @retval -EINVAL\n+ *   One of the parameters is invalid.\n+ */\n+typedef int (*hairpin_get_peer_ports_t)(struct rte_eth_dev *dev,\n+\t\t\t\t\tuint16_t *peer_ports, size_t len,\n+\t\t\t\t\tuint32_t direction);\n+\n+/**\n+ * @internal\n  * Bind all hairpin Tx queues of one port to the Rx queues of the peer port.\n  *\n  * @param dev\n@@ -849,6 +880,8 @@ struct eth_dev_ops {\n \t/**< Get Forward Error Correction(FEC) mode. */\n \teth_fec_set_t fec_set;\n \t/**< Set Forward Error Correction(FEC) mode. */\n+\thairpin_get_peer_ports_t hairpin_get_peer_ports;\n+\t/**< Get hairpin peer ports list. */\n \teth_hairpin_bind_t hairpin_bind;\n \t/**< Bind all hairpin Tx queues of device to the peer port Rx queues. */\n \teth_hairpin_unbind_t hairpin_unbind;\ndiff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map\nindex d67c9dc..a1e6897 100644\n--- a/lib/librte_ethdev/rte_ethdev_version.map\n+++ b/lib/librte_ethdev/rte_ethdev_version.map\n@@ -228,6 +228,7 @@ EXPERIMENTAL {\n \n \t# added in 20.11\n \trte_eth_hairpin_bind;\n+\trte_eth_hairpin_get_peer_ports;\n \trte_eth_hairpin_unbind;\n \trte_eth_link_speed_to_str;\n \trte_eth_link_to_str;\n",
    "prefixes": [
        "v6",
        "3/5"
    ]
}