Skip to content

Commit caa343e

Browse files
Michael Chankuba-moo
authored andcommitted
bnxt_en: Enhance TX pri counters
The priority packet and byte counters in ethtool -S are returned by the driver based on the pri2cos mapping. The assumption is that each priority is mapped to one and only one hardware CoS queue. In a special RoCE configuration, the FW uses combined CoS queue 0 and CoS queue 1 for the priority mapped to CoS queue 0. In this special case, we need to add the CoS queue 0 and CoS queue 1 counters for the priority packet and byte counters. Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20251126215648.1885936-2-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 61dbc61 commit caa343e

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8506,6 +8506,11 @@ static int bnxt_hwrm_func_qcfg(struct bnxt *bp)
85068506

85078507
if (flags & FUNC_QCFG_RESP_FLAGS_ENABLE_RDMA_SRIOV)
85088508
bp->fw_cap |= BNXT_FW_CAP_ENABLE_RDMA_SRIOV;
8509+
if (resp->roce_bidi_opt_mode &
8510+
FUNC_QCFG_RESP_ROCE_BIDI_OPT_MODE_DEDICATED)
8511+
bp->cos0_cos1_shared = 1;
8512+
else
8513+
bp->cos0_cos1_shared = 0;
85098514

85108515
switch (resp->port_partition_type) {
85118516
case FUNC_QCFG_RESP_PORT_PARTITION_TYPE_NPAR1_0:

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,6 +2424,7 @@ struct bnxt {
24242424
u8 tc_to_qidx[BNXT_MAX_QUEUE];
24252425
u8 q_ids[BNXT_MAX_QUEUE];
24262426
u8 max_q;
2427+
u8 cos0_cos1_shared;
24272428
u8 num_tc;
24282429

24292430
u16 max_pfcwd_tmo_ms;

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -688,16 +688,22 @@ static void bnxt_get_ethtool_stats(struct net_device *dev,
688688
buf[j] = *(rx_port_stats_ext + n);
689689
}
690690
for (i = 0; i < 8; i++, j++) {
691-
long n = bnxt_tx_bytes_pri_arr[i].base_off +
692-
bp->pri2cos_idx[i];
691+
u8 cos_idx = bp->pri2cos_idx[i];
692+
long n;
693693

694+
n = bnxt_tx_bytes_pri_arr[i].base_off + cos_idx;
694695
buf[j] = *(tx_port_stats_ext + n);
696+
if (bp->cos0_cos1_shared && !cos_idx)
697+
buf[j] += *(tx_port_stats_ext + n + 1);
695698
}
696699
for (i = 0; i < 8; i++, j++) {
697-
long n = bnxt_tx_pkts_pri_arr[i].base_off +
698-
bp->pri2cos_idx[i];
700+
u8 cos_idx = bp->pri2cos_idx[i];
701+
long n;
699702

703+
n = bnxt_tx_pkts_pri_arr[i].base_off + cos_idx;
700704
buf[j] = *(tx_port_stats_ext + n);
705+
if (bp->cos0_cos1_shared && !cos_idx)
706+
buf[j] += *(tx_port_stats_ext + n + 1);
701707
}
702708
}
703709
}

0 commit comments

Comments
 (0)