DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rasesh Mody <Rasesh.Mody@cavium.com>
To: <thomas.monjalon@6wind.com>
Cc: dev@dpdk.org, Dept-EngDPDKDev@qlogic.com
Subject: [dpdk-dev] [PATCH v2] net/qede: fix advertising link speed capability
Date: Fri, 28 Oct 2016 23:14:37 -0700	[thread overview]
Message-ID: <1477721677-25668-1-git-send-email-Rasesh.Mody@cavium.com> (raw)
In-Reply-To: <9851708.0H4Kn83q5Z@xps13>

From: Harish Patil <harish.patil@qlogic.com>

Fix to advertise device's link speed capability based on NVM
port configuration instead of returning driver supported speeds.

Fixes: 95e67b479506 ("net/qede: add 100G link speed capability")

Signed-off-by: Harish Patil <harish.patil@qlogic.com>
---
 drivers/net/qede/qede_ethdev.c |  6 ++++--
 drivers/net/qede/qede_ethdev.h |  1 +
 drivers/net/qede/qede_if.h     |  1 +
 drivers/net/qede/qede_main.c   | 24 ++++++++++++++++++++++++
 4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index b91b478..59129f2 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -646,6 +646,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
 {
 	struct qede_dev *qdev = eth_dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
+	struct qed_link_output link;

 	PMD_INIT_FUNC_TRACE(edev);

@@ -678,8 +679,9 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
 				     DEV_TX_OFFLOAD_UDP_CKSUM |
 				     DEV_TX_OFFLOAD_TCP_CKSUM);

-	dev_info->speed_capa = ETH_LINK_SPEED_25G | ETH_LINK_SPEED_40G |
-			       ETH_LINK_SPEED_100G;
+	memset(&link, 0, sizeof(struct qed_link_output));
+	qdev->ops->common->get_link(edev, &link);
+	dev_info->speed_capa = rte_eth_speed_bitflag(link.adv_speed, 0);
 }

 /* return 0 means link status changed, -1 means not changed */
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index 5eb3f52..a97e3d9 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -30,6 +30,7 @@
 #include "base/ecore_dev_api.h"
 #include "base/ecore_iov_api.h"
 #include "base/ecore_cxt.h"
+#include "base/nvm_cfg.h"

 #include "qede_logs.h"
 #include "qede_if.h"
diff --git a/drivers/net/qede/qede_if.h b/drivers/net/qede/qede_if.h
index 2d38b1b..4936349 100644
--- a/drivers/net/qede/qede_if.h
+++ b/drivers/net/qede/qede_if.h
@@ -70,6 +70,7 @@ struct qed_link_output {
 	uint32_t advertised_caps;	/* In ADVERTISED defs */
 	uint32_t lp_caps;	/* In ADVERTISED defs */
 	uint32_t speed;		/* In Mb/s */
+	uint32_t adv_speed;	/* In Mb/s */
 	uint8_t duplex;		/* In DUPLEX defs */
 	uint8_t port;		/* In PORT defs */
 	bool autoneg;
diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index 2d354e1..e6501d0 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -488,6 +488,7 @@ static void qed_fill_link(struct ecore_hwfn *hwfn,
 	struct ecore_mcp_link_state link;
 	struct ecore_mcp_link_capabilities link_caps;
 	uint32_t media_type;
+	uint32_t adv_speed;
 	uint8_t change = 0;

 	memset(if_link, 0, sizeof(*if_link));
@@ -514,6 +515,29 @@ static void qed_fill_link(struct ecore_hwfn *hwfn,
 		if_link->speed = link.speed;

 	if_link->duplex = QEDE_DUPLEX_FULL;
+
+	/* Fill up the native advertised speed */
+	switch (params.speed.advertised_speeds) {
+		case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_10G:
+			adv_speed = 10000;
+			break;
+		case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_25G:
+			adv_speed = 25000;
+			break;
+		case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_40G:
+			adv_speed = 40000;
+			break;
+		case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_50G:
+			adv_speed = 50000;
+			break;
+		case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_BB_100G:
+			adv_speed = 100000;
+			break;
+		default:
+			DP_NOTICE(hwfn, false, "Unknown speed\n");
+			adv_speed = 0;
+	}
+	if_link->adv_speed = adv_speed;

 	if (params.speed.autoneg)
 		if_link->supported_caps |= QEDE_SUPPORTED_AUTONEG;
--
1.8.3.1

  parent reply	other threads:[~2016-10-29  6:14 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19  4:11 [dpdk-dev] [PATCH v4 00/32] net/qede: update qede pmd to 1.2.0.1 and enable by default Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 01/32] net/qede/base: add new init files and rearrange the code Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 02/32] net/qede/base: formatting changes Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 03/32] net/qede: use FW CONFIG defines as needed Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 04/32] net/qede/base: add HSI changes and register defines Rasesh Mody
2016-10-19 12:37   ` Ferruh Yigit
2016-10-19 13:46     ` Mody, Rasesh
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 05/32] net/qede/base: add attention formatting string Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 06/32] net/qede/base: additional formatting/comment changes Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 07/32] net/qede: fix 32 bit compilation Rasesh Mody
2016-10-26 16:54   ` Thomas Monjalon
2016-10-26 21:01     ` Mody, Rasesh
2016-10-26 21:40       ` Thomas Monjalon
2016-10-28  6:37         ` [dpdk-dev] [PATCH] net/qede: fix gcc compiler option checks Rasesh Mody
2016-10-28 22:12           ` Stephen Hemminger
2016-10-28 22:49             ` Mody, Rasesh
2016-11-07 19:54               ` Thomas Monjalon
2016-11-07 20:10           ` Thomas Monjalon
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 08/32] net/qede: change signature of MCP command API Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 09/32] net/qede: serialize access to MFW mbox Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 10/32] net/qede: add NIC selftest and query sensor info support Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 11/32] net/qede/base: update base driver Rasesh Mody
2021-03-24 14:07   ` Ferruh Yigit
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 12/32] net/qede/base: rename structure and defines Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 13/32] net/qede/base: comment enhancements Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 14/32] net/qede/base: add MFW crash dump support Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 15/32] net/qede: enable support for unequal number of Rx/Tx queues Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 16/32] net/qede: fix port (re)configuration issue Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 17/32] net/qede/base: allow MTU change via vport-update Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 18/32] net/qede: add missing 100G link speed capability Rasesh Mody
2016-10-26 15:41   ` Thomas Monjalon
2016-10-26 15:54     ` Bruce Richardson
2016-10-26 21:28     ` Harish Patil
2016-10-26 21:43       ` Thomas Monjalon
2016-10-28  6:42         ` [dpdk-dev] [PATCH] net/qede: fix advertising " Rasesh Mody
2016-10-28  7:26           ` Thomas Monjalon
2016-10-29  1:11             ` Harish Patil
2016-10-29  6:14             ` Rasesh Mody [this message]
2016-10-31 18:35               ` [dpdk-dev] [PATCH v3] " Rasesh Mody
2016-10-31 18:35                 ` Rasesh Mody
2016-11-07 19:48                   ` Thomas Monjalon
2016-11-10  2:54                     ` Harish Patil
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 19/32] net/qede: remove unused/dead code Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 20/32] net/qede: fixes for VLAN filters Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 21/32] net/qede: add enable/disable VLAN filtering Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 22/32] net/qede: fix RSS related issues Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 23/32] net/qede: add scatter gather support Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 24/32] net/qede/base: change Rx Tx queue start APIs Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 25/32] net/qede/base: add support to initiate PF FLR Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 26/32] net/qede: skip slowpath polling for 100G VF device Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 27/32] net/qede: fix driver version string Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 28/32] net/qede: fix status block index for VF queues Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 29/32] net/qede: add support for queue statistics Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 30/32] net/qede: remove zlib dependency and enable PMD by default Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 31/32] doc: update qede pmd documentation Rasesh Mody
2016-10-19  4:11 ` [dpdk-dev] [PATCH v4 32/32] net/qede: update driver version Rasesh Mody
2016-10-24 13:41 ` [dpdk-dev] [PATCH v4 00/32] net/qede: update qede pmd to 1.2.0.1 and enable by default Bruce Richardson
2016-10-26 15:20   ` Thomas Monjalon
2016-10-26 17:01     ` Mody, Rasesh

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=1477721677-25668-1-git-send-email-Rasesh.Mody@cavium.com \
    --to=rasesh.mody@cavium.com \
    --cc=Dept-EngDPDKDev@qlogic.com \
    --cc=dev@dpdk.org \
    --cc=thomas.monjalon@6wind.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).