diff options
author | David S. Miller <davem@davemloft.net> | 2015-01-13 00:10:32 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-13 00:10:32 +0300 |
commit | 2f516d52cd07db9414dc0cd4e6f308e460b69f87 (patch) | |
tree | 6e5d7fc4695dcdc621efab65ba4688ed2c19ecc7 | |
parent | 3bf3947526c1053ddf2523f261395d682718f56c (diff) | |
parent | ef827a5b578c4255043a0c0032c88799fb4a774b (diff) | |
download | linux-2f516d52cd07db9414dc0cd4e6f308e460b69f87.tar.xz |
Merge branch 'r8152-next'
Hayes Wang says:
====================
r8152: adjust r8152_submit_rx
v2:
Replace the patch #1 with "call rtl_start_rx after netif_carrier_on".
For patch #2, replace checking tp->speed with netif_carrier_ok.
v1:
Avoid r8152_submit_rx() from submitting rx during unexpected
moment. This could reduce the time of stopping rx.
For patch #1, the tp->speed should be updated early. Then,
the patch #2 could use it to check the current linking status.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/usb/r8152.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 57ec23e8ccfa..b23426e4952c 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1789,6 +1789,11 @@ int r8152_submit_rx(struct r8152 *tp, struct rx_agg *agg, gfp_t mem_flags) { int ret; + /* The rx would be stopped, so skip submitting */ + if (test_bit(RTL8152_UNPLUG, &tp->flags) || + !test_bit(WORK_ENABLE, &tp->flags) || !netif_carrier_ok(tp->netdev)) + return 0; + usb_fill_bulk_urb(agg->urb, tp->udev, usb_rcvbulkpipe(tp->udev, 1), agg->head, agg_buf_sz, (usb_complete_t)read_bulk_callback, agg); @@ -2059,7 +2064,7 @@ static int rtl_enable(struct r8152 *tp) rxdy_gated_en(tp, false); - return rtl_start_rx(tp); + return 0; } static int rtl8152_enable(struct r8152 *tp) @@ -2874,6 +2879,7 @@ static void set_carrier(struct r8152 *tp) tp->rtl_ops.enable(tp); set_bit(RTL8152_SET_RX_MODE, &tp->flags); netif_carrier_on(netdev); + rtl_start_rx(tp); } } else { if (tp->speed & LINK_STATUS) { |