* [RESEND. PATCH] mt76: mt76u_vendor_request: Do not print error messages when -EPROTO
@ 2024-12-18 9:08 WangYuli
2024-12-18 16:10 ` Alexander Lobakin
0 siblings, 1 reply; 7+ messages in thread
From: WangYuli @ 2024-12-18 9:08 UTC (permalink / raw)
To: nbd, lorenzo, ryder.lee, shayne.chen, sean.wang, kvalo,
matthias.bgg, angelogioacchino.delregno, davem, andrew+netdev,
edumazet, kuba, pabeni, alexander.deucher, gregkh, rodrigo.vivi
Cc: linux-wireless, linux-kernel, linux-arm-kernel, linux-mediatek,
raoxu, guanwentao, zhanjun, cug_yangyuancong, lorenzo.bianconi,
kvalo, sidhayn, lorenzo.bianconi83, sgruszka, keescook,
markus.theil, gustavoars, stf_xl, romain.perier, apais, mrkiko.rs,
oliver, woojung.huh, helmut.schaa, mailhol.vincent, dokyungs,
deren.wu, daniel, sujuan.chen, mikhail.v.gavrilov, stern,
linux-usb, leitao, dsahern, weiwan, netdev, horms, andrew, leit,
wang.zhao, chui-hao.chiu, lynxis, mingyen.hsieh, yn.chen,
quan.zhou, dzm91, gch981213, git, jiefeng_li, nelson.yu, rong.yan,
Bo.Jiao, StanleyYP.Wang, WangYuli
When initializing the network card, unplugging the device will
trigger an -EPROTO error, resulting in a flood of error messages
being printed frantically.
Co-developed-by: Xu Rao <raoxu@uniontech.com>
Signed-off-by: Xu Rao <raoxu@uniontech.com>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
---
drivers/net/wireless/mediatek/mt76/usb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index 58ff06823389..f9e67b8c3b3c 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -33,9 +33,9 @@ int __mt76u_vendor_request(struct mt76_dev *dev, u8 req, u8 req_type,
ret = usb_control_msg(udev, pipe, req, req_type, val,
offset, buf, len, MT_VEND_REQ_TOUT_MS);
- if (ret == -ENODEV)
+ if (ret == -ENODEV || ret == -EPROTO)
set_bit(MT76_REMOVED, &dev->phy.state);
- if (ret >= 0 || ret == -ENODEV)
+ if (ret >= 0 || ret == -ENODEV || ret == -EPROTO)
return ret;
usleep_range(5000, 10000);
}
--
2.45.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [RESEND. PATCH] mt76: mt76u_vendor_request: Do not print error messages when -EPROTO
2024-12-18 9:08 [RESEND. PATCH] mt76: mt76u_vendor_request: Do not print error messages when -EPROTO WangYuli
@ 2024-12-18 16:10 ` Alexander Lobakin
2024-12-18 16:50 ` Kalle Valo
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Alexander Lobakin @ 2024-12-18 16:10 UTC (permalink / raw)
To: WangYuli
Cc: nbd, lorenzo, ryder.lee, shayne.chen, sean.wang, kvalo,
matthias.bgg, angelogioacchino.delregno, davem, andrew+netdev,
edumazet, kuba, pabeni, alexander.deucher, gregkh, rodrigo.vivi,
linux-wireless, linux-kernel, linux-arm-kernel, linux-mediatek,
raoxu, guanwentao, zhanjun, cug_yangyuancong, lorenzo.bianconi,
kvalo, sidhayn, lorenzo.bianconi83, sgruszka, keescook,
markus.theil, gustavoars, stf_xl, romain.perier, apais, mrkiko.rs,
oliver, woojung.huh, helmut.schaa, mailhol.vincent, dokyungs,
deren.wu, daniel, sujuan.chen, mikhail.v.gavrilov, stern,
linux-usb, leitao, dsahern, weiwan, netdev, horms, andrew, leit,
wang.zhao, chui-hao.chiu, lynxis, mingyen.hsieh, yn.chen,
quan.zhou, dzm91, gch981213, git, jiefeng_li, nelson.yu, rong.yan,
Bo.Jiao, StanleyYP.Wang
From: Wangyuli <wangyuli@uniontech.com>
Date: Wed, 18 Dec 2024 17:08:33 +0800
> [RESEND. PATCH] mt76: mt76u_vendor_request: Do not print error messages when -EPROTO
Is it a fix or an improvement?
You need to specify the target tree, either 'PATCH net' (fixes) or
'PATCH net-next' (improvements).
The '.' after 'RESEND' is not needed.
> When initializing the network card, unplugging the device will
> trigger an -EPROTO error, resulting in a flood of error messages
> being printed frantically.
>
If it's a fix, you need to have a 'Fixes:' tag here.
> Co-developed-by: Xu Rao <raoxu@uniontech.com>
> Signed-off-by: Xu Rao <raoxu@uniontech.com>
> Signed-off-by: WangYuli <wangyuli@uniontech.com>
> ---
> drivers/net/wireless/mediatek/mt76/usb.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
> index 58ff06823389..f9e67b8c3b3c 100644
> --- a/drivers/net/wireless/mediatek/mt76/usb.c
> +++ b/drivers/net/wireless/mediatek/mt76/usb.c
> @@ -33,9 +33,9 @@ int __mt76u_vendor_request(struct mt76_dev *dev, u8 req, u8 req_type,
>
> ret = usb_control_msg(udev, pipe, req, req_type, val,
> offset, buf, len, MT_VEND_REQ_TOUT_MS);
> - if (ret == -ENODEV)
> + if (ret == -ENODEV || ret == -EPROTO)
> set_bit(MT76_REMOVED, &dev->phy.state);
> - if (ret >= 0 || ret == -ENODEV)
> + if (ret >= 0 || ret == -ENODEV || ret == -EPROTO)
> return ret;
> usleep_range(5000, 10000);
How do other drivers handle this?
Can -EPROTO happen in other cases, not only unplugging, which this patch
would break?
Thanks,
Olek
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RESEND. PATCH] mt76: mt76u_vendor_request: Do not print error messages when -EPROTO
2024-12-18 16:10 ` Alexander Lobakin
@ 2024-12-18 16:50 ` Kalle Valo
2024-12-19 7:11 ` WangYuli
2024-12-19 23:27 ` mt76: dealing with disconnections, -ENODEV and -EPROTO Michał Pecio
2 siblings, 0 replies; 7+ messages in thread
From: Kalle Valo @ 2024-12-18 16:50 UTC (permalink / raw)
To: Alexander Lobakin
Cc: WangYuli, nbd, lorenzo, ryder.lee, shayne.chen, sean.wang,
matthias.bgg, angelogioacchino.delregno, davem, andrew+netdev,
edumazet, kuba, pabeni, alexander.deucher, gregkh, rodrigo.vivi,
linux-wireless, linux-kernel, linux-arm-kernel, linux-mediatek,
raoxu, guanwentao, zhanjun, cug_yangyuancong, lorenzo.bianconi,
kvalo, sidhayn, lorenzo.bianconi83, sgruszka, keescook,
markus.theil, gustavoars, stf_xl, romain.perier, apais, mrkiko.rs,
oliver, woojung.huh, helmut.schaa, mailhol.vincent, dokyungs,
deren.wu, daniel, sujuan.chen, mikhail.v.gavrilov, stern,
linux-usb, leitao, dsahern, weiwan, netdev, horms, andrew, leit,
wang.zhao, chui-hao.chiu, lynxis, mingyen.hsieh, yn.chen,
quan.zhou, dzm91, gch981213, git, jiefeng_li, nelson.yu, rong.yan,
Bo.Jiao, StanleyYP.Wang
Alexander Lobakin <aleksander.lobakin@intel.com> writes:
> From: Wangyuli <wangyuli@uniontech.com>
> Date: Wed, 18 Dec 2024 17:08:33 +0800
>
>> [RESEND. PATCH] mt76: mt76u_vendor_request: Do not print error messages when -EPROTO
>
> Is it a fix or an improvement?
> You need to specify the target tree, either 'PATCH net' (fixes) or
> 'PATCH net-next' (improvements).
Actually this is a wireless driver so the options are either wireless
tree or Felix' tree (for -next). And please add 'wifi:' to subject.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RESEND. PATCH] mt76: mt76u_vendor_request: Do not print error messages when -EPROTO
2024-12-18 16:10 ` Alexander Lobakin
2024-12-18 16:50 ` Kalle Valo
@ 2024-12-19 7:11 ` WangYuli
2024-12-19 15:23 ` Alexander Lobakin
2024-12-19 23:27 ` mt76: dealing with disconnections, -ENODEV and -EPROTO Michał Pecio
2 siblings, 1 reply; 7+ messages in thread
From: WangYuli @ 2024-12-19 7:11 UTC (permalink / raw)
To: Alexander Lobakin
Cc: nbd, lorenzo, ryder.lee, shayne.chen, sean.wang, kvalo,
matthias.bgg, angelogioacchino.delregno, davem, andrew+netdev,
edumazet, kuba, pabeni, alexander.deucher, gregkh, rodrigo.vivi,
linux-wireless, linux-kernel, linux-arm-kernel, linux-mediatek,
raoxu, guanwentao, zhanjun, cug_yangyuancong, lorenzo.bianconi,
kvalo, sidhayn, lorenzo.bianconi83, sgruszka, keescook,
markus.theil, gustavoars, stf_xl, romain.perier, apais, mrkiko.rs,
oliver, woojung.huh, helmut.schaa, mailhol.vincent, dokyungs,
deren.wu, daniel, sujuan.chen, mikhail.v.gavrilov, stern,
linux-usb, leitao, dsahern, weiwan, netdev, horms, andrew, leit,
wang.zhao, chui-hao.chiu, lynxis, mingyen.hsieh, yn.chen,
quan.zhou, dzm91, gch981213, git, jiefeng_li, nelson.yu, rong.yan,
Bo.Jiao, StanleyYP.Wang
[-- Attachment #1.1.1.1: Type: text/plain, Size: 1521 bytes --]
On 2024/12/19 00:10, Alexander Lobakin wrote:
> Is it a fix or an improvement?
> You need to specify the target tree, either 'PATCH net' (fixes) or
> 'PATCH net-next' (improvements).
It is a fix not an improvement.
> How do other drivers handle this?
> Can -EPROTO happen in other cases, not only unplugging, which this patch
> would break?
>
When initializing the network card, unplugging the device will trigger
an -EPROTO error.
The exception is printed as follows:
mt76x2u 2-2.4:1.0: vendor request req:47 off:9018 failed:-71
mt76x2u 2-2.4:1.0: vendor request req:47 off:9018 failed:-71
...
It will continue to print more than 2000 times for about 5 minutes,
causing the usb device to be unable to be disconnected. During this
period, the usb port cannot recognize the new device because the old
device has not disconnected.
There may be other operating methods that cause -EPROTO, but -EPROTO is
a low-level hardware error. It is unwise to repeat vendor requests
expecting to read correct data. It is a better choice to treat -EPROTO
and -ENODEV the same way。
Similar to commit (mt76: usb: process URBs with status EPROTO
properly)do no schedule rx_worker for urb marked with status set
-EPROTO. I also reproduced this situation when plugging and unplugging
the device, and this patch is effective.
Just do not vendor request again for urb marked with status set -EPROTO .
Thanks,
--
WangYuli
[-- Attachment #1.1.1.2: Type: text/html, Size: 2382 bytes --]
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 645 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RESEND. PATCH] mt76: mt76u_vendor_request: Do not print error messages when -EPROTO
2024-12-19 7:11 ` WangYuli
@ 2024-12-19 15:23 ` Alexander Lobakin
2024-12-24 9:01 ` WangYuli
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Lobakin @ 2024-12-19 15:23 UTC (permalink / raw)
To: WangYuli
Cc: nbd, lorenzo, ryder.lee, shayne.chen, sean.wang, kvalo,
matthias.bgg, angelogioacchino.delregno, davem, andrew+netdev,
edumazet, kuba, pabeni, alexander.deucher, gregkh, rodrigo.vivi,
linux-wireless, linux-kernel, linux-arm-kernel, linux-mediatek,
raoxu, guanwentao, zhanjun, cug_yangyuancong, lorenzo.bianconi,
kvalo, sidhayn, lorenzo.bianconi83, sgruszka, keescook,
markus.theil, gustavoars, stf_xl, romain.perier, apais, mrkiko.rs,
oliver, woojung.huh, helmut.schaa, mailhol.vincent, dokyungs,
deren.wu, daniel, sujuan.chen, mikhail.v.gavrilov, stern,
linux-usb, leitao, dsahern, weiwan, netdev, horms, andrew, leit,
wang.zhao, chui-hao.chiu, lynxis, mingyen.hsieh, yn.chen,
quan.zhou, dzm91, gch981213, git, jiefeng_li, nelson.yu, rong.yan,
Bo.Jiao, StanleyYP.Wang
From: Wangyuli <wangyuli@uniontech.com>
Date: Thu, 19 Dec 2024 15:11:24 +0800
> On 2024/12/19 00:10, Alexander Lobakin wrote:
>
>> Is it a fix or an improvement?
>> You need to specify the target tree, either 'PATCH net' (fixes) or
>> 'PATCH net-next' (improvements).
> It is a fix not an improvement.
So you need to add the correct tree and/or subject prefix and specify
"Fixes:" tag with the commit this change fixes.
>> How do other drivers handle this?
>> Can -EPROTO happen in other cases, not only unplugging, which this patch
>> would break?
>>
> When initializing the network card, unplugging the device will trigger
> an -EPROTO error.
>
> The exception is printed as follows:
>
>
> mt76x2u 2-2.4:1.0: vendor request req:47 off:9018 failed:-71
> mt76x2u 2-2.4:1.0: vendor request req:47 off:9018 failed:-71
> ...
>
>
> It will continue to print more than 2000 times for about 5 minutes,
> causing the usb device to be unable to be disconnected. During this
> period, the usb port cannot recognize the new device because the old
> device has not disconnected.
>
> There may be other operating methods that cause -EPROTO, but -EPROTO is
> a low-level hardware error. It is unwise to repeat vendor requests
> expecting to read correct data. It is a better choice to treat -EPROTO
> and -ENODEV the same way.
>
> Similar to commit (mt76: usb: process URBs with status EPROTO
> properly)do no schedule rx_worker for urb marked with status set -
> EPROTO. I also reproduced this situation when plugging and unplugging
> the device, and this patch is effective.
I'm not a wireless expert, from my PoV sounds good. Just describe
everything in details in the commit message, so that it will be clear
for everyone.
>
> Just do not vendor request again for urb marked with status set -EPROTO .
>
>
> Thanks,
>
> --
> WangYuli
Thanks,
Olek
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: mt76: dealing with disconnections, -ENODEV and -EPROTO
2024-12-18 16:10 ` Alexander Lobakin
2024-12-18 16:50 ` Kalle Valo
2024-12-19 7:11 ` WangYuli
@ 2024-12-19 23:27 ` Michał Pecio
2 siblings, 0 replies; 7+ messages in thread
From: Michał Pecio @ 2024-12-19 23:27 UTC (permalink / raw)
To: aleksander.lobakin
Cc: Bo.Jiao, StanleyYP.Wang, alexander.deucher, andrew+netdev, andrew,
angelogioacchino.delregno, apais, chui-hao.chiu, cug_yangyuancong,
daniel, davem, deren.wu, dokyungs, dsahern, dzm91, edumazet,
gch981213, git, gregkh, guanwentao, gustavoars, helmut.schaa,
horms, jiefeng_li, keescook, kuba, kvalo, kvalo, leit, leitao,
linux-arm-kernel, linux-kernel, linux-mediatek, linux-usb,
linux-wireless, lorenzo.bianconi83, lorenzo.bianconi, lorenzo,
lynxis, mailhol.vincent, markus.theil, matthias.bgg,
mikhail.v.gavrilov, mingyen.hsieh, mrkiko.rs, nbd, nelson.yu,
netdev, oliver, pabeni, quan.zhou, raoxu, rodrigo.vivi,
romain.perier, rong.yan, ryder.lee, sean.wang, sgruszka,
shayne.chen, sidhayn, stern, stf_xl, sujuan.chen, wang.zhao,
wangyuli, weiwan, woojung.huh, yn.chen, zhanjun
> > ret = usb_control_msg(udev, pipe, req, req_type, val,
> > offset, buf, len, MT_VEND_REQ_TOUT_MS);
> > - if (ret == -ENODEV)
> > + if (ret == -ENODEV || ret == -EPROTO)
> > set_bit(MT76_REMOVED, &dev->phy.state);
> > - if (ret >= 0 || ret == -ENODEV)
> > + if (ret >= 0 || ret == -ENODEV || ret == -EPROTO)
> > return ret;
> > usleep_range(5000, 10000);
>
> How do other drivers handle this?
> Can -EPROTO happen in other cases, not only unplugging, which this
> patch would break?
Yes, -EPROTO may be a transient error, although they are relatively
rare as some retries are done before the URB fails. This patch will
only break things if things work in the first place, i.e. the driver
has sensible retry policies, the hardware doesn't get confused, etc.
Note that -EPROTO is not guaranteed in this case, see
Documentation/driver-api/usb/error-codes.rst
I know that xHCI gives -EPROTO and it looks like EHCI does too (IDK
if this is reliable), but I just checked that OHCI gives -ETIME.
I don't have this hardware, but I played with some other wired/WiFi
dongles and observed similar problems of varying severity.
It looks to me like USB core doesn't actually return -ENODEV on
disconnected devices, or at least doesn't react to disconnection
until .probe() returns, I am not yet sure which of those.
And drivers don't seem to expect -EPROTO or -ETIME to be fatal.
And maybe they should, if they wouldn't be able to recover from it
anyway, and I know that there are drivers which can't. But I think
this USB subsystem behavior is suboptimal too.
Regards,
Michal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RESEND. PATCH] mt76: mt76u_vendor_request: Do not print error messages when -EPROTO
2024-12-19 15:23 ` Alexander Lobakin
@ 2024-12-24 9:01 ` WangYuli
0 siblings, 0 replies; 7+ messages in thread
From: WangYuli @ 2024-12-24 9:01 UTC (permalink / raw)
To: Alexander Lobakin, Kalle Valo
Cc: nbd, lorenzo, ryder.lee, shayne.chen, sean.wang, kvalo,
matthias.bgg, angelogioacchino.delregno, davem, andrew+netdev,
edumazet, kuba, pabeni, alexander.deucher, gregkh, rodrigo.vivi,
linux-wireless, linux-kernel, linux-arm-kernel, linux-mediatek,
raoxu, guanwentao, zhanjun, cug_yangyuancong, lorenzo.bianconi,
kvalo, sidhayn, lorenzo.bianconi83, sgruszka, keescook,
markus.theil, gustavoars, stf_xl, romain.perier, apais, mrkiko.rs,
oliver, woojung.huh, helmut.schaa, mailhol.vincent, dokyungs,
deren.wu, daniel, sujuan.chen, mikhail.v.gavrilov, stern,
linux-usb, leitao, dsahern, weiwan, netdev, horms, andrew, leit,
wang.zhao, chui-hao.chiu, lynxis, mingyen.hsieh, yn.chen,
quan.zhou, dzm91, gch981213, git, jiefeng_li, nelson.yu, rong.yan,
Bo.Jiao, StanleyYP.Wang
On 2024/12/19 23:23, Alexander Lobakin wrote:
> So you need to add the correct tree and/or subject prefix and specify
> "Fixes:" tag with the commit this change fixes.
>
>> ...
> I'm not a wireless expert, from my PoV sounds good. Just describe
> everything in details in the commit message, so that it will be clear
> for everyone.
Hi, I have attached the new patch as requested for your review.
Link:
https://lore.kernel.org/all/BA065B146422EE5B+20241224085244.629015-1-wangyuli@uniontech.com/
Please let me know if you have any questions.
Thanks,
--
WangYuli
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-12-24 9:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-18 9:08 [RESEND. PATCH] mt76: mt76u_vendor_request: Do not print error messages when -EPROTO WangYuli
2024-12-18 16:10 ` Alexander Lobakin
2024-12-18 16:50 ` Kalle Valo
2024-12-19 7:11 ` WangYuli
2024-12-19 15:23 ` Alexander Lobakin
2024-12-24 9:01 ` WangYuli
2024-12-19 23:27 ` mt76: dealing with disconnections, -ENODEV and -EPROTO Michał Pecio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).