DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@amd.com>
To: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>, dev@dpdk.org
Cc: Dengdui Huang <huangdengdui@huawei.com>
Subject: Re: [PATCH v2 3/4] lib/ethdev: add support for displaying lanes capability
Date: Wed, 12 Jun 2024 00:39:19 +0100	[thread overview]
Message-ID: <b86cf843-7018-4260-8c96-ee59ae08a500@amd.com> (raw)
In-Reply-To: <20240602024504.179506-4-damodharam.ammepalli@broadcom.com>

On 6/2/2024 3:45 AM, Damodharam Ammepalli wrote:
> Add new rte_lib callback to display ethernet controller's
> supporting speeds and bitmap of supported lanes per speed.
> 
> The new command display looks like this.
> 
> testpmd> show port 0 speed_lanes capabilities
> 
>  Supported speeds         Valid lanes
> -----------------------------------
>  10 Gbps                  1
>  25 Gbps                  1
>  40 Gbps                  4
>  50 Gbps                  1 2
>  100 Gbps                 1 2 4
>  200 Gbps                 2 4
>  400 Gbps                 4 8
> testpmd>
> 

Can you please merge this patch with first one, no need to have
capability API its own patch


Also testpmd patch to get above output is not added yet, please merge
testpmd patch and ethdev patch together. Same for others.

> Signed-off-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
> ---
>  lib/ethdev/ethdev_driver.h | 21 +++++++++++++++++++++
>  lib/ethdev/rte_ethdev.c    | 13 +++++++++++++
>  lib/ethdev/rte_ethdev.h    | 32 ++++++++++++++++++++++++++++++++
>  lib/ethdev/version.map     |  1 +
>  4 files changed, 67 insertions(+)
> 
> diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
> index b1f473e4de..5951986cec 100644
> --- a/lib/ethdev/ethdev_driver.h
> +++ b/lib/ethdev/ethdev_driver.h
> @@ -1224,6 +1224,26 @@ typedef int (*eth_speed_lanes_get_t)(struct rte_eth_dev *dev,
>   */
>  typedef int (*eth_speed_lanes_set_t)(struct rte_eth_dev *dev, uint32_t speed_lanes_capa);
>  
> +/**
> + * @internal
> + * Get speed vs number of lanes supported bitmap that controller supports
> + *
> + * @param dev
> + *   ethdev handle of port.
> + * @param speed_lanes_capa
> + *   int array of size max speeds bitmap ie 17
> + * @return
> + *   Negative errno value on error, 0 on success.
> + *
> + * @retval 0
> + *   Success, driver updates the speed_lanes_capa bitmap.
> + * @retval -ENOTSUP
> + *   Operation is not supported.
> + * @retval -EIO
> + *   Device is removed.
> + */
> +typedef int (*eth_speed_lanes_get_capa_t)(struct rte_eth_dev *dev, uint32_t *speed_lanes_bmap);
> +
>

'speed_lanes_bmap' is an array of bitmaps, and each element in array for
a specific speed, but speed is not explicit, it is found by index
defined by 'RTE_ETH_LINK_SPEED_XXX'.
Instead, for more explicit information, can you please check "struct
rte_eth_fec_capa" and 'rte_eth_fec_get_capability()' API?
Also using same logic helps on consistency.


>  /**
>   * @internal
>   * Dump Tx descriptor info to a file.
> @@ -1523,6 +1543,7 @@ struct eth_dev_ops {
>  	eth_speed_lanes_get_t speed_lanes_get;
>  	/** Set number of speed lanes */
>  	eth_speed_lanes_set_t speed_lanes_set;
> +	eth_speed_lanes_get_capa_t speed_lanes_get_capa;
>  };
>  
>  /**
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index 45e2f7645b..1ac5174d62 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -7021,6 +7021,19 @@ rte_eth_speed_lanes_get(uint16_t port_id, struct rte_eth_speed_lanes_capa *capa)
>  	return eth_err(port_id, (*dev->dev_ops->speed_lanes_get)(dev, capa));
>  }
>  
> +int
> +rte_eth_speed_lanes_get_capa(uint16_t port_id, uint32_t *speed_lanes_bmap)
> +{
> +        struct rte_eth_dev *dev;
> +
> +        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> +        dev = &rte_eth_devices[port_id];
> +
> +        if (*dev->dev_ops->speed_lanes_get == NULL)
> +                return -ENOTSUP;
>

Should we verify if 'speed_lanes_bmap' parameter is NULL in the API?

> +        return eth_err(port_id, (*dev->dev_ops->speed_lanes_get_capa)(dev, speed_lanes_bmap));
> +}
> +
>  int
>  rte_eth_speed_lanes_set(uint16_t port_id, uint32_t speed_lanes_capa)
>  {
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index caae1f27c6..b8a29416b6 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -308,6 +308,16 @@ struct rte_eth_stats {
>  #define RTE_ETH_LINK_SPEED_400G    RTE_BIT32(16) /**< 400 Gbps */
>  /**@}*/
>  
> +/**@{@name Link speed lane capabilities
> + * Device supported speeds lane bitmap flags
> + */
> +#define RTE_ETH_LINK_SPEED_MAX_BIT	17 /**< RTE_ETH_LINK_SPEED_400G bit position + 1 */
> +#define LANE_1	RTE_BIT32(1)
> +#define LANE_2 	RTE_BIT32(2)
> +#define LANE_4 	RTE_BIT32(4)
> +#define LANE_8 	RTE_BIT32(8)
>

If capability get updated similarly to FEC one, above defines are not
needed.


> +/**@}*/
> +
>  /**@{@name Link speed
>   * Ethernet numeric link speeds in Mbps
>   */
> @@ -6969,6 +6979,28 @@ int rte_eth_speed_lanes_get(uint16_t port_id, struct rte_eth_speed_lanes_capa *c
>  __rte_experimental
>  int rte_eth_speed_lanes_set(uint16_t port_id, uint32_t speed_lanes_capa);
>  
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * Set speed lanes supported by the NIC.
>

Set??

> + *
> + * @param port_id
> + *   The port identifier of the Ethernet device.
> + * @param speed_lanes_bmap
> + *   speed_lanes_bmap int array updated by driver by valid lanes bmap.
> + *
> + * @return
> + *  - (>=0) valid input and supported by driver or hardware.
> + *   - (-ENOTSUP) if underlying hardware OR driver doesn't support.
> + *     that operation.
> + *   - (-EIO) if device is removed.
> + *   - (-ENODEV)  if *port_id* invalid.
> + *   - (-EINVAL)  if *speed_lanes* invalid
>

'speed_lanes_bmap'


> + */
> +__rte_experimental
> +int rte_eth_speed_lanes_get_capa(uint16_t port_id, uint32_t *speed_lanes_bmap);
> +
>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
> index 9c27980f3a..c453494b8d 100644
> --- a/lib/ethdev/version.map
> +++ b/lib/ethdev/version.map
> @@ -327,6 +327,7 @@ EXPERIMENTAL {
>  	rte_flow_template_table_resize_complete;
>  	rte_eth_speed_lanes_get;
>  	rte_eth_speed_lanes_set;
> +	rte_eth_speed_lanes_get_capa;
>  };
>  
>  INTERNAL {


  reply	other threads:[~2024-06-11 23:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22 22:25 [RFC 0/2] Add support for link speed lanes Damodharam Ammepalli
2024-03-22 22:25 ` [RFC 1/2] lib/ethdev: Add link_speed lanes support into rte lib Damodharam Ammepalli
2024-03-22 22:25 ` [RFC 2/2] testpmd: Add speed lanes to testpmd config and show command Damodharam Ammepalli
2024-05-22 20:59 ` [RFC 0/2] Add support for link speed lanes Ferruh Yigit
2024-05-28 21:19   ` Damodharam Ammepalli
2024-06-02  2:45     ` [PATCH v2 0/4] " Damodharam Ammepalli
2024-06-02  2:45       ` [PATCH v2 1/4] lib/ethdev: Add link_speed lanes support into rte lib Damodharam Ammepalli
2024-06-11 23:39         ` Ferruh Yigit
2024-06-14 18:27           ` Damodharam Ammepalli
2024-06-17 20:34             ` [PATCH v3] ethdev: Add link_speed lanes support Damodharam Ammepalli
2024-06-02  2:45       ` [PATCH v2 2/4] testpmd: Add speed lanes to testpmd config and show command Damodharam Ammepalli
2024-06-11 23:39         ` Ferruh Yigit
2024-06-02  2:45       ` [PATCH v2 3/4] lib/ethdev: add support for displaying lanes capability Damodharam Ammepalli
2024-06-11 23:39         ` Ferruh Yigit [this message]
2024-06-02  2:45       ` [PATCH v2 4/4] testpmd: " Damodharam Ammepalli
2024-06-11 23:39         ` Ferruh Yigit
2024-06-12 17:53           ` Damodharam Ammepalli
2024-06-12 20:57             ` Ferruh Yigit
2024-06-11 23:38       ` [PATCH v2 0/4] Add support for link speed lanes Ferruh Yigit
2024-06-12 17:46         ` Damodharam Ammepalli

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=b86cf843-7018-4260-8c96-ee59ae08a500@amd.com \
    --to=ferruh.yigit@amd.com \
    --cc=damodharam.ammepalli@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=huangdengdui@huawei.com \
    /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).