DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, Stephen Hurd <stephen.hurd@broadcom.com>
Subject: [dpdk-dev] [PATCH v2 6/9] net/bnxt: fix get link config
Date: Fri, 30 Jun 2017 09:20:18 -0500	[thread overview]
Message-ID: <20170630142021.50855-7-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20170630142021.50855-1-ajit.khaparde@broadcom.com>

This patch fixes the get link configuration code.
bnxt_get_hwrm_link_config was using wrong macros and wrongly
deriving link speed based on link status which was causing
incorrect link information to be displayed in few scenarios.

Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: split the patch into relevant patches based on code review
---
 drivers/net/bnxt/bnxt_hwrm.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 3d2d408..9b00b60 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -686,13 +686,10 @@ static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp,
 	HWRM_CHECK_RESULT;
 
 	link_info->phy_link_status = resp->link;
-	if (link_info->phy_link_status == HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK) {
-		link_info->link_up = 1;
-		link_info->link_speed = rte_le_to_cpu_16(resp->link_speed);
-	} else {
-		link_info->link_up = 0;
-		link_info->link_speed = 0;
-	}
+	link_info->link_up =
+		(link_info->phy_link_status ==
+		 HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK) ? 1 : 0;
+	link_info->link_speed = rte_le_to_cpu_16(resp->link_speed);
 	link_info->duplex = resp->duplex;
 	link_info->pause = resp->pause;
 	link_info->auto_pause = resp->auto_pause;
@@ -1887,7 +1884,7 @@ int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link)
 			"Get link config failed with rc %d\n", rc);
 		goto exit;
 	}
-	if (link_info->link_up)
+	if (link_info->link_speed)
 		link->link_speed =
 			bnxt_parse_hw_link_speed(link_info->link_speed);
 	else
@@ -1896,7 +1893,7 @@ int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link)
 	link->link_status = link_info->link_up;
 	link->link_autoneg = link_info->auto_mode ==
 		HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE ?
-		ETH_LINK_SPEED_FIXED : ETH_LINK_SPEED_AUTONEG;
+		ETH_LINK_FIXED : ETH_LINK_AUTONEG;
 exit:
 	return rc;
 }
-- 
2.10.1 (Apple Git-78)

  parent reply	other threads:[~2017-06-30 14:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29  2:51 [dpdk-dev] [PATCH 0/7] bnxt patch series Ajit Khaparde
2017-06-29  2:51 ` [dpdk-dev] [PATCH 1/7] net/bnxt: add support for Stratus VF device Ajit Khaparde
2017-06-29  2:51 ` [dpdk-dev] [PATCH 2/7] net/bnxt: fix mtu configuration for the function Ajit Khaparde
2017-06-29 10:55   ` Ferruh Yigit
2017-06-30  2:27     ` Ajit Khaparde
2017-06-29  2:51 ` [dpdk-dev] [PATCH 3/7] net/bnxt: fix calculation of VNICs Ajit Khaparde
2017-06-29  2:51 ` [dpdk-dev] [PATCH 4/7] net/bnxt: pass func_default flag to VNIC_ALLOC Ajit Khaparde
2017-06-29  2:51 ` [dpdk-dev] [PATCH 5/7] net/bnxt: fix automatic clearing of VF stats Ajit Khaparde
2017-06-29 10:53   ` Ferruh Yigit
2017-06-29  2:51 ` [dpdk-dev] [PATCH 6/7] net/bnxt: fix some link related issues Ajit Khaparde
2017-06-29 10:55   ` Ferruh Yigit
2017-06-30  2:27     ` Ajit Khaparde
2017-06-30 14:20     ` [dpdk-dev] [PATCH v2 0/9] bnxt patch series Ajit Khaparde
2017-06-30 14:20       ` [dpdk-dev] [PATCH v2 1/9] net/bnxt: add support for Stratus VF device Ajit Khaparde
2017-06-30 14:20       ` [dpdk-dev] [PATCH v2 2/9] net/bnxt: fix mtu configuration for the function Ajit Khaparde
2017-06-30 14:20       ` [dpdk-dev] [PATCH v2 3/9] net/bnxt: fix calculation of VNICs Ajit Khaparde
2017-06-30 14:20       ` [dpdk-dev] [PATCH v2 4/9] net/bnxt: pass func_default flag to VNIC_ALLOC Ajit Khaparde
2017-06-30 14:20       ` [dpdk-dev] [PATCH v2 5/9] net/bnxt: fix automatic clearing of VF stats Ajit Khaparde
2017-06-30 14:20       ` Ajit Khaparde [this message]
2017-06-30 14:20       ` [dpdk-dev] [PATCH v2 7/9] net/bnxt: fix autoneg on 10GBase-T links Ajit Khaparde
2017-06-30 14:20       ` [dpdk-dev] [PATCH v2 8/9] net/bnxt: fix set link config Ajit Khaparde
2017-06-30 14:20       ` [dpdk-dev] [PATCH v2 9/9] net/bnxt: fix copy/pasted error message Ajit Khaparde
2017-07-03  9:40       ` [dpdk-dev] [PATCH v2 0/9] bnxt patch series Ferruh Yigit
2017-06-29  2:51 ` [dpdk-dev] [PATCH 7/7] net/bnxt: fix copy/pasted error message Ajit Khaparde
2017-06-29 10:56   ` 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=20170630142021.50855-7-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=stephen.hurd@broadcom.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).