mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
net: usb: ax88179_178a: fix link status when link is set to down/up
The idea was to keep only one reset at initialization stage in order to
reduce the total delay, or the reset from usbnet_probe or the reset from
usbnet_open.
I have seen that restarting from usbnet_probe is necessary to avoid doing
too complex things. But when the link is set to down/up (for example to
configure a different mac address) the link is not correctly recovered
unless a reset is commanded from usbnet_open.
So, detect the initialization stage (first call) to not reset from
usbnet_open after the reset from usbnet_probe and after this stage, always
reset from usbnet_open too (when the link needs to be rechecked).
Apply to all the possible devices, the behavior now is going to be the same.
cc: stable@vger.kernel.org # 6.6+
Fixes: 56f78615bc
("net: usb: ax88179_178a: avoid writing the mac address before first reading")
Reported-by: Isaac Ganoung <inventor500@vivaldi.net>
Reported-by: Yongqin Liu <yongqin.liu@linaro.org>
Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240510090846.328201-1-jtornosm@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
5eefb477d2
commit
ecf848eb93
@ -174,6 +174,7 @@ struct ax88179_data {
|
|||||||
u32 wol_supported;
|
u32 wol_supported;
|
||||||
u32 wolopts;
|
u32 wolopts;
|
||||||
u8 disconnecting;
|
u8 disconnecting;
|
||||||
|
u8 initialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ax88179_int_data {
|
struct ax88179_int_data {
|
||||||
@ -1673,6 +1674,18 @@ static int ax88179_reset(struct usbnet *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ax88179_net_reset(struct usbnet *dev)
|
||||||
|
{
|
||||||
|
struct ax88179_data *ax179_data = dev->driver_priv;
|
||||||
|
|
||||||
|
if (ax179_data->initialized)
|
||||||
|
ax88179_reset(dev);
|
||||||
|
else
|
||||||
|
ax179_data->initialized = 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int ax88179_stop(struct usbnet *dev)
|
static int ax88179_stop(struct usbnet *dev)
|
||||||
{
|
{
|
||||||
u16 tmp16;
|
u16 tmp16;
|
||||||
@ -1692,6 +1705,7 @@ static const struct driver_info ax88179_info = {
|
|||||||
.unbind = ax88179_unbind,
|
.unbind = ax88179_unbind,
|
||||||
.status = ax88179_status,
|
.status = ax88179_status,
|
||||||
.link_reset = ax88179_link_reset,
|
.link_reset = ax88179_link_reset,
|
||||||
|
.reset = ax88179_net_reset,
|
||||||
.stop = ax88179_stop,
|
.stop = ax88179_stop,
|
||||||
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
||||||
.rx_fixup = ax88179_rx_fixup,
|
.rx_fixup = ax88179_rx_fixup,
|
||||||
@ -1704,6 +1718,7 @@ static const struct driver_info ax88178a_info = {
|
|||||||
.unbind = ax88179_unbind,
|
.unbind = ax88179_unbind,
|
||||||
.status = ax88179_status,
|
.status = ax88179_status,
|
||||||
.link_reset = ax88179_link_reset,
|
.link_reset = ax88179_link_reset,
|
||||||
|
.reset = ax88179_net_reset,
|
||||||
.stop = ax88179_stop,
|
.stop = ax88179_stop,
|
||||||
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
||||||
.rx_fixup = ax88179_rx_fixup,
|
.rx_fixup = ax88179_rx_fixup,
|
||||||
@ -1716,7 +1731,7 @@ static const struct driver_info cypress_GX3_info = {
|
|||||||
.unbind = ax88179_unbind,
|
.unbind = ax88179_unbind,
|
||||||
.status = ax88179_status,
|
.status = ax88179_status,
|
||||||
.link_reset = ax88179_link_reset,
|
.link_reset = ax88179_link_reset,
|
||||||
.reset = ax88179_reset,
|
.reset = ax88179_net_reset,
|
||||||
.stop = ax88179_stop,
|
.stop = ax88179_stop,
|
||||||
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
||||||
.rx_fixup = ax88179_rx_fixup,
|
.rx_fixup = ax88179_rx_fixup,
|
||||||
@ -1729,7 +1744,7 @@ static const struct driver_info dlink_dub1312_info = {
|
|||||||
.unbind = ax88179_unbind,
|
.unbind = ax88179_unbind,
|
||||||
.status = ax88179_status,
|
.status = ax88179_status,
|
||||||
.link_reset = ax88179_link_reset,
|
.link_reset = ax88179_link_reset,
|
||||||
.reset = ax88179_reset,
|
.reset = ax88179_net_reset,
|
||||||
.stop = ax88179_stop,
|
.stop = ax88179_stop,
|
||||||
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
||||||
.rx_fixup = ax88179_rx_fixup,
|
.rx_fixup = ax88179_rx_fixup,
|
||||||
@ -1742,7 +1757,7 @@ static const struct driver_info sitecom_info = {
|
|||||||
.unbind = ax88179_unbind,
|
.unbind = ax88179_unbind,
|
||||||
.status = ax88179_status,
|
.status = ax88179_status,
|
||||||
.link_reset = ax88179_link_reset,
|
.link_reset = ax88179_link_reset,
|
||||||
.reset = ax88179_reset,
|
.reset = ax88179_net_reset,
|
||||||
.stop = ax88179_stop,
|
.stop = ax88179_stop,
|
||||||
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
||||||
.rx_fixup = ax88179_rx_fixup,
|
.rx_fixup = ax88179_rx_fixup,
|
||||||
@ -1755,7 +1770,7 @@ static const struct driver_info samsung_info = {
|
|||||||
.unbind = ax88179_unbind,
|
.unbind = ax88179_unbind,
|
||||||
.status = ax88179_status,
|
.status = ax88179_status,
|
||||||
.link_reset = ax88179_link_reset,
|
.link_reset = ax88179_link_reset,
|
||||||
.reset = ax88179_reset,
|
.reset = ax88179_net_reset,
|
||||||
.stop = ax88179_stop,
|
.stop = ax88179_stop,
|
||||||
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
||||||
.rx_fixup = ax88179_rx_fixup,
|
.rx_fixup = ax88179_rx_fixup,
|
||||||
@ -1768,7 +1783,7 @@ static const struct driver_info lenovo_info = {
|
|||||||
.unbind = ax88179_unbind,
|
.unbind = ax88179_unbind,
|
||||||
.status = ax88179_status,
|
.status = ax88179_status,
|
||||||
.link_reset = ax88179_link_reset,
|
.link_reset = ax88179_link_reset,
|
||||||
.reset = ax88179_reset,
|
.reset = ax88179_net_reset,
|
||||||
.stop = ax88179_stop,
|
.stop = ax88179_stop,
|
||||||
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
||||||
.rx_fixup = ax88179_rx_fixup,
|
.rx_fixup = ax88179_rx_fixup,
|
||||||
@ -1781,7 +1796,7 @@ static const struct driver_info belkin_info = {
|
|||||||
.unbind = ax88179_unbind,
|
.unbind = ax88179_unbind,
|
||||||
.status = ax88179_status,
|
.status = ax88179_status,
|
||||||
.link_reset = ax88179_link_reset,
|
.link_reset = ax88179_link_reset,
|
||||||
.reset = ax88179_reset,
|
.reset = ax88179_net_reset,
|
||||||
.stop = ax88179_stop,
|
.stop = ax88179_stop,
|
||||||
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
||||||
.rx_fixup = ax88179_rx_fixup,
|
.rx_fixup = ax88179_rx_fixup,
|
||||||
@ -1794,7 +1809,7 @@ static const struct driver_info toshiba_info = {
|
|||||||
.unbind = ax88179_unbind,
|
.unbind = ax88179_unbind,
|
||||||
.status = ax88179_status,
|
.status = ax88179_status,
|
||||||
.link_reset = ax88179_link_reset,
|
.link_reset = ax88179_link_reset,
|
||||||
.reset = ax88179_reset,
|
.reset = ax88179_net_reset,
|
||||||
.stop = ax88179_stop,
|
.stop = ax88179_stop,
|
||||||
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
||||||
.rx_fixup = ax88179_rx_fixup,
|
.rx_fixup = ax88179_rx_fixup,
|
||||||
@ -1807,7 +1822,7 @@ static const struct driver_info mct_info = {
|
|||||||
.unbind = ax88179_unbind,
|
.unbind = ax88179_unbind,
|
||||||
.status = ax88179_status,
|
.status = ax88179_status,
|
||||||
.link_reset = ax88179_link_reset,
|
.link_reset = ax88179_link_reset,
|
||||||
.reset = ax88179_reset,
|
.reset = ax88179_net_reset,
|
||||||
.stop = ax88179_stop,
|
.stop = ax88179_stop,
|
||||||
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
||||||
.rx_fixup = ax88179_rx_fixup,
|
.rx_fixup = ax88179_rx_fixup,
|
||||||
@ -1820,7 +1835,7 @@ static const struct driver_info at_umc2000_info = {
|
|||||||
.unbind = ax88179_unbind,
|
.unbind = ax88179_unbind,
|
||||||
.status = ax88179_status,
|
.status = ax88179_status,
|
||||||
.link_reset = ax88179_link_reset,
|
.link_reset = ax88179_link_reset,
|
||||||
.reset = ax88179_reset,
|
.reset = ax88179_net_reset,
|
||||||
.stop = ax88179_stop,
|
.stop = ax88179_stop,
|
||||||
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
||||||
.rx_fixup = ax88179_rx_fixup,
|
.rx_fixup = ax88179_rx_fixup,
|
||||||
@ -1833,7 +1848,7 @@ static const struct driver_info at_umc200_info = {
|
|||||||
.unbind = ax88179_unbind,
|
.unbind = ax88179_unbind,
|
||||||
.status = ax88179_status,
|
.status = ax88179_status,
|
||||||
.link_reset = ax88179_link_reset,
|
.link_reset = ax88179_link_reset,
|
||||||
.reset = ax88179_reset,
|
.reset = ax88179_net_reset,
|
||||||
.stop = ax88179_stop,
|
.stop = ax88179_stop,
|
||||||
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
||||||
.rx_fixup = ax88179_rx_fixup,
|
.rx_fixup = ax88179_rx_fixup,
|
||||||
@ -1846,7 +1861,7 @@ static const struct driver_info at_umc2000sp_info = {
|
|||||||
.unbind = ax88179_unbind,
|
.unbind = ax88179_unbind,
|
||||||
.status = ax88179_status,
|
.status = ax88179_status,
|
||||||
.link_reset = ax88179_link_reset,
|
.link_reset = ax88179_link_reset,
|
||||||
.reset = ax88179_reset,
|
.reset = ax88179_net_reset,
|
||||||
.stop = ax88179_stop,
|
.stop = ax88179_stop,
|
||||||
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
|
||||||
.rx_fixup = ax88179_rx_fixup,
|
.rx_fixup = ax88179_rx_fixup,
|
||||||
|
Loading…
Reference in New Issue
Block a user