]> Gentwo Git Trees - linux/.git/commitdiff
bnxt_en: Enhance TX pri counters
authorMichael Chan <michael.chan@broadcom.com>
Wed, 26 Nov 2025 21:56:42 +0000 (13:56 -0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 28 Nov 2025 02:59:28 +0000 (18:59 -0800)
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>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

index 8f95f5f29e0089ae8c9ef489118119b7840e6108..c289d1f35e168dd6f169a68b09344c7092b869e8 100644 (file)
@@ -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:
index 3613a172483a16ac43c74fc8f27814dbf0bb7110..aedb059f4ce55d3414f43e9df1877d8ab0dd6038 100644 (file)
@@ -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;
index 41686a6f84b581265bdbe86dc5068aef18113c82..baac639f9c9418404b8556867d43d6f4cb90f951 100644 (file)
@@ -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);
                        }
                }
        }