|
32 | 32 | #define NETNEXT_VERSION "08"
|
33 | 33 |
|
34 | 34 | /* Information for net */
|
35 |
| -#define NET_VERSION "8" |
| 35 | +#define NET_VERSION "9" |
36 | 36 |
|
37 | 37 | #define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION
|
38 | 38 | #define DRIVER_AUTHOR "Realtek linux nic maintainers < [email protected]>"
|
@@ -501,6 +501,8 @@ enum rtl_register_content {
|
501 | 501 | #define RTL8153_RMS RTL8153_MAX_PACKET
|
502 | 502 | #define RTL8152_TX_TIMEOUT (5 * HZ)
|
503 | 503 | #define RTL8152_NAPI_WEIGHT 64
|
| 504 | +#define rx_reserved_size(x) ((x) + VLAN_ETH_HLEN + CRC_SIZE + \ |
| 505 | + sizeof(struct rx_desc) + RX_ALIGN) |
504 | 506 |
|
505 | 507 | /* rtl8152 flags */
|
506 | 508 | enum rtl8152_flags {
|
@@ -2253,8 +2255,7 @@ static void r8153_set_rx_early_timeout(struct r8152 *tp)
|
2253 | 2255 |
|
2254 | 2256 | static void r8153_set_rx_early_size(struct r8152 *tp)
|
2255 | 2257 | {
|
2256 |
| - u32 mtu = tp->netdev->mtu; |
2257 |
| - u32 ocp_data = (agg_buf_sz - mtu - VLAN_ETH_HLEN - VLAN_HLEN) / 8; |
| 2258 | + u32 ocp_data = (agg_buf_sz - rx_reserved_size(tp->netdev->mtu)) / 4; |
2258 | 2259 |
|
2259 | 2260 | ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data);
|
2260 | 2261 | }
|
@@ -2899,7 +2900,8 @@ static void r8153_first_init(struct r8152 *tp)
|
2899 | 2900 |
|
2900 | 2901 | rtl_rx_vlan_en(tp, tp->netdev->features & NETIF_F_HW_VLAN_CTAG_RX);
|
2901 | 2902 |
|
2902 |
| - ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8153_RMS); |
| 2903 | + ocp_data = tp->netdev->mtu + VLAN_ETH_HLEN + CRC_SIZE; |
| 2904 | + ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, ocp_data); |
2903 | 2905 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_MTPS, MTPS_JUMBO);
|
2904 | 2906 |
|
2905 | 2907 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_TCR0);
|
@@ -2951,7 +2953,8 @@ static void r8153_enter_oob(struct r8152 *tp)
|
2951 | 2953 | usleep_range(1000, 2000);
|
2952 | 2954 | }
|
2953 | 2955 |
|
2954 |
| - ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8153_RMS); |
| 2956 | + ocp_data = tp->netdev->mtu + VLAN_ETH_HLEN + CRC_SIZE; |
| 2957 | + ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, ocp_data); |
2955 | 2958 |
|
2956 | 2959 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_TEREDO_CFG);
|
2957 | 2960 | ocp_data &= ~TEREDO_WAKE_MASK;
|
@@ -4201,8 +4204,14 @@ static int rtl8152_change_mtu(struct net_device *dev, int new_mtu)
|
4201 | 4204 |
|
4202 | 4205 | dev->mtu = new_mtu;
|
4203 | 4206 |
|
4204 |
| - if (netif_running(dev) && netif_carrier_ok(dev)) |
4205 |
| - r8153_set_rx_early_size(tp); |
| 4207 | + if (netif_running(dev)) { |
| 4208 | + u32 rms = new_mtu + VLAN_ETH_HLEN + CRC_SIZE; |
| 4209 | + |
| 4210 | + ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, rms); |
| 4211 | + |
| 4212 | + if (netif_carrier_ok(dev)) |
| 4213 | + r8153_set_rx_early_size(tp); |
| 4214 | + } |
4206 | 4215 |
|
4207 | 4216 | mutex_unlock(&tp->control);
|
4208 | 4217 |
|
|
0 commit comments