From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 50F875952 for ; Thu, 12 Mar 2015 11:49:17 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 12 Mar 2015 03:48:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,387,1422950400"; d="scan'208";a="691006307" Received: from bricha3-mobl3.ger.corp.intel.com ([10.243.20.23]) by fmsmga002.fm.intel.com with SMTP; 12 Mar 2015 03:48:51 -0700 Received: by (sSMTP sendmail emulation); Thu, 12 Mar 2015 10:48:50 +0025 Date: Thu, 12 Mar 2015 10:48:50 +0000 From: Bruce Richardson To: Tetsuya Mukawa Message-ID: <20150312104850.GA10100@bricha3-MOBL3> References: <1425438703-18895-1-git-send-email-mukawa@igel.co.jp> <1426155474-1596-1-git-send-email-mukawa@igel.co.jp> <1426155474-1596-2-git-send-email-mukawa@igel.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1426155474-1596-2-git-send-email-mukawa@igel.co.jp> Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v2 01/15] eal: Fix cording style of eal_pci.c and eal_pci_uio.c 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: Thu, 12 Mar 2015 10:49:18 -0000 On Thu, Mar 12, 2015 at 07:17:40PM +0900, Tetsuya Mukawa wrote: > This patch fixes cording style of below files in linuxapp and bsdapp. > - eal_pci.c > - eal_pci_uio.c > > Signed-off-by: Tetsuya Mukawa Hi Tetsuya, While there is some good cleanup here, I disagree with a number of the changes made purely to the whitespace in the file. The style of using a double-indent for line continuations is very widely used in DPDK code, much more so than the style of lining things up with the previous line. So ack to the changes removing unnecessary braces, and occasional splitting of really long lines (though a few chars over 80 is ok). NAK to the whitespace and indentation changes. Regards, /Bruce > --- > lib/librte_eal/bsdapp/eal/eal_pci.c | 67 ++++++++++++++++++------------- > lib/librte_eal/linuxapp/eal/eal_pci.c | 32 +++++++++------ > lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 37 ++++++++++------- > 3 files changed, 80 insertions(+), 56 deletions(-) > > diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c > index fe3ef86..cbd0a4e 100644 > --- a/lib/librte_eal/bsdapp/eal/eal_pci.c > +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c > @@ -142,8 +142,9 @@ pci_map_resource(void *requested_addr, const char *devname, off_t offset, > MAP_SHARED, fd, offset); > close(fd); > if (mapaddr == MAP_FAILED || > - (requested_addr != NULL && mapaddr != requested_addr)) { > - RTE_LOG(ERR, EAL, "%s(): cannot mmap(%s(%d), %p, 0x%lx, 0x%lx):" > + (requested_addr != NULL && mapaddr != requested_addr)) { > + RTE_LOG(ERR, EAL, > + "%s(): cannot mmap(%s(%d), %p, 0x%lx, 0x%lx):" > " %s (%p)\n", __func__, devname, fd, requested_addr, > (unsigned long)size, (unsigned long)offset, > strerror(errno), mapaddr); > @@ -161,9 +162,10 @@ fail: > static int > pci_uio_map_secondary(struct rte_pci_device *dev) > { > - size_t i; > - struct uio_resource *uio_res; > - struct uio_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, uio_res_list); > + size_t i; > + struct uio_resource *uio_res; > + struct uio_res_list *uio_res_list = > + RTE_TAILQ_CAST(rte_uio_tailq.head, uio_res_list); > > TAILQ_FOREACH(uio_res, uio_res_list, next) { > > @@ -179,10 +181,10 @@ pci_uio_map_secondary(struct rte_pci_device *dev) > != uio_res->maps[i].addr) { > RTE_LOG(ERR, EAL, > "Cannot mmap device resource\n"); > - return (-1); > + return -1; > } > } > - return (0); > + return 0; > } > > RTE_LOG(ERR, EAL, "Cannot find resource for device\n"); > @@ -201,7 +203,8 @@ pci_uio_map_resource(struct rte_pci_device *dev) > uint64_t pagesz; > struct rte_pci_addr *loc = &dev->addr; > struct uio_resource *uio_res; > - struct uio_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, uio_res_list); > + struct uio_res_list *uio_res_list = > + RTE_TAILQ_CAST(rte_uio_tailq.head, uio_res_list); > struct uio_map *maps; > > dev->intr_handle.fd = -1; > @@ -209,14 +212,16 @@ pci_uio_map_resource(struct rte_pci_device *dev) > > /* secondary processes - use already recorded details */ > if (rte_eal_process_type() != RTE_PROC_PRIMARY) > - return (pci_uio_map_secondary(dev)); > + return pci_uio_map_secondary(dev); > > snprintf(devname, sizeof(devname), "/dev/uio@pci:%u:%u:%u", > dev->addr.bus, dev->addr.devid, dev->addr.function); > > if (access(devname, O_RDWR) < 0) { > - RTE_LOG(WARNING, EAL, " "PCI_PRI_FMT" not managed by UIO driver, " > - "skipping\n", loc->domain, loc->bus, loc->devid, loc->function); > + RTE_LOG(WARNING, EAL, > + " "PCI_PRI_FMT" not managed by UIO driver, " > + "skipping\n", loc->domain, loc->bus, > + loc->devid, loc->function); > return 1; > } > > @@ -233,7 +238,7 @@ pci_uio_map_resource(struct rte_pci_device *dev) > if ((uio_res = rte_zmalloc("UIO_RES", sizeof (*uio_res), 0)) == NULL) { > RTE_LOG(ERR, EAL, > "%s(): cannot store uio mmap details\n", __func__); > - return (-1); > + return -1; > } > > snprintf(uio_res->path, sizeof(uio_res->path), "%s", devname); > @@ -248,7 +253,8 @@ pci_uio_map_resource(struct rte_pci_device *dev) > > j = uio_res->nb_maps; > /* skip empty BAR */ > - if ((phaddr = dev->mem_resource[i].phys_addr) == 0) > + phaddr = dev->mem_resource[i].phys_addr; > + if (phaddr == 0) > continue; > > /* if matching map is found, then use it */ > @@ -261,7 +267,7 @@ pci_uio_map_resource(struct rte_pci_device *dev) > (size_t)maps[j].size) > ) == NULL) { > rte_free(uio_res); > - return (-1); > + return -1; > } > > maps[j].addr = mapaddr; > @@ -271,7 +277,7 @@ pci_uio_map_resource(struct rte_pci_device *dev) > > TAILQ_INSERT_TAIL(uio_res_list, uio_res, next); > > - return (0); > + return 0; > } > > /* Scan one pci sysfs entry, and fill the devices list from it. */ > @@ -311,7 +317,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf) > /* FreeBSD has no NUMA support (yet) */ > dev->numa_node = 0; > > -/* parse resources */ > + /* parse resources */ > switch (conf->pc_hdr & PCIM_HDRTYPE) { > case PCIM_HDRTYPE_NORMAL: > max = PCIR_MAX_BAR_0; > @@ -440,32 +446,37 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d > > /* check if device's identifiers match the driver's ones */ > if (id_table->vendor_id != dev->id.vendor_id && > - id_table->vendor_id != PCI_ANY_ID) > + id_table->vendor_id != PCI_ANY_ID) > continue; > if (id_table->device_id != dev->id.device_id && > - id_table->device_id != PCI_ANY_ID) > + id_table->device_id != PCI_ANY_ID) > continue; > - if (id_table->subsystem_vendor_id != dev->id.subsystem_vendor_id && > - id_table->subsystem_vendor_id != PCI_ANY_ID) > + if (id_table->subsystem_vendor_id != > + dev->id.subsystem_vendor_id && > + id_table->subsystem_vendor_id != PCI_ANY_ID) > continue; > - if (id_table->subsystem_device_id != dev->id.subsystem_device_id && > - id_table->subsystem_device_id != PCI_ANY_ID) > + if (id_table->subsystem_device_id != > + dev->id.subsystem_device_id && > + id_table->subsystem_device_id != PCI_ANY_ID) > continue; > > struct rte_pci_addr *loc = &dev->addr; > > - RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n", > - loc->domain, loc->bus, loc->devid, loc->function, > - dev->numa_node); > + RTE_LOG(DEBUG, EAL, > + "PCI device "PCI_PRI_FMT" on NUMA socket %i\n", > + loc->domain, loc->bus, loc->devid, loc->function, > + dev->numa_node); > > - RTE_LOG(DEBUG, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id, > - dev->id.device_id, dr->name); > + RTE_LOG(DEBUG, EAL, > + " probe driver: %x:%x %s\n", dev->id.vendor_id, > + dev->id.device_id, dr->name); > > /* no initialization when blacklisted, return without error */ > if (dev->devargs != NULL && > dev->devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) { > > - RTE_LOG(DEBUG, EAL, " Device is blacklisted, not initializing\n"); > + RTE_LOG(DEBUG, EAL, > + " Device is blacklisted, not initializing\n"); > return 0; > } > > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c > index 83c589e..353b0b8 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c > @@ -154,7 +154,8 @@ pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size, > mapaddr = mmap(requested_addr, size, PROT_READ | PROT_WRITE, > MAP_SHARED | additional_flags, fd, offset); > if (mapaddr == MAP_FAILED) { > - RTE_LOG(ERR, EAL, "%s(): cannot mmap(%d, %p, 0x%lx, 0x%lx): %s (%p)\n", > + RTE_LOG(ERR, EAL, > + "%s(): cannot mmap(%d, %p, 0x%lx, 0x%lx): %s (%p)\n", > __func__, fd, requested_addr, > (unsigned long)size, (unsigned long)offset, > strerror(errno), mapaddr); > @@ -631,31 +632,36 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d > > /* check if device's identifiers match the driver's ones */ > if (id_table->vendor_id != dev->id.vendor_id && > - id_table->vendor_id != PCI_ANY_ID) > + id_table->vendor_id != PCI_ANY_ID) > continue; > if (id_table->device_id != dev->id.device_id && > - id_table->device_id != PCI_ANY_ID) > + id_table->device_id != PCI_ANY_ID) > continue; > - if (id_table->subsystem_vendor_id != dev->id.subsystem_vendor_id && > - id_table->subsystem_vendor_id != PCI_ANY_ID) > + if (id_table->subsystem_vendor_id != > + dev->id.subsystem_vendor_id && > + id_table->subsystem_vendor_id != PCI_ANY_ID) > continue; > - if (id_table->subsystem_device_id != dev->id.subsystem_device_id && > - id_table->subsystem_device_id != PCI_ANY_ID) > + if (id_table->subsystem_device_id != > + dev->id.subsystem_device_id && > + id_table->subsystem_device_id != PCI_ANY_ID) > continue; > > struct rte_pci_addr *loc = &dev->addr; > > - RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n", > - loc->domain, loc->bus, loc->devid, loc->function, > - dev->numa_node); > + RTE_LOG(DEBUG, EAL, > + "PCI device "PCI_PRI_FMT" on NUMA socket %i\n", > + loc->domain, loc->bus, loc->devid, loc->function, > + dev->numa_node); > > - RTE_LOG(DEBUG, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id, > - dev->id.device_id, dr->name); > + RTE_LOG(DEBUG, EAL, > + " probe driver: %x:%x %s\n", dev->id.vendor_id, > + dev->id.device_id, dr->name); > > /* no initialization when blacklisted, return without error */ > if (dev->devargs != NULL && > dev->devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) { > - RTE_LOG(DEBUG, EAL, " Device is blacklisted, not initializing\n"); > + RTE_LOG(DEBUG, EAL, > + " Device is blacklisted, not initializing\n"); > return 1; > } > > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > index 2d1c69b..6f229d6 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > @@ -92,7 +92,8 @@ pci_uio_map_secondary(struct rte_pci_device *dev) > { > int fd, i; > struct mapped_pci_resource *uio_res; > - struct mapped_pci_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list); > + struct mapped_pci_res_list *uio_res_list = > + RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list); > > TAILQ_FOREACH(uio_res, uio_res_list, next) { > > @@ -117,14 +118,16 @@ pci_uio_map_secondary(struct rte_pci_device *dev) > if (mapaddr != uio_res->maps[i].addr) { > if (mapaddr == MAP_FAILED) > RTE_LOG(ERR, EAL, > - "Cannot mmap device resource file %s: %s\n", > - uio_res->maps[i].path, > - strerror(errno)); > + "Cannot mmap device resource " > + "file %s: %s\n", > + uio_res->maps[i].path, > + strerror(errno)); > else > RTE_LOG(ERR, EAL, > - "Cannot mmap device resource file %s to address: %p\n", > - uio_res->maps[i].path, > - uio_res->maps[i].addr); > + "Cannot mmap device resource " > + "file %s to address: %p\n", > + uio_res->maps[i].path, > + uio_res->maps[i].addr); > > close(fd); > return -1; > @@ -272,7 +275,8 @@ pci_uio_map_resource(struct rte_pci_device *dev) > uint64_t phaddr; > struct rte_pci_addr *loc = &dev->addr; > struct mapped_pci_resource *uio_res; > - struct mapped_pci_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list); > + struct mapped_pci_res_list *uio_res_list = > + RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list); > struct pci_map *maps; > > dev->intr_handle.fd = -1; > @@ -286,8 +290,10 @@ pci_uio_map_resource(struct rte_pci_device *dev) > /* find uio resource */ > uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname)); > if (uio_num < 0) { > - RTE_LOG(WARNING, EAL, " "PCI_PRI_FMT" not managed by UIO driver, " > - "skipping\n", loc->domain, loc->bus, loc->devid, loc->function); > + RTE_LOG(WARNING, EAL, > + " "PCI_PRI_FMT" not managed by UIO driver, " > + "skipping\n", loc->domain, loc->bus, > + loc->devid, loc->function); > return 1; > } > snprintf(devname, sizeof(devname), "/dev/uio%u", uio_num); > @@ -338,12 +344,11 @@ pci_uio_map_resource(struct rte_pci_device *dev) > if (phaddr == 0) > continue; > > - > /* update devname for mmap */ > snprintf(devname, sizeof(devname), > SYSFS_PCI_DEVICES "/" PCI_PRI_FMT "/resource%d", > - loc->domain, loc->bus, loc->devid, loc->function, > - i); > + loc->domain, loc->bus, loc->devid, > + loc->function, i); > > /* > * open resource file, to mmap it > @@ -412,7 +417,8 @@ static struct mapped_pci_resource * > pci_uio_find_resource(struct rte_pci_device *dev) > { > struct mapped_pci_resource *uio_res; > - struct mapped_pci_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list); > + struct mapped_pci_res_list *uio_res_list = > + RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list); > > if (dev == NULL) > return NULL; > @@ -431,7 +437,8 @@ void > pci_uio_unmap_resource(struct rte_pci_device *dev) > { > struct mapped_pci_resource *uio_res; > - struct mapped_pci_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list); > + struct mapped_pci_res_list *uio_res_list = > + RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list); > > if (dev == NULL) > return; > -- > 1.9.1 >