Skip to contentSkip to conversation

net/ice: invoke callback func when link status change

PATCH Superseded Leyi Rong 2 participants 6 messages Oct 14, 2019 – Oct 17, 2019 Network drivers

lore
Share & tools
lore

Leyi Rong

author
#0 lore raw

PATCH 1/1 net/ice: invoke callback func when link status change

Call _rte_eth_dev_callback_process when link status change.

---
 drivers/net/ice/ice_ethdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.c +5 -1
index dfccef65d..ddcb4848b 100644
@@ -1293,6 +1293,7 @@ ice_interrupt_handler(void *param)
 	uint8_t pf_num;
 	uint8_t event;
 	uint16_t queue;
+	int ret;
 #ifdef ICE_LSE_SPT
 	uint32_t int_fw_ctl;
 #endif
@@ -1320,7 +1321,10 @@ ice_interrupt_handler(void *param)
 #else
 	if (oicr & PFINT_OICR_LINK_STAT_CHANGE_M) {
 		PMD_DRV_LOG(INFO, "OICR: link state change event");
-		ice_link_update(dev, 0);
+		ret = ice_link_update(dev, 0);
+		if (!ret)
+			_rte_eth_dev_callback_process
+				(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 #endif
 
Signature · 1 line
2.17.1
#1 lore raw

Hi, Leyi

Quoted 1 line · Leyi Rong

Call _rte_eth_dev_callback_process when link status change.

Could you elaborate more in commit log, like why we need this patch, what's the impact without this patch, is it a fix, etc?

Thanks,
Xiaolong

Quoted 33 lines

---
drivers/net/ice/ice_ethdev.c | 6 +++++-

1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.c +5 -1
index dfccef65d..ddcb4848b 100644
@@ -1293,6 +1293,7 @@ ice_interrupt_handler(void *param)
 	uint8_t pf_num;
 	uint8_t event;
 	uint16_t queue;
+	int ret;
 #ifdef ICE_LSE_SPT
 	uint32_t int_fw_ctl;
 #endif
@@ -1320,7 +1321,10 @@ ice_interrupt_handler(void *param)
 #else
 	if (oicr & PFINT_OICR_LINK_STAT_CHANGE_M) {
 		PMD_DRV_LOG(INFO, "OICR: link state change event");
-		ice_link_update(dev, 0);
+		ret = ice_link_update(dev, 0);
+		if (!ret)
+			_rte_eth_dev_callback_process
+				(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 #endif
 
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH v2 1/1 net/ice: invoke callback func when link status change

In reply to Leyi Rong

Needs to call _rte_eth_dev_callback_process to run registered callbacks when link status change.

Fixes cf911d90e366 ("net/ice: support link update")

---
v2:
- adds fixline in commit log.

---
 drivers/net/ice/ice_ethdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.c +5 -1
index 5567beb55..092f10d47 100644
@@ -1303,6 +1303,7 @@ ice_interrupt_handler(void *param)
 	uint8_t pf_num;
 	uint8_t event;
 	uint16_t queue;
+	int ret;
 #ifdef ICE_LSE_SPT
 	uint32_t int_fw_ctl;
 #endif
@@ -1330,7 +1331,10 @@ ice_interrupt_handler(void *param)
 #else
 	if (oicr & PFINT_OICR_LINK_STAT_CHANGE_M) {
 		PMD_DRV_LOG(INFO, "OICR: link state change event");
-		ice_link_update(dev, 0);
+		ret = ice_link_update(dev, 0);
+		if (!ret)
+			_rte_eth_dev_callback_process
+				(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 #endif
 
Signature · 1 line
2.17.1
#3 lore raw
Quoted 3 lines · Leyi Rong

Needs to call _rte_eth_dev_callback_process to run registered callbacks when link status change.

Is it a must to call _rte_eth_dev_callback_process after link status change, I see ice_link_update is also called in ice_dev_start, do we need to apply the same change there too?

Thanks,
Xiaolong

Quoted 38 lines
Fixes cf911d90e366 ("net/ice: support link update")

---
v2:
- adds fixline in commit log.
---
drivers/net/ice/ice_ethdev.c | 6 +++++-

1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.c +5 -1
index 5567beb55..092f10d47 100644
@@ -1303,6 +1303,7 @@ ice_interrupt_handler(void *param)
 	uint8_t pf_num;
 	uint8_t event;
 	uint16_t queue;
+	int ret;
 #ifdef ICE_LSE_SPT
 	uint32_t int_fw_ctl;
 #endif
@@ -1330,7 +1331,10 @@ ice_interrupt_handler(void *param)
 #else
 	if (oicr & PFINT_OICR_LINK_STAT_CHANGE_M) {
 		PMD_DRV_LOG(INFO, "OICR: link state change event");
-		ice_link_update(dev, 0);
+		ret = ice_link_update(dev, 0);
+		if (!ret)
+			_rte_eth_dev_callback_process
+				(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 #endif
 
Signature · 1 line
2.17.1
author
#4 lore raw
Quoted 9 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Wednesday, October 16, 2019 2:41 PM
To: Rong, Leyi <[email protected]>
Cc: Lu, Wenzhuo <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Subject: Re: [PATCH v2] net/ice: invoke callback func when link status change

Quoted 9 lines
Quoted 3 lines · Leyi Rong

Needs to call _rte_eth_dev_callback_process to run registered callbacks when link status change.

Is it a must to call _rte_eth_dev_callback_process after link status change, I see ice_link_update is also called in ice_dev_start, do we need to apply the same change there too?

I think no needs to invoke the same callback in ice_dev_start, as it's not triggered by event in start process.

Quoted 40 lines

Thanks,
Xiaolong

Quoted 37 lines
Fixes cf911d90e366 ("net/ice: support link update")

---
v2:
- adds fixline in commit log.
---
drivers/net/ice/ice_ethdev.c | 6 +++++-

1 file changed, 5 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/ice/ice_ethdev.c index 5567beb55..092f10d47 100644

drivers/net/ice/ice_ethdev.c +5 -2
@@ -1303,6 +1303,7 @@ ice_interrupt_handler(void *param)
 	uint8_t pf_num;
 	uint8_t event;
 	uint16_t queue;
+	int ret;
 #ifdef ICE_LSE_SPT
 	uint32_t int_fw_ctl;
 #endif
@@ -1330,7 +1331,10 @@ ice_interrupt_handler(void *param)  #else
 	if (oicr & PFINT_OICR_LINK_STAT_CHANGE_M) {
 		PMD_DRV_LOG(INFO, "OICR: link state change event");
-		ice_link_update(dev, 0);
+		ret = ice_link_update(dev, 0);
+		if (!ret)
+			_rte_eth_dev_callback_process
+				(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 #endif
 
--

2.17.1

Reviewed-by on v2 1/1 Applied
#5 lore raw
In reply to Leyi Rong
Quoted 41 lines · Leyi Rong

Needs to call _rte_eth_dev_callback_process to run registered callbacks when link status change.

Fixes cf911d90e366 ("net/ice: support link update")

---
v2:
- adds fixline in commit log.
---
drivers/net/ice/ice_ethdev.c | 6 +++++-

1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.c +5 -1
index 5567beb55..092f10d47 100644
@@ -1303,6 +1303,7 @@ ice_interrupt_handler(void *param)
 	uint8_t pf_num;
 	uint8_t event;
 	uint16_t queue;
+	int ret;
 #ifdef ICE_LSE_SPT
 	uint32_t int_fw_ctl;
 #endif
@@ -1330,7 +1331,10 @@ ice_interrupt_handler(void *param)
 #else
 	if (oicr & PFINT_OICR_LINK_STAT_CHANGE_M) {
 		PMD_DRV_LOG(INFO, "OICR: link state change event");
-		ice_link_update(dev, 0);
+		ret = ice_link_update(dev, 0);
+		if (!ret)
+			_rte_eth_dev_callback_process
+				(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 #endif
 
Signature · 1 line
2.17.1

Applied to dpdk-next-net-intel.