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++;
}
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;
{
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];
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];
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
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])
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);
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);
}
}
- 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);