DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] bugfix for link for hns3 PMD
@ 2021-04-25 12:06 Min Hu (Connor)
  2021-04-25 12:06 ` [dpdk-dev] [PATCH 1/2] net/hns3: fix link status when port is stopped Min Hu (Connor)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Min Hu (Connor) @ 2021-04-25 12:06 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

This patch set contains two bugfixes for hns3 PMD.

Huisong Li (2):
  net/hns3: fix link status when port is stopped
  net/hns3: fix link speed when port is down

 drivers/net/hns3/hns3_ethdev.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH 1/2] net/hns3: fix link status when port is stopped
  2021-04-25 12:06 [dpdk-dev] [PATCH 0/2] bugfix for link for hns3 PMD Min Hu (Connor)
@ 2021-04-25 12:06 ` Min Hu (Connor)
  2021-04-25 12:06 ` [dpdk-dev] [PATCH 2/2] net/hns3: fix link speed when port is down Min Hu (Connor)
  2021-04-29 12:55 ` [dpdk-dev] [PATCH 0/2] bugfix for link for hns3 PMD Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Min Hu (Connor) @ 2021-04-25 12:06 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Huisong Li <lihuisong@huawei.com>

When port is stopped, link down should be reported to user. For HNS3
PF driver, link status comes from link status of hardware. If the port
supports NCSI feature, hardware MAC will not be disabled. At this case,
even if the port is stopped, the link status is still Up. So driver
should set link down when the port is stopped.

Fixes: 59fad0f32135 ("net/hns3: support link update operation")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 60267e1..1496bb0 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2894,6 +2894,15 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)
 	struct rte_eth_link new_link;
 	int ret;
 
+	/* When port is stopped, report link down. */
+	if (eth_dev->data->dev_started == 0) {
+		new_link.link_autoneg = mac->link_autoneg;
+		new_link.link_duplex = mac->link_duplex;
+		new_link.link_speed = ETH_SPEED_NUM_NONE;
+		new_link.link_status = ETH_LINK_DOWN;
+		goto out;
+	}
+
 	do {
 		ret = hns3_update_port_link_info(eth_dev);
 		if (ret) {
@@ -2911,6 +2920,7 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)
 	memset(&new_link, 0, sizeof(new_link));
 	hns3_setup_linkstatus(eth_dev, &new_link);
 
+out:
 	return rte_eth_linkstatus_set(eth_dev, &new_link);
 }
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH 2/2] net/hns3: fix link speed when port is down
  2021-04-25 12:06 [dpdk-dev] [PATCH 0/2] bugfix for link for hns3 PMD Min Hu (Connor)
  2021-04-25 12:06 ` [dpdk-dev] [PATCH 1/2] net/hns3: fix link status when port is stopped Min Hu (Connor)
@ 2021-04-25 12:06 ` Min Hu (Connor)
  2021-04-29 12:55 ` [dpdk-dev] [PATCH 0/2] bugfix for link for hns3 PMD Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Min Hu (Connor) @ 2021-04-25 12:06 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Huisong Li <lihuisong@huawei.com>

When the port is link down state, it is meaningless to display the
port link speed. It should be an undefined state.

Fixes: 59fad0f32135 ("net/hns3: support link update operation")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 1496bb0..5f7b4ab 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2867,16 +2867,18 @@ hns3_setup_linkstatus(struct rte_eth_dev *eth_dev,
 	case ETH_SPEED_NUM_50G:
 	case ETH_SPEED_NUM_100G:
 	case ETH_SPEED_NUM_200G:
-		new_link->link_speed = mac->link_speed;
+		if (mac->link_status)
+			new_link->link_speed = mac->link_speed;
 		break;
 	default:
 		if (mac->link_status)
 			new_link->link_speed = ETH_SPEED_NUM_UNKNOWN;
-		else
-			new_link->link_speed = ETH_SPEED_NUM_NONE;
 		break;
 	}
 
+	if (!mac->link_status)
+		new_link->link_speed = ETH_SPEED_NUM_NONE;
+
 	new_link->link_duplex = mac->link_duplex;
 	new_link->link_status = mac->link_status ? ETH_LINK_UP : ETH_LINK_DOWN;
 	new_link->link_autoneg = mac->link_autoneg;
-- 
2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH 0/2] bugfix for link for hns3 PMD
  2021-04-25 12:06 [dpdk-dev] [PATCH 0/2] bugfix for link for hns3 PMD Min Hu (Connor)
  2021-04-25 12:06 ` [dpdk-dev] [PATCH 1/2] net/hns3: fix link status when port is stopped Min Hu (Connor)
  2021-04-25 12:06 ` [dpdk-dev] [PATCH 2/2] net/hns3: fix link speed when port is down Min Hu (Connor)
@ 2021-04-29 12:55 ` Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2021-04-29 12:55 UTC (permalink / raw)
  To: Min Hu (Connor), dev

On 4/25/2021 1:06 PM, Min Hu (Connor) wrote:
> This patch set contains two bugfixes for hns3 PMD.
> 
> Huisong Li (2):
>   net/hns3: fix link status when port is stopped
>   net/hns3: fix link speed when port is down
> 

Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-29 12:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-25 12:06 [dpdk-dev] [PATCH 0/2] bugfix for link for hns3 PMD Min Hu (Connor)
2021-04-25 12:06 ` [dpdk-dev] [PATCH 1/2] net/hns3: fix link status when port is stopped Min Hu (Connor)
2021-04-25 12:06 ` [dpdk-dev] [PATCH 2/2] net/hns3: fix link speed when port is down Min Hu (Connor)
2021-04-29 12:55 ` [dpdk-dev] [PATCH 0/2] bugfix for link for hns3 PMD Ferruh Yigit

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).