From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BC49AA04C8; Fri, 18 Sep 2020 20:15:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2F7251DB11; Fri, 18 Sep 2020 20:15:56 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 254471DB0F for ; Fri, 18 Sep 2020 20:15:54 +0200 (CEST) IronPort-SDR: dWUZfX693Xui1V3zDTAYCCH6Ffm2hx52pGG8etzcH3JtzdKd7TRLHSMYTSByuOOoxusbUCSr/Q FLeQe7TmdkEg== X-IronPort-AV: E=McAfee;i="6000,8403,9748"; a="159316764" X-IronPort-AV: E=Sophos;i="5.77,274,1596524400"; d="scan'208";a="159316764" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2020 11:15:47 -0700 IronPort-SDR: JY7mjQU1V4uJEnAUAG2Hip3rgh+kT4TCTXMKFw3ENvMrONu/vuu9ccODOkBkOy6n/Pbc2Oy+j6 WlS+ibq6kXhA== X-IronPort-AV: E=Sophos;i="5.77,274,1596524400"; d="scan'208";a="484308792" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.227.248]) ([10.213.227.248]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2020 11:15:41 -0700 To: i.dyukov@samsung.com, dev@dpdk.org, v.kuramshin@samsung.com, thomas@monjalon.net, david.marchand@redhat.com, arybchenko@solarflare.com, wei.zhao1@intel.com, jia.guo@intel.com, beilei.xing@intel.com, qiming.yang@intel.com, wenzhuo.lu@intel.com, mb@smartsharesystems.com, stephen@networkplumber.org, nicolas.chautru@intel.com, bruce.richardson@intel.com, konstantin.ananyev@intel.com, cristian.dumitrescu@intel.com, radu.nicolau@intel.com, akhil.goyal@nxp.com, declan.doherty@intel.com, skori@marvell.com, pbhagavatula@marvell.com, jerinj@marvell.com, kirankumark@marvell.com, david.hunt@intel.com, anatoly.burakov@intel.com, xiaoyun.li@intel.com, jingjing.wu@intel.com, john.mcnamara@intel.com, jasvinder.singh@intel.com, byron.marohn@intel.com, yipeng1.wang@intel.com References: <20200427095737.11082-1-i.dyukov@samsung.com> <20200915190728.18143-1-i.dyukov@samsung.com> <20200915190728.18143-8-i.dyukov@samsung.com> From: Ferruh Yigit Message-ID: Date: Fri, 18 Sep 2020 19:15:39 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: <20200915190728.18143-8-i.dyukov@samsung.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v11 07/24] examples: new link status print format X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 9/15/2020 8:07 PM, Ivan Dyukov wrote: > Add usage of rte_eth_link_to_str function to example > applications: > * ipv4_multicast > * l2fwd-jobstats > * l2fwd-keepalive > * l3fwd > * link_status_interrupt > > Signed-off-by: Ivan Dyukov <...> > --- a/examples/link_status_interrupt/main.c > +++ b/examples/link_status_interrupt/main.c > @@ -133,7 +133,7 @@ print_stats(void) > link_get_err = rte_eth_link_get_nowait(portid, &link); > printf("\nStatistics for port %u ------------------------------" > "\nLink status: %25s" > - "\nLink speed: %26u" > + "\nLink speed: %26s" > "\nLink duplex: %25s" > "\nPackets sent: %24"PRIu64 > "\nPackets received: %20"PRIu64 > @@ -141,8 +141,8 @@ print_stats(void) > portid, > link_get_err < 0 ? "Link get failed" : > (link.link_status ? "Link up" : "Link down"), > - link_get_err < 0 ? 0 : > - (unsigned int)link.link_speed, > + link_get_err < 0 ? "0" : > + rte_eth_link_speed_to_str(link.link_speed), > link_get_err < 0 ? "Link get failed" : > (link.link_duplex == ETH_LINK_FULL_DUPLEX ? \ > "full-duplex" : "half-duplex"), > @@ -445,6 +445,7 @@ lsi_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *param, > { > struct rte_eth_link link; > int ret; > + char link_status_text[ETH_LINK_MAX_STR_LEN]; s/ETH_LINK_MAX_STR_LEN/RTE_ETH_LINK_MAX_STR_LEN/ > > RTE_SET_USED(param); > RTE_SET_USED(ret_param); > @@ -457,13 +458,9 @@ lsi_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *param, > port_id, rte_strerror(-ret)); > return ret; > } > - if (link.link_status) { > - printf("Port %d Link Up - speed %u Mbps - %s\n\n", > - port_id, (unsigned)link.link_speed, > - (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? > - ("full-duplex") : ("half-duplex")); > - } else > - printf("Port %d Link Down\n\n", port_id); > + rte_eth_link_to_str(link_status_text, sizeof(link_status_text), > + NULL, &link); > + printf("Port %d %s\n\n", port_id, link_status_text); > > return 0; > } > @@ -478,6 +475,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[ETH_LINK_MAX_STR_LEN]; s/ETH_LINK_MAX_STR_LEN/RTE_ETH_LINK_MAX_STR_LEN/ > > printf("\nChecking link status"); > fflush(stdout); > @@ -497,14 +495,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), NULL, &link); > + printf("Port %d %s", portid, > + link_status_text); > continue; > } > /* clear all_ports_up flag if any link down */ >