From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 749915F48 for ; Fri, 21 Sep 2018 18:49:32 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Sep 2018 09:49:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,285,1534834800"; d="scan'208";a="71877418" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.39]) ([10.237.221.39]) by fmsmga007.fm.intel.com with ESMTP; 21 Sep 2018 09:49:30 -0700 To: =?UTF-8?Q?Ga=c3=abtan_Rivet?= Cc: dev@dpdk.org References: <01e0e0ffd6a796a73150588823cf3434aafa7c50.1537261084.git.gaetan.rivet@6wind.com> <582815f0-926e-8977-c8d1-3d4e1c5e2fd4@intel.com> <20180921161327.q54z27v2wrt27q4f@bidouze.vm.6wind.com> From: Ferruh Yigit Openpgp: preference=signencrypt Message-ID: <5b2d590a-ccf2-1b42-22d2-8cdd020b14f2@intel.com> Date: Fri, 21 Sep 2018 17:49:30 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180921161327.q54z27v2wrt27q4f@bidouze.vm.6wind.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v1] testpmd: eeprom display 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: , X-List-Received-Date: Fri, 21 Sep 2018 16:49:32 -0000 On 9/21/2018 5:13 PM, Gaƫtan Rivet wrote: > On Fri, Sep 21, 2018 at 04:41:10PM +0100, Ferruh Yigit wrote: >> On 9/18/2018 9:59 AM, Gaetan Rivet wrote: >>> The interactive command >>> >>> show port eeprom >>> >>> will dump the content of the EEPROM for the selected port. >>> Dumping eeprom of all ports at once is not supported. >>> >>> Signed-off-by: Gaetan Rivet >> >> <...> >> >>> +void >>> +port_eeprom_display(portid_t port_id) >>> +{ >>> + struct rte_eth_dev_module_info minfo; >>> + struct rte_dev_eeprom_info einfo; >>> + char buf[1024]; >>> + int ret; >>> + >>> + if (port_id == (portid_t)RTE_PORT_ALL) >>> + return; >>> + >>> + ret = rte_eth_dev_get_module_info(port_id, &minfo); >>> + if (ret) { >>> + printf("Unable to get module info: %d\n", ret); >>> + return; >>> + } >>> + >>> + einfo.offset = 0; >>> + einfo.length = minfo.eeprom_len; >>> + einfo.data = buf; >>> + >>> + ret = rte_eth_dev_get_module_eeprom(port_id, &einfo); >>> + if (ret) { >>> + printf("Unable to get module EEPROM: %d\n", ret); >>> + return; >>> + } >>> + >>> + printf("Port %hhu EEPROM:\n", port_id); >> >> Causing build error [1], there are various formatting used for printing port_id >> [2], do we need this %hhu accuracy, I am for %u since port_id is an unsigned >> value result should be same. >> >> [1] >> printf("Port %hhu EEPROM:\n", port_id); >> ~~~~ ^~~~~~~ >> %hu >> >> [2] >> %d, %u, %PRIu8 [wrong], %PRIu16 > > You're right, no need for %hhu. > I'd prefer myself using PRIu8 only by principle, but I think consistency > is better, and testpmd uses %u more often. > > On another note, I think this command was misnamed anyway. > >> show port sfp_eeprom 0 > > is more correct, because we won't get the actual port EEPROM. > I will send a v2, thanks for reading Ferruh. Ok, thanks.