diff mbox series

[13/31] net/bnxt: code cleanup style of bnxt stats

Message ID 20180619213058.12273-14-ajit.khaparde@broadcom.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers show
Series bnxt patchset | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Ajit Khaparde June 19, 2018, 9:30 p.m. UTC
From: Scott Branden <scott.branden@broadcom.com>

Cleanup alignment, brackets, debug string style of bnxt_stats

Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_stats.c | 84 ++++++++++++++++++++++++++-----------------
 drivers/net/bnxt/bnxt_stats.h | 27 +++++++++-----
 2 files changed, 70 insertions(+), 41 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index a5d3c8660..d930aa00e 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -201,7 +201,7 @@  void bnxt_free_stats(struct bnxt *bp)
 }
 
 int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
-			   struct rte_eth_stats *bnxt_stats)
+		      struct rte_eth_stats *bnxt_stats)
 {
 	int rc = 0;
 	unsigned int i;
@@ -217,8 +217,11 @@  int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 		struct bnxt_rx_queue *rxq = bp->rx_queues[i];
 		struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
 
-		rc = bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i,
-				     bnxt_stats, 1);
+		rc = bnxt_hwrm_ctx_qstats(bp,
+					  cpr->hw_stats_ctx_id,
+					  i,
+					  bnxt_stats,
+					  1);
 		if (unlikely(rc))
 			return rc;
 		bnxt_stats->rx_nombuf +=
@@ -229,8 +232,12 @@  int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 		struct bnxt_tx_queue *txq = bp->tx_queues[i];
 		struct bnxt_cp_ring_info *cpr = txq->cp_ring;
 
-		rc = bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i,
-				     bnxt_stats, 0);
+		rc = bnxt_hwrm_ctx_qstats(bp,
+					  cpr->hw_stats_ctx_id,
+					  i,
+					  bnxt_stats,
+					  0);
+
 		if (unlikely(rc))
 			return rc;
 	}
@@ -259,7 +266,8 @@  void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
 }
 
 int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
-			   struct rte_eth_xstat *xstats, unsigned int n)
+			   struct rte_eth_xstat *xstats,
+			   unsigned int n)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 
@@ -279,18 +287,20 @@  int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 	for (i = 0; i < RTE_DIM(bnxt_rx_stats_strings); i++) {
 		uint64_t *rx_stats = (uint64_t *)bp->hw_rx_port_stats;
 		xstats[count].id = count;
-		xstats[count].value = rte_le_to_cpu_64(
-				*(uint64_t *)((char *)rx_stats +
-				bnxt_rx_stats_strings[i].offset));
+		xstats[count].value = rte_le_to_cpu_64
+					(*(uint64_t *)((char *)rx_stats +
+					 bnxt_rx_stats_strings[i].offset));
+
 		count++;
 	}
 
 	for (i = 0; i < RTE_DIM(bnxt_tx_stats_strings); i++) {
 		uint64_t *tx_stats = (uint64_t *)bp->hw_tx_port_stats;
 		xstats[count].id = count;
-		xstats[count].value = rte_le_to_cpu_64(
-				 *(uint64_t *)((char *)tx_stats +
-				bnxt_tx_stats_strings[i].offset));
+		xstats[count].value = rte_le_to_cpu_64
+					(*(uint64_t *)((char *)tx_stats +
+					 bnxt_tx_stats_strings[i].offset));
+
 		count++;
 	}
 
@@ -303,8 +313,8 @@  int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 }
 
 int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
-	struct rte_eth_xstat_name *xstats_names,
-	__rte_unused unsigned int limit)
+				 struct rte_eth_xstat_name *xstats_names,
+				 __rte_unused unsigned int limit)
 {
 	/* Account for the Tx drop pkts aka the Anti spoof counter */
 	const unsigned int stat_cnt = RTE_DIM(bnxt_rx_stats_strings) +
@@ -316,24 +326,27 @@  int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
 
 		for (i = 0; i < RTE_DIM(bnxt_rx_stats_strings); i++) {
 			snprintf(xstats_names[count].name,
-				sizeof(xstats_names[count].name),
-				"%s",
-				bnxt_rx_stats_strings[i].name);
+				 sizeof(xstats_names[count].name),
+				 "%s",
+				 bnxt_rx_stats_strings[i].name);
+
 			count++;
 		}
 
 		for (i = 0; i < RTE_DIM(bnxt_tx_stats_strings); i++) {
 			snprintf(xstats_names[count].name,
-				sizeof(xstats_names[count].name),
-				"%s",
-				bnxt_tx_stats_strings[i].name);
+				 sizeof(xstats_names[count].name),
+				 "%s",
+				 bnxt_tx_stats_strings[i].name);
+
 			count++;
 		}
 
 		snprintf(xstats_names[count].name,
-				sizeof(xstats_names[count].name),
-				"%s",
-				bnxt_func_stats_strings[4].name);
+			 sizeof(xstats_names[count].name),
+			 "%s",
+			 bnxt_func_stats_strings[4].name);
+
 		count++;
 	}
 	return stat_cnt;
@@ -354,8 +367,10 @@  void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 		PMD_DRV_LOG(ERR, "Operation not supported\n");
 }
 
-int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
-		uint64_t *values, unsigned int limit)
+int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev,
+				 const uint64_t *ids,
+				 uint64_t *values,
+				 unsigned int limit)
 {
 	/* Account for the Tx drop pkts aka the Anti spoof counter */
 	const unsigned int stat_cnt = RTE_DIM(bnxt_rx_stats_strings) +
@@ -370,7 +385,7 @@  int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
 	bnxt_dev_xstats_get_by_id_op(dev, NULL, values_copy, stat_cnt);
 	for (i = 0; i < limit; i++) {
 		if (ids[i] >= stat_cnt) {
-			PMD_DRV_LOG(ERR, "id value isn't valid");
+			PMD_DRV_LOG(ERR, "id value isn't valid\n");
 			return -1;
 		}
 		values[i] = values_copy[ids[i]];
@@ -379,8 +394,9 @@  int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
 }
 
 int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
-				struct rte_eth_xstat_name *xstats_names,
-				const uint64_t *ids, unsigned int limit)
+				       struct rte_eth_xstat_name *xstats_names,
+				       const uint64_t *ids,
+				       unsigned int limit)
 {
 	/* Account for the Tx drop pkts aka the Anti spoof counter */
 	const unsigned int stat_cnt = RTE_DIM(bnxt_rx_stats_strings) +
@@ -391,16 +407,18 @@  int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
 	if (!ids)
 		return bnxt_dev_xstats_get_names_op(dev, xstats_names,
 						    stat_cnt);
-	bnxt_dev_xstats_get_names_by_id_op(dev, xstats_names_copy, NULL,
-			stat_cnt);
+
+	bnxt_dev_xstats_get_names_by_id_op(dev,
+					   xstats_names_copy,
+					   NULL,
+					   stat_cnt);
 
 	for (i = 0; i < limit; i++) {
 		if (ids[i] >= stat_cnt) {
-			PMD_DRV_LOG(ERR, "id value isn't valid");
+			PMD_DRV_LOG(ERR, "id value isn't valid\n");
 			return -1;
 		}
-		strcpy(xstats_names[i].name,
-				xstats_names_copy[ids[i]].name);
+		strcpy(xstats_names[i].name, xstats_names_copy[ids[i]].name);
 	}
 	return stat_cnt;
 }
diff --git a/drivers/net/bnxt/bnxt_stats.h b/drivers/net/bnxt/bnxt_stats.h
index b0f135a5a..08570238d 100644
--- a/drivers/net/bnxt/bnxt_stats.h
+++ b/drivers/net/bnxt/bnxt_stats.h
@@ -9,20 +9,31 @@ 
 #include <rte_ethdev_driver.h>
 
 void bnxt_free_stats(struct bnxt *bp);
+
 int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
-			   struct rte_eth_stats *bnxt_stats);
+		      struct rte_eth_stats *bnxt_stats);
+
 void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev);
+
 int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
-	struct rte_eth_xstat_name *xstats_names,
-	__rte_unused unsigned int limit);
+				 struct rte_eth_xstat_name *xstats_names,
+				 __rte_unused unsigned int limit);
+
 int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
-			   struct rte_eth_xstat *xstats, unsigned int n);
+			   struct rte_eth_xstat *xstats,
+			   unsigned int n);
+
 void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev);
-int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
-				uint64_t *values, unsigned int limit);
+
+int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev,
+				 const uint64_t *ids,
+				 uint64_t *values,
+				 unsigned int limit);
+
 int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
-				struct rte_eth_xstat_name *xstats_names,
-				const uint64_t *ids, unsigned int limit);
+				       struct rte_eth_xstat_name *xstats_names,
+				       const uint64_t *ids,
+				       unsigned int limit);
 
 struct bnxt_xstats_name_off {
 	char name[RTE_ETH_XSTATS_NAME_SIZE];