Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/78796/?format=api
https://patches.dpdk.org/api/patches/78796/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1601023147-57193-2-git-send-email-humin29@huawei.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": "<1601023147-57193-2-git-send-email-humin29@huawei.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1601023147-57193-2-git-send-email-humin29@huawei.com", "date": "2020-09-25T08:39:05", "name": "[V13,1/3] ethdev: introduce FEC API", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "48d13bc1663abe6e6c27ab2a49ebddbe8c96af98", "submitter": { "id": 1944, "url": "https://patches.dpdk.org/api/people/1944/?format=api", "name": "humin (Q)", "email": "humin29@huawei.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/1601023147-57193-2-git-send-email-humin29@huawei.com/mbox/", "series": [ { "id": 12502, "url": "https://patches.dpdk.org/api/series/12502/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=12502", "date": "2020-09-25T08:39:05", "name": "add FEC support", "version": 13, "mbox": "https://patches.dpdk.org/series/12502/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/78796/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/78796/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 28797A04C0;\n\tFri, 25 Sep 2020 10:41:48 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E7F4B1D424;\n\tFri, 25 Sep 2020 10:41:47 +0200 (CEST)", "from huawei.com (szxga07-in.huawei.com [45.249.212.35])\n by dpdk.org (Postfix) with ESMTP id 83D641D16E\n for <dev@dpdk.org>; Fri, 25 Sep 2020 10:41:46 +0200 (CEST)", "from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59])\n by Forcepoint Email with ESMTP id 3CABDC3EA6C78B2C656C;\n Fri, 25 Sep 2020 16:41:45 +0800 (CST)", "from localhost.localdomain (10.69.192.56) by\n DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id\n 14.3.487.0; Fri, 25 Sep 2020 16:41:36 +0800" ], "From": "\"Min Hu (Connor)\" <humin29@huawei.com>", "To": "<dev@dpdk.org>", "CC": "<konstantin.ananyev@intel.com>, <thomas@monjalon.net>,\n <arybchenko@solarflare.com>, <ferruh.yigit@intel.com>, <linuxarm@huawei.com>", "Date": "Fri, 25 Sep 2020 16:39:05 +0800", "Message-ID": "<1601023147-57193-2-git-send-email-humin29@huawei.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1601023147-57193-1-git-send-email-humin29@huawei.com>", "References": "<1599534347-20430-1-git-send-email-humin29@huawei.com>\n <1601023147-57193-1-git-send-email-humin29@huawei.com>", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Originating-IP": "[10.69.192.56]", "X-CFilter-Loop": "Reflected", "Subject": "[dpdk-dev] [PATCH V13 1/3] ethdev: introduce FEC API", "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": "This patch adds Forward error correction(FEC) support for ethdev.\nIntroduce APIs which support query and config FEC information in\nhardware.\n\nSigned-off-by: Min Hu (Connor) <humin29@huawei.com>\nReviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>\nReviewed-by: Chengwen Feng <fengchengwen@huawei.com>\nReviewed-by: Chengchang Tang <tangchengchang@huawei.com>\n---\nv12->v13:\nchange fec get capa API.\nfix comment styles.\n\n---\nv10->v11:\nallow to report capabilities per link speed.\nspecify what should be reported if link is down\nwhen get FEC.\nchange mode to capa bitmask.\n\n---\nv9->v10:\nadd macro RTE_ETH_FEC_MODE_CAPA_MASK(x) to indicate\ndifferent FEC mode capa.\n\n---\nv8->v9:\nadded reviewed-by and acked-by.\n\n---\nv7->v8:\nput AUTO just after NOFEC in rte_fec_mode definition.\n\n---\nv6->v7:\ndeleted RTE_ETH_FEC_NUM to prevent ABI breakage.\nadd new macro to indicate translation from fec mode\nto capa.\n\n---\nv5->v6:\nmodified release notes.\ndeleted check duplicated for FEC API\nfixed code styles according to DPDK coding style.\nadded _eth prefix.\n\n---\nv4->v5:\nModifies FEC capa definitions using macros.\nAdd RTE_ prefix for public FEC mode enum.\nadd release notes about FEC for dpdk20_11.\n\n---\nv2->v3:\nadd function return value \"-ENOTSUP\" for API.\n\n---\n doc/guides/rel_notes/release_20_11.rst | 5 ++\n lib/librte_ethdev/rte_ethdev.c | 43 +++++++++++++++\n lib/librte_ethdev/rte_ethdev.h | 94 ++++++++++++++++++++++++++++++++\n lib/librte_ethdev/rte_ethdev_driver.h | 80 +++++++++++++++++++++++++++\n lib/librte_ethdev/rte_ethdev_version.map | 3 +\n 5 files changed, 225 insertions(+)", "diff": "diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst\nindex c6642f5..1f04bd5 100644\n--- a/doc/guides/rel_notes/release_20_11.rst\n+++ b/doc/guides/rel_notes/release_20_11.rst\n@@ -78,6 +78,11 @@ New Features\n ``--portmask=N``\n where N represents the hexadecimal bitmask of ports used.\n \n+* **Added the FEC API, for a generic FEC query and config.**\n+\n+ Added the FEC API which provides functions for query FEC capabilities and\n+ current FEC mode from device. Also, API for configuring FEC mode is also provided.\n+\n \n Removed Items\n -------------\ndiff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c\nindex dfe5c1b..86ead87 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -3679,6 +3679,49 @@ rte_eth_led_off(uint16_t port_id)\n \treturn eth_err(port_id, (*dev->dev_ops->dev_led_off)(dev));\n }\n \n+int\n+rte_eth_fec_get_capability(uint16_t port_id,\n+\t\t\t struct rte_eth_fec_capa *speed_fec_capa,\n+\t\t\t unsigned int num)\n+{\n+\tstruct rte_eth_dev *dev;\n+\tint ret;\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->fec_get_capability, -ENOTSUP);\n+\tret = (*dev->dev_ops->fec_get_capability)(dev, speed_fec_capa, num);\n+\tif (ret > (int)num)\n+\t\tRTE_ETHDEV_LOG(ERR, \"Insufficient num, num should be no less than %d\\n\",\n+\t\t\t ret);\n+\n+\treturn ret;\n+}\n+\n+int\n+rte_eth_fec_get(uint16_t port_id, uint32_t *mode)\n+{\n+\tstruct rte_eth_dev *dev;\n+\n+\tif (mode == NULL)\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->fec_get, -ENOTSUP);\n+\treturn eth_err(port_id, (*dev->dev_ops->fec_get)(dev, mode));\n+}\n+\n+int\n+rte_eth_fec_set(uint16_t port_id, uint32_t mode)\n+{\n+\tstruct rte_eth_dev *dev;\n+\n+\tdev = &rte_eth_devices[port_id];\n+\tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_set, -ENOTSUP);\n+\treturn eth_err(port_id, (*dev->dev_ops->fec_set)(dev, mode));\n+}\n+\n /*\n * Returns index into MAC address array of addr. Use 00:00:00:00:00:00 to find\n * an empty spot.\ndiff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h\nindex 645a186..04525a8 100644\n--- a/lib/librte_ethdev/rte_ethdev.h\n+++ b/lib/librte_ethdev/rte_ethdev.h\n@@ -1544,6 +1544,29 @@ struct rte_eth_dcb_info {\n \tstruct rte_eth_dcb_tc_queue_mapping tc_queue;\n };\n \n+/**\n+ * This enum indicates the possible Forward Error Correction (FEC) modes\n+ * of an ethdev port.\n+ */\n+enum rte_eth_fec_mode {\n+\tRTE_ETH_FEC_NOFEC = 0, /**< FEC is off */\n+\tRTE_ETH_FEC_AUTO,\t /**< FEC autonegotiation modes */\n+\tRTE_ETH_FEC_BASER, /**< FEC using common algorithm */\n+\tRTE_ETH_FEC_RS, /**< FEC using RS algorithm */\n+};\n+\n+/* Translate from FEC mode to FEC capa */\n+#define RTE_ETH_FEC_MODE_TO_CAPA(x)\t(1U << (x))\n+\n+/* This macro indicates FEC capa mask */\n+#define RTE_ETH_FEC_MODE_CAPA_MASK(x)\t(1U << (RTE_ETH_FEC_ ## x))\n+\n+/* A structure used to get capabilities per link speed */\n+struct rte_eth_fec_capa {\n+\tuint32_t speed; /**< Link speed (see ETH_SPEED_NUM_*) */\n+\tuint32_t capa; /**< FEC capabilities bitmask (see RTE_FEC_CAPA_*) */\n+};\n+\n #define RTE_ETH_ALL RTE_MAX_ETHPORTS\n \n /* Macros to check for valid port */\n@@ -3397,6 +3420,77 @@ int rte_eth_led_on(uint16_t port_id);\n int rte_eth_led_off(uint16_t port_id);\n \n /**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n+ * Get Forward Error Correction(FEC) capability.\n+ *\n+ * @param port_id\n+ * The port identifier of the Ethernet device.\n+ * @param speed_fec_capa\n+ * speed_fec_capa is out only with per-speed capabilities.\n+ * If set to NULL, the function returns the required number\n+ * of required array entries.\n+ * @param num\n+ * the num is in/out with a number of elements in an array.\n+ *\n+ * @return\n+ * - (0) if successful.\n+ * - (-ENOTSUP) if underlying hardware OR driver doesn't support.\n+ * that operation.\n+ * - (-EIO) if device is removed.\n+ * - (-ENODEV) if *port_id* invalid.\n+ * - (-EINVAL) if *num* or *speed_fec_capa* invalid\n+ */\n+__rte_experimental\n+int rte_eth_fec_get_capability(uint16_t port_id,\n+\t\t\t struct rte_eth_fec_capa *speed_fec_capa,\n+\t\t\t unsigned int num);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n+ * Get current Forward Error Correction(FEC) mode.\n+ * If link is down and AUTO is enabled, AUTO is returned, otherwise,\n+ * configured FEC mode is returned.\n+ * If link is up, current FEC mode is returned.\n+ *\n+ * @param port_id\n+ * The port identifier of the Ethernet device.\n+ * @param mode\n+ * Returns the FEC mode from the device.\n+ * @return\n+ * - (0) if successful.\n+ * - (-ENOTSUP) if underlying hardware OR driver doesn't support.\n+ * that operation.\n+ * - (-EIO) if device is removed.\n+ * - (-ENODEV) if *port_id* invalid.\n+ */\n+__rte_experimental\n+int rte_eth_fec_get(uint16_t port_id, uint32_t *mode);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n+ * Set Forward Error Correction(FEC) mode.\n+ *\n+ * @param port_id\n+ * The port identifier of the Ethernet device.\n+ * @param mode\n+ * The FEC mode.\n+ * @return\n+ * - (0) if successful.\n+ * - (-EINVAL) if the FEC mode is not valid.\n+ * - (-ENOTSUP) if underlying hardware OR driver doesn't support.\n+ * - (-EIO) if device is removed.\n+ * - (-ENODEV) if *port_id* invalid.\n+ */\n+__rte_experimental\n+int rte_eth_fec_set(uint16_t port_id, uint32_t mode);\n+\n+/**\n * Get current status of the Ethernet link flow control for Ethernet device\n *\n * @param port_id\ndiff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h\nindex 23cc1e0..306f3a6 100644\n--- a/lib/librte_ethdev/rte_ethdev_driver.h\n+++ b/lib/librte_ethdev/rte_ethdev_driver.h\n@@ -575,6 +575,79 @@ typedef int (*eth_tx_hairpin_queue_setup_t)\n \t const struct rte_eth_hairpin_conf *hairpin_conf);\n \n /**\n+ * @internal\n+ * Get Forward Error Correction(FEC) capability.\n+ *\n+ * @param dev\n+ * ethdev handle of port.\n+ * @param speed_fec_capa\n+ * speed_fec_capa is out only with per-speed capabilities.\n+ * @param num\n+ * the num is in/out with a number of elements in an array.\n+ *\n+ * @return\n+ * Negative errno value on error, 0 on success.\n+ *\n+ * @retval 0\n+ * Success, get FEC success.\n+ * @retval -ENOTSUP\n+ * Operation is not supported.\n+ * @retval -EIO\n+ * Device is removed.\n+ * @retval -EINVAL\n+ * *num* or *speed_fec_capa* invalid.\n+ */\n+typedef int (*eth_fec_get_capability_t)(struct rte_eth_dev *dev,\n+\t\tstruct rte_eth_fec_capa *speed_fec_capa, unsigned int num);\n+\n+/**\n+ * @internal\n+ * Get Forward Error Correction(FEC) mode.\n+ *\n+ * @param dev\n+ * ethdev handle of port.\n+ * @param mode\n+ * returns the FEC mode from the device.\n+ *\n+ * @return\n+ * Negative errno value on error, 0 on success.\n+ *\n+ * @retval 0\n+ * Success, get FEC success.\n+ * @retval -ENOTSUP\n+ * Operation is not supported.\n+ * @retval -EIO\n+ * Device is removed.\n+ */\n+typedef int (*eth_fec_get_t)(struct rte_eth_dev *dev,\n+\t\t\t uint32_t *mode);\n+\n+/**\n+ * @internal\n+ * Set Forward Error Correction(FEC) mode.\n+ *\n+ * @param dev\n+ * ethdev handle of port.\n+ * @param mode\n+ * bitmask of allowed FEC modes. It must be only one\n+ * if AUTO is disabled. If AUTO is enabled, other\n+ * bits specify FEC modes which may be negotiated.\n+ *\n+ * @return\n+ * Negative errno value on error, 0 on success.\n+ *\n+ * @retval 0\n+ * Success, set FEC success.\n+ * @retval -ENOTSUP\n+ * Operation is not supported.\n+ * @retval -EINVAL\n+ * Unsupported FEC mode requested.\n+ * @retval -EIO\n+ * Device is removed.\n+ */\n+typedef int (*eth_fec_set_t)(struct rte_eth_dev *dev, uint32_t mode);\n+\n+/**\n * @internal A structure containing the functions exported by an Ethernet driver.\n */\n struct eth_dev_ops {\n@@ -713,6 +786,13 @@ struct eth_dev_ops {\n \t/**< Set up device RX hairpin queue. */\n \teth_tx_hairpin_queue_setup_t tx_hairpin_queue_setup;\n \t/**< Set up device TX hairpin queue. */\n+\n+\teth_fec_get_capability_t fec_get_capability;\n+\t/**< Get Forward Error Correction(FEC) capability. */\n+\teth_fec_get_t fec_get;\n+\t/**< Get Forward Error Correction(FEC) mode. */\n+\teth_fec_set_t fec_set;\n+\t/**< Set Forward Error Correction(FEC) mode. */\n };\n \n /**\ndiff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map\nindex c95ef51..b9ace3a 100644\n--- a/lib/librte_ethdev/rte_ethdev_version.map\n+++ b/lib/librte_ethdev/rte_ethdev_version.map\n@@ -229,6 +229,9 @@ EXPERIMENTAL {\n \t# added in 20.11\n \trte_eth_link_speed_to_str;\n \trte_eth_link_to_str;\n+\trte_eth_fec_get_capability;\n+\trte_eth_fec_get;\n+\trte_eth_fec_set;\n };\n \n INTERNAL {\n", "prefixes": [ "V13", "1/3" ] }{ "id": 78796, "url": "