mirror of
https://github.com/torvalds/linux.git
synced 2026-07-30 19:21:28 +02:00
bnxt_en: Add pcie_stat_len to struct bp
Add this length field to capture the length of the pcie stats structure supported by the FW. This length will be determined in bnxt_ethtool_init(). The minimum of this FW length and the length known to the driver will determine the actual ethtool -d length. Suggested-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com> Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Signed-off-by: Shruti Parab <shruti.parab@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20250819163919.104075-4-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
1cc174d33a
commit
b530173d3c
|
|
@ -2543,6 +2543,7 @@ struct bnxt {
|
|||
u16 fw_rx_stats_ext_size;
|
||||
u16 fw_tx_stats_ext_size;
|
||||
u16 hw_ring_stats_size;
|
||||
u16 pcie_stat_len;
|
||||
u8 pri2cos_idx[8];
|
||||
u8 pri2cos_valid;
|
||||
|
||||
|
|
|
|||
|
|
@ -2061,17 +2061,11 @@ static void bnxt_get_drvinfo(struct net_device *dev,
|
|||
static int bnxt_get_regs_len(struct net_device *dev)
|
||||
{
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
int reg_len;
|
||||
|
||||
if (!BNXT_PF(bp))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
reg_len = BNXT_PXP_REG_LEN;
|
||||
|
||||
if (bp->fw_cap & BNXT_FW_CAP_PCIE_STATS_SUPPORTED)
|
||||
reg_len += sizeof(struct pcie_ctx_hw_stats);
|
||||
|
||||
return reg_len;
|
||||
return BNXT_PXP_REG_LEN + bp->pcie_stat_len;
|
||||
}
|
||||
|
||||
static void *
|
||||
|
|
@ -2107,6 +2101,7 @@ static const struct {
|
|||
static void bnxt_get_regs(struct net_device *dev, struct ethtool_regs *regs,
|
||||
void *_p)
|
||||
{
|
||||
struct hwrm_pcie_qstats_output *resp;
|
||||
struct hwrm_pcie_qstats_input *req;
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
u8 *src;
|
||||
|
|
@ -2121,14 +2116,15 @@ static void bnxt_get_regs(struct net_device *dev, struct ethtool_regs *regs,
|
|||
if (hwrm_req_init(bp, req, HWRM_PCIE_QSTATS))
|
||||
return;
|
||||
|
||||
hwrm_req_hold(bp, req);
|
||||
resp = hwrm_req_hold(bp, req);
|
||||
src = __bnxt_hwrm_pcie_qstats(bp, req);
|
||||
if (src) {
|
||||
u8 *dst = (u8 *)(_p + BNXT_PXP_REG_LEN);
|
||||
int i, j;
|
||||
int i, j, len;
|
||||
|
||||
len = min(bp->pcie_stat_len, le16_to_cpu(resp->pcie_stat_size));
|
||||
regs->version = 1;
|
||||
for (i = 0, j = 0; i < sizeof(struct pcie_ctx_hw_stats); ) {
|
||||
for (i = 0, j = 0; i < len; ) {
|
||||
if (i >= bnxt_pcie_32b_entries[j].start &&
|
||||
i <= bnxt_pcie_32b_entries[j].end) {
|
||||
u32 *dst32 = (u32 *)(dst + i);
|
||||
|
|
@ -5273,6 +5269,26 @@ static int bnxt_get_ts_info(struct net_device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void bnxt_hwrm_pcie_qstats(struct bnxt *bp)
|
||||
{
|
||||
struct hwrm_pcie_qstats_output *resp;
|
||||
struct hwrm_pcie_qstats_input *req;
|
||||
|
||||
bp->pcie_stat_len = 0;
|
||||
if (!(bp->fw_cap & BNXT_FW_CAP_PCIE_STATS_SUPPORTED))
|
||||
return;
|
||||
|
||||
if (hwrm_req_init(bp, req, HWRM_PCIE_QSTATS))
|
||||
return;
|
||||
|
||||
resp = hwrm_req_hold(bp, req);
|
||||
if (__bnxt_hwrm_pcie_qstats(bp, req))
|
||||
bp->pcie_stat_len = min_t(u16,
|
||||
le16_to_cpu(resp->pcie_stat_size),
|
||||
sizeof(struct pcie_ctx_hw_stats_v2));
|
||||
hwrm_req_drop(bp, req);
|
||||
}
|
||||
|
||||
void bnxt_ethtool_init(struct bnxt *bp)
|
||||
{
|
||||
struct hwrm_selftest_qlist_output *resp;
|
||||
|
|
@ -5281,6 +5297,7 @@ void bnxt_ethtool_init(struct bnxt *bp)
|
|||
struct net_device *dev = bp->dev;
|
||||
int i, rc;
|
||||
|
||||
bnxt_hwrm_pcie_qstats(bp);
|
||||
if (!(bp->fw_cap & BNXT_FW_CAP_PKG_VER))
|
||||
bnxt_get_pkgver(dev);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user