]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bnxt_en: Implement ethtool .get_tunable() for ETHTOOL_PFC_PREVENTION_TOUT
authorMichael Chan <michael.chan@broadcom.com>
Wed, 17 Sep 2025 04:08:38 +0000 (21:08 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 18 Sep 2025 11:09:43 +0000 (13:09 +0200)
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>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
include/linux/bnxt/hsi.h

index c49a4755a94d0b43c1d190465751d8cb2d9a1f2a..d59612d1e176005b18fc1d02eabb58946feefb5e 100644 (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);
index c0f46eaf91c037a3a238384842ae32db02793cc5..06a4c2afdf8ab1b538bbfca2abb20302756cfee6 100644 (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;
index 2830a2b17a27ca7fe1675f2ccfa1048011e87465..d94a8a2bf0f9e3a8be6f16e97aaca50752f85848 100644 (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;
        }
index 8c5dac3b3ef37eeebffbfb938582f91afb6ece25..23e7b1290a92edba28af75ecb789b68ac28ec650 100644 (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;