X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Fbnxt_stats.c;h=3c9715f5fa520fe7e913ddc6084287b7c29b5298;hb=c1d4e9d37abdc6c07a05f7d96928e624fea9ebb5;hp=1d3be16f8aeb8195adf242dcab50d0d3a313d281;hpb=02a95625fe9c23dd7fb4cd7e4175c51db695be27;p=dpdk.git diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c index 1d3be16f8a..3c9715f5fa 100644 --- a/drivers/net/bnxt/bnxt_stats.c +++ b/drivers/net/bnxt/bnxt_stats.c @@ -643,7 +643,8 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev, for (i = 0; i < RTE_DIM(bnxt_func_stats_strings); i++) { xstats[count].id = count; xstats[count].value = - rte_le_to_cpu_64(((uint64_t *)&func_qstats)[i]); + rte_le_to_cpu_64(*(uint64_t *)((char *)&func_qstats + + bnxt_func_stats_strings[i].offset)); count++; } @@ -669,7 +670,7 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev, if (bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_COUNTERS && bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_MGMT && - bp->flow_xstat) { + BNXT_FLOW_XSTATS_EN(bp)) { int j; i = 0; @@ -713,7 +714,7 @@ int bnxt_flow_stats_cnt(struct bnxt *bp) { if (bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_COUNTERS && bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_MGMT && - bp->flow_xstat) { + BNXT_FLOW_XSTATS_EN(bp)) { struct bnxt_xstats_name_off flow_bytes[bp->max_l2_ctx]; struct bnxt_xstats_name_off flow_pkts[bp->max_l2_ctx]; @@ -783,7 +784,7 @@ int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev, if (bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_COUNTERS && bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_MGMT && - bp->flow_xstat) { + BNXT_FLOW_XSTATS_EN(bp)) { for (i = 0; i < bp->max_l2_ctx; i++) { char buf[RTE_ETH_XSTATS_NAME_SIZE]; @@ -827,75 +828,6 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev) return ret; } -int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids, - uint64_t *values, unsigned int limit) -{ - struct bnxt *bp = dev->data->dev_private; - const unsigned int stat_cnt = RTE_DIM(bnxt_rx_stats_strings) + - RTE_DIM(bnxt_tx_stats_strings) + - RTE_DIM(bnxt_func_stats_strings) + - RTE_DIM(bnxt_rx_ext_stats_strings) + - RTE_DIM(bnxt_tx_ext_stats_strings) + - bnxt_flow_stats_cnt(bp); - 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); - - 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"); - return -EINVAL; - } - values[i] = values_copy[ids[i]]; - } - return stat_cnt; -} - -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 bnxt *bp = dev->data->dev_private; - const unsigned int stat_cnt = RTE_DIM(bnxt_rx_stats_strings) + - RTE_DIM(bnxt_tx_stats_strings) + - RTE_DIM(bnxt_func_stats_strings) + - RTE_DIM(bnxt_rx_ext_stats_strings) + - RTE_DIM(bnxt_tx_ext_stats_strings) + - bnxt_flow_stats_cnt(bp); - struct rte_eth_xstat_name xstats_names_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_names_op(dev, xstats_names, - 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"); - return -EINVAL; - } - strcpy(xstats_names[i].name, - xstats_names_copy[ids[i]].name); - } - return stat_cnt; -} - /* Update the input context memory with the flow counter IDs * of the flows that we are interested in. * Also, update the output tables with the current local values @@ -936,8 +868,8 @@ static int bnxt_update_fc_tbl(struct bnxt *bp, uint16_t ctr, uint32_t out_rx_tbl_cnt = 0; int i, rc = 0; - in_rx_tbl = (uint32_t *)bp->rx_fc_in_tbl.va; - out_rx_tbl = (uint64_t *)bp->rx_fc_out_tbl.va; + in_rx_tbl = (uint32_t *)bp->flow_stat->rx_fc_in_tbl.va; + out_rx_tbl = (uint64_t *)bp->flow_stat->rx_fc_out_tbl.va; for (i = 0; i < in_flow_cnt; i++) { if (!en_tbl[i]) @@ -979,7 +911,7 @@ int bnxt_flow_stats_req(struct bnxt *bp) struct rte_flow *flow; uint16_t in_flow_tbl_cnt = 0; struct bnxt_vnic_info *vnic = NULL; - struct bnxt_filter_info *valid_en_tbl[bp->max_fc]; + struct bnxt_filter_info *valid_en_tbl[bp->flow_stat->max_fc]; uint16_t counter_type = CFA_COUNTER_CFG_IN_COUNTER_TYPE_FC; bnxt_acquire_flow_lock(bp); @@ -996,7 +928,7 @@ int bnxt_flow_stats_req(struct bnxt *bp) continue; valid_en_tbl[in_flow_tbl_cnt++] = flow->filter; - if (in_flow_tbl_cnt >= bp->max_fc) { + if (in_flow_tbl_cnt >= bp->flow_stat->max_fc) { rc = bnxt_update_fc_tbl(bp, counter_type, valid_en_tbl, in_flow_tbl_cnt); @@ -1008,8 +940,10 @@ int bnxt_flow_stats_req(struct bnxt *bp) } } - if (!in_flow_tbl_cnt) + if (!in_flow_tbl_cnt) { + bnxt_release_flow_lock(bp); goto out; + } rc = bnxt_update_fc_tbl(bp, counter_type, valid_en_tbl, in_flow_tbl_cnt);