Skip to content

Commit 8e1f51b

Browse files
hayesorzdavem330
authored andcommitted
r8152: change some definitions
Replace RX_BUF_THR with RX_THR_HIGH. Replace RWSUME_INDICATE with RESUME_INDICATE. Add CRC_SIZE, TX_ALIGN, and RX_ALIGN. Signed-off-by: Hayes Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ac244d3 commit 8e1f51b

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

drivers/net/usb/r8152.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@
209209
#define TX_AGG_MAX_THRESHOLD 0x03
210210

211211
/* USB_RX_BUF_TH */
212-
#define RX_BUF_THR 0x7a120180
212+
#define RX_THR_HIGH 0x7a120180
213213

214214
/* USB_TX_DMA */
215215
#define TEST_MODE_DISABLE 0x00000001
@@ -219,7 +219,7 @@
219219
#define POWER_CUT 0x0100
220220

221221
/* USB_PM_CTRL_STATUS */
222-
#define RWSUME_INDICATE 0x0001
222+
#define RESUME_INDICATE 0x0001
223223

224224
/* USB_USB_CTRL */
225225
#define RX_AGG_DISABLE 0x0010
@@ -274,6 +274,9 @@ enum rtl_register_content {
274274
#define RTL8152_MAX_TX 10
275275
#define RTL8152_MAX_RX 10
276276
#define INTBUFSIZE 2
277+
#define CRC_SIZE 4
278+
#define TX_ALIGN 4
279+
#define RX_ALIGN 8
277280

278281
#define INTR_LINK 0x0004
279282

@@ -916,12 +919,12 @@ static void intr_callback(struct urb *urb)
916919

917920
static inline void *rx_agg_align(void *data)
918921
{
919-
return (void *)ALIGN((uintptr_t)data, 8);
922+
return (void *)ALIGN((uintptr_t)data, RX_ALIGN);
920923
}
921924

922925
static inline void *tx_agg_align(void *data)
923926
{
924-
return (void *)ALIGN((uintptr_t)data, 4);
927+
return (void *)ALIGN((uintptr_t)data, TX_ALIGN);
925928
}
926929

927930
static void free_all_mem(struct r8152 *tp)
@@ -990,7 +993,8 @@ static int alloc_all_mem(struct r8152 *tp)
990993

991994
if (buf != rx_agg_align(buf)) {
992995
kfree(buf);
993-
buf = kmalloc_node(rx_buf_sz + 8, GFP_KERNEL, node);
996+
buf = kmalloc_node(rx_buf_sz + RX_ALIGN, GFP_KERNEL,
997+
node);
994998
if (!buf)
995999
goto err1;
9961000
}
@@ -1015,7 +1019,8 @@ static int alloc_all_mem(struct r8152 *tp)
10151019

10161020
if (buf != tx_agg_align(buf)) {
10171021
kfree(buf);
1018-
buf = kmalloc_node(rx_buf_sz + 4, GFP_KERNEL, node);
1022+
buf = kmalloc_node(rx_buf_sz + TX_ALIGN, GFP_KERNEL,
1023+
node);
10191024
if (!buf)
10201025
goto err1;
10211026
}
@@ -1215,7 +1220,7 @@ static void rx_bottom(struct r8152 *tp)
12151220

12161221
stats = rtl8152_get_stats(netdev);
12171222

1218-
pkt_len -= 4; /* CRC */
1223+
pkt_len -= CRC_SIZE;
12191224
rx_data += sizeof(struct rx_desc);
12201225

12211226
skb = netdev_alloc_skb_ip_align(netdev, pkt_len);
@@ -1230,7 +1235,7 @@ static void rx_bottom(struct r8152 *tp)
12301235
stats->rx_packets++;
12311236
stats->rx_bytes += pkt_len;
12321237

1233-
rx_data = rx_agg_align(rx_data + pkt_len + 4);
1238+
rx_data = rx_agg_align(rx_data + pkt_len + CRC_SIZE);
12341239
rx_desc = (struct rx_desc *)rx_data;
12351240
len_used = (int)(rx_data - (u8 *)agg->head);
12361241
len_used += sizeof(struct rx_desc);
@@ -1580,7 +1585,7 @@ static void r8152b_exit_oob(struct r8152 *tp)
15801585
ocp_write_dword(tp, MCU_TYPE_PLA, PLA_TXFIFO_CTRL, TXFIFO_THR_NORMAL);
15811586

15821587
ocp_write_byte(tp, MCU_TYPE_USB, USB_TX_AGG, TX_AGG_MAX_THRESHOLD);
1583-
ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_BUF_THR);
1588+
ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_THR_HIGH);
15841589
ocp_write_dword(tp, MCU_TYPE_USB, USB_TX_DMA,
15851590
TEST_MODE_DISABLE | TX_SIZE_ADJUST1);
15861591

@@ -1893,7 +1898,7 @@ static void r8152b_init(struct r8152 *tp)
18931898
ocp_write_word(tp, MCU_TYPE_USB, USB_UPS_CTRL, ocp_data);
18941899

18951900
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS);
1896-
ocp_data &= ~RWSUME_INDICATE;
1901+
ocp_data &= ~RESUME_INDICATE;
18971902
ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data);
18981903

18991904
r8152b_exit_oob(tp);
@@ -2074,7 +2079,7 @@ static void rtl8152_unload(struct r8152 *tp)
20742079
}
20752080

20762081
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS);
2077-
ocp_data &= ~RWSUME_INDICATE;
2082+
ocp_data &= ~RESUME_INDICATE;
20782083
ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data);
20792084
}
20802085

0 commit comments

Comments
 (0)