Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Hayes Wang and committed by
David S. Miller
9fae5418 1e64d7cb

+26 -10
+26 -10
drivers/net/usb/r8152.c
··· 2367 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 2376 static int rtl_enable(struct r8152 *tp) 2371 2377 { 2372 2378 u32 ocp_data; ··· 2382 2376 ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CR); 2383 2377 ocp_data |= CR_RE | CR_TE; 2384 2378 ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CR, ocp_data); 2379 + 2380 + switch (tp->version) { 2381 + case RTL_VER_08: 2382 + case RTL_VER_09: 2383 + r8153b_rx_agg_chg_indicate(tp); 2384 + break; 2385 + default: 2386 + break; 2387 + } 2385 2388 2386 2389 rxdy_gated_en(tp, false); 2387 2390 ··· 2406 2391 rtl_set_eee_plus(tp); 2407 2392 2408 2393 return rtl_enable(tp); 2409 - } 2410 - 2411 - static inline void r8153b_rx_agg_chg_indicate(struct r8152 *tp) 2412 - { 2413 - ocp_write_byte(tp, MCU_TYPE_USB, USB_UPT_RXDMA_OWN, 2414 - OWN_UPDATE | OWN_CLEAR); 2415 2394 } 2416 2395 2417 2396 static void r8153_set_rx_early_timeout(struct r8152 *tp) ··· 2430 2421 128 / 8); 2431 2422 ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EXTRA_AGGR_TMR, 2432 2423 ocp_data); 2433 - r8153b_rx_agg_chg_indicate(tp); 2434 2424 break; 2435 2425 2436 2426 default: ··· 2453 2445 case RTL_VER_09: 2454 2446 ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, 2455 2447 ocp_data / 8); 2456 - r8153b_rx_agg_chg_indicate(tp); 2457 2448 break; 2458 2449 default: 2459 2450 WARN_ON_ONCE(1); ··· 4926 4919 if (tp->coalesce != coalesce->rx_coalesce_usecs) { 4927 4920 tp->coalesce = coalesce->rx_coalesce_usecs; 4928 4921 4929 - if (netif_running(tp->netdev) && netif_carrier_ok(netdev)) 4930 - r8153_set_rx_early_timeout(tp); 4922 + if (netif_running(netdev) && netif_carrier_ok(netdev)) { 4923 + netif_stop_queue(netdev); 4924 + napi_disable(&tp->napi); 4925 + tp->rtl_ops.disable(tp); 4926 + tp->rtl_ops.enable(tp); 4927 + rtl_start_rx(tp); 4928 + clear_bit(RTL8152_SET_RX_MODE, &tp->flags); 4929 + _rtl8152_set_rx_mode(netdev); 4930 + napi_enable(&tp->napi); 4931 + netif_wake_queue(netdev); 4932 + } 4931 4933 } 4932 4934 4933 4935 mutex_unlock(&tp->control);