af7214c11af67a9aac11bfdb436799b8cf2993e3
[openwrt/staging/jow.git] /
1 From 2557e3b9339a9e4239afcab8d39ce6943a79164f Mon Sep 17 00:00:00 2001
2 From: P33M <p33m@github.com>
3 Date: Tue, 14 May 2019 14:55:19 +0100
4 Subject: [PATCH 490/782] Revert "smsc95xx: dynamically fix up TX buffer
5 alignment with padding bytes"
6
7 As reported in https://github.com/raspberrypi/linux/issues/2964 this
8 commit causes a regression corrupting non-option TCP ack packets.
9
10 This reverts commit 96b972dc736d943f371a16ccca452a053d83c65b.
11 ---
12 drivers/net/usb/smsc95xx.c | 12 +++++-------
13 drivers/net/usb/smsc95xx.h | 2 +-
14 2 files changed, 6 insertions(+), 8 deletions(-)
15
16 --- a/drivers/net/usb/smsc95xx.c
17 +++ b/drivers/net/usb/smsc95xx.c
18 @@ -2082,9 +2082,7 @@ static struct sk_buff *smsc95xx_tx_fixup
19 struct sk_buff *skb, gfp_t flags)
20 {
21 bool csum = skb->ip_summed == CHECKSUM_PARTIAL;
22 - unsigned int align_bytes = -((uintptr_t)skb->data) & 0x3;
23 - int overhead = csum ? SMSC95XX_TX_OVERHEAD_CSUM + align_bytes
24 - : SMSC95XX_TX_OVERHEAD + align_bytes;
25 + int overhead = csum ? SMSC95XX_TX_OVERHEAD_CSUM : SMSC95XX_TX_OVERHEAD;
26 u32 tx_cmd_a, tx_cmd_b;
27
28 /* We do not advertise SG, so skbs should be already linearized */
29 @@ -2118,16 +2116,16 @@ static struct sk_buff *smsc95xx_tx_fixup
30 }
31 }
32
33 - skb_push(skb, 4 + align_bytes);
34 - tx_cmd_b = (u32)(skb->len - 4 - align_bytes);
35 + skb_push(skb, 4);
36 + tx_cmd_b = (u32)(skb->len - 4);
37 if (csum)
38 tx_cmd_b |= TX_CMD_B_CSUM_ENABLE;
39 cpu_to_le32s(&tx_cmd_b);
40 memcpy(skb->data, &tx_cmd_b, 4);
41
42 skb_push(skb, 4);
43 - tx_cmd_a = (u32)(skb->len - 8 - align_bytes) | TX_CMD_A_FIRST_SEG_ |
44 - (align_bytes << 16) | TX_CMD_A_LAST_SEG_;
45 + tx_cmd_a = (u32)(skb->len - 8) | TX_CMD_A_FIRST_SEG_ |
46 + TX_CMD_A_LAST_SEG_;
47 cpu_to_le32s(&tx_cmd_a);
48 memcpy(skb->data, &tx_cmd_a, 4);
49
50 --- a/drivers/net/usb/smsc95xx.h
51 +++ b/drivers/net/usb/smsc95xx.h
52 @@ -21,7 +21,7 @@
53 #define _SMSC95XX_H
54
55 /* Tx command words */
56 -#define TX_CMD_A_DATA_OFFSET_ (0x00030000) /* Data Start Offset */
57 +#define TX_CMD_A_DATA_OFFSET_ (0x001F0000) /* Data Start Offset */
58 #define TX_CMD_A_FIRST_SEG_ (0x00002000) /* First Segment */
59 #define TX_CMD_A_LAST_SEG_ (0x00001000) /* Last Segment */
60 #define TX_CMD_A_BUF_SIZE_ (0x000007FF) /* Buffer Size */