aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/r8152.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2017-02-26 15:34:42 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2017-02-26 15:34:42 -0500
commit8e22e1b3499a446df48c2b26667ca36c55bf864c (patch)
tree5329f98b3eb3c95a9dcbab0fa4f9b6e62f0e788d /drivers/net/usb/r8152.c
parent00d3c14f14d51babd8aeafd5fa734ccf04f5ca3d (diff)
parent64a577196d66b44e37384bc5c4d78c61f59d5b2a (diff)
Merge airlied/drm-next into drm-misc-next
Backmerge the main pull request to sync up with all the newly landed drivers. Otherwise we'll have chaos even before 4.12 started in earnest. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'drivers/net/usb/r8152.c')
-rw-r--r--drivers/net/usb/r8152.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index f3b48ad90865..ad42295356dd 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -32,7 +32,7 @@
32#define NETNEXT_VERSION "08" 32#define NETNEXT_VERSION "08"
33 33
34/* Information for net */ 34/* Information for net */
35#define NET_VERSION "6" 35#define NET_VERSION "8"
36 36
37#define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION 37#define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION
38#define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" 38#define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>"
@@ -1936,6 +1936,9 @@ static int r8152_poll(struct napi_struct *napi, int budget)
1936 napi_complete(napi); 1936 napi_complete(napi);
1937 if (!list_empty(&tp->rx_done)) 1937 if (!list_empty(&tp->rx_done))
1938 napi_schedule(napi); 1938 napi_schedule(napi);
1939 else if (!skb_queue_empty(&tp->tx_queue) &&
1940 !list_empty(&tp->tx_free))
1941 napi_schedule(napi);
1939 } 1942 }
1940 1943
1941 return work_done; 1944 return work_done;
@@ -3155,10 +3158,13 @@ static void set_carrier(struct r8152 *tp)
3155 if (!netif_carrier_ok(netdev)) { 3158 if (!netif_carrier_ok(netdev)) {
3156 tp->rtl_ops.enable(tp); 3159 tp->rtl_ops.enable(tp);
3157 set_bit(RTL8152_SET_RX_MODE, &tp->flags); 3160 set_bit(RTL8152_SET_RX_MODE, &tp->flags);
3161 netif_stop_queue(netdev);
3158 napi_disable(&tp->napi); 3162 napi_disable(&tp->napi);
3159 netif_carrier_on(netdev); 3163 netif_carrier_on(netdev);
3160 rtl_start_rx(tp); 3164 rtl_start_rx(tp);
3161 napi_enable(&tp->napi); 3165 napi_enable(&tp->napi);
3166 netif_wake_queue(netdev);
3167 netif_info(tp, link, netdev, "carrier on\n");
3162 } 3168 }
3163 } else { 3169 } else {
3164 if (netif_carrier_ok(netdev)) { 3170 if (netif_carrier_ok(netdev)) {
@@ -3166,6 +3172,7 @@ static void set_carrier(struct r8152 *tp)
3166 napi_disable(&tp->napi); 3172 napi_disable(&tp->napi);
3167 tp->rtl_ops.disable(tp); 3173 tp->rtl_ops.disable(tp);
3168 napi_enable(&tp->napi); 3174 napi_enable(&tp->napi);
3175 netif_info(tp, link, netdev, "carrier off\n");
3169 } 3176 }
3170 } 3177 }
3171} 3178}
@@ -3515,12 +3522,12 @@ static int rtl8152_pre_reset(struct usb_interface *intf)
3515 if (!netif_running(netdev)) 3522 if (!netif_running(netdev))
3516 return 0; 3523 return 0;
3517 3524
3525 netif_stop_queue(netdev);
3518 napi_disable(&tp->napi); 3526 napi_disable(&tp->napi);
3519 clear_bit(WORK_ENABLE, &tp->flags); 3527 clear_bit(WORK_ENABLE, &tp->flags);
3520 usb_kill_urb(tp->intr_urb); 3528 usb_kill_urb(tp->intr_urb);
3521 cancel_delayed_work_sync(&tp->schedule); 3529 cancel_delayed_work_sync(&tp->schedule);
3522 if (netif_carrier_ok(netdev)) { 3530 if (netif_carrier_ok(netdev)) {
3523 netif_stop_queue(netdev);
3524 mutex_lock(&tp->control); 3531 mutex_lock(&tp->control);
3525 tp->rtl_ops.disable(tp); 3532 tp->rtl_ops.disable(tp);
3526 mutex_unlock(&tp->control); 3533 mutex_unlock(&tp->control);
@@ -3545,12 +3552,17 @@ static int rtl8152_post_reset(struct usb_interface *intf)
3545 if (netif_carrier_ok(netdev)) { 3552 if (netif_carrier_ok(netdev)) {
3546 mutex_lock(&tp->control); 3553 mutex_lock(&tp->control);
3547 tp->rtl_ops.enable(tp); 3554 tp->rtl_ops.enable(tp);
3555 rtl_start_rx(tp);
3548 rtl8152_set_rx_mode(netdev); 3556 rtl8152_set_rx_mode(netdev);
3549 mutex_unlock(&tp->control); 3557 mutex_unlock(&tp->control);
3550 netif_wake_queue(netdev);
3551 } 3558 }
3552 3559
3553 napi_enable(&tp->napi); 3560 napi_enable(&tp->napi);
3561 netif_wake_queue(netdev);
3562 usb_submit_urb(tp->intr_urb, GFP_KERNEL);
3563
3564 if (!list_empty(&tp->rx_done))
3565 napi_schedule(&tp->napi);
3554 3566
3555 return 0; 3567 return 0;
3556} 3568}
@@ -3572,6 +3584,8 @@ static bool delay_autosuspend(struct r8152 *tp)
3572 */ 3584 */
3573 if (!sw_linking && tp->rtl_ops.in_nway(tp)) 3585 if (!sw_linking && tp->rtl_ops.in_nway(tp))
3574 return true; 3586 return true;
3587 else if (!skb_queue_empty(&tp->tx_queue))
3588 return true;
3575 else 3589 else
3576 return false; 3590 return false;
3577} 3591}
@@ -3581,10 +3595,15 @@ static int rtl8152_rumtime_suspend(struct r8152 *tp)
3581 struct net_device *netdev = tp->netdev; 3595 struct net_device *netdev = tp->netdev;
3582 int ret = 0; 3596 int ret = 0;
3583 3597
3598 set_bit(SELECTIVE_SUSPEND, &tp->flags);
3599 smp_mb__after_atomic();
3600
3584 if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) { 3601 if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) {
3585 u32 rcr = 0; 3602 u32 rcr = 0;
3586 3603
3587 if (delay_autosuspend(tp)) { 3604 if (delay_autosuspend(tp)) {
3605 clear_bit(SELECTIVE_SUSPEND, &tp->flags);
3606 smp_mb__after_atomic();
3588 ret = -EBUSY; 3607 ret = -EBUSY;
3589 goto out1; 3608 goto out1;
3590 } 3609 }
@@ -3601,6 +3620,8 @@ static int rtl8152_rumtime_suspend(struct r8152 *tp)
3601 if (!(ocp_data & RXFIFO_EMPTY)) { 3620 if (!(ocp_data & RXFIFO_EMPTY)) {
3602 rxdy_gated_en(tp, false); 3621 rxdy_gated_en(tp, false);
3603 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, rcr); 3622 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, rcr);
3623 clear_bit(SELECTIVE_SUSPEND, &tp->flags);
3624 smp_mb__after_atomic();
3604 ret = -EBUSY; 3625 ret = -EBUSY;
3605 goto out1; 3626 goto out1;
3606 } 3627 }
@@ -3620,8 +3641,6 @@ static int rtl8152_rumtime_suspend(struct r8152 *tp)
3620 } 3641 }
3621 } 3642 }
3622 3643
3623 set_bit(SELECTIVE_SUSPEND, &tp->flags);
3624
3625out1: 3644out1:
3626 return ret; 3645 return ret;
3627} 3646}
@@ -3677,12 +3696,15 @@ static int rtl8152_resume(struct usb_interface *intf)
3677 if (netif_running(tp->netdev) && tp->netdev->flags & IFF_UP) { 3696 if (netif_running(tp->netdev) && tp->netdev->flags & IFF_UP) {
3678 if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { 3697 if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
3679 tp->rtl_ops.autosuspend_en(tp, false); 3698 tp->rtl_ops.autosuspend_en(tp, false);
3680 clear_bit(SELECTIVE_SUSPEND, &tp->flags);
3681 napi_disable(&tp->napi); 3699 napi_disable(&tp->napi);
3682 set_bit(WORK_ENABLE, &tp->flags); 3700 set_bit(WORK_ENABLE, &tp->flags);
3683 if (netif_carrier_ok(tp->netdev)) 3701 if (netif_carrier_ok(tp->netdev))
3684 rtl_start_rx(tp); 3702 rtl_start_rx(tp);
3685 napi_enable(&tp->napi); 3703 napi_enable(&tp->napi);
3704 clear_bit(SELECTIVE_SUSPEND, &tp->flags);
3705 smp_mb__after_atomic();
3706 if (!list_empty(&tp->rx_done))
3707 napi_schedule(&tp->napi);
3686 } else { 3708 } else {
3687 tp->rtl_ops.up(tp); 3709 tp->rtl_ops.up(tp);
3688 netif_carrier_off(tp->netdev); 3710 netif_carrier_off(tp->netdev);