Commit caa343e9 authored by Michael Chan's avatar Michael Chan Committed by Jakub Kicinski
Browse files

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: default avatarAndy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20251126215648.1885936-2-michael.chan@broadcom.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 61dbc61a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -8506,6 +8506,11 @@ static int bnxt_hwrm_func_qcfg(struct bnxt *bp)

	if (flags & FUNC_QCFG_RESP_FLAGS_ENABLE_RDMA_SRIOV)
		bp->fw_cap |= BNXT_FW_CAP_ENABLE_RDMA_SRIOV;
	if (resp->roce_bidi_opt_mode &
	    FUNC_QCFG_RESP_ROCE_BIDI_OPT_MODE_DEDICATED)
		bp->cos0_cos1_shared = 1;
	else
		bp->cos0_cos1_shared = 0;

	switch (resp->port_partition_type) {
	case FUNC_QCFG_RESP_PORT_PARTITION_TYPE_NPAR1_0:
+1 −0
Original line number Diff line number Diff line
@@ -2424,6 +2424,7 @@ struct bnxt {
	u8			tc_to_qidx[BNXT_MAX_QUEUE];
	u8			q_ids[BNXT_MAX_QUEUE];
	u8			max_q;
	u8			cos0_cos1_shared;
	u8			num_tc;

	u16			max_pfcwd_tmo_ms;
+10 −4
Original line number Diff line number Diff line
@@ -688,16 +688,22 @@ static void bnxt_get_ethtool_stats(struct net_device *dev,
				buf[j] = *(rx_port_stats_ext + n);
			}
			for (i = 0; i < 8; i++, j++) {
				long n = bnxt_tx_bytes_pri_arr[i].base_off +
					 bp->pri2cos_idx[i];
				u8 cos_idx = bp->pri2cos_idx[i];
				long n;

				n = bnxt_tx_bytes_pri_arr[i].base_off + cos_idx;
				buf[j] = *(tx_port_stats_ext + n);
				if (bp->cos0_cos1_shared && !cos_idx)
					buf[j] += *(tx_port_stats_ext + n + 1);
			}
			for (i = 0; i < 8; i++, j++) {
				long n = bnxt_tx_pkts_pri_arr[i].base_off +
					 bp->pri2cos_idx[i];
				u8 cos_idx = bp->pri2cos_idx[i];
				long n;

				n = bnxt_tx_pkts_pri_arr[i].base_off + cos_idx;
				buf[j] = *(tx_port_stats_ext + n);
				if (bp->cos0_cos1_shared && !cos_idx)
					buf[j] += *(tx_port_stats_ext + n + 1);
			}
		}
	}