Re: [PATCH] wifi: rtl8xxxu: fixing transmisison failure for rtl8192eu

From: Ping-Ke Shih
Date: Tue Dec 20 2022 - 20:42:59 EST


On Tue, 2022-12-20 at 15:03 +0200, Bitterblue Smith wrote:
> On 20/12/2022 07:44, Ping-Ke Shih wrote:
> >
> > > -----Original Message-----
> > > From: Jun ASAKA <JunASAKA@xxxxxxxxxxxxx>
> > > Sent: Saturday, December 17, 2022 11:07 AM
> > > To: Jes.Sorensen@xxxxxxxxx
> > > Cc: kvalo@xxxxxxxxxx; davem@xxxxxxxxxxxxx; edumazet@xxxxxxxxxx; kuba@xxxxxxxxxx;
> > > pabeni@xxxxxxxxxx;
> > > linux-wireless@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Jun
> > > ASAKA
> > > <JunASAKA@xxxxxxxxxxxxx>
> > > Subject: [PATCH] wifi: rtl8xxxu: fixing transmisison failure for rtl8192eu
> > >
> > > Fixing transmission failure which results in
> > > "authentication with ... timed out". This can be
> > > fixed by disable the REG_TXPAUSE.
> > >
> > > Signed-off-by: Jun ASAKA <JunASAKA@xxxxxxxxxxxxx>
> > > ---
> > > drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 5 +++++
> > > 1 file changed, 5 insertions(+)
> > >
> > > diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
> > > b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
> > > index a7d76693c02d..9d0ed6760cb6 100644
> > > --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
> > > +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
> > > @@ -1744,6 +1744,11 @@ static void rtl8192e_enable_rf(struct rtl8xxxu_priv *priv)
> > > val8 = rtl8xxxu_read8(priv, REG_PAD_CTRL1);
> > > val8 &= ~BIT(0);
> > > rtl8xxxu_write8(priv, REG_PAD_CTRL1, val8);
> > > +
> > > + /*
> > > + * Fix transmission failure of rtl8192e.
> > > + */
> > > + rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00);
> >
> > I trace when rtl8xxxu set REG_TXPAUSE=0xff that will stop TX.
> > The occasions include RF calibration, LPS mode (called by power off), and
> > going to stop. So, I think RF calibration does TX pause but not restore
> > settings after calibration, and causes TX stuck. As the flow I traced,
> > this patch looks reasonable. But, I wonder why other people don't meet
> > this problem.
> >
> Other people have this problem too:
> https://bugzilla.kernel.org/show_bug.cgi?id=196769
> https://bugzilla.kernel.org/show_bug.cgi?id=216746

In the threads, you have answered my question with
"kernel 4.8.0 works, but 4.9.? does not work."

>
> The RF calibration does restore REG_TXPAUSE at the end. What happens is
> when you plug in the device, something (mac80211? wpa_supplicant?) calls
> rtl8xxxu_start(), then rtl8xxxu_stop(), then rtl8xxxu_start() again.
> rtl8xxxu_stop() sets REG_TXPAUSE to 0xff and nothing sets it back to 0.
>

You are correct. That is clear to me. I miss the point that RF calibration
does backup/restore registers containing REG_TXPAUSE.

Then, I think my reviewed-by can be still applied, right?

Ping-Ke