[dpdk-dev] [PATCH 14/31] net/bnxt: code cleanup style of bnxt vnic

Ajit Khaparde ajit.khaparde at broadcom.com
Tue Jun 19 23:30:41 CEST 2018


From: Scott Branden <scott.branden at broadcom.com>

Cleanup alignment, brackets, debug string style of bnxt_vnic

Signed-off-by: Scott Branden <scott.branden at broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
---
 drivers/net/bnxt/bnxt_vnic.c | 26 +++++++++++++-------------
 drivers/net/bnxt/bnxt_vnic.h |  8 ++++++--
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index 19d06af55..5d9d369a3 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -64,8 +64,9 @@ void bnxt_init_vnics(struct bnxt *bp)
 		STAILQ_INIT(&bp->ff_pool[i]);
 }
 
-int bnxt_free_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic,
-			  int pool)
+int bnxt_free_vnic(struct bnxt *bp,
+		   struct bnxt_vnic_info *vnic,
+		   int pool)
 {
 	struct bnxt_vnic_info *temp;
 
@@ -143,14 +144,16 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 	struct rte_pci_device *pdev = bp->pdev;
 	const struct rte_memzone *mz;
 	char mz_name[RTE_MEMZONE_NAMESIZE];
-	uint32_t entry_length = RTE_CACHE_LINE_ROUNDUP(
-				HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table) +
-				HW_HASH_KEY_SIZE +
-				BNXT_MAX_MC_ADDRS * ETHER_ADDR_LEN);
+	uint32_t entry_length;
 	uint16_t max_vnics;
 	int i;
 	rte_iova_t mz_phys_addr;
 
+	entry_length = RTE_CACHE_LINE_ROUNDUP
+			(HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table) +
+			 HW_HASH_KEY_SIZE +
+			 BNXT_MAX_MC_ADDRS * ETHER_ADDR_LEN);
+
 	max_vnics = bp->max_vnics;
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
 		 "bnxt_%04x:%02x:%02x:%02x_vnicattr", pdev->addr.domain,
@@ -168,14 +171,11 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 	}
 	mz_phys_addr = mz->iova;
 	if ((unsigned long)mz->addr == mz_phys_addr) {
-		PMD_DRV_LOG(WARNING,
-			"Memzone physical address same as virtual.\n");
-		PMD_DRV_LOG(WARNING,
-			"Using rte_mem_virt2iova()\n");
+		PMD_DRV_LOG(WARNING, "Memzone phys addr == virtual\n");
+		PMD_DRV_LOG(WARNING, "Using rte_mem_virt2iova()\n");
 		mz_phys_addr = rte_mem_virt2iova(mz->addr);
 		if (mz_phys_addr == 0) {
-			PMD_DRV_LOG(ERR,
-			"unable to map vnic address to physical memory\n");
+			PMD_DRV_LOG(ERR, "unable to map vnic addr\n");
 			return -ENOMEM;
 		}
 	}
@@ -234,7 +234,7 @@ int bnxt_alloc_vnic_mem(struct bnxt *bp)
 	vnic_mem = rte_zmalloc("bnxt_vnic_info",
 			       max_vnics * sizeof(struct bnxt_vnic_info), 0);
 	if (vnic_mem == NULL) {
-		PMD_DRV_LOG(ERR, "Failed to alloc memory for %d VNICs",
+		PMD_DRV_LOG(ERR, "Failed to alloc memory for %d VNICs\n",
 			max_vnics);
 		return -ENOMEM;
 	}
diff --git a/drivers/net/bnxt/bnxt_vnic.h b/drivers/net/bnxt/bnxt_vnic.h
index c521d7e5a..3401ae098 100644
--- a/drivers/net/bnxt/bnxt_vnic.h
+++ b/drivers/net/bnxt/bnxt_vnic.h
@@ -58,12 +58,16 @@ struct bnxt_vnic_info {
 
 struct bnxt;
 void bnxt_init_vnics(struct bnxt *bp);
-int bnxt_free_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic,
-			  int pool);
+
+int bnxt_free_vnic(struct bnxt *bp,
+		   struct bnxt_vnic_info *vnic,
+		   int pool);
+
 struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp);
 void bnxt_free_all_vnics(struct bnxt *bp);
 void bnxt_free_vnic_attributes(struct bnxt *bp);
 int bnxt_alloc_vnic_attributes(struct bnxt *bp);
 void bnxt_free_vnic_mem(struct bnxt *bp);
 int bnxt_alloc_vnic_mem(struct bnxt *bp);
+
 #endif
-- 
2.15.1 (Apple Git-101)



More information about the dev mailing list