bnxt_en: Implement ethtool .get_tunable() for ETHTOOL_PFC_PREVENTION_TOUT

Return the current PFC watchdog timeout value if it is supported.

Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20250917040839.1924698-10-michael.chan@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Michael Chan 2025-09-16 21:08:38 -07:00 committed by Paolo Abeni
parent 7ef55292dc
commit 6684b91d04
4 changed files with 81 additions and 0 deletions

View File

@ -14748,6 +14748,23 @@ static bool bnxt_fw_pre_resv_vnics(struct bnxt *bp)
return false;
}
static void bnxt_hwrm_pfcwd_qcaps(struct bnxt *bp)
{
struct hwrm_queue_pfcwd_timeout_qcaps_output *resp;
struct hwrm_queue_pfcwd_timeout_qcaps_input *req;
int rc;
bp->max_pfcwd_tmo_ms = 0;
rc = hwrm_req_init(bp, req, HWRM_QUEUE_PFCWD_TIMEOUT_QCAPS);
if (rc)
return;
resp = hwrm_req_hold(bp, req);
rc = hwrm_req_send_silent(bp, req);
if (!rc)
bp->max_pfcwd_tmo_ms = le16_to_cpu(resp->max_pfcwd_timeout);
hwrm_req_drop(bp, req);
}
static int bnxt_fw_init_one_p1(struct bnxt *bp)
{
int rc;
@ -14825,6 +14842,7 @@ static int bnxt_fw_init_one_p2(struct bnxt *bp)
if (bnxt_fw_pre_resv_vnics(bp))
bp->fw_cap |= BNXT_FW_CAP_PRE_RESV_VNICS;
bnxt_hwrm_pfcwd_qcaps(bp);
bnxt_hwrm_func_qcfg(bp);
bnxt_hwrm_vnic_qcaps(bp);
bnxt_hwrm_port_led_qcaps(bp);

View File

@ -2426,6 +2426,8 @@ struct bnxt {
u8 max_q;
u8 num_tc;
u16 max_pfcwd_tmo_ms;
u8 tph_mode;
unsigned int current_interval;

View File

@ -4399,6 +4399,23 @@ static int bnxt_get_eee(struct net_device *dev, struct ethtool_keee *edata)
return 0;
}
static int bnxt_hwrm_pfcwd_qcfg(struct bnxt *bp, u16 *val)
{
struct hwrm_queue_pfcwd_timeout_qcfg_output *resp;
struct hwrm_queue_pfcwd_timeout_qcfg_input *req;
int rc;
rc = hwrm_req_init(bp, req, HWRM_QUEUE_PFCWD_TIMEOUT_QCFG);
if (rc)
return rc;
resp = hwrm_req_hold(bp, req);
rc = hwrm_req_send(bp, req);
if (!rc)
*val = le16_to_cpu(resp->pfcwd_timeout_value);
hwrm_req_drop(bp, req);
return rc;
}
static int bnxt_set_tunable(struct net_device *dev,
const struct ethtool_tunable *tuna,
const void *data)
@ -4431,6 +4448,10 @@ static int bnxt_get_tunable(struct net_device *dev,
case ETHTOOL_RX_COPYBREAK:
*(u32 *)data = bp->rx_copybreak;
break;
case ETHTOOL_PFC_PREVENTION_TOUT:
if (!bp->max_pfcwd_tmo_ms)
return -EOPNOTSUPP;
return bnxt_hwrm_pfcwd_qcfg(bp, data);
default:
return -EOPNOTSUPP;
}

View File

@ -6751,6 +6751,46 @@ struct hwrm_queue_dscp2pri_cfg_output {
u8 valid;
};
/* hwrm_queue_pfcwd_timeout_qcaps_input (size:128b/16B) */
struct hwrm_queue_pfcwd_timeout_qcaps_input {
__le16 req_type;
__le16 cmpl_ring;
__le16 seq_id;
__le16 target_id;
__le64 resp_addr;
};
/* hwrm_queue_pfcwd_timeout_qcaps_output (size:128b/16B) */
struct hwrm_queue_pfcwd_timeout_qcaps_output {
__le16 error_code;
__le16 req_type;
__le16 seq_id;
__le16 resp_len;
__le16 max_pfcwd_timeout;
u8 unused_0[5];
u8 valid;
};
/* hwrm_queue_pfcwd_timeout_qcfg_input (size:128b/16B) */
struct hwrm_queue_pfcwd_timeout_qcfg_input {
__le16 req_type;
__le16 cmpl_ring;
__le16 seq_id;
__le16 target_id;
__le64 resp_addr;
};
/* hwrm_queue_pfcwd_timeout_qcfg_output (size:128b/16B) */
struct hwrm_queue_pfcwd_timeout_qcfg_output {
__le16 error_code;
__le16 req_type;
__le16 seq_id;
__le16 resp_len;
__le16 pfcwd_timeout_value;
u8 unused_0[5];
u8 valid;
};
/* hwrm_vnic_alloc_input (size:192b/24B) */
struct hwrm_vnic_alloc_input {
__le16 req_type;