Skip to content

Commit b20cb60

Browse files
hayesorzdavem330
authored andcommitted
r8152: fix the rx early size of RTL8153
revert commit a59e6d8 ("r8152: correct the rx early size") and fix the rx early size as (rx buffer size - rx packet size - rx desc size - alignment) / 4 Signed-off-by: Hayes Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 210c4f7 commit b20cb60

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/net/usb/r8152.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#define NETNEXT_VERSION "08"
3333

3434
/* Information for net */
35-
#define NET_VERSION "8"
35+
#define NET_VERSION "9"
3636

3737
#define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION
3838
#define DRIVER_AUTHOR "Realtek linux nic maintainers <[email protected]>"
@@ -501,6 +501,8 @@ enum rtl_register_content {
501501
#define RTL8153_RMS RTL8153_MAX_PACKET
502502
#define RTL8152_TX_TIMEOUT (5 * HZ)
503503
#define RTL8152_NAPI_WEIGHT 64
504+
#define rx_reserved_size(x) ((x) + VLAN_ETH_HLEN + CRC_SIZE + \
505+
sizeof(struct rx_desc) + RX_ALIGN)
504506

505507
/* rtl8152 flags */
506508
enum rtl8152_flags {
@@ -2253,8 +2255,7 @@ static void r8153_set_rx_early_timeout(struct r8152 *tp)
22532255

22542256
static void r8153_set_rx_early_size(struct r8152 *tp)
22552257
{
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;
22582259

22592260
ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data);
22602261
}

0 commit comments

Comments
 (0)