ethdev: avoid blocking telemetry callback for link status
PATCH 1/1 ethdev: avoid blocking telemetry callback for link status
When querying the link status via telemetry interface, we don't want the client to have to wait for multiple seconds for a reply. Therefore use "rte_eth_link_get_nowait()" rather than "rte_eth_link_get()" in the telemetry callback.
--- lib/librte_ethdev/rte_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_ethdev/rte_ethdev.c +1 -1
@@ -5692,7 +5692,7 @@ eth_dev_handle_port_link_status(const char *cmd __rte_unused,if (!rte_eth_dev_is_valid_port (port_id))return -1 ; - ret =rte_eth_link_get (port_id, &link); + ret =rte_eth_link_get_nowait (port_id, &link);if (ret <0 )return -1 ;
Signature · 1 line
2.27.0
Hi Bruce,
Quoted 39 lines
-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: Thursday 14 January 2021 12:18
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; [email protected]; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>; Power, Ciara <[email protected]>; Wiles, Keith <[email protected]>
Subject: [PATCH] ethdev: avoid blocking telemetry callback for link statusWhen querying the link status via telemetry interface, we don't want the client to have to wait for multiple seconds for a reply. Therefore use "
rte_eth_link_get_nowait()" rather than "rte_eth_link_get()" in the telemetry callback.Fixes c190daedb9b1 ("ethdev: add telemetry callbacks")Signed-off-by Bruce Richardson <[email protected]>---
lib/librte_ethdev/rte_ethdev.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)lib/librte_ethdev/rte_ethdev.c +1
-2@@ -5692,7 +5692,7 @@ eth_dev_handle_port_link_status(const char *cmd __rte_unused, if (!rte_eth_dev_is_valid_port(port_id))return -1 ; - ret =rte_eth_link_get (port_id, &link); + ret =rte_eth_link_get_nowait (port_id, &link);if (ret <0 )return -1 ; --
Quoted 1 line
2.27.0
This change looks good to me.
Thomas Monjalon
Acked-byQuoted 18 lines
Quoted 13 lines
When querying the link status via telemetry interface, we don't want the client to have to wait for multiple seconds for a reply. Therefore use "
rte_eth_link_get_nowait()" rather than "rte_eth_link_get()" in the telemetry callback.Fixes c190daedb9b1 ("ethdev: add telemetry callbacks")Signed-off-by Bruce Richardson <[email protected]>---
lib/librte_ethdev/rte_ethdev.c eth_dev_handle_port_link_status(const char *cmd · line 5692
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +1
-1@@ -5692,7 +5692,7 @@ eth_dev_handle_port_link_status(const char *cmd - ret =rte_eth_link_get (port_id, &link); + ret =rte_eth_link_get_nowait (port_id, &link);This change looks good to me.
Quoted 1 line
Acked-by Ciara Power <[email protected]>
Ferruh Yigit
AppliedQuoted 18 lines · Thomas Monjalon
Quoted 18 lines
Quoted 13 lines
When querying the link status via telemetry interface, we don't want the client to have to wait for multiple seconds for a reply. Therefore use "
rte_eth_link_get_nowait()" rather than "rte_eth_link_get()" in the telemetry callback.Fixes c190daedb9b1 ("ethdev: add telemetry callbacks")Signed-off-by Bruce Richardson <[email protected]>---
lib/librte_ethdev/rte_ethdev.c eth_dev_handle_port_link_status(const char *cmd · line 5692
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +1
-1@@ -5692,7 +5692,7 @@ eth_dev_handle_port_link_status(const char *cmd - ret =rte_eth_link_get (port_id, &link); + ret =rte_eth_link_get_nowait (port_id, &link);This change looks good to me.
Quoted 4 lines
Quoted 1 line
Acked-by Ciara Power <[email protected]>Acked-by Thomas Monjalon <[email protected]>
Applied to dpdk-next-net/main, thanks.
Hi, Bruce and all,
Do you know the difference between "rte_eth_link_get" and
"rte_eth_link_get_nowait"? I know they call funciton "link_update" with differenct parameter "wait_to_complete"(set 1 means wait, set 0
means not wait). But how to define the "wait" time, and why it shoud wait?
On the further, What are the application scenarios of the two
APIs?
Look forward to your reply, thanks.
Quoted 27 lines · Bruce Richardson
When querying the link status via telemetry interface, we don't want the client to have to wait for multiple seconds for a reply. Therefore use "
rte_eth_link_get_nowait()" rather than "rte_eth_link_get()" in the telemetry callback.Fixes c190daedb9b1 ("ethdev: add telemetry callbacks")Signed-off-by Bruce Richardson <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/librte_ethdev/rte_ethdev.c +1
-1@@ -5692,7 +5692,7 @@ eth_dev_handle_port_link_status(const char *cmd __rte_unused,if (!rte_eth_dev_is_valid_port (port_id))return -1 ; - ret =rte_eth_link_get (port_id, &link); + ret =rte_eth_link_get_nowait (port_id, &link);if (ret <0 )return -1 ;
Quoted 8 lines · On Tue, 19 Jan 2021 09:06:48 +0800 "Min Hu (Connor)" <[email protected]> wrote:
Hi, Bruce and all,
Do you know the difference between "rte_eth_link_get" and
"rte_eth_link_get_nowait"? I know they call funciton "link_update" with differenct parameter "wait_to_complete"(set 1 means wait, set 0
means not wait). But how to define the "wait" time, and why it shoud wait?
On the further, What are the application scenarios of the two
APIs?
The default behavior of rte_eth_link_get (in some drivers) is to wait for link to come up. Many drivers don't do this. It seems mostly the Intel ones that do.
Thank Stephen,
but in which the scenarios, it should wait link to up, in which scenarios, it should not ?
By the way, how to define the "wait" time value ?
Quoted 17 lines · Stephen Hemminger
Quoted 8 lines · On Tue, 19 Jan 2021 09:06:48 +0800 "Min Hu (Connor)" <[email protected]> wrote:
Hi, Bruce and all,
Do you know the difference between "rte_eth_link_get" and
"rte_eth_link_get_nowait"? I know they call funciton "link_update" with differenct parameter "wait_to_complete"(set 1 means wait, set 0
means not wait). But how to define the "wait" time, and why it shoud wait?
On the further, What are the application scenarios of the two
APIs?The default behavior of
rte_eth_link_get(in some drivers) is to wait for link to come up. Many drivers don't do this. It seems mostly the Intel ones that do.
.
Quoted 5 lines · Min Hu (Connor)
Thank Stephen,
but in which the scenarios, it should wait link to up, in which scenarios, it should not ?
By the way, how to define the "wait" time value ?
I believe the documentation somewhere refers to a wait time of up to 9 seconds, but I don't think it's terribly well defined. Some Intel NICs will stall for a few seconds if the link is not yet stable or if the link is down. With the link up, I don't think any NIC fails to return immediately.
However, if delays in the app are something you want to avoid, the _nowait varient is the one to call to be sure.
/Bruce
Quoted 20 lines · Stephen Hemminger
Quoted 17 lines
Quoted 8 lines · On Tue, 19 Jan 2021 09:06:48 +0800 "Min Hu (Connor)" <[email protected]> wrote:
Hi, Bruce and all,
Do you know the difference between "rte_eth_link_get" and
"rte_eth_link_get_nowait"? I know they call funciton "link_update" with differenct parameter "wait_to_complete"(set 1 means wait, set 0
means not wait). But how to define the "wait" time, and why it shoud wait?
On the further, What are the application scenarios of the two
APIs?The default behavior of
rte_eth_link_get(in some drivers) is to wait for link to come up. Many drivers don't do this. It seems mostly the Intel ones that do.
.