[v7,21/25] examples/ntb: new link status print format
diff mbox series

Message ID 20200710070226.6045-22-i.dyukov@samsung.com
State Deferred
Delegated to: Ferruh Yigit
Headers show
Series
  • ethdev: allow unknown link speed
Related show

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Ivan Dyukov July 10, 2020, 7:02 a.m. UTC
Add usage of rte_eth_link_strf function to example
applications

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
---
 examples/ntb/ntb_fwd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Ferruh Yigit July 10, 2020, 1:20 p.m. UTC | #1
> -----Original Message-----
> From: Ivan Dyukov <i.dyukov@samsung.com>
> Sent: Friday, July 10, 2020 8:02 AM
> To: dev@dpdk.org; i.dyukov@samsung.com; v.kuramshin@samsung.com;
> thomas@monjalon.net; david.marchand@redhat.com; Yigit, Ferruh
> <ferruh.yigit@intel.com>; arybchenko@solarflare.com; Zhao1, Wei
> <wei.zhao1@intel.com>; Guo, Jia <jia.guo@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Lu,
> Wenzhuo <wenzhuo.lu@intel.com>; mb@smartsharesystems.com;
> stephen@networkplumber.org; Chautru, Nicolas
> <nicolas.chautru@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; Nicolau, Radu <radu.nicolau@intel.com>;
> akhil.goyal@nxp.com; Doherty, Declan <declan.doherty@intel.com>;
> skori@marvell.com; pbhagavatula@marvell.com; jerinj@marvell.com;
> kirankumark@marvell.com; Hunt, David <david.hunt@intel.com>; Burakov,
> Anatoly <anatoly.burakov@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>;
> Wu, Jingjing <jingjing.wu@intel.com>; Mcnamara, John
> <john.mcnamara@intel.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>; Marohn, Byron <byron.marohn@intel.com>;
> Wang, Yipeng1 <yipeng1.wang@intel.com>
> Subject: [PATCH v7 21/25] examples/ntb: new link status print format
> 
> Add usage of rte_eth_link_strf function to example applications
> 
> Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
> ---
>  examples/ntb/ntb_fwd.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c index
> eba8ebf9f..84fe374c4 100644
> --- a/examples/ntb/ntb_fwd.c
> +++ b/examples/ntb/ntb_fwd.c
> @@ -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[60];
> 
>  	ret = ntb_fwd_config_setup();
>  	if (ret < 0) {
> @@ -747,11 +748,10 @@ 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_strf(link_status_text, 60, NULL,
> +						    &link);

s/link/eth_link/

.../examples/ntb/ntb_fwd.c:752:11: error: passing argument 4 of ‘rte_eth_link_strf’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  752 |           &link);
      |           ^~~~~
      |           |
      |           int (*)(const char *, const char *)

> +				printf("Eth%u %s", eth_port_id,
> +				       link_status_text);
>  				break;
>  			}
>  		}
> --
> 2.17.1

Patch
diff mbox series

diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c
index eba8ebf9f..84fe374c4 100644
--- a/examples/ntb/ntb_fwd.c
+++ b/examples/ntb/ntb_fwd.c
@@ -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[60];
 
 	ret = ntb_fwd_config_setup();
 	if (ret < 0) {
@@ -747,11 +748,10 @@  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_strf(link_status_text, 60, NULL,
+						    &link);
+				printf("Eth%u %s", eth_port_id,
+				       link_status_text);
 				break;
 			}
 		}