RE: [PATCH V3] wifi: rtlwifi: Drastically reduce the attempts to read efuse in case of failures
From: Ping-Ke Shih
Date: Fri Nov 01 2024 - 00:23:06 EST
Guilherme G. Piccoli <gpiccoli@xxxxxxxxxx> wrote:
> diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.c
> b/drivers/net/wireless/realtek/rtlwifi/efuse.c
> index 82cf5fb5175f..0ff553f650f9 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/efuse.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/efuse.c
> @@ -162,9 +162,19 @@ void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value)
> void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf)
> {
> struct rtl_priv *rtlpriv = rtl_priv(hw);
> + u16 retry, max_attempts;
> u32 value32;
> u8 readbyte;
> - u16 retry;
> +
> + /*
> + * In case of USB devices, transfer speeds are limited, hence
> + * efuse I/O reads could be (way) slower. So, decrease (a lot)
> + * the read attempts in case of failures.
> + */
> + if (rtlpriv->rtlhal.interface == INTF_PCI)
> + max_attempts = 10000;
> + else
> + max_attempts = 10;
As your comment, setting max_atttempts to 10 under condition of INTF_USB would
be more reasonable, like
u16 max_attempts = 10000;
if (rtlpriv->rtlhal.interface == INTF_USB)
max_attempts = 10;