diff options
author | Hayes Wang <hayeswang@realtek.com> | 2019-07-03 03:11:56 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-03 14:31:33 -0400 |
commit | 9fae54186c64db6faec85c194812fb2e5e970f77 (patch) | |
tree | 9eb3d6a88fca17de901b99e3d5da2940af15b1cd /drivers/net/usb | |
parent | 1e64d7cbfdce4887008314d5b367209582223f27 (diff) |
r8152: move calling r8153b_rx_agg_chg_indicate()
r8153b_rx_agg_chg_indicate() needs to be called after enabling TX/RX and
before calling rxdy_gated_en(tp, false). Otherwise, the change of the
settings of RX aggregation wouldn't work.
Besides, adjust rtl8152_set_coalesce() for the same reason. If
rx_coalesce_usecs is changed, restart TX/RX to let the setting work.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/r8152.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 101d1325f3f1..e887ac86fbef 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -2367,6 +2367,12 @@ static int rtl_stop_rx(struct r8152 *tp) | |||
2367 | return 0; | 2367 | return 0; |
2368 | } | 2368 | } |
2369 | 2369 | ||
2370 | static inline void r8153b_rx_agg_chg_indicate(struct r8152 *tp) | ||
2371 | { | ||
2372 | ocp_write_byte(tp, MCU_TYPE_USB, USB_UPT_RXDMA_OWN, | ||
2373 | OWN_UPDATE | OWN_CLEAR); | ||
2374 | } | ||
2375 | |||
2370 | static int rtl_enable(struct r8152 *tp) | 2376 | static int rtl_enable(struct r8152 *tp) |
2371 | { | 2377 | { |
2372 | u32 ocp_data; | 2378 | u32 ocp_data; |
@@ -2377,6 +2383,15 @@ static int rtl_enable(struct r8152 *tp) | |||
2377 | ocp_data |= CR_RE | CR_TE; | 2383 | ocp_data |= CR_RE | CR_TE; |
2378 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CR, ocp_data); | 2384 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CR, ocp_data); |
2379 | 2385 | ||
2386 | switch (tp->version) { | ||
2387 | case RTL_VER_08: | ||
2388 | case RTL_VER_09: | ||
2389 | r8153b_rx_agg_chg_indicate(tp); | ||
2390 | break; | ||
2391 | default: | ||
2392 | break; | ||
2393 | } | ||
2394 | |||
2380 | rxdy_gated_en(tp, false); | 2395 | rxdy_gated_en(tp, false); |
2381 | 2396 | ||
2382 | return 0; | 2397 | return 0; |
@@ -2393,12 +2408,6 @@ static int rtl8152_enable(struct r8152 *tp) | |||
2393 | return rtl_enable(tp); | 2408 | return rtl_enable(tp); |
2394 | } | 2409 | } |
2395 | 2410 | ||
2396 | static inline void r8153b_rx_agg_chg_indicate(struct r8152 *tp) | ||
2397 | { | ||
2398 | ocp_write_byte(tp, MCU_TYPE_USB, USB_UPT_RXDMA_OWN, | ||
2399 | OWN_UPDATE | OWN_CLEAR); | ||
2400 | } | ||
2401 | |||
2402 | static void r8153_set_rx_early_timeout(struct r8152 *tp) | 2411 | static void r8153_set_rx_early_timeout(struct r8152 *tp) |
2403 | { | 2412 | { |
2404 | u32 ocp_data = tp->coalesce / 8; | 2413 | u32 ocp_data = tp->coalesce / 8; |
@@ -2421,7 +2430,6 @@ static void r8153_set_rx_early_timeout(struct r8152 *tp) | |||
2421 | 128 / 8); | 2430 | 128 / 8); |
2422 | ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EXTRA_AGGR_TMR, | 2431 | ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EXTRA_AGGR_TMR, |
2423 | ocp_data); | 2432 | ocp_data); |
2424 | r8153b_rx_agg_chg_indicate(tp); | ||
2425 | break; | 2433 | break; |
2426 | 2434 | ||
2427 | default: | 2435 | default: |
@@ -2445,7 +2453,6 @@ static void r8153_set_rx_early_size(struct r8152 *tp) | |||
2445 | case RTL_VER_09: | 2453 | case RTL_VER_09: |
2446 | ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, | 2454 | ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, |
2447 | ocp_data / 8); | 2455 | ocp_data / 8); |
2448 | r8153b_rx_agg_chg_indicate(tp); | ||
2449 | break; | 2456 | break; |
2450 | default: | 2457 | default: |
2451 | WARN_ON_ONCE(1); | 2458 | WARN_ON_ONCE(1); |
@@ -4919,8 +4926,17 @@ static int rtl8152_set_coalesce(struct net_device *netdev, | |||
4919 | if (tp->coalesce != coalesce->rx_coalesce_usecs) { | 4926 | if (tp->coalesce != coalesce->rx_coalesce_usecs) { |
4920 | tp->coalesce = coalesce->rx_coalesce_usecs; | 4927 | tp->coalesce = coalesce->rx_coalesce_usecs; |
4921 | 4928 | ||
4922 | if (netif_running(tp->netdev) && netif_carrier_ok(netdev)) | 4929 | if (netif_running(netdev) && netif_carrier_ok(netdev)) { |
4923 | r8153_set_rx_early_timeout(tp); | 4930 | netif_stop_queue(netdev); |
4931 | napi_disable(&tp->napi); | ||
4932 | tp->rtl_ops.disable(tp); | ||
4933 | tp->rtl_ops.enable(tp); | ||
4934 | rtl_start_rx(tp); | ||
4935 | clear_bit(RTL8152_SET_RX_MODE, &tp->flags); | ||
4936 | _rtl8152_set_rx_mode(netdev); | ||
4937 | napi_enable(&tp->napi); | ||
4938 | netif_wake_queue(netdev); | ||
4939 | } | ||
4924 | } | 4940 | } |
4925 | 4941 | ||
4926 | mutex_unlock(&tp->control); | 4942 | mutex_unlock(&tp->control); |