1 From d7126c242190ab444fe69a0e323700887c5a5a56 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 491/773] Revert "smsc95xx: dynamically fix up TX buffer
5 alignment with padding bytes"
7 As reported in https://github.com/raspberrypi/linux/issues/2964 this
8 commit causes a regression corrupting non-option TCP ack packets.
10 This reverts commit 96b972dc736d943f371a16ccca452a053d83c65b.
12 drivers/net/usb/smsc95xx.c | 12 +++++-------
13 drivers/net/usb/smsc95xx.h | 2 +-
14 2 files changed, 6 insertions(+), 8 deletions(-)
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)
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;
28 /* We do not advertise SG, so skbs should be already linearized */
29 @@ -2118,16 +2116,16 @@ static struct sk_buff *smsc95xx_tx_fixup
33 - skb_push(skb, 4 + align_bytes);
34 - tx_cmd_b = (u32)(skb->len - 4 - align_bytes);
36 + tx_cmd_b = (u32)(skb->len - 4);
38 tx_cmd_b |= TX_CMD_B_CSUM_ENABLE;
39 cpu_to_le32s(&tx_cmd_b);
40 memcpy(skb->data, &tx_cmd_b, 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_ |
47 cpu_to_le32s(&tx_cmd_a);
48 memcpy(skb->data, &tx_cmd_a, 4);
50 --- a/drivers/net/usb/smsc95xx.h
51 +++ b/drivers/net/usb/smsc95xx.h
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 */