From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH] net/nfp: avoid sysfs resource file access Date: Wed, 27 Jun 2018 15:31:41 +0100 Message-ID: <16e8f779-fd7a-9cf2-d82c-06f9819ccfa3@intel.com> References: <1530019540-27680-1-git-send-email-alejandro.lucero@netronome.com> <208e8416-29d5-78ea-91d3-dd18da767240@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Alejandro Lucero , dev@dpdk.org Return-path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id C79C91BF0B for ; Wed, 27 Jun 2018 16:31:56 +0200 (CEST) In-Reply-To: <208e8416-29d5-78ea-91d3-dd18da767240@intel.com> Content-Language: en-US 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 6/27/2018 3:27 PM, Ferruh Yigit wrote: > On 6/26/2018 2:25 PM, Alejandro Lucero wrote: >> Getting the bar size is required for NFP CPP interface configuration. >> However, this information can be obtained from the VFIO or UIO driver >> instead of accessing the sysfs resource file. >> >> Signed-off-by: Alejandro Lucero >> --- >> drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 27 +++++---------------------- >> 1 file changed, 5 insertions(+), 22 deletions(-) >> >> diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c >> index 2a1ec96..b0beb8d 100644 >> --- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c >> +++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c >> @@ -762,33 +762,16 @@ struct nfp6000_area_priv { >> } >> >> static int >> -nfp6000_set_barsz(struct nfp_pcie_user *desc) >> +nfp6000_set_barsz(struct rte_pci_device *dev, struct nfp_pcie_user *desc) > > Need to update caller of this function. I can see the that it has been modified in other patch [1], I will move the change from other patch to here, please double check and confirm the final commits. [1] https://patches.dpdk.org/patch/41573/ > >> { >> - char tmp_str[80]; >> - unsigned long start, end, flags, tmp; >> - int i; >> - FILE *fp; >> - >> - snprintf(tmp_str, sizeof(tmp_str), "%s/%s/resource", PCI_DEVICES, >> - desc->busdev); >> - >> - fp = fopen(tmp_str, "r"); >> - if (!fp) >> - return -1; >> + unsigned long tmp; >> + int i = 0; >> >> - if (fscanf(fp, "0x%lx 0x%lx 0x%lx", &start, &end, &flags) == 0) { >> - printf("error reading resource file for bar size\n"); >> - fclose(fp); >> - return -1; >> - } >> + tmp = dev->mem_resource[0].len; >> >> - if (fclose(fp) == -1) >> - return -1; >> - >> - tmp = (end - start) + 1; >> - i = 0; >> while (tmp >>= 1) >> i++; >> + >> desc->barsz = i; >> return 0; >> } >> >