]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
eth: fbnic: Update RX mbox timeout value
authorMohsin Bashir <mohsin.bashr@gmail.com>
Thu, 15 Jan 2026 00:33:53 +0000 (16:33 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 21 Jan 2026 02:18:41 +0000 (18:18 -0800)
While waiting for completions on read requests, driver is using
different timeout values for different messages. Make use of a single
timeout value.

Introduce a wrapper function to handle the wait, which also simplify
maintaining the 80 char line limit.

Signed-off-by: Mohsin Bashir <mohsin.bashr@gmail.com>
Link: https://patch.msgid.link/20260115003353.4150771-6-mohsin.bashr@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/meta/fbnic/fbnic_devlink.c
drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
drivers/net/ethernet/meta/fbnic/fbnic_fw.h

index b62b1d5b1453e7555fa003a33e9992ea303ad85c..f1c992f5fe94621902154be70b8aae24954b4003 100644 (file)
@@ -178,7 +178,7 @@ fbnic_flash_start(struct fbnic_dev *fbd, struct pldmfw_component *component)
                goto cmpl_free;
 
        /* Wait for firmware to ack firmware upgrade start */
-       if (wait_for_completion_timeout(&cmpl->done, 10 * HZ))
+       if (fbnic_mbx_wait_for_cmpl(cmpl))
                err = cmpl->result;
        else
                err = -ETIMEDOUT;
@@ -252,7 +252,7 @@ fbnic_flash_component(struct pldmfw *context,
                goto err_no_msg;
 
        while (offset < size) {
-               if (!wait_for_completion_timeout(&cmpl->done, 15 * HZ)) {
+               if (!fbnic_mbx_wait_for_cmpl(cmpl)) {
                        err = -ETIMEDOUT;
                        break;
                }
@@ -390,7 +390,7 @@ static int fbnic_fw_reporter_dump(struct devlink_health_reporter *reporter,
                                   "Failed to transmit core dump info msg");
                goto cmpl_free;
        }
-       if (!wait_for_completion_timeout(&fw_cmpl->done, 2 * HZ)) {
+       if (!fbnic_mbx_wait_for_cmpl(fw_cmpl)) {
                NL_SET_ERR_MSG_MOD(extack,
                                   "Timed out waiting on core dump info");
                err = -ETIMEDOUT;
@@ -447,7 +447,7 @@ static int fbnic_fw_reporter_dump(struct devlink_health_reporter *reporter,
                                goto cmpl_cleanup;
                }
 
-               if (wait_for_completion_timeout(&fw_cmpl->done, 2 * HZ)) {
+               if (fbnic_mbx_wait_for_cmpl(fw_cmpl)) {
                        reinit_completion(&fw_cmpl->done);
                } else {
                        NL_SET_ERR_MSG_FMT_MOD(extack,
index 693ebdf387055203d62de51d2b4f0994ec572ffa..61b8005a0db5fde2d1bd9ed3127e65802be49323 100644 (file)
@@ -1671,7 +1671,7 @@ fbnic_get_module_eeprom_by_page(struct net_device *netdev,
                goto exit_free;
        }
 
-       if (!wait_for_completion_timeout(&fw_cmpl->done, 2 * HZ)) {
+       if (!fbnic_mbx_wait_for_cmpl(fw_cmpl)) {
                err = -ETIMEDOUT;
                NL_SET_ERR_MSG_MOD(extack,
                                   "Timed out waiting for firmware response");
index 1ecd777aaadab7de5f77b8e02de084d9b12f3314..b40f68187ad58e6befc8783eae5b699ed462d327 100644 (file)
@@ -4,6 +4,7 @@
 #ifndef _FBNIC_FW_H_
 #define _FBNIC_FW_H_
 
+#include <linux/completion.h>
 #include <linux/if_ether.h>
 #include <linux/types.h>
 
@@ -36,6 +37,7 @@ struct fbnic_fw_mbx {
  *                       + INDEX_SZ))
  */
 #define FBNIC_FW_MAX_LOG_HISTORY               14
+#define FBNIC_MBX_RX_TO_SEC                    10
 
 struct fbnic_fw_ver {
        u32 version;
@@ -129,6 +131,13 @@ struct fbnic_fw_completion *__fbnic_fw_alloc_cmpl(u32 msg_type,
 struct fbnic_fw_completion *fbnic_fw_alloc_cmpl(u32 msg_type);
 void fbnic_fw_put_cmpl(struct fbnic_fw_completion *cmpl_data);
 
+static inline unsigned long
+fbnic_mbx_wait_for_cmpl(struct fbnic_fw_completion *cmpl)
+{
+       return wait_for_completion_timeout(&cmpl->done,
+                                          FBNIC_MBX_RX_TO_SEC * HZ);
+}
+
 #define fbnic_mk_full_fw_ver_str(_rev_id, _delim, _commit, _str, _str_sz) \
 do {                                                                   \
        const u32 __rev_id = _rev_id;                                   \