From patchwork Thu Mar 12 10:17:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuya Mukawa X-Patchwork-Id: 3977 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id EAB865A88; Thu, 12 Mar 2015 11:18:21 +0100 (CET) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by dpdk.org (Postfix) with ESMTP id 96F125A6A for ; Thu, 12 Mar 2015 11:18:19 +0100 (CET) Received: by pabli10 with SMTP id li10so19473414pab.2 for ; Thu, 12 Mar 2015 03:18:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JEhd34i9n7AnCMfoMNujUcYVgiwGEjJWSLgzdorsE1A=; b=MxB7XFIeg+zCLck/+QA0lC+rj7YqcctFbRrAWr6EG9W9LgBaS6+mUsygtTwiM1yde0 Itmm88IvwR2WZnhMCRTAZrQvadIcuI9NA4GZBNac+jORwRg9iZCz4y0a7oMFJSJJUiSQ xbxTdK8Lh1rQuujIBmeD++RjzedyxLFrEBJqw2ltSWRLa1hdj4ZQH4lmoCDdtycMhX2x ZcJ8LK9IdQpqE93JNHPMktDXn1ZRxatU/ukcC+Hqhdg78py0pMdcFfhsCAVrjLSPhGz9 mgQcuD73uKipENt7j6f9X2APkBfHGNonSmx5mvLYz2HUJwGDowVLkGGg47yQ6uipxJbX 1UkA== X-Gm-Message-State: ALoCoQlgWX8RbC2OgV9IlaogHwMGeCICfVJ+Oo8w1OpquKodWg05NKuacGq2d3H5cLa5CAbW1gdl X-Received: by 10.67.3.105 with SMTP id bv9mr87055808pad.149.1426155498648; Thu, 12 Mar 2015 03:18:18 -0700 (PDT) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id z4sm10080331pdi.90.2015.03.12.03.18.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Mar 2015 03:18:18 -0700 (PDT) From: Tetsuya Mukawa To: dev@dpdk.org Date: Thu, 12 Mar 2015 19:17:40 +0900 Message-Id: <1426155474-1596-2-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426155474-1596-1-git-send-email-mukawa@igel.co.jp> References: <1425438703-18895-1-git-send-email-mukawa@igel.co.jp> <1426155474-1596-1-git-send-email-mukawa@igel.co.jp> Subject: [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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch fixes cording style of below files in linuxapp and bsdapp. - eal_pci.c - eal_pci_uio.c Signed-off-by: Tetsuya Mukawa --- 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;