X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Fbnxt_stats.c;h=14d355fd088eae3e3c72803db324a51b4e346bd2;hb=aa2cbd32e9695c0f552ee26653b7867cade5ffb3;hp=049ad9e3984cb0c6db82df920d45001cc390e894;hpb=9970a9ad07db7745ca6bc441819b287940ae86ea;p=dpdk.git diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c index 049ad9e398..14d355fd08 100644 --- a/drivers/net/bnxt/bnxt_stats.c +++ b/drivers/net/bnxt/bnxt_stats.c @@ -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[] = { @@ -353,10 +385,14 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev, struct bnxt *bp = eth_dev->data->dev_private; unsigned int num_q_stats; + rc = is_bnxt_in_error(bp); + if (rc) + return rc; + 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, @@ -386,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; } @@ -398,6 +433,10 @@ int bnxt_stats_reset_op(struct rte_eth_dev *eth_dev) unsigned int i; int ret; + ret = is_bnxt_in_error(bp); + if (ret) + return ret; + if (!(bp->flags & BNXT_FLAG_INIT_DONE)) { PMD_DRV_LOG(ERR, "Device Initialization not complete!\n"); return -EINVAL; @@ -417,13 +456,20 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev, struct rte_eth_xstat *xstats, unsigned int n) { struct bnxt *bp = eth_dev->data->dev_private; - unsigned int count, i; uint64_t tx_drop_pkts; unsigned int rx_port_stats_ext_cnt; unsigned int tx_port_stats_ext_cnt; unsigned int stat_size = sizeof(uint64_t); unsigned int stat_count; + int rc; + + rc = is_bnxt_in_error(bp); + if (rc) + return rc; + + if (xstats == NULL) + return 0; memset(xstats, 0, sizeof(*xstats)); @@ -502,7 +548,13 @@ int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev, RTE_DIM(bnxt_tx_stats_strings) + 1 + RTE_DIM(bnxt_rx_ext_stats_strings) + RTE_DIM(bnxt_tx_ext_stats_strings); + struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; unsigned int i, count; + int rc; + + rc = is_bnxt_in_error(bp); + if (rc) + return rc; if (xstats_names != NULL) { count = 0; @@ -551,30 +603,21 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev) struct bnxt *bp = eth_dev->data->dev_private; int 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; + ret = is_bnxt_in_error(bp); + if (ret) + return ret; - 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; } @@ -586,9 +629,15 @@ int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids, RTE_DIM(bnxt_tx_stats_strings) + 1 + RTE_DIM(bnxt_rx_ext_stats_strings) + RTE_DIM(bnxt_tx_ext_stats_strings); + struct bnxt *bp = dev->data->dev_private; struct rte_eth_xstat xstats[stat_cnt]; uint64_t values_copy[stat_cnt]; uint16_t i; + int rc; + + rc = is_bnxt_in_error(bp); + if (rc) + return rc; if (!ids) return bnxt_dev_xstats_get_op(dev, xstats, stat_cnt); @@ -597,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]]; } @@ -614,7 +663,13 @@ int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev, RTE_DIM(bnxt_rx_ext_stats_strings) + RTE_DIM(bnxt_tx_ext_stats_strings); struct rte_eth_xstat_name xstats_names_copy[stat_cnt]; + struct bnxt *bp = dev->data->dev_private; uint16_t i; + int rc; + + rc = is_bnxt_in_error(bp); + if (rc) + return rc; if (!ids) return bnxt_dev_xstats_get_names_op(dev, xstats_names, @@ -625,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);