|
27 | 27 | #include <linux/usb/cdc.h>
|
28 | 28 |
|
29 | 29 | /* Version Information */
|
30 |
| -#define DRIVER_VERSION "v1.08.0 (2015/01/13)" |
| 30 | +#define DRIVER_VERSION "v1.08.1 (2015/07/28)" |
31 | 31 | #define DRIVER_AUTHOR "Realtek linux nic maintainers < [email protected]>"
|
32 | 32 | #define DRIVER_DESC "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters"
|
33 | 33 | #define MODULENAME "r8152"
|
@@ -1902,11 +1902,10 @@ static void rtl_drop_queued_tx(struct r8152 *tp)
|
1902 | 1902 | static void rtl8152_tx_timeout(struct net_device *netdev)
|
1903 | 1903 | {
|
1904 | 1904 | struct r8152 *tp = netdev_priv(netdev);
|
1905 |
| - int i; |
1906 | 1905 |
|
1907 | 1906 | netif_warn(tp, tx_err, netdev, "Tx timeout\n");
|
1908 |
| - for (i = 0; i < RTL8152_MAX_TX; i++) |
1909 |
| - usb_unlink_urb(tp->tx_info[i].urb); |
| 1907 | + |
| 1908 | + usb_queue_reset_device(tp->intf); |
1910 | 1909 | }
|
1911 | 1910 |
|
1912 | 1911 | static void rtl8152_set_rx_mode(struct net_device *netdev)
|
@@ -3342,6 +3341,58 @@ static void r8153_init(struct r8152 *tp)
|
3342 | 3341 | r8153_u2p3en(tp, true);
|
3343 | 3342 | }
|
3344 | 3343 |
|
| 3344 | +static int rtl8152_pre_reset(struct usb_interface *intf) |
| 3345 | +{ |
| 3346 | + struct r8152 *tp = usb_get_intfdata(intf); |
| 3347 | + struct net_device *netdev; |
| 3348 | + |
| 3349 | + if (!tp) |
| 3350 | + return 0; |
| 3351 | + |
| 3352 | + netdev = tp->netdev; |
| 3353 | + if (!netif_running(netdev)) |
| 3354 | + return 0; |
| 3355 | + |
| 3356 | + napi_disable(&tp->napi); |
| 3357 | + clear_bit(WORK_ENABLE, &tp->flags); |
| 3358 | + usb_kill_urb(tp->intr_urb); |
| 3359 | + cancel_delayed_work_sync(&tp->schedule); |
| 3360 | + if (netif_carrier_ok(netdev)) { |
| 3361 | + netif_stop_queue(netdev); |
| 3362 | + mutex_lock(&tp->control); |
| 3363 | + tp->rtl_ops.disable(tp); |
| 3364 | + mutex_unlock(&tp->control); |
| 3365 | + } |
| 3366 | + |
| 3367 | + return 0; |
| 3368 | +} |
| 3369 | + |
| 3370 | +static int rtl8152_post_reset(struct usb_interface *intf) |
| 3371 | +{ |
| 3372 | + struct r8152 *tp = usb_get_intfdata(intf); |
| 3373 | + struct net_device *netdev; |
| 3374 | + |
| 3375 | + if (!tp) |
| 3376 | + return 0; |
| 3377 | + |
| 3378 | + netdev = tp->netdev; |
| 3379 | + if (!netif_running(netdev)) |
| 3380 | + return 0; |
| 3381 | + |
| 3382 | + set_bit(WORK_ENABLE, &tp->flags); |
| 3383 | + if (netif_carrier_ok(netdev)) { |
| 3384 | + mutex_lock(&tp->control); |
| 3385 | + tp->rtl_ops.enable(tp); |
| 3386 | + rtl8152_set_rx_mode(netdev); |
| 3387 | + mutex_unlock(&tp->control); |
| 3388 | + netif_wake_queue(netdev); |
| 3389 | + } |
| 3390 | + |
| 3391 | + napi_enable(&tp->napi); |
| 3392 | + |
| 3393 | + return 0; |
| 3394 | +} |
| 3395 | + |
3345 | 3396 | static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message)
|
3346 | 3397 | {
|
3347 | 3398 | struct r8152 *tp = usb_get_intfdata(intf);
|
@@ -4164,6 +4215,8 @@ static struct usb_driver rtl8152_driver = {
|
4164 | 4215 | .suspend = rtl8152_suspend,
|
4165 | 4216 | .resume = rtl8152_resume,
|
4166 | 4217 | .reset_resume = rtl8152_resume,
|
| 4218 | + .pre_reset = rtl8152_pre_reset, |
| 4219 | + .post_reset = rtl8152_post_reset, |
4167 | 4220 | .supports_autosuspend = 1,
|
4168 | 4221 | .disable_hub_initiated_lpm = 1,
|
4169 | 4222 | };
|
|
0 commit comments