net/virtio: add link speed tuning
Subsystems (2)
Re: [dpdk-dev] [PATCH v11 11/24] examples/ip_pipeline: new link status print format
In reply to Ivan DyukovQuoted 13 lines · Ivan Dyukov
Add usage of
rte_eth_link_speed_to_strfunction to example applicationsSigned-off-by Ivan Dyukov <[email protected]>--- examples/ip_pipeline/cli.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)examples/ip_pipeline/cli.c +0
-0
examples/ip_pipeline/cli.c print_link_info(struct link *link, char *out, size_t out_size) · line 276
Quoted 5 lines
examples/ip_pipeline/cli.c +1
-1@@ -273,7 +273,7 @@ print_link_info(struct link *link, char *out, size_t out_size)"\n" "%s: flags=<%s> mtu %u\n" "\tether %02X:%02X:%02X:%02X:%02X:%02X rxqueues %u txqueues %u\n" -"\tport# %u speed %u Mbps\n" +"\tport# %u speed %s Mbps\n"
Same here, " Mbps" can be dropped.
Quoted 13 lines
examples/ip_pipeline/cli.c +1
-1"\tRX packets %" PRIu64" bytes %" PRIu64"\n" "\tRX errors %" PRIu64" missed %" PRIu64" no-mbuf %" PRIu64"\n" "\tTX packets %" PRIu64" bytes %" PRIu64"\n" @@ -287,7 +287,7 @@ print_link_info(struct link *link, char *out, size_t out_size) link->n_rxq, link->n_txq, link->port_id, - eth_link.link_speed, +rte_eth_link_speed_to_str (eth_link.link_speed), stats.ipackets, stats.ibytes, stats.ierrors,
PATCH v11 12/24 examples/ipsec-secgw: new link status print format
In reply to Ivan DyukovAdd usage of rte_eth_link_to_str function to example applications
--- examples/ipsec-secgw/ipsec-secgw.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
examples/ipsec-secgw/ipsec-secgw.c +5 -8
@@ -1775,6 +1775,7 @@ check_all_ports_link_status(uint32_t port_mask)uint8_t count, all_ports_up, print_flag =0 ;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status" );fflush (stdout);
@@ -1794,14 +1795,10 @@ check_all_ports_link_status(uint32_t port_mask) }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ( -"Port%d Link Up - speed %u Mbps -%s\n" , - portid, link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); -else -printf ("Port %d Link Down\n" , portid); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , portid, + link_status_text);continue ; }/* clear all_ports_up flag if any link down */
Signature · 1 line
2.17.1
PATCH v11 13/24 examples/kni: new link status print format
In reply to Ivan DyukovAdd usage of rte_eth_link_to_str function to example applications
--- examples/kni/main.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-)
examples/kni/main.c +10 -17
@@ -661,6 +661,7 @@ check_all_ports_link_status(uint32_t port_mask)uint8_t count, all_ports_up, print_flag =0 ;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status\n" );fflush (stdout);
@@ -680,14 +681,10 @@ check_all_ports_link_status(uint32_t port_mask) }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ( -"Port%d Link Up - speed %uMbps - %s\n" , - portid, link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); -else -printf ("Port %d Link Down\n" , portid); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , portid, + link_status_text);continue ; }/* clear all_ports_up flag if any link down */
@@ -717,19 +714,15 @@ check_all_ports_link_status(uint32_t port_mask)static void log_link_state (struct rte_kni *kni,int prev,struct rte_eth_link *link) { +char link_status_text[60 ];if (kni ==NULL || link ==NULL )return ; -if (prev ==ETH_LINK_DOWN && link->link_status ==ETH_LINK_UP ) { -RTE_LOG (INFO ,APP ,"%s NIC Link is Up %d Mbps %s %s.\n" , +rte_eth_link_to_str (link_status_text,60 ,NULL , link); +if (prev != link->link_status) +RTE_LOG (INFO ,APP ,"%s NIC %s" ,rte_kni_get_name (kni), - link->link_speed, - link->link_autoneg ?"(AutoNeg)" :"(Fixed)" , - link->link_duplex ?"Full Duplex" :"Half Duplex" ); - }else if (prev ==ETH_LINK_UP && link->link_status ==ETH_LINK_DOWN ) { -RTE_LOG (INFO ,APP ,"%s NIC Link is Down.\n" , -rte_kni_get_name (kni)); - } + link_status_text); }/*
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v11 13/24] examples/kni: new link status print format
Quoted 40 lines · Ivan Dyukov
Add usage of
rte_eth_link_to_strfunction to example applicationsSigned-off-by Ivan Dyukov <[email protected]>--- examples/kni/main.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-)examples/kni/main.c +5
-8@@ -661,6 +661,7 @@ check_all_ports_link_status(uint32_t port_mask)uint8_t count, all_ports_up, print_flag =0 ;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status\n" );fflush (stdout);@@ -680,14 +681,10 @@ check_all_ports_link_status(uint32_t port_mask) }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ( -"Port%d Link Up - speed %uMbps - %s\n" , - portid, link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); -else -printf ("Port %d Link Down\n" , portid); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , portid, + link_status_text);continue ; }/* clear all_ports_up flag if any link down */
examples/kni/main.c check_all_ports_link_status(uint32_t port_mask) · line 717
Quoted 4 lines
examples/kni/main.c +1
-0@@ -717,19 +714,15 @@ check_all_ports_link_status(uint32_t port_mask)static void log_link_state (struct rte_kni *kni,int prev,struct rte_eth_link *link) { +char link_status_text[60 ];
'60' seems forgotten, it also can be replaced with 'RTE_ETH_LINK_MAX_STR_LEN'
Also good to have an empty line between variables declarations and code.
Quoted 21 lines
examples/kni/main.c +4
-9if (kni ==NULL || link ==NULL )return ; -if (prev ==ETH_LINK_DOWN && link->link_status ==ETH_LINK_UP ) { -RTE_LOG (INFO ,APP ,"%s NIC Link is Up %d Mbps %s %s.\n" , +rte_eth_link_to_str (link_status_text,60 ,NULL , link); +if (prev != link->link_status) +RTE_LOG (INFO ,APP ,"%s NIC %s" ,rte_kni_get_name (kni), - link->link_speed, - link->link_autoneg ?"(AutoNeg)" :"(Fixed)" , - link->link_duplex ?"Full Duplex" :"Half Duplex" ); - }else if (prev ==ETH_LINK_UP && link->link_status ==ETH_LINK_DOWN ) { -RTE_LOG (INFO ,APP ,"%s NIC Link is Down.\n" , -rte_kni_get_name (kni)); - } + link_status_text); }/*
PATCH v11 14/24 examples/l2fwd-crypt: new link status print format
In reply to Ivan DyukovAdd usage of rte_eth_link_to_str function to example applications
--- examples/l2fwd-crypto/main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
examples/l2fwd-crypto/main.c +5 -8
@@ -1734,6 +1734,7 @@ check_all_ports_link_status(uint32_t port_mask)uint8_t count, all_ports_up, print_flag =0 ;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status" );fflush (stdout);
@@ -1753,14 +1754,10 @@ check_all_ports_link_status(uint32_t port_mask) }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ( -"Port%d Link Up. Speed %u Mbps - %s\n" , - portid, link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); -else -printf ("Port %d Link Down\n" , portid); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , portid, + link_status_text);continue ; }/* clear all_ports_up flag if any link down */
Signature · 1 line
2.17.1
PATCH v11 15/24 examples/l2fwd-event: new link status print format
In reply to Ivan DyukovAdd usage of rte_eth_link_to_str function to example applications
--- examples/l2fwd-event/main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
examples/l2fwd-event/main.c +5 -8
@@ -366,6 +366,7 @@ check_all_ports_link_status(struct l2fwd_resources *rsrc,uint8_t count, all_ports_up, print_flag =0 ;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status..." );fflush (stdout);
@@ -389,14 +390,10 @@ check_all_ports_link_status(struct l2fwd_resources *rsrc, }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ( -"Port%d Link Up. Speed %u Mbps - %s\n" , - port_id, link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); -else -printf ("Port %d Link Down\n" , port_id); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , port_id, + link_status_text);continue ; }/* clear all_ports_up flag if any link down */
Signature · 1 line
2.17.1
PATCH v11 16/24 examples/l2fwd: new link status print format
In reply to Ivan DyukovAdd usage of rte_eth_link_to_str function to example applications
--- examples/l2fwd/main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
examples/l2fwd/main.c +5 -8
@@ -571,6 +571,7 @@ check_all_ports_link_status(uint32_t port_mask)uint8_t count, all_ports_up, print_flag =0 ;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status" );fflush (stdout);
@@ -594,14 +595,10 @@ check_all_ports_link_status(uint32_t port_mask) }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ( -"Port%d Link Up. Speed %u Mbps - %s\n" , - portid, link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); -else -printf ("Port %d Link Down\n" , portid); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , portid, + link_status_text);continue ; }/* clear all_ports_up flag if any link down */
Signature · 1 line
2.17.1
PATCH v11 17/24 examples/l3fwd-graph: new link status print format
In reply to Ivan DyukovAdd usage of rte_eth_link_to_str function to example applications
--- examples/l3fwd-graph/main.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
examples/l3fwd-graph/main.c +5 -10
@@ -599,6 +599,7 @@ check_all_ports_link_status(uint32_t port_mask)struct rte_eth_link link;uint16_t portid;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status" );fflush (stdout);
@@ -623,16 +624,10 @@ check_all_ports_link_status(uint32_t port_mask) }/* Print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ("Port%d Link Up. Speed %u Mbps " -"-%s\n" , - portid, link.link_speed, - (link.link_duplex == -ETH_LINK_FULL_DUPLEX ) - ? ("full-duplex" ) - : ("half-duplex\n" )); -else -printf ("Port %d Link Down\n" , portid); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , portid, + link_status_text);continue ; }/* Clear all_ports_up flag if any link down */
Signature · 1 line
2.17.1
PATCH v11 18/24 examples/l3fwd-power: new link status print format
In reply to Ivan DyukovAdd usage of rte_eth_link_to_str function to example applications
--- examples/l3fwd-power/main.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
examples/l3fwd-power/main.c +5 -9
@@ -1945,6 +1945,7 @@ check_all_ports_link_status(uint32_t port_mask)uint16_t portid;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status" );fflush (stdout);
@@ -1964,15 +1965,10 @@ check_all_ports_link_status(uint32_t port_mask) }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ("Port %d Link Up - speed %u " -"Mbps - %s\n" , (uint8_t )portid, - (unsigned )link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); -else -printf ("Port %d Link Down\n" , - (uint8_t )portid); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , portid, + link_status_text);continue ; }/* clear all_ports_up flag if any link down */
Signature · 1 line
2.17.1
PATCH v11 19/24 examples/multi_proc*: new link status print format
In reply to Ivan DyukovAdd usage of rte_eth_link_to_str function to example applications
--- .../client_server_mp/mp_server/init.c | 15 ++++++--------- examples/multi_process/symmetric_mp/main.c | 13 +++++-------- 2 files changed, 11 insertions(+), 17 deletions(-)
examples/multi_process/client_server_mp/mp_server/init.c +6 -9
@@ -185,6 +185,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)uint8_t count, all_ports_up, print_flag =0 ;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status" );fflush (stdout);
@@ -204,15 +205,11 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ("Port %d Link Up - speed %u " -"Mbps - %s\n" , ports->id[portid], - (unsigned )link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); -else -printf ("Port %d Link Down\n" , - (uint8_t )ports->id[portid]); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , + (uint8_t )ports->id[portid], + link_status_text);continue ; }/* clear all_ports_up flag if any link down */
examples/multi_process/symmetric_mp/main.c +5 -8
@@ -365,6 +365,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)uint8_t count, all_ports_up, print_flag =0 ;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status" );fflush (stdout);
@@ -384,14 +385,10 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ( -"Port%d Link Up. Speed %u Mbps - %s\n" , - portid, link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); -else -printf ("Port %d Link Down\n" , portid); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , portid, + link_status_text);continue ; }/* clear all_ports_up flag if any link down */
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v11 19/24] examples/multi_proc*: new link status print format
Quoted 29 lines · Ivan Dyukov
Add usage of
rte_eth_link_to_strfunction to example applicationsSigned-off-by Ivan Dyukov <[email protected]>--- .../client_server_mp/mp_server/init.c | 15 ++++++--------- examples/multi_process/symmetric_mp/main.c | 13 +++++-------- 2 files changed, 11 insertions(+), 17 deletions(-)examples/multi_process/client_server_mp/mp_server/init.c +1
-4@@ -185,6 +185,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)uint8_t count, all_ports_up, print_flag =0 ;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status" );fflush (stdout);@@ -204,15 +205,11 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) - printf("Port %d Link Up - speed %u " - "Mbps - %s\n", ports->id[portid], - (unsigned)link.link_speed,
examples/multi_process/client_server_mp/mp_server/init.c check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) · line 212
Quoted 10 lines
examples/multi_process/client_server_mp/mp_server/init.c +5
-5- (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex") : ("half-duplex")); - else - printf("Port %d Link Down\n", - (uint8_t)ports->id[portid]); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , + (uint8_t )ports->id[portid], + link_status_text);
This is not related to your patch, but port is 16bits, it shouldn't be cast to 'uint8_t'.
Quoted 35 lines
examples/multi_process/client_server_mp/mp_server/init.c +0
-0continue ; }/* clear all_ports_up flag if any link down */ examples/multi_process/symmetric_mp/main.c +5
-8@@ -365,6 +365,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)uint8_t count, all_ports_up, print_flag =0 ;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status" );fflush (stdout);@@ -384,14 +385,10 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ( -"Port%d Link Up. Speed %u Mbps - %s\n" , - portid, link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); -else -printf ("Port %d Link Down\n" , portid); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , portid, + link_status_text);continue ; }/* clear all_ports_up flag if any link down */
PATCH v11 20/24 examples/ntb: new link status print format
In reply to Ivan DyukovAdd usage of rte_eth_link_strf function to example applications
--- examples/ntb/ntb_fwd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
examples/ntb/ntb_fwd.c +6 -5
@@ -729,6 +729,7 @@ start_pkt_fwd(void)struct rte_eth_link eth_link;uint32_t lcore_id;int ret, i; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ]; ret =ntb_fwd_config_setup ();if (ret <0 ) {
@@ -747,11 +748,11 @@ start_pkt_fwd(void)return ; }if (eth_link.link_status) { -printf ("Eth%u Link Up. Speed %u Mbps - %s\n" , - eth_port_id, eth_link.link_speed, - (eth_link.link_duplex == -ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), + ð_link); +printf ("Eth%u %s\n" , eth_port_id, + link_status_text);break ; } }
Signature · 1 line
2.17.1
PATCH v11 21/24 example/performance*: new link status print format
In reply to Ivan DyukovAdd usage of rte_eth_link_to_str function to example applications
--- examples/performance-thread/l3fwd-thread/main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
examples/performance-thread/l3fwd-thread/main.c +5 -8
@@ -3433,6 +3433,7 @@ check_all_ports_link_status(uint32_t port_mask)uint8_t count, all_ports_up, print_flag =0 ;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status" );fflush (stdout);
@@ -3452,14 +3453,10 @@ check_all_ports_link_status(uint32_t port_mask) }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ( -"Port%d Link Up. Speed %u Mbps - %s\n" , - portid, link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); -else -printf ("Port %d Link Down\n" , portid); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , portid, + link_status_text);continue ; }/* clear all_ports_up flag if any link down */
Signature · 1 line
2.17.1
PATCH v11 22/24 examples/qos_sched: new link status print format
In reply to Ivan DyukovAdd usage of rte_eth_link_to_str function to example applications
--- examples/qos_sched/init.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
examples/qos_sched/init.c +4 -8
@@ -76,6 +76,7 @@ app_init_port(uint16_t portid, struct rte_mempool *mp)uint16_t rx_size;uint16_t tx_size;struct rte_eth_conf local_port_conf = port_conf; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];/* check if port already initialized (multistream configuration) */ if (app_inited_port_mask & (1u << portid))
@@ -160,14 +161,9 @@ app_init_port(uint16_t portid, struct rte_mempool *mp)"rte_eth_link_get: err=%d, port=%u: %s\n" , ret, portid, rte_strerror(-ret)); -if (link.link_status) { -printf (" Link Up - speed %u Mbps - %s\n" , - (uint32_t ) link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); - }else { -printf (" Link Down\n" ); - } +rte_eth_link_to_str (link_status_text,sizeof (link_status_text), &link); +printf ("%s\n" , link_status_text); + ret =rte_eth_promiscuous_enable (portid);if (ret !=0 ) rte_exit(EXIT_FAILURE,
Signature · 1 line
2.17.1
PATCH v11 23/24 examples/server_nod*: new link status print format
In reply to Ivan DyukovAdd usage of rte_eth_link_to_str function to example applications
--- examples/server_node_efd/server/init.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
examples/server_node_efd/server/init.c +5 -10
@@ -247,6 +247,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)uint16_t portid;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status" );fflush (stdout);
@@ -266,16 +267,10 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ( -"Port%d Link Up. Speed %u Mbps - %s\n" , - info->id[portid], - link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); -else -printf ("Port %d Link Down\n" , - info->id[portid]); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , info->id[portid], + link_status_text);continue ; }/* clear all_ports_up flag if any link down */
Signature · 1 line
2.17.1
PATCH v11 24/24 examples/vm_power_*: new link status print format
In reply to Ivan DyukovAdd usage of rte_eth_link_to_str function to example applications
--- examples/vm_power_manager/main.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
examples/vm_power_manager/main.c +5 -9
@@ -244,6 +244,7 @@ check_all_ports_link_status(uint32_t port_mask)uint16_t portid, count, all_ports_up, print_flag =0 ;struct rte_eth_link link;int ret; +char link_status_text[RTE_ETH_LINK_MAX_STR_LEN ];printf ("\nChecking link status" );fflush (stdout);
@@ -267,15 +268,10 @@ check_all_ports_link_status(uint32_t port_mask) }/* print link status if flag set */ if (print_flag ==1 ) { -if (link.link_status) -printf ("Port %d Link Up - speed %u " -"Mbps - %s\n" , (uint16_t )portid, - (unsigned int )link.link_speed, - (link.link_duplex ==ETH_LINK_FULL_DUPLEX ) ? - ("full-duplex" ) : ("half-duplex" )); -else -printf ("Port %d Link Down\n" , - (uint16_t )portid); +rte_eth_link_to_str (link_status_text, +sizeof (link_status_text), &link); +printf ("Port %d %s\n" , portid, + link_status_text);continue ; }/* clear all_ports_up flag if any link down */
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v11 00/24] ethdev: allow unknown link speed
In reply to Ivan DyukovOn 9/15/2020 8:06 PM, Ivan Dyukov wrote:
<...>
Quoted 64 lines
v11 changes:
* 0 Mbps => None
* Invalid speed => Invalid
* Change code style ofrte_eth_link_speed_to_strv10 changes:
* remove format string arg fromrte_eth_link_to_strfunction
* addrte_eth_link_speed_to_strfunction
* add usage ofrte_eth_link_speed_to_strin examplesv9 changes:
* removerte_eth_link_printffunction
* addETH_LINK_MAX_STR_LENdefinition
* add usage ofETH_LINK_MAX_STR_LENin examplesv8 changes:
* renamerte_eth_link_strftorte_eth_link_to_str
* refactorrte_eth_link_to_straccording to review comments
* fix codestyle
* fix commit message in 02 patch
* fix compile error in ntb application
* merge "app" and "doc" commitsv7 changes:
* fix meson build
* change_strffunction. now it does not fails in case of unknown specifiers like %d. it just copy it to target string.
* removeinvalid_fmtunit test.
* add unknown specifier test.
* fix codestylev6 changes:
* fix spelling in comments according to checkpatch warningv5 changes:
* renamerte_eth_link_formattorte_eth_link_strf
* add '\n' to default strings
* update remaining examples. patch with subj 'examples: new link status print format' contains examples which have no maintainers. TBD:
update remaining nic drivers with 'unknown' speed. It should be provided in separate patchset.v4 changes:
* refactorrte_eth_link_formatusing strlcat func instead of snprintf
* added new checks to unit tests
* few minor fixes according review comments
TBD:
update examples in 'example' folder with new status printing mechanism update remaining nic drivers with 'unknown' speedv3 changes:
* removerte_eth_link_prepare_textfunction
* addrte_eth_link_formatandrte_eth_link_printffunctions
* added unit tests forrte_eth_link_formatfunction
TBD:
update examples in 'example' folder with new status printing mechanism update remaining nic drivers with 'unknown' speedv2 changes:
* add function which format link status to textual representation
* update drivers for Intel nics with 'unknown' speed
TBD:
update examples in 'example' folder with new status printing mechanism update remaining nic drivers with 'unknown' speed
Quoted 7 lines
v1 changes:
This is initial patchset which introduces UNKNOWN speed to dpdk applications. Also it contains changes related to printf formating. Patchset contains changes for app/ and doc/ folders. examples/ folder will be provided later.
The ethdev patch introduces 'ETH_SPEED_NUM_UNKNOWN' and driver patches were already merged from previous version. Will get the remaining ones.
Ferruh Yigit
Reviewed-byRe: [dpdk-dev] [PATCH v11 00/24] ethdev: allow unknown link speed
Quoted 75 lines · Ferruh Yigit
On 9/15/2020 8:06 PM, Ivan Dyukov wrote:
<...>Quoted 64 lines
v11 changes:
* 0 Mbps => None
* Invalid speed => Invalid
* Change code style ofrte_eth_link_speed_to_strv10 changes:
* remove format string arg fromrte_eth_link_to_strfunction
* addrte_eth_link_speed_to_strfunction
* add usage ofrte_eth_link_speed_to_strin examplesv9 changes:
* removerte_eth_link_printffunction
* addETH_LINK_MAX_STR_LENdefinition
* add usage ofETH_LINK_MAX_STR_LENin examplesv8 changes:
* renamerte_eth_link_strftorte_eth_link_to_str
* refactorrte_eth_link_to_straccording to review comments
* fix codestyle
* fix commit message in 02 patch
* fix compile error in ntb application
* merge "app" and "doc" commitsv7 changes:
* fix meson build
* change_strffunction. now it does not fails in case of unknown specifiers like %d. it just copy it to target string.
* removeinvalid_fmtunit test.
* add unknown specifier test.
* fix codestylev6 changes:
* fix spelling in comments according to checkpatch warningv5 changes:
* renamerte_eth_link_formattorte_eth_link_strf
* add '\n' to default strings
* update remaining examples. patch with subj 'examples: new link status print format' contains examples which have no maintainers. TBD:
update remaining nic drivers with 'unknown' speed. It should be provided in separate patchset.v4 changes:
* refactorrte_eth_link_formatusing strlcat func instead of snprintf
* added new checks to unit tests
* few minor fixes according review comments
TBD:
update examples in 'example' folder with new status printing mechanism update remaining nic drivers with 'unknown' speedv3 changes:
* removerte_eth_link_prepare_textfunction
* addrte_eth_link_formatandrte_eth_link_printffunctions
* added unit tests forrte_eth_link_formatfunction
TBD:
update examples in 'example' folder with new status printing mechanism update remaining nic drivers with 'unknown' speedv2 changes:
* add function which format link status to textual representation
* update drivers for Intel nics with 'unknown' speed
TBD:
update examples in 'example' folder with new status printing mechanism update remaining nic drivers with 'unknown' speedQuoted 7 lines
v1 changes:
This is initial patchset which introduces UNKNOWN speed to dpdk applications. Also it contains changes related to printf formating. Patchset contains changes for app/ and doc/ folders. examples/ folder will be provided later.
Quoted 2 lines
The ethdev patch introduces '
ETH_SPEED_NUM_UNKNOWN' and driver patches were already merged from previous version. Will get the remaining ones.
For series,
The comments on the patches fixed while merging.
All example patches squashed into single commit.
Series applied to dpdk-next-net/main, thanks.
PATCH v12 2/7 net/virtio: replace default virtio speed
In reply to a message not in the archiveThis patch set speed to unknown
--- drivers/net/virtio/virtio_ethdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/virtio/virtio_ethdev.c +3 -3
@@ -2371,8 +2371,8 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_completmemset (&link,0 ,sizeof (link)); link.link_duplex =ETH_LINK_FULL_DUPLEX ; - link.link_speed =ETH_SPEED_NUM_10G ; - link.link_autoneg =ETH_LINK_FIXED ; + link.link_speed =ETH_SPEED_NUM_UNKNOWN ; + link.link_autoneg =ETH_LINK_AUTONEG ;if (!hw->started) { link.link_status =ETH_LINK_DOWN ;
@@ -2427,7 +2427,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)uint64_t tso_mask, host_features;struct virtio_hw *hw = dev->data->dev_private; - dev_info->speed_capa =ETH_LINK_SPEED_10G ;/* fake value */ + dev_info->speed_capa =ETH_LINK_SPEED_AUTONEG ;/* fake value */ dev_info->max_rx_queues =RTE_MIN (hw->max_queue_pairs,VIRTIO_MAX_RX_QUEUES );
Signature · 1 line
2.17.1
PATCH v12 3/7 net/virtio: refactor devargs parsing
In reply to a message not in the archiverefactor vdpa specific devargs parsing to more generic way
--- drivers/net/virtio/virtio_ethdev.c | 34 +++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 10 deletions(-)
drivers/net/virtio/virtio_ethdev.c +24 -10
@@ -1957,16 +1957,18 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev) } static int vdpa_check_handler(__rte_unused const char *key, - const char *value, __rte_unused void *opaque) +const char *value,void *ret_val) { -if (strcmp (value,"1" )) -return -1 ; +if (strcmp (value,"1" ) ==0 ) + *(int *)ret_val =1 ; +else + *(int *)ret_val =0 ;return 0 ; }static int -vdpa_mode_selected (struct rte_devargs *devargs) +virtio_dev_devargs_parse (struct rte_devargs *devargs,int *vdpa) {struct rte_kvargs *kvlist;const char *key ="vdpa" ;
@@ -1982,12 +1984,16 @@ vdpa_mode_selected(struct rte_devargs *devargs)if (!rte_kvargs_count (kvlist, key)) goto exit; -/* vdpa mode selected when there's a key-value pair: vdpa=1 */ -if (rte_kvargs_process (kvlist, key, - vdpa_check_handler,NULL ) <0 ) { - goto exit; +if (vdpa) { +/* vdpa mode selected when there's a key-value pair: +* vdpa=1 +*/ + ret =rte_kvargs_process (kvlist, key, + vdpa_check_handler, vdpa); +if (ret <0 ) + goto exit; } - ret =1 ; + exit:rte_kvargs_free (kvlist);
@@ -1997,8 +2003,16 @@ vdpa_mode_selected(struct rte_devargs *devargs) static int eth_virtio_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,struct rte_pci_device *pci_dev) { +int vdpa =0 ; +int ret =0 ; + + ret =virtio_dev_devargs_parse (pci_dev->device.devargs, &vdpa); +if (ret <0 ) { +PMD_INIT_LOG (ERR ,"devargs parsing is failed" ); +return ret; + }/* virtio pmd skips probe if device needs to work in vdpa mode */ -if (vdpa_mode_selected (pci_dev->device.devargs)) +if (vdpa ==1 )return 1 ; return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct virtio_hw),
Signature · 1 line
2.17.1
PATCH v12 4/7 net/virtio: add link speed devarg
In reply to a message not in the archiveDefault value of link speed is 0xffffffff (Unknown)
This patch adds speed devarg which allows to configure link speed of virtio device.
--- doc/guides/nics/virtio.rst | 7 ++ drivers/net/virtio/virtio_ethdev.c | 107 ++++++++++++++++++++++++----- drivers/net/virtio/virtio_pci.h | 1 + 3 files changed, 99 insertions(+), 16 deletions(-)
doc/guides/nics/virtio.rst +7 -0
@@ -356,6 +356,13 @@ Below devargs are supported by the PCI virtio driver: a virtio device needs to work in vDPA mode. (Default: 0 (disabled)) +#. ``speed``: + + It is used to specify link speed of virtio device, in units of 1Mb. + Link speed is a part of link status structure. It could be requested + by application using rte_eth_link_get_nowait function. + (Default: 0xffffffff (Unknown)) + Below devargs are supported by the virtio-user vdev: #. ``path``:
drivers/net/virtio/virtio_ethdev.c +91 -16
165 lines not on this page · raw message
drivers/net/virtio/virtio_pci.h +1 -0
@@ -259,6 +259,7 @@ struct virtio_hw {uint16_t port_id;uint8_t mac_addr[RTE_ETHER_ADDR_LEN ];uint32_t notify_off_multiplier; +uint32_t speed;/* link speed in MB */ uint8_t *isr;uint16_t *notify_base;struct virtio_pci_common_cfg *common_cfg;
Signature · 1 line
2.17.1
PATCH v12 5/7 net/virtio-user: fix devargs parsing
In reply to a message not in the archivestrtoull returns 0 if it fails to parse input string. It's ignored in get_integer_arg.
This patch handles error cases for strtoull function.
--- drivers/net/virtio/virtio_user_ethdev.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/virtio/virtio_user_ethdev.c +9 -4
@@ -477,12 +477,17 @@ static int get_integer_arg(const char *key __rte_unused, const char *value, void *extra_args) { + uint64_t integer = 0;if (!value || !extra_args)return -EINVAL ; - - *(uint64_t *)extra_args =strtoull (value,NULL ,0 ); - -return 0 ; + errno =0 ; + integer =strtoull (value,NULL ,0 ); +/* extra_args keeps default value, it should be replaced +* only in case of successful parsing of the 'value' arg +*/ +if (errno ==0 ) + *(uint64_t *)extra_args = integer; +return -errno; } static struct rte_eth_dev *
Signature · 1 line
2.17.1
PATCH v12 6/7 net/virtio-user: adding link speed devarg
In reply to a message not in the archivevirtio driver already parses speed devarg. virtio-user should add it to list of valid devargs and call eth_virtio_dev_init function which init speed value.
eth_virtio_dev_init already is called from virtio_user_pmd_probe function. The only change is required to enable speed devargs:
adding speed to list of valid devargs.
--- doc/guides/nics/virtio.rst | 8 ++++++++ drivers/net/virtio/virtio_user_ethdev.c | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-)
doc/guides/nics/virtio.rst +8 -0
@@ -410,6 +410,14 @@ Below devargs are supported by the virtio-user vdev: It is used to enable virtio device packed virtqueue feature. (Default: 0 (disabled)) +#. ``speed``: + + It is used to specify link speed of virtio device, in units of 1Mb. + Link speed is a part of link status structure. It could be requested + by application using rte_eth_link_get_nowait function. + (Default: 0xffffffff (Unknown)) + + Virtio paths Selection and Usage --------------------------------
drivers/net/virtio/virtio_user_ethdev.c +4 -1
@@ -450,6 +450,8 @@ static const char *valid_args[] = {VIRTIO_USER_ARG_IN_ORDER , #define VIRTIO_USER_ARG_PACKED_VQ "packed_vq"VIRTIO_USER_ARG_PACKED_VQ , +#define VIRTIO_USER_ARG_SPEED "speed" +VIRTIO_USER_ARG_SPEED , NULL };
@@ -782,4 +784,5 @@ RTE_PMD_REGISTER_PARAM_STRING(net_virtio_user,"server=<0|1> " "mrg_rxbuf=<0|1> " "in_order=<0|1> " - "packed_vq=<0|1>"); +"packed_vq=<0|1> " + "speed=<int>");
Signature · 1 line
2.17.1
PATCH v12 7/7 net/virtio: Support of VIRTIO_NET_F_SPEED_DUPLEX
In reply to a message not in the archiveThis patch adds a support of VIRTIO_NET_F_SPEED_DUPLEX feature for virtio driver.
There are two ways to specify speed of the link:
* 'speed' devarg
* negotiate speed from qemu via VIRTIO_NET_F_SPEED_DUPLEX
The highest priority is devarg. If devarg is not specified, driver tries to negotiate it from qemu.
--- drivers/net/virtio/virtio_ethdev.c | 14 ++++++++++++++ drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.h | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-)
drivers/net/virtio/virtio_ethdev.c +14 -0
@@ -1718,6 +1718,20 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) hw->mac_addr[0 ], hw->mac_addr[1 ], hw->mac_addr[2 ], hw->mac_addr[3], hw->mac_addr[4], hw->mac_addr[5]); +if (vtpci_with_feature (hw,VIRTIO_NET_F_SPEED_DUPLEX )) { + config = &local_config; +/* if speed is not specified in devargs */ +if (hw->speed ==ETH_SPEED_NUM_UNKNOWN ) { +vtpci_read_dev_config (hw, + offsetof(struct virtio_net_config , speed), + &config->speed,sizeof (config->speed)); + hw->speed = config->speed; + } + } + +PMD_INIT_LOG (DEBUG ,"link speed = %u%s" , + hw->speed, hw->speed ==ETH_SPEED_NUM_UNKNOWN ? +"(UNKNOWN)" :"" );if (vtpci_with_feature (hw,VIRTIO_NET_F_CTRL_VQ )) { config = &local_config;
drivers/net/virtio/virtio_ethdev.h +2 -1
@@ -37,7 +37,8 @@ 1ULL << VIRTIO_F_RING_PACKED | \ 1ULL << VIRTIO_F_IOMMU_PLATFORM | \ 1ULL << VIRTIO_F_ORDER_PLATFORM | \ - 1ULL << VIRTIO_F_NOTIFICATION_DATA) + 1ULL << VIRTIO_F_NOTIFICATION_DATA | \ + 1ULL << VIRTIO_NET_F_SPEED_DUPLEX)#define VIRTIO_PMD_SUPPORTED_GUEST_FEATURES \ (VIRTIO_PMD_DEFAULT_GUEST_FEATURES | \
drivers/net/virtio/virtio_pci.h +15 -0
@@ -141,6 +141,9 @@ struct virtnet_ctl;*/ #define VIRTIO_F_NOTIFICATION_DATA 38 +/* Device set linkspeed and duplex */ +#define VIRTIO_NET_F_SPEED_DUPLEX 63 +/* The Guest publishes the used index for which it expects an interrupt * at the end of the avail ring. Host should ignore the avail->flags field. */ /* The Host publishes the avail index for which it expects a kick
@@ -306,6 +309,18 @@ struct virtio_net_config {uint16_t status;uint16_t max_virtqueue_pairs;uint16_t mtu; +/* +* speed, in units of 1Mb. All values 0 to INT_MAX are legal. +* Any other value stands for unknown. +*/ +uint32_t speed; +/* +* 0x00 - half duplex +* 0x01 - full duplex +* Any other value stands for unknown. +*/ +uint8_t duplex; + } __attribute__((packed));/*
Signature · 1 line
2.17.1