}
int bnxt_hwrm_func_qstats(struct bnxt *bp, uint16_t fid,
- struct rte_eth_stats *stats)
+ struct rte_eth_stats *stats,
+ struct hwrm_func_qstats_output *func_qstats)
{
int rc = 0;
struct hwrm_func_qstats_input req = {.req_type = 0};
rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
HWRM_CHECK_RESULT();
+ if (func_qstats)
+ memcpy(func_qstats, resp,
+ sizeof(struct hwrm_func_qstats_output));
+
+ if (!stats)
+ goto exit;
stats->ipackets = rte_le_to_cpu_64(resp->rx_ucast_pkts);
stats->ipackets += rte_le_to_cpu_64(resp->rx_mcast_pkts);
stats->ierrors = rte_le_to_cpu_64(resp->rx_drop_pkts);
stats->oerrors = rte_le_to_cpu_64(resp->tx_discard_pkts);
+exit:
HWRM_UNLOCK();
return rc;
struct bnxt;
struct bnxt_filter_info;
struct bnxt_cp_ring_info;
+struct hwrm_func_qstats_output;
#define HWRM_SEQ_ID_INVALID -1U
/* Convert Bit field location to value */
int bnxt_hwrm_func_reset(struct bnxt *bp);
int bnxt_hwrm_func_driver_unregister(struct bnxt *bp, uint32_t flags);
int bnxt_hwrm_func_qstats(struct bnxt *bp, uint16_t fid,
- struct rte_eth_stats *stats);
+ struct rte_eth_stats *stats,
+ struct hwrm_func_qstats_output *func_qstats);
int bnxt_hwrm_func_qstats_tx_drop(struct bnxt *bp, uint16_t fid,
uint64_t *dropped);
int bnxt_hwrm_func_clr_stats(struct bnxt *bp, uint16_t fid);
return rc;
}
- rc = bnxt_hwrm_func_qstats(bp, 0xffff, bnxt_stats);
+ rc = bnxt_hwrm_func_qstats(bp, 0xffff, bnxt_stats, NULL);
return rc;
}
{
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);
+ struct hwrm_func_qstats_output func_qstats = {0};
unsigned int stat_count;
int rc;
memset(xstats, 0, sizeof(*xstats));
+ bnxt_hwrm_func_qstats(bp, 0xffff, NULL, &func_qstats);
bnxt_hwrm_port_qstats(bp);
- bnxt_hwrm_func_qstats_tx_drop(bp, 0xffff, &tx_drop_pkts);
bnxt_hwrm_ext_port_qstats(bp);
rx_port_stats_ext_cnt = RTE_MIN(RTE_DIM(bnxt_rx_ext_stats_strings),
(bp->fw_rx_port_stats_ext_size /
stat_size));
count = RTE_DIM(bnxt_rx_stats_strings) +
- RTE_DIM(bnxt_tx_stats_strings) + 1/* For tx_drop_pkts */ +
+ 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);
stat_count = count;
count++;
}
- /* The Tx drop pkts aka the Anti spoof coounter */
- xstats[count].id = count;
- xstats[count].value = rte_le_to_cpu_64(tx_drop_pkts);
- count++;
+ 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]);
+ count++;
+ }
+
for (i = 0; i < rx_port_stats_ext_cnt; i++) {
uint64_t *rx_stats_ext = (uint64_t *)bp->hw_rx_port_stats_ext;
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) +
- RTE_DIM(bnxt_tx_stats_strings) + 1 +
+ 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);
struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
count++;
}
- strlcpy(xstats_names[count].name,
- bnxt_func_stats_strings[4].name,
- sizeof(xstats_names[count].name));
- count++;
+ for (i = 0; i < RTE_DIM(bnxt_func_stats_strings); i++) {
+ strlcpy(xstats_names[count].name,
+ bnxt_func_stats_strings[i].name,
+ sizeof(xstats_names[count].name));
+ count++;
+ }
for (i = 0; i < RTE_DIM(bnxt_rx_ext_stats_strings); i++) {
strlcpy(xstats_names[count].name,
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) +
- RTE_DIM(bnxt_tx_stats_strings) + 1 +
+ 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);
struct bnxt *bp = dev->data->dev_private;
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) +
- RTE_DIM(bnxt_tx_stats_strings) + 1 +
+ 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);
struct rte_eth_xstat_name xstats_names_copy[stat_cnt];