From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A56BDA04B7; Wed, 16 Sep 2020 16:10:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0D1F61C2A7; Wed, 16 Sep 2020 16:10:19 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 80F941C29F for ; Wed, 16 Sep 2020 16:10:17 +0200 (CEST) IronPort-SDR: GFT18OtAmPl3dFktoU3UsMRqHh05f+NyJBgDe0o1EkLXAw8m6x6JFGyu0MdbsZCSGwtuobuRP1 +aRo2mM6g8Cg== X-IronPort-AV: E=McAfee;i="6000,8403,9745"; a="147153728" X-IronPort-AV: E=Sophos;i="5.76,433,1592895600"; d="scan'208";a="147153728" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2020 07:10:16 -0700 IronPort-SDR: XK3HS+cOzFJotGDghHR8Frjpef77wxkTx8gtILn9YFt6A7lCPygZzbPxtq4eIJmbKexuqNWuet +8hnZsfpbXJg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,433,1592895600"; d="scan'208";a="343907098" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by FMSMGA003.fm.intel.com with ESMTP; 16 Sep 2020 07:10:15 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 16 Sep 2020 07:10:15 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 16 Sep 2020 07:10:15 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.43) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Wed, 16 Sep 2020 07:10:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kp+Vd/QqZwHKGEm6RvcjU8933o00QvhEsQhcrtbdB7+MlLpQ4DJMwAa433/dycubfK3Px2Rau3WRpEQbsggKQPPD0gsSdyzb+nXzXEY1dL4LnZ9IkLNsDcb0DItTQlyqp+7MRLI9RyotctuGsgbsRMUKy9huWORdr1OHlYFV/aaQGOdukF25Z0G7ytEHJvtRCRvMoph31k68l0vjtDwX1S7w2qOIUYt5Ak693CJxcbNPZ/ZJoQ5/u5uc5WUlfMN0Mof8QXI7YDs3/lh9qwfVvT238O/aGrBoeKSr/1LGnuKPJvaUvgU2wzm3jPb+Jye3/4EaiYYvJJFSpwh57IoNFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4z0sKXeAXENjFZEPS8sIWqgoLTRM4pQ+dkq4FvMkN6E=; b=aMpTgPNmt0byrsygvuBltdPGWSX4gZA6NLYs/xy8sO2wToIQsNz7nrWeG4OiB8Ats6gMiflFyxwHjS2GUJ8pM5uMfHZLWjA8AOo0NwQDelNSk5ck7vQasqWLmOpE8VhT2ZgwAE5UvW6nMn7C/K7+s3NpwRkGc3B4aTwPGhonge99AHEYMHxXcaapxEsGa3ELexCoU+7WMfd9nQ5TC1ohl9t6ZIboKwrOGz4svliInxpG8A+RYEzzeGw6jxfELVvtZ03zOcCTcddjZavxoI8j2Ic6zfecuQ/P2hA/M2wRUcGU1ffFPQ9tsa1rIUjOk+9TlgO5l3LGOwLsWXhSJhdV0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4z0sKXeAXENjFZEPS8sIWqgoLTRM4pQ+dkq4FvMkN6E=; b=ydpTxpG72y+4igAO2a9Q5I7swURyCiw43LekKIbFdtyxQdGA7F47E8ET1IeyeVwsOm5eqpsNxOQZ1MP+14avk5PDAo8bLsyMmcaMlrGwVi0dO0Em9okc/lrKMDESEk9SXK2tkulbNKhfp2o714To8tlM0LOHqSuRdqVp/CehH2U= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by BYAPR11MB2728.namprd11.prod.outlook.com (2603:10b6:a02:ca::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.11; Wed, 16 Sep 2020 14:10:11 +0000 Received: from BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f43b:a137:dab8:8b0b]) by BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f43b:a137:dab8:8b0b%6]) with mapi id 15.20.3391.011; Wed, 16 Sep 2020 14:10:11 +0000 From: "Ananyev, Konstantin" To: "Min Hu (Connor)" , "dev@dpdk.org" CC: "thomas@monjalon.net" , "arybchenko@solarflare.com" , "Yigit, Ferruh" , "linuxarm@huawei.com" Thread-Topic: [dpdk-dev] [PATCH V4 1/3] ethdev: introduce FEC API Thread-Index: AQHWh0PMrXJO3kQBVUq6J4Du/JzTzqlrVRkQ Date: Wed, 16 Sep 2020 14:10:10 +0000 Message-ID: References: <1599534347-20430-1-git-send-email-humin29@huawei.com> <1599722646-19188-1-git-send-email-humin29@huawei.com> <1599722646-19188-2-git-send-email-humin29@huawei.com> In-Reply-To: <1599722646-19188-2-git-send-email-humin29@huawei.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [46.7.39.127] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7986170b-8ceb-40c0-7891-08d85a4a39ab x-ms-traffictypediagnostic: BYAPR11MB2728: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AvqgiDHQ9HV5COde5aW6RRhRFeMVmfr2ZrdmNNCwb9hsmFIn5pNkbz27mtMBY1+JUSK9PFI6N1GrjXREyyrsUE9KqM2XFJTrYVboFPjv75+o6jTYeav+YXcPRoftH/hUkRI9p/p1CL3DFPZZ62zYHWFm0+j/u4j6RhfQ1m9qtaDseLp43+sKEuZiQaHI9wZP1awW0OrXj69xVc5Rj1V7m9nFLMzx24I+O21MQSj0UmkG2HuJcaoNv6Z+If+4j6nO4GY4yCOd4sSwASON/HoHklXQGA/0rKdEB6DaAovj8op9iw/vOtK0DjCJdS3B85SwgXQE2ic4MSMm35lvRV2uCnuTBbekhgQ7CGFTnXhSlJiswVuS7D2jSTD/Hj5N92h3 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3301.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(376002)(346002)(366004)(396003)(64756008)(6506007)(66446008)(26005)(110136005)(66946007)(478600001)(71200400001)(4326008)(66556008)(66476007)(8676002)(33656002)(8936002)(86362001)(186003)(83380400001)(7696005)(54906003)(316002)(2906002)(5660300002)(9686003)(52536014)(55016002)(76116006)(21314003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: MvMFu/9M4UenFb8bExXyMmkethYP5utcyeuFAtdq/Bv8lHWDN52Bkc2RlVC70CCL57cyPXGgsPJNU8IswdNEW4urR2IEtzBwWaLaR0OCymmD1/BUigYLYEhPmYxn4Ax7+LfbPpXV5ulLkO+4XH5NnneW7T0hQQZffZ+QTJj4+bG8Qj1yoT8/Rk4PmyzvsIEmSquYkUN8QDTD+UIoVO/S59s98R5BfHfmM2vGXf3AWboX4jWjAS0XrFo3uPFX20dqOSlS+WpEa8jDRB27e8nplXWV/oPi6MyngfwekNmnXTqjrePDhjUtBrAp5/g9JmbYwwj9C/QnWpXlPpQg2Qv6yghSke/w7PwPpI9dnHlJgizTTg0yhv0sCjnOvN0YEPgPyGWQ6ZFpJW1n7Nq3ZVaJpQ3yN4g6qAWmgzu9oyT6obKfuJCaFTm0qHexRd4BQ5awlg9nspO4jAxscmI0RnQTlXBwkIPZEHkxEUB9U/hri2XjeetDfp4yTl0EH/NfNpD/4BGJd4Cxo6SYcDSBFpCKON4LUTY7cYkEAIf6fJTnL1rLRqbLkcU7iBX7FKA8unLXHnas5TWxYIzSstgSaI+BLDKIVPn4uvv38TtZUZkwHHdOeIVLcxJe9If1DWZWWFOy7s56PmtskqRuneMPAiPHyw== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3301.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7986170b-8ceb-40c0-7891-08d85a4a39ab X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Sep 2020 14:10:10.8387 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SuhFN74wXXHy9aSs8CKOc9crmV37zjA7FfeKu3zWyBIOayj6KO+XWEa3bjtN0ylWA/ScQiZMjbnaxxApVbZP5gWNVyksBvCzDKmWrP1/OUE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2728 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH V4 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Seems ok in general, few nits below. > This patch adds Forward error correction(FEC) support for ethdev. > Introduce APIs which support query and config FEC information in > hardware. >=20 > Signed-off-by: Min Hu (Connor) > Reviewed-by: Wei Hu (Xavier) > Reviewed-by: Chengwen Feng > Reviewed-by: Chengchang Tang >=20 > --- > v2->v3: > add function return value "-ENOTSUP" for API > --- > lib/librte_ethdev/rte_ethdev.c | 50 +++++++++++++++++++++ > lib/librte_ethdev/rte_ethdev.h | 75 ++++++++++++++++++++++++++= +++++ > lib/librte_ethdev/rte_ethdev_core.h | 77 ++++++++++++++++++++++++++= ++++++ > lib/librte_ethdev/rte_ethdev_version.map | 5 +++ This is a wew feature, probably worth to update release notes.=20 > 4 files changed, 207 insertions(+) >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index 7858ad5..b7ac791 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -3642,6 +3642,56 @@ rte_eth_led_off(uint16_t port_id) > return eth_err(port_id, (*dev->dev_ops->dev_led_off)(dev)); > } >=20 > +int > +rte_eth_fec_get_capability(uint16_t port_id, uint8_t *fec_cap) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + dev =3D &rte_eth_devices[port_id]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get_capability, -ENOTSUP); > + return eth_err(port_id, (*dev->dev_ops->fec_get_capability)(dev, > + fec_cap)); > +} > + > +int > +rte_eth_fec_get(uint16_t port_id, enum rte_fec_mode *mode) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + dev =3D &rte_eth_devices[port_id]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get, -ENOTSUP); > + return eth_err(port_id, (*dev->dev_ops->fec_get)(dev, mode)); > +} > + > +int > +rte_eth_fec_set(uint16_t port_id, enum rte_fec_mode mode) > +{ > + struct rte_eth_dev *dev; > + uint8_t fec_mode_mask; > + int ret; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + > + ret =3D rte_eth_fec_get_capability(port_id, &fec_mode_mask); > + if (ret) > + return ret; > + > + /* > + * Check whether the configured mode is within the FEC capability. > + * If not, the configured mode will not be supported. > + */ > + if (!(fec_mode_mask & (1U << (uint8_t)mode))) { > + RTE_ETHDEV_LOG(ERR, "unsupported fec mode=3D%d\n", mode); > + return -EINVAL; > + } > + > + dev =3D &rte_eth_devices[port_id]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_set, -ENOTSUP); > + return eth_err(port_id, (*dev->dev_ops->fec_set)(dev, mode)); > +} > + > /* > * Returns index into MAC address array of addr. Use 00:00:00:00:00:00 t= o find > * an empty spot. > diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethde= v.h > index 70295d7..c353480 100644 > --- a/lib/librte_ethdev/rte_ethdev.h > +++ b/lib/librte_ethdev/rte_ethdev.h > @@ -1511,6 +1511,17 @@ struct rte_eth_dcb_info { > struct rte_eth_dcb_tc_queue_mapping tc_queue; > }; >=20 > +/** > + * This enum indicates the possible (forward error correction)FEC modes > + * of an ethdev port. > + */ > +enum rte_fec_mode { > + ETH_FEC_NOFEC =3D 0, /**< FEC is off */ As it is a public enum, RTE_ prefix is needed for each value. > + ETH_FEC_BASER, /**< FEC using common algorithm */ > + ETH_FEC_RS, /**< FEC using RS algorithm */ > + ETH_FEC_AUTO /**< FEC autonegotiation modes */ > +}; > + > #define RTE_ETH_ALL RTE_MAX_ETHPORTS >=20 > /* Macros to check for valid port */ > @@ -3328,6 +3339,70 @@ int rte_eth_led_on(uint16_t port_id); > int rte_eth_led_off(uint16_t port_id); >=20 > /** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior no= tice > + * > + * Get Forward Error Correction(FEC) capability. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param fec_cap > + * returns the FEC capability from the device, as follows: > + * bit0: nofec > + * bit1: baser > + * bit2: rs > + * bit3: auto Instead of putting bit description into the comment, I think it is better t= o define them explicitly. Something like:=20 #define RTE_ETH_FEC_CAPA_XXX (1 << RTE_ETH_FEC_XXX) > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if underlying hardware OR driver doesn't support. > + * that operation. > + * - (-EIO) if device is removed. > + * - (-ENODEV) if *port_id* invalid. > + */ > +__rte_experimental > +int rte_eth_fec_get_capability(uint16_t port_id, uint8_t *fec_cap); Probably make sense to have uint32_t bit value for fec_cap (for possible f= uture expansion)? > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior no= tice > + * > + * Get current Forward Error Correction(FEC) mode. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param mode > + * returns the FEC mode from the device. > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if underlying hardware OR driver doesn't support. > + * that operation. > + * - (-EIO) if device is removed. > + * - (-ENODEV) if *port_id* invalid. > + */ > +__rte_experimental > +int rte_eth_fec_get(uint16_t port_id, enum rte_fec_mode *mode); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior no= tice > + * > + * Set Forward Error Correction(FEC) mode. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param mode > + * the FEC mode. > + * @return > + * - (0) if successful. > + * - (-EINVAL) if the FEC mode is not valid. > + * - (-ENOTSUP) if underlying hardware OR driver doesn't support. > + * - (-EIO) if device is removed. > + * - (-ENODEV) if *port_id* invalid. > + */ > +__rte_experimental > +int rte_eth_fec_set(uint16_t port_id, enum rte_fec_mode mode); > + > +/** > * Get current status of the Ethernet link flow control for Ethernet dev= ice > * > * @param port_id > diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_= ethdev_core.h > index 32407dd..df9e18a 100644 > --- a/lib/librte_ethdev/rte_ethdev_core.h > +++ b/lib/librte_ethdev/rte_ethdev_core.h > @@ -604,6 +604,76 @@ typedef int (*eth_tx_hairpin_queue_setup_t) > const struct rte_eth_hairpin_conf *hairpin_conf); >=20 > /** > + * @internal > + * Get Forward Error Correction(FEC) capability. > + * > + * @param dev > + * ethdev handle of port. > + * @param fec_cap > + * returns the FEC capability from the device. > + * > + * @return > + * Negative errno value on error, 0 on success. > + * > + * @retval 0 > + * Success, get FEC success. > + * @retval -ENOTSUP > + * operation is not supported. > + * @retval -EIO > + * device is removed. > + * @retval -ENODEV > + * Device is gone. > + */ > +typedef int (*eth_fec_get_capability_t)(struct rte_eth_dev *dev, > + uint8_t *fec_cap); > + > +/** > + * @internal > + * Get Forward Error Correction(FEC) mode. > + * > + * @param dev > + * ethdev handle of port. > + * @param mode > + * returns the FEC mode from the device. > + * > + * @return > + * Negative errno value on error, 0 on success. > + * > + * @retval 0 > + * Success, get FEC success. > + * @retval -ENOTSUP > + * operation is not supported. > + * @retval -EIO > + * device is removed. > + * @retval -ENODEV > + * Device is gone. > + */ > +typedef int (*eth_fec_get_t)(struct rte_eth_dev *dev, enum rte_fec_mode = *mode); > + > +/** > + * @internal > + * Set Forward Error Correction(FEC) mode. > + * > + * @param dev > + * ethdev handle of port. > + * @param mode > + * the FEC mode. > + * > + * @return > + * Negative errno value on error, 0 on success. > + * > + * @retval 0 > + * Success, set FEC success. > + * @retval -ENOTSUP > + * operation is not supported. > + * @retval -EIO > + * device is removed. > + * @retval -ENODEV > + * Device is gone. > + */ > +typedef int (*eth_fec_set_t)(struct rte_eth_dev *dev, enum rte_fec_mode = mode); > + > +/** > * @internal A structure containing the functions exported by an Etherne= t driver. > */ > struct eth_dev_ops { > @@ -752,6 +822,13 @@ struct eth_dev_ops { > /**< Set up device RX hairpin queue. */ > eth_tx_hairpin_queue_setup_t tx_hairpin_queue_setup; > /**< Set up device TX hairpin queue. */ > + > + eth_fec_get_capability_t fec_get_capability; > + /**< Get Forward Error Correction(FEC) capability; */ > + eth_fec_get_t fec_get; > + /**< Get Forward Error Correction(FEC) mode; */ > + eth_fec_set_t fec_set; > + /**< Set Forward Error Correction(FEC) mode; */ > }; >=20 > /** > diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev= /rte_ethdev_version.map > index 1212a17..33cf5e4 100644 > --- a/lib/librte_ethdev/rte_ethdev_version.map > +++ b/lib/librte_ethdev/rte_ethdev_version.map > @@ -241,6 +241,11 @@ EXPERIMENTAL { > __rte_ethdev_trace_rx_burst; > __rte_ethdev_trace_tx_burst; > rte_flow_get_aged_flows; > + > + # added in 20.11 > + rte_eth_fec_get_capability; > + rte_eth_fec_get; > + rte_eth_fec_set; > }; >=20 > INTERNAL { > -- > 2.7.4