From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by dpdk.org (Postfix) with ESMTP id 243F56848 for ; Sat, 7 Jun 2014 01:50:54 +0200 (CEST) Received: by mail-pb0-f50.google.com with SMTP id ma3so3081061pbc.23 for ; Fri, 06 Jun 2014 16:51:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:user-agent:date:from:to:cc:subject :references:mime-version:content-type:content-disposition; bh=3smGq/fZUBlbxDZ8c2spudbkBhiNjQjeT/KlZeT5V1A=; b=bacG+7k3PbocZ0piZ4lYApnBzmyPRKzUr5W0yjLjQLfQTGU7GeEPtncKBbF4hJprq2 Z02RiOtXbGSuKwzQX/eH2Ao4YA5gWQtxnLukuMKoKlBC0zohPBpC+QmxrG0cY0zyklXH Um26oGqr2T/Qlb0G0Iy52MwieUYQlComWgoh6hZq0gEueNuZ2Q2CXPXA8uahATAt7Bp7 p9Z8H1arsyc6DIBkeZisJBo2hAIlHoGvQVM3B1EsSxe6RqKw2WVRtRm/5jtd4NjEVHiI Ryy2in64gDAO/pzU4BPfS1R1ZocPD6FaeBETtjY6NlRzOPw+sQeD3PC1qvFOuIXArsW0 RRXw== X-Gm-Message-State: ALoCoQnKb4gcbhjPIaw3s7gv/p6z1wzNfVY+zKmTfiXcMECTRnNopGrDl1cPFQX49kb6p+DOefAo X-Received: by 10.68.247.131 with SMTP id ye3mr12270595pbc.40.1402098668426; Fri, 06 Jun 2014 16:51:08 -0700 (PDT) Received: from localhost (static-50-53-83-51.bvtn.or.frontiernet.net. [50.53.83.51]) by mx.google.com with ESMTPSA id ec2sm40862233pbc.63.2014.06.06.16.51.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jun 2014 16:51:07 -0700 (PDT) Message-Id: <20140606235106.919627057@networkplumber.org> User-Agent: quilt/0.63-1 Date: Fri, 06 Jun 2014 16:50:32 -0700 From: Stephen Hemminger To: Alan Carew References: <20140606235028.189345212@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=igb_uio-better-pci-num-vf.patch Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH v2 04/10] igb_uio: dont wrap pci_num_vf function needlessly X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jun 2014 23:50:56 -0000 It is better style to just use the pci_num_vf directly, rather than wrapping it with a local (but globally named) function with the same effect. Signed-off-by: Stephen Hemminger --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -98,9 +98,8 @@ } /* sriov sysfs */ -int local_pci_num_vf(struct pci_dev *dev) -{ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) +static int pci_num_vf(struct pci_dev *dev) struct iov { int pos; int nres; @@ -115,17 +114,15 @@ return 0; return iov->nr_virtfn; -#else - return pci_num_vf(dev); -#endif } +#endif static ssize_t show_max_vfs(struct device *dev, struct device_attribute *attr, char *buf) { - return snprintf(buf, 10, "%u\n", local_pci_num_vf( - container_of(dev, struct pci_dev, dev))); + return snprintf(buf, 10, "%u\n", + pci_num_vf(container_of(dev, struct pci_dev, dev))); } static ssize_t @@ -141,7 +138,7 @@ if (0 == max_vfs) pci_disable_sriov(pdev); - else if (0 == local_pci_num_vf(pdev)) + else if (0 == pci_num_vf(pdev)) err = pci_enable_sriov(pdev, max_vfs); else /* do nothing if change max_vfs number */ err = -EINVAL;