Commit e9ace99c authored by hayeswang's avatar hayeswang Committed by Greg Kroah-Hartman

r8152: avoid start_xmit to schedule napi when napi is disabled


[ Upstream commit de9bf29d ]

Stop the tx when the napi is disabled to prevent napi_schedule() is
called.
Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c1a7106b
...@@ -3158,10 +3158,13 @@ static void set_carrier(struct r8152 *tp) ...@@ -3158,10 +3158,13 @@ static void set_carrier(struct r8152 *tp)
if (!netif_carrier_ok(netdev)) { if (!netif_carrier_ok(netdev)) {
tp->rtl_ops.enable(tp); tp->rtl_ops.enable(tp);
set_bit(RTL8152_SET_RX_MODE, &tp->flags); set_bit(RTL8152_SET_RX_MODE, &tp->flags);
netif_stop_queue(netdev);
napi_disable(&tp->napi); napi_disable(&tp->napi);
netif_carrier_on(netdev); netif_carrier_on(netdev);
rtl_start_rx(tp); rtl_start_rx(tp);
napi_enable(&tp->napi); napi_enable(&tp->napi);
netif_wake_queue(netdev);
netif_info(tp, link, netdev, "carrier on\n");
} }
} else { } else {
if (netif_carrier_ok(netdev)) { if (netif_carrier_ok(netdev)) {
...@@ -3169,6 +3172,7 @@ static void set_carrier(struct r8152 *tp) ...@@ -3169,6 +3172,7 @@ static void set_carrier(struct r8152 *tp)
napi_disable(&tp->napi); napi_disable(&tp->napi);
tp->rtl_ops.disable(tp); tp->rtl_ops.disable(tp);
napi_enable(&tp->napi); napi_enable(&tp->napi);
netif_info(tp, link, netdev, "carrier off\n");
} }
} }
} }
...@@ -3518,12 +3522,12 @@ static int rtl8152_pre_reset(struct usb_interface *intf) ...@@ -3518,12 +3522,12 @@ static int rtl8152_pre_reset(struct usb_interface *intf)
if (!netif_running(netdev)) if (!netif_running(netdev))
return 0; return 0;
netif_stop_queue(netdev);
napi_disable(&tp->napi); napi_disable(&tp->napi);
clear_bit(WORK_ENABLE, &tp->flags); clear_bit(WORK_ENABLE, &tp->flags);
usb_kill_urb(tp->intr_urb); usb_kill_urb(tp->intr_urb);
cancel_delayed_work_sync(&tp->schedule); cancel_delayed_work_sync(&tp->schedule);
if (netif_carrier_ok(netdev)) { if (netif_carrier_ok(netdev)) {
netif_stop_queue(netdev);
mutex_lock(&tp->control); mutex_lock(&tp->control);
tp->rtl_ops.disable(tp); tp->rtl_ops.disable(tp);
mutex_unlock(&tp->control); mutex_unlock(&tp->control);
...@@ -3551,10 +3555,10 @@ static int rtl8152_post_reset(struct usb_interface *intf) ...@@ -3551,10 +3555,10 @@ static int rtl8152_post_reset(struct usb_interface *intf)
rtl_start_rx(tp); rtl_start_rx(tp);
rtl8152_set_rx_mode(netdev); rtl8152_set_rx_mode(netdev);
mutex_unlock(&tp->control); mutex_unlock(&tp->control);
netif_wake_queue(netdev);
} }
napi_enable(&tp->napi); napi_enable(&tp->napi);
netif_wake_queue(netdev);
usb_submit_urb(tp->intr_urb, GFP_KERNEL); usb_submit_urb(tp->intr_urb, GFP_KERNEL);
if (!list_empty(&tp->rx_done)) if (!list_empty(&tp->rx_done))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment