net/bnxt: remove unnecessary macro for unused variables
[dpdk.git] / drivers / net / bnxt / bnxt_stats.c
index 21012e1..20a16a6 100644 (file)
@@ -81,6 +81,22 @@ static const struct bnxt_xstats_name_off bnxt_rx_stats_strings[] = {
                                rx_runt_bytes)},
        {"rx_runt_frames", offsetof(struct rx_port_stats,
                                rx_runt_frames)},
+       {"rx_pfc_ena_frames_pri0", offsetof(struct rx_port_stats,
+                               rx_pfc_ena_frames_pri0)},
+       {"rx_pfc_ena_frames_pri1", offsetof(struct rx_port_stats,
+                               rx_pfc_ena_frames_pri1)},
+       {"rx_pfc_ena_frames_pri2", offsetof(struct rx_port_stats,
+                               rx_pfc_ena_frames_pri2)},
+       {"rx_pfc_ena_frames_pri3", offsetof(struct rx_port_stats,
+                               rx_pfc_ena_frames_pri3)},
+       {"rx_pfc_ena_frames_pri4", offsetof(struct rx_port_stats,
+                               rx_pfc_ena_frames_pri4)},
+       {"rx_pfc_ena_frames_pri5", offsetof(struct rx_port_stats,
+                               rx_pfc_ena_frames_pri5)},
+       {"rx_pfc_ena_frames_pri6", offsetof(struct rx_port_stats,
+                               rx_pfc_ena_frames_pri6)},
+       {"rx_pfc_ena_frames_pri7", offsetof(struct rx_port_stats,
+                               rx_pfc_ena_frames_pri7)},
 };
 
 static const struct bnxt_xstats_name_off bnxt_tx_stats_strings[] = {
@@ -136,6 +152,22 @@ static const struct bnxt_xstats_name_off bnxt_tx_stats_strings[] = {
                                tx_total_collisions)},
        {"tx_bytes", offsetof(struct tx_port_stats,
                                tx_bytes)},
+       {"tx_pfc_ena_frames_pri0", offsetof(struct tx_port_stats,
+                               tx_pfc_ena_frames_pri0)},
+       {"tx_pfc_ena_frames_pri1", offsetof(struct tx_port_stats,
+                               tx_pfc_ena_frames_pri1)},
+       {"tx_pfc_ena_frames_pri2", offsetof(struct tx_port_stats,
+                               tx_pfc_ena_frames_pri2)},
+       {"tx_pfc_ena_frames_pri3", offsetof(struct tx_port_stats,
+                               tx_pfc_ena_frames_pri3)},
+       {"tx_pfc_ena_frames_pri4", offsetof(struct tx_port_stats,
+                               tx_pfc_ena_frames_pri4)},
+       {"tx_pfc_ena_frames_pri5", offsetof(struct tx_port_stats,
+                               tx_pfc_ena_frames_pri5)},
+       {"tx_pfc_ena_frames_pri6", offsetof(struct tx_port_stats,
+                               tx_pfc_ena_frames_pri6)},
+       {"tx_pfc_ena_frames_pri7", offsetof(struct tx_port_stats,
+                               tx_pfc_ena_frames_pri7)},
 };
 
 static const struct bnxt_xstats_name_off bnxt_func_stats_strings[] = {
@@ -360,7 +392,7 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
        memset(bnxt_stats, 0, sizeof(*bnxt_stats));
        if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
                PMD_DRV_LOG(ERR, "Device Initialization not complete!\n");
-               return -1;
+               return -EIO;
        }
 
        num_q_stats = RTE_MIN(bp->rx_cp_nr_rings,
@@ -390,9 +422,8 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
                if (unlikely(rc))
                        return rc;
        }
+
        rc = bnxt_hwrm_func_qstats(bp, 0xffff, bnxt_stats);
-       if (unlikely(rc))
-               return rc;
        return rc;
 }
 
@@ -437,6 +468,9 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
        if (rc)
                return rc;
 
+       if (xstats == NULL)
+               return 0;
+
        memset(xstats, 0, sizeof(*xstats));
 
        bnxt_hwrm_port_qstats(bp);
@@ -505,9 +539,9 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
        return stat_count;
 }
 
-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)
+int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev,
+                                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) +
@@ -573,30 +607,17 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
        if (ret)
                return ret;
 
-       if (bp->flags & BNXT_FLAG_PORT_STATS && BNXT_SINGLE_PF(bp)) {
-               ret = bnxt_hwrm_port_clr_stats(bp);
-               if (ret != 0) {
-                       PMD_DRV_LOG(ERR, "Operation failed: %s\n",
-                                   strerror(-ret));
-                       return ret;
-               }
-       }
-
-       ret = 0;
-
-       if (BNXT_VF(bp)) {
-               PMD_DRV_LOG(ERR, "Operation not supported on a VF device\n");
-               ret = -ENOTSUP;
-       }
-       if (!BNXT_SINGLE_PF(bp)) {
-               PMD_DRV_LOG(ERR, "Operation not supported on a MF device\n");
-               ret = -ENOTSUP;
-       }
-       if (!(bp->flags & BNXT_FLAG_PORT_STATS)) {
+       if (BNXT_VF(bp) || !BNXT_SINGLE_PF(bp) ||
+           !(bp->flags & BNXT_FLAG_PORT_STATS)) {
                PMD_DRV_LOG(ERR, "Operation not supported\n");
-               ret = -ENOTSUP;
+               return -ENOTSUP;
        }
 
+       ret = bnxt_hwrm_port_clr_stats(bp);
+       if (ret != 0)
+               PMD_DRV_LOG(ERR, "Failed to reset xstats: %s\n",
+                           strerror(-ret));
+
        return ret;
 }
 
@@ -625,7 +646,7 @@ int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
        for (i = 0; i < limit; i++) {
                if (ids[i] >= stat_cnt) {
                        PMD_DRV_LOG(ERR, "id value isn't valid");
-                       return -1;
+                       return -EINVAL;
                }
                values[i] = values_copy[ids[i]];
        }
@@ -659,7 +680,7 @@ int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
        for (i = 0; i < limit; i++) {
                if (ids[i] >= stat_cnt) {
                        PMD_DRV_LOG(ERR, "id value isn't valid");
-                       return -1;
+                       return -EINVAL;
                }
                strcpy(xstats_names[i].name,
                                xstats_names_copy[ids[i]].name);