From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DEC494412D; Sun, 2 Jun 2024 04:46:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3106B42DCE; Sun, 2 Jun 2024 04:45:48 +0200 (CEST) Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) by mails.dpdk.org (Postfix) with ESMTP id 089F4402D5 for ; Sun, 2 Jun 2024 04:45:46 +0200 (CEST) Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-43fdc18a89cso17953061cf.2 for ; Sat, 01 Jun 2024 19:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1717296344; x=1717901144; darn=dpdk.org; h=mime-version:references:in-reply-to:message-id:date:subject:to:from :from:to:cc:subject:date:message-id:reply-to; bh=UsW5NvBupYpqRMELJlWH4w3ACIkm30KkqlzNGE23vgU=; b=CySQs8IXDJ7Snp1FhBrWBRbDc12lpr7Djyi2dmD/yInX0a5eYXXLV/ONr46H9rxEI1 +iR3rHJGs8y1i1eC0YWY9WHewLIMvjUg2tg/rMmjOcbp9sso0Bn3H4jnIF7cK8YUoVpR kakFysKbO4y45+0S69lM527L+gHCnGgXwvpIY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717296344; x=1717901144; h=mime-version:references:in-reply-to:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UsW5NvBupYpqRMELJlWH4w3ACIkm30KkqlzNGE23vgU=; b=r4ENkBVchRvaWojzhvk1WE4niSt5D9/0o0ofD5N5plIXYGwWEMKovx/PS4y1y5tPXD T+whjUvWuWmZ/hHb0zqMC1sAMkRS4ZLxhcITG2+ujrnGbzYrHn0VhFPAunCr8em6VcIy EJw/SvJmnFFKXPBkvqnTeupV2RjMFnUyoLRWlnyX2EKf/VuoB+KJiiZ6WnApgfOHstrd vNVwEWh2jEyLFgx94vKpIAF456XyZDg/wAmJU2wbiMLq6E0zfCFosBF/XrcEM0WMBPoO XRazGhVrPfrVbCT4w9glRJmuL9xVQpljYZ85xsc3Q6MECqs9YoX/5Z8NTE6gapU7Q+MP hEgg== X-Gm-Message-State: AOJu0YxD03E2RLJVTsAI+U1CbUmqWEeSxXTbtS3zF9TurgFrw7+NIukh x1NW1BPieaUyj1WZ1em8Tm7cQ0kW+lYQ9fUa2mKq2ZetpVYBZU75Q9jvdxpKvKfs/a3ljl+Brut rP/LsTp9xHfO92MCpZKWV7fJbjDVeRNuM4wiYY7ZwiMWmgxCSQP+rHdXBerN70U7n6yLQzoEXr8 yQFdxwm8SCbrZ5FEVH/MIc9q7TltIhM2x3VTYDQA== X-Google-Smtp-Source: AGHT+IFAaEDBqQeCh2HQAybiqnHb9oRlpUnBpUDUWdmdEkOUhkh+bh7jjL9w5fgMXpwQAeTD3vUR3A== X-Received: by 2002:a05:622a:2a15:b0:43a:8877:e372 with SMTP id d75a77b69052e-43ff52b6947mr63886461cf.48.1717296344044; Sat, 01 Jun 2024 19:45:44 -0700 (PDT) Received: from dhcp-10-193-55-224.dhcp.broadcom.net ([192.19.224.250]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-43ff23e0de8sm24579281cf.40.2024.06.01.19.45.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 19:45:43 -0700 (PDT) From: Damodharam Ammepalli To: dev@dpdk.org Subject: [PATCH v2 3/4] lib/ethdev: add support for displaying lanes capability Date: Sat, 1 Jun 2024 19:45:03 -0700 Message-Id: <20240602024504.179506-4-damodharam.ammepalli@broadcom.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240602024504.179506-1-damodharam.ammepalli@broadcom.com> References: <20240602024504.179506-1-damodharam.ammepalli@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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> Signed-off-by: Damodharam Ammepalli --- 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); + /** * @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; + 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) +/**@}*/ + /**@{@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. + * + * @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 + */ +__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 { -- 2.39.3 -- This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.