DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: Andrew Rybchenko <arybchenko@solarflare.com>, <dev@dpdk.org>
Cc: <konstantin.ananyev@intel.com>, <thomas@monjalon.net>,
	<ferruh.yigit@intel.com>, <linuxarm@huawei.com>
Subject: Re: [dpdk-dev] [PATCH V9 1/3] ethdev: introduce FEC API
Date: Tue, 22 Sep 2020 12:58:54 +0800	[thread overview]
Message-ID: <fcd5718a-bdec-6027-76de-545d01d53fdc@huawei.com> (raw)
In-Reply-To: <c2654fcf-8ce9-e480-2f18-e6daea200350@solarflare.com>



在 2020/9/21 21:39, Andrew Rybchenko 写道:
> On 9/21/20 9:13 AM, Min Hu (Connor) wrote:
>> This patch adds Forward error correction(FEC) support for ethdev.
>> Introduce APIs which support query and config FEC information in
>> hardware.
>>
>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>> Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>> Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
>> Reviewed-by: Chengchang Tang <tangchengchang@huawei.com>
>> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
>> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 
> [snip]
> 
>> diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
>> index 70295d7..7d5e81b 100644
>> --- a/lib/librte_ethdev/rte_ethdev.h
>> +++ b/lib/librte_ethdev/rte_ethdev.h
>> @@ -1310,6 +1310,9 @@ struct rte_eth_conf {
>>   #define RTE_ETH_DEV_FALLBACK_RX_NBQUEUES 1
>>   #define RTE_ETH_DEV_FALLBACK_TX_NBQUEUES 1
>>   
>> +/* Translate from FEC mode to FEC capa */
>> +#define RTE_ETH_FEC_MODE_TO_CAPA(x)	(1U << (x))
>> +
> 
> It should not be so far from rte_eth_fec_mode. Please, add just
> after it.
I will fix it in V10, thanks.
> 
> May be it should be:
> #define RTE_ETH_FEC_MODE_TO_CAPA(x) (1U << (RTE_ETH_FEC_ ## x))
> 
This will be weird, as "x" should be one fec mode。examples
as follows:

rte_eth_fec_set(uint16_t port_id, enum rte_eth_fec_mode mode)
{
	struct rte_eth_dev *dev;
	uint32_t fec_mode_mask;
	int ret;

	ret = rte_eth_fec_get_capability(port_id, &fec_mode_mask);
	if (ret != 0)
		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 & RTE_ETH_FEC_MODE_TO_CAPA(mode))) {
		RTE_ETHDEV_LOG(ERR, "unsupported FEC mode = %d, port_id = %u\n",
			       mode, port_id);
		return -EINVAL;
	}
[snip]
>>   /**
>>    * Preferred Rx/Tx port parameters.
>>    * There are separate instances of this structure for transmission
>> @@ -1511,6 +1514,24 @@ struct rte_eth_dcb_info {
>>   	struct rte_eth_dcb_tc_queue_mapping tc_queue;
>>   };
>>   
>> +/**
>> + * This enum indicates the possible (forward error correction)FEC modes
>> + * of an ethdev port.
>> + */
>> +enum rte_eth_fec_mode {
>> +	RTE_ETH_FEC_NOFEC = 0,      /**< FEC is off */
>> +	RTE_ETH_FEC_AUTO,	    /**< FEC autonegotiation modes */
>> +	RTE_ETH_FEC_BASER,          /**< FEC using common algorithm */
>> +	RTE_ETH_FEC_RS,             /**< FEC using RS algorithm */
>> +};
>> +
>> +/* This indicates FEC capabilities */
>> +#define RTE_ETH_FEC_CAPA_NOFEC  (1U << RTE_ETH_FEC_NOFEC)
>> +#define RTE_ETH_FEC_CAPA_AUTO   (1U << RTE_ETH_FEC_AUTO)
>> +#define RTE_ETH_FEC_CAPA_BASER  (1U << RTE_ETH_FEC_BASER)
>> +#define RTE_ETH_FEC_CAPA_RS     (1U << RTE_ETH_FEC_RS)
> 
> Shouldn't RTE_ETH_FEC_MODE_TO_CAPA be used as definition
> values?
> I will define a new macro as you suggest in V10, like this:
/* This macro indicates FEC capa mask*/
#define RTE_ETH_FEC_MODE_CAPA_MASK(x)	(1U << (RTE_ETH_FEC_ ## x))

that macro will replace the follow macros:
#define RTE_ETH_FEC_CAPA_NOFEC  (1U << RTE_ETH_FEC_NOFEC)
#define RTE_ETH_FEC_CAPA_AUTO   (1U << RTE_ETH_FEC_AUTO)
#define RTE_ETH_FEC_CAPA_BASER  (1U << RTE_ETH_FEC_BASER)
#define RTE_ETH_FEC_CAPA_RS     (1U << RTE_ETH_FEC_RS)

i.e.:
RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC)
RTE_ETH_FEC_MODE_CAPA_MASK(AUTO)
RTE_ETH_FEC_MODE_CAPA_MASK(BASER)
RTE_ETH_FEC_MODE_CAPA_MASK(RS)

thanks for your suggestions.

>> +
>> +
>>   #define RTE_ETH_ALL RTE_MAX_ETHPORTS
>>   
>>   /* Macros to check for valid port */
>> @@ -3328,6 +3349,70 @@ int  rte_eth_led_on(uint16_t port_id);
>>   int  rte_eth_led_off(uint16_t port_id);
>>   
>>   /**
>> + * @warning
>> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
>> + *
>> + * 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:
>> + *   RTE_ETH_FEC_CAPA_NOFEC
>> + *   RTE_ETH_FEC_CAPA_AUTO
>> + *   RTE_ETH_FEC_CAPA_BASER
>> + *   RTE_ETH_FEC_CAPA_RS
>> + * @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, uint32_t *fec_cap);
> 
> The API does not allow to report capabilities per link speed:
> which FEC mode is supported at which link speed?
> 
> What about something like:
> 
> struct rte_eth_fec_capa {
>    uint32_t speed; /**< Link speed (see ETH_SPEED_NUM_*) */
>    uint32_t capa;  /**< FEC capabilities bitmask (see RTE_FEC_CAPA_*) */
> };
> 
> __rte_experimental
> int rte_eth_fec_get_capability(uint16_t port_id, uint32_t *num, struct
> rte_eth_fec_capa *speed_capa);
> 
> where:
>   - num is in/out with a number of elements in an array
>   - speed_capa is out only with per-speed capabilities
> 
There is no need to report capabilities per link speed, because 
relastionship between the link speed and fec mode is fixed. The 
infomations can be referred to in official documents or internet.

A ethernet port may have various link speed in diffrent situations(for 
example, optical module with different speed is used). But we do not
care about capabilities per link speed. We only care about FEC capa of 
the ethernet device at a specific moment, because set FEC mode also 
depend on the current FEC capa.

By the way, we can also get link speed of the device by API 
"rte_eth_link_get" in the same time.

thanks.

>> +
>> +/**
>> + * @warning
>> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
>> + *
>> + * 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_eth_fec_mode *mode);
> 
> Please, specify what should be reported if link is down.
> E.g. if set to RS, but link is down.
> 
> Does AUTO make sense here?
> 
OK, I will add the information in the function header comment:
when link down,None AUTO mode(RS, BASER. NOFEC) keep as it is when link 
up, AUTO mode will change from rs,baser to nofec when quering the mode.


>> +
>> +/**
>> + * @warning
>> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
>> + *
>> + * 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_eth_fec_mode mode);
> 
> It does not allow to tweak autoneg facilities.
> E.g. "I know that RS is buggy, so I want to exclude it from
> auto-negotiation".
> So, I suggest to change mode to capa bitmask.
> If AUTO is set, other bits may be set and specify allowed
> options. E.g. AUTO|RS|BASER will require FEC, i.e. NOFEC is
The two FEC modes cannot be configured for hardware at the same time, 
including AUTO and other FEC modes. This is determined by Hardware itself.
Thanks.

> not allowed. If just RS, it means that auto-negotiation is
> disabled and RS must be used.
> If AUTO is unset, only one bit may be set in capabilities.
> Since we don't do it per speed, I think it is safe to ignore
> unsupported mode bits. I.e. do not return error if unsupported
> capa is requested to together with AUTO, however it could be
> a problem if no modes are allowed for negotiated link speed.
> Thoughts are welcome.
> 
>> +
>> +/**
>>    * Get current status of the Ethernet link flow control for Ethernet device
>>    *
>>    * @param port_id
> 
> [snip]
> 
> .
> 

  reply	other threads:[~2020-09-22  4:59 UTC|newest]

Thread overview: 118+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28 11:32 [dpdk-dev] [RFC] ethdev: add Forward Error Correction support Min Hu(Connor)
2020-08-30 12:43 ` Andrew Rybchenko
2020-09-08  3:05 ` [dpdk-dev] [PATCH 0/3] add FEC support Min Hu (Connor)
2020-09-08  3:05   ` [dpdk-dev] [PATCH 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-09  2:42     ` [dpdk-dev] [PATCH V2 0/3] add FEC support Min Hu (Connor)
2020-09-09  2:42       ` [dpdk-dev] [PATCH V2 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-09  2:43       ` [dpdk-dev] [PATCH V2 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-09  2:43       ` [dpdk-dev] [PATCH V2 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-08  3:05   ` [dpdk-dev] [PATCH 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-08  3:05   ` [dpdk-dev] [PATCH 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-10  7:24   ` [dpdk-dev] [PATCH V4 0/3] add FEC support Min Hu (Connor)
2020-09-10  7:24     ` [dpdk-dev] [PATCH V4 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-12  4:53       ` Ajit Khaparde
2020-09-16 14:10       ` Ananyev, Konstantin
2020-09-10  7:24     ` [dpdk-dev] [PATCH V4 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-10  7:24     ` [dpdk-dev] [PATCH V4 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-10 21:02     ` [dpdk-dev] [PATCH V4 0/3] add FEC support Ajit Khaparde
2020-09-11  8:39       ` humin (Connor)
2020-09-16 12:37     ` humin (Connor)
2020-09-17  8:23   ` [dpdk-dev] [V5 " Min Hu (Connor)
2020-09-17  8:23     ` [dpdk-dev] [V5 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-17  8:23     ` [dpdk-dev] [V5 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-17  8:23     ` [dpdk-dev] [V5 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-17  8:52   ` [dpdk-dev] [V5 0/3] add FEC support Min Hu (Connor)
2020-09-17  8:52     ` [dpdk-dev] [V5 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-17  9:58       ` Andrew Rybchenko
2020-09-18  9:28         ` Min Hu (Connor)
2020-09-19  8:42           ` Andrew Rybchenko
2020-09-19 12:06             ` Min Hu (Connor)
2020-09-17 12:49       ` Ananyev, Konstantin
2020-09-18  1:57         ` humin (Connor)
2020-09-18 10:46           ` Ananyev, Konstantin
2020-09-17  8:52     ` [dpdk-dev] [V5 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-17  8:52     ` [dpdk-dev] [V5 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-18  9:04   ` [dpdk-dev] [PATCH V6 0/3] add FEC support Min Hu (Connor)
2020-09-18  9:04     ` [dpdk-dev] [PATCH V6 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-18  9:04     ` [dpdk-dev] [PATCH V6 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-18  9:04     ` [dpdk-dev] [PATCH V6 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-18 11:48   ` [dpdk-dev] [PATCH V7 0/3] add FEC support Min Hu (Connor)
2020-09-18 11:48     ` [dpdk-dev] [PATCH V7 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-18 12:13       ` Ananyev, Konstantin
2020-09-18 18:10         ` Ajit Khaparde
2020-09-19  8:44           ` Andrew Rybchenko
2020-09-18 11:48     ` [dpdk-dev] [PATCH V7 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-18 11:48     ` [dpdk-dev] [PATCH V7 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-18 20:35       ` Ajit Khaparde
2020-09-21  2:59   ` [dpdk-dev] [PATCH V8 0/3] add FEC support Min Hu (Connor)
2020-09-21  2:59     ` [dpdk-dev] [PATCH V8 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-21  2:59     ` [dpdk-dev] [PATCH V8 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-21  2:59     ` [dpdk-dev] [PATCH V8 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-21  6:13   ` [dpdk-dev] [PATCH V9 0/3] add FEC support Min Hu (Connor)
2020-09-21  6:13     ` [dpdk-dev] [PATCH V9 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-21 13:39       ` Andrew Rybchenko
2020-09-22  4:58         ` Min Hu (Connor) [this message]
2020-09-22  8:02           ` Andrew Rybchenko
2020-09-22 11:06             ` Min Hu (Connor)
2020-09-22 12:18               ` Andrew Rybchenko
2020-09-24 11:07                 ` Min Hu (Connor)
2020-09-21  6:13     ` [dpdk-dev] [PATCH V9 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-21  6:13     ` [dpdk-dev] [PATCH V9 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-22  7:26   ` [dpdk-dev] [PATCH V10 0/3] add FEC support Min Hu (Connor)
2020-09-22  7:26     ` [dpdk-dev] [PATCH V10 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-22  7:26     ` [dpdk-dev] [PATCH V10 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-22  7:26     ` [dpdk-dev] [PATCH V10 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-24 11:01   ` [dpdk-dev] [PATCH V11 0/4] add FEC support Min Hu (Connor)
2020-09-24 11:01     ` [dpdk-dev] [PATCH V11 1/4] ethdev: introduce FEC API Min Hu (Connor)
2020-09-24 11:01     ` [dpdk-dev] [PATCH V11 2/4] net/hns3: support FEC Min Hu (Connor)
2020-09-24 11:01     ` [dpdk-dev] [PATCH V11 3/4] app/testpmd: add FEC command Min Hu (Connor)
2020-09-24 11:01     ` [dpdk-dev] [PATCH V11 4/4] doc: add FEC API and PMD information Min Hu (Connor)
2020-09-24 13:05   ` [dpdk-dev] [PATCH V12 0/4] add FEC support Min Hu (Connor)
2020-09-24 13:05     ` [dpdk-dev] [PATCH V12 1/4] ethdev: introduce FEC API Min Hu (Connor)
2020-09-24 14:46       ` Andrew Rybchenko
2020-09-25  8:47         ` Min Hu (Connor)
2020-09-25 15:36           ` Ajit Khaparde
2020-09-25 16:12             ` Stephen Hemminger
2020-09-25 16:38               ` Ferruh Yigit
2020-09-24 13:05     ` [dpdk-dev] [PATCH V12 2/4] net/hns3: support FEC Min Hu (Connor)
2020-09-24 13:05     ` [dpdk-dev] [PATCH V12 3/4] app/testpmd: add FEC command Min Hu (Connor)
2020-09-24 13:05     ` [dpdk-dev] [PATCH V12 4/4] doc: add FEC API and PMD information Min Hu (Connor)
2020-09-24 13:52       ` Andrew Rybchenko
2020-09-25  8:39   ` [dpdk-dev] [PATCH V13 0/3] add FEC support Min Hu (Connor)
2020-09-25  8:39     ` [dpdk-dev] [PATCH V13 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-28  7:35       ` Andrew Rybchenko
2020-09-28 11:13         ` Min Hu (Connor)
2020-09-25  8:39     ` [dpdk-dev] [PATCH V13 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-25  8:39     ` [dpdk-dev] [PATCH V13 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-27  7:08     ` [dpdk-dev] [PATCH V13 0/3] add FEC support Min Hu (Connor)
2020-09-28 10:27       ` Ferruh Yigit
2020-09-28 11:11         ` Min Hu (Connor)
2020-09-28 11:08   ` [dpdk-dev] [PATCH V14 " Min Hu (Connor)
2020-09-28 11:08     ` [dpdk-dev] [PATCH V14 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-28 12:48       ` Andrew Rybchenko
2020-09-29  2:09         ` Min Hu (Connor)
2020-09-28 11:08     ` [dpdk-dev] [PATCH V14 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-28 11:08     ` [dpdk-dev] [PATCH V14 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-29  1:03   ` [dpdk-dev] [PATCH V15 0/3] add FEC support Min Hu (Connor)
2020-09-29  1:03     ` [dpdk-dev] [PATCH V15 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-29  4:18       ` Ajit Khaparde
2020-09-29  8:44         ` Min Hu (Connor)
2020-09-30  2:45           ` Min Hu (Connor)
2020-09-30  8:15           ` Thomas Monjalon
2020-09-30  9:45       ` Andrew Rybchenko
2020-09-29  1:03     ` [dpdk-dev] [PATCH V15 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-29  1:03     ` [dpdk-dev] [PATCH V15 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-30 16:52       ` Ferruh Yigit
2020-10-07  0:15         ` humin (Q)
2020-10-07  9:28         ` Ferruh Yigit
2020-10-07 23:38           ` humin (Q)
2020-10-08 10:06           ` Min Hu (Connor)
2020-10-08 10:02   ` [dpdk-dev] [PATCH V16 0/3] add FEC support Min Hu (Connor)
2020-10-08 10:02     ` [dpdk-dev] [PATCH V16 1/3] ethdev: introduce FEC API Min Hu (Connor)
2021-01-15 14:07       ` Ferruh Yigit
2021-01-16  2:03         ` Min Hu (Connor)
2020-10-08 10:02     ` [dpdk-dev] [PATCH V16 2/3] net/hns3: support FEC Min Hu (Connor)
2020-10-08 10:02     ` [dpdk-dev] [PATCH V16 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-10-08 15:57       ` Ferruh Yigit
2020-10-09  3:48         ` Min Hu (Connor)
2020-10-08 16:28     ` [dpdk-dev] [PATCH V16 0/3] add FEC support Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fcd5718a-bdec-6027-76de-545d01d53fdc@huawei.com \
    --to=humin29@huawei.com \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=linuxarm@huawei.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).