Skip to content

Commit a202b26

Browse files
jtornosmgregkh
authored andcommitted
net: usb: ax88179_178a: fix link status when link is set to down/up
commit ecf848e upstream. 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: 56f7861 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ec96bcf commit a202b26

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

drivers/net/usb/ax88179_178a.c

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ struct ax88179_data {
174174
u32 wol_supported;
175175
u32 wolopts;
176176
u8 disconnecting;
177+
u8 initialized;
177178
};
178179

179180
struct ax88179_int_data {
@@ -1673,6 +1674,18 @@ static int ax88179_reset(struct usbnet *dev)
16731674
return 0;
16741675
}
16751676

1677+
static int ax88179_net_reset(struct usbnet *dev)
1678+
{
1679+
struct ax88179_data *ax179_data = dev->driver_priv;
1680+
1681+
if (ax179_data->initialized)
1682+
ax88179_reset(dev);
1683+
else
1684+
ax179_data->initialized = 1;
1685+
1686+
return 0;
1687+
}
1688+
16761689
static int ax88179_stop(struct usbnet *dev)
16771690
{
16781691
u16 tmp16;
@@ -1692,6 +1705,7 @@ static const struct driver_info ax88179_info = {
16921705
.unbind = ax88179_unbind,
16931706
.status = ax88179_status,
16941707
.link_reset = ax88179_link_reset,
1708+
.reset = ax88179_net_reset,
16951709
.stop = ax88179_stop,
16961710
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
16971711
.rx_fixup = ax88179_rx_fixup,
@@ -1704,6 +1718,7 @@ static const struct driver_info ax88178a_info = {
17041718
.unbind = ax88179_unbind,
17051719
.status = ax88179_status,
17061720
.link_reset = ax88179_link_reset,
1721+
.reset = ax88179_net_reset,
17071722
.stop = ax88179_stop,
17081723
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
17091724
.rx_fixup = ax88179_rx_fixup,
@@ -1716,7 +1731,7 @@ static const struct driver_info cypress_GX3_info = {
17161731
.unbind = ax88179_unbind,
17171732
.status = ax88179_status,
17181733
.link_reset = ax88179_link_reset,
1719-
.reset = ax88179_reset,
1734+
.reset = ax88179_net_reset,
17201735
.stop = ax88179_stop,
17211736
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
17221737
.rx_fixup = ax88179_rx_fixup,
@@ -1729,7 +1744,7 @@ static const struct driver_info dlink_dub1312_info = {
17291744
.unbind = ax88179_unbind,
17301745
.status = ax88179_status,
17311746
.link_reset = ax88179_link_reset,
1732-
.reset = ax88179_reset,
1747+
.reset = ax88179_net_reset,
17331748
.stop = ax88179_stop,
17341749
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
17351750
.rx_fixup = ax88179_rx_fixup,
@@ -1742,7 +1757,7 @@ static const struct driver_info sitecom_info = {
17421757
.unbind = ax88179_unbind,
17431758
.status = ax88179_status,
17441759
.link_reset = ax88179_link_reset,
1745-
.reset = ax88179_reset,
1760+
.reset = ax88179_net_reset,
17461761
.stop = ax88179_stop,
17471762
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
17481763
.rx_fixup = ax88179_rx_fixup,
@@ -1755,7 +1770,7 @@ static const struct driver_info samsung_info = {
17551770
.unbind = ax88179_unbind,
17561771
.status = ax88179_status,
17571772
.link_reset = ax88179_link_reset,
1758-
.reset = ax88179_reset,
1773+
.reset = ax88179_net_reset,
17591774
.stop = ax88179_stop,
17601775
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
17611776
.rx_fixup = ax88179_rx_fixup,
@@ -1768,7 +1783,7 @@ static const struct driver_info lenovo_info = {
17681783
.unbind = ax88179_unbind,
17691784
.status = ax88179_status,
17701785
.link_reset = ax88179_link_reset,
1771-
.reset = ax88179_reset,
1786+
.reset = ax88179_net_reset,
17721787
.stop = ax88179_stop,
17731788
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
17741789
.rx_fixup = ax88179_rx_fixup,
@@ -1781,7 +1796,7 @@ static const struct driver_info belkin_info = {
17811796
.unbind = ax88179_unbind,
17821797
.status = ax88179_status,
17831798
.link_reset = ax88179_link_reset,
1784-
.reset = ax88179_reset,
1799+
.reset = ax88179_net_reset,
17851800
.stop = ax88179_stop,
17861801
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
17871802
.rx_fixup = ax88179_rx_fixup,
@@ -1794,7 +1809,7 @@ static const struct driver_info toshiba_info = {
17941809
.unbind = ax88179_unbind,
17951810
.status = ax88179_status,
17961811
.link_reset = ax88179_link_reset,
1797-
.reset = ax88179_reset,
1812+
.reset = ax88179_net_reset,
17981813
.stop = ax88179_stop,
17991814
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
18001815
.rx_fixup = ax88179_rx_fixup,
@@ -1807,7 +1822,7 @@ static const struct driver_info mct_info = {
18071822
.unbind = ax88179_unbind,
18081823
.status = ax88179_status,
18091824
.link_reset = ax88179_link_reset,
1810-
.reset = ax88179_reset,
1825+
.reset = ax88179_net_reset,
18111826
.stop = ax88179_stop,
18121827
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
18131828
.rx_fixup = ax88179_rx_fixup,
@@ -1820,7 +1835,7 @@ static const struct driver_info at_umc2000_info = {
18201835
.unbind = ax88179_unbind,
18211836
.status = ax88179_status,
18221837
.link_reset = ax88179_link_reset,
1823-
.reset = ax88179_reset,
1838+
.reset = ax88179_net_reset,
18241839
.stop = ax88179_stop,
18251840
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
18261841
.rx_fixup = ax88179_rx_fixup,
@@ -1833,7 +1848,7 @@ static const struct driver_info at_umc200_info = {
18331848
.unbind = ax88179_unbind,
18341849
.status = ax88179_status,
18351850
.link_reset = ax88179_link_reset,
1836-
.reset = ax88179_reset,
1851+
.reset = ax88179_net_reset,
18371852
.stop = ax88179_stop,
18381853
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
18391854
.rx_fixup = ax88179_rx_fixup,
@@ -1846,7 +1861,7 @@ static const struct driver_info at_umc2000sp_info = {
18461861
.unbind = ax88179_unbind,
18471862
.status = ax88179_status,
18481863
.link_reset = ax88179_link_reset,
1849-
.reset = ax88179_reset,
1864+
.reset = ax88179_net_reset,
18501865
.stop = ax88179_stop,
18511866
.flags = FLAG_ETHER | FLAG_FRAMING_AX,
18521867
.rx_fixup = ax88179_rx_fixup,

0 commit comments

Comments
 (0)