get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 78140,
    "url": "http://patchwork.dpdk.org/api/patches/78140/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1600668838-31498-2-git-send-email-humin29@huawei.com/",
    "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": "<1600668838-31498-2-git-send-email-humin29@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1600668838-31498-2-git-send-email-humin29@huawei.com",
    "date": "2020-09-21T06:13:56",
    "name": "[V9,1/3] ethdev: introduce FEC API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e11cc5cbbb30d85e2e161854ed65200191e1e6e7",
    "submitter": {
        "id": 1944,
        "url": "http://patchwork.dpdk.org/api/people/1944/?format=api",
        "name": "humin (Q)",
        "email": "humin29@huawei.com"
    },
    "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/1600668838-31498-2-git-send-email-humin29@huawei.com/mbox/",
    "series": [
        {
            "id": 12369,
            "url": "http://patchwork.dpdk.org/api/series/12369/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=12369",
            "date": "2020-09-21T06:13:56",
            "name": "add FEC support",
            "version": 9,
            "mbox": "http://patchwork.dpdk.org/series/12369/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/78140/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/78140/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 C8011A04B7;\n\tMon, 21 Sep 2020 08:16:38 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id B28691D8CC;\n\tMon, 21 Sep 2020 08:16:36 +0200 (CEST)",
            "from huawei.com (szxga07-in.huawei.com [45.249.212.35])\n by dpdk.org (Postfix) with ESMTP id 75BEF1D73A\n for <dev@dpdk.org>; Mon, 21 Sep 2020 08:16:34 +0200 (CEST)",
            "from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60])\n by Forcepoint Email with ESMTP id CDC4FF5357EF02D923E0;\n Mon, 21 Sep 2020 14:16:32 +0800 (CST)",
            "from localhost.localdomain (10.69.192.56) by\n DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id\n 14.3.487.0; Mon, 21 Sep 2020 14:16:24 +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": "Mon, 21 Sep 2020 14:13:56 +0800",
        "Message-ID": "<1600668838-31498-2-git-send-email-humin29@huawei.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1600668838-31498-1-git-send-email-humin29@huawei.com>",
        "References": "<1599534347-20430-1-git-send-email-humin29@huawei.com>\n <1600668838-31498-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 V9 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>\nReviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\nAcked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>\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   | 10 ++++\n lib/librte_ethdev/rte_ethdev.c           | 49 ++++++++++++++++++\n lib/librte_ethdev/rte_ethdev.h           | 85 ++++++++++++++++++++++++++++++++\n lib/librte_ethdev/rte_ethdev_core.h      | 79 +++++++++++++++++++++++++++++\n lib/librte_ethdev/rte_ethdev_version.map |  5 ++\n 5 files changed, 228 insertions(+)",
    "diff": "diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst\nindex cc72609..e19b037 100644\n--- a/doc/guides/rel_notes/release_20_11.rst\n+++ b/doc/guides/rel_notes/release_20_11.rst\n@@ -55,6 +55,16 @@ New Features\n      Also, make sure to start the actual text at the margin.\n      =======================================================\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+* **Added hns3 FEC PMD, for supporting query and config FEC mode.**\n+\n+  Added the FEC PMD which provides functions for query FEC capabilities and\n+  current FEC mode from device. Also, PMD 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 7858ad5..d7cd737 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -3642,6 +3642,55 @@ 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, uint32_t *fec_cap)\n+{\n+\tstruct rte_eth_dev *dev;\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+\treturn eth_err(port_id, (*dev->dev_ops->fec_get_capability)(dev,\n+\t\t\t\t\t\t\t\tfec_cap));\n+}\n+\n+int\n+rte_eth_fec_get(uint16_t port_id, enum rte_eth_fec_mode *mode)\n+{\n+\tstruct rte_eth_dev *dev;\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, enum rte_eth_fec_mode mode)\n+{\n+\tstruct rte_eth_dev *dev;\n+\tuint32_t fec_mode_mask;\n+\tint ret;\n+\n+\tret = rte_eth_fec_get_capability(port_id, &fec_mode_mask);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n+\t/*\n+\t * Check whether the configured mode is within the FEC capability.\n+\t * If not, the configured mode will not be supported.\n+\t */\n+\tif (!(fec_mode_mask & RTE_ETH_FEC_MODE_TO_CAPA(mode))) {\n+\t\tRTE_ETHDEV_LOG(ERR, \"unsupported FEC mode = %d, port_id = %u\\n\",\n+\t\t\t       mode, port_id);\n+\t\treturn -EINVAL;\n+\t}\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 70295d7..7d5e81b 100644\n--- a/lib/librte_ethdev/rte_ethdev.h\n+++ b/lib/librte_ethdev/rte_ethdev.h\n@@ -1310,6 +1310,9 @@ struct rte_eth_conf {\n #define RTE_ETH_DEV_FALLBACK_RX_NBQUEUES 1\n #define RTE_ETH_DEV_FALLBACK_TX_NBQUEUES 1\n \n+/* Translate from FEC mode to FEC capa */\n+#define RTE_ETH_FEC_MODE_TO_CAPA(x)\t(1U << (x))\n+\n /**\n  * Preferred Rx/Tx port parameters.\n  * There are separate instances of this structure for transmission\n@@ -1511,6 +1514,24 @@ 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+/* This indicates FEC capabilities */\n+#define RTE_ETH_FEC_CAPA_NOFEC  (1U << RTE_ETH_FEC_NOFEC)\n+#define RTE_ETH_FEC_CAPA_AUTO   (1U << RTE_ETH_FEC_AUTO)\n+#define RTE_ETH_FEC_CAPA_BASER  (1U << RTE_ETH_FEC_BASER)\n+#define RTE_ETH_FEC_CAPA_RS     (1U << RTE_ETH_FEC_RS)\n+\n+\n #define RTE_ETH_ALL RTE_MAX_ETHPORTS\n \n /* Macros to check for valid port */\n@@ -3328,6 +3349,70 @@ 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 fec_cap\n+ *   returns the FEC capability from the device, as follows:\n+ *   RTE_ETH_FEC_CAPA_NOFEC\n+ *   RTE_ETH_FEC_CAPA_AUTO\n+ *   RTE_ETH_FEC_CAPA_BASER\n+ *   RTE_ETH_FEC_CAPA_RS\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_capability(uint16_t port_id, uint32_t *fec_cap);\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+ *\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, enum rte_eth_fec_mode *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, enum rte_eth_fec_mode 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_core.h b/lib/librte_ethdev/rte_ethdev_core.h\nindex 32407dd..755a15a 100644\n--- a/lib/librte_ethdev/rte_ethdev_core.h\n+++ b/lib/librte_ethdev/rte_ethdev_core.h\n@@ -604,6 +604,78 @@ 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 fec_cap\n+ *   returns the FEC capability 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+ * @retval -ENODEV\n+ *   Device is gone.\n+ */\n+typedef int (*eth_fec_get_capability_t)(struct rte_eth_dev *dev,\n+\t\t\t\t\tuint32_t *fec_cap);\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+ * @retval -ENODEV\n+ *   Device is gone.\n+ */\n+typedef int (*eth_fec_get_t)(struct rte_eth_dev *dev,\n+\t\t\t     enum rte_eth_fec_mode *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+ *   the FEC mode.\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 -EIO\n+ *   device is removed.\n+ * @retval -ENODEV\n+ *   Device is gone.\n+ */\n+typedef int (*eth_fec_set_t)(struct rte_eth_dev *dev,\n+\t\t\t     enum rte_eth_fec_mode mode);\n+\n+/**\n  * @internal A structure containing the functions exported by an Ethernet driver.\n  */\n struct eth_dev_ops {\n@@ -752,6 +824,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 02081d9..9f3fb8f 100644\n--- a/lib/librte_ethdev/rte_ethdev_version.map\n+++ b/lib/librte_ethdev/rte_ethdev_version.map\n@@ -239,6 +239,11 @@ EXPERIMENTAL {\n \t__rte_ethdev_trace_rx_burst;\n \t__rte_ethdev_trace_tx_burst;\n \trte_flow_get_aged_flows;\n+\n+\t# added in 20.11\n+\trte_eth_fec_get_capability;\n+\trte_eth_fec_get;\n+\trte_eth_fec_set;\n };\n \n INTERNAL {\n",
    "prefixes": [
        "V9",
        "1/3"
    ]
}