aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/patches-4.19/950-0481-smsc95xx-dynamically-fix-up-TX-buffer-alignment-with.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2019-07-31 18:23:26 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2019-08-02 18:51:32 +0200
commit19226502bf6393706defe7f049c587b32c9b4f33 (patch)
tree0bff89a72b7006051a6eec1ac3c0c9250490cf4f /target/linux/brcm2708/patches-4.19/950-0481-smsc95xx-dynamically-fix-up-TX-buffer-alignment-with.patch
parent66458c49aa14ebc9ba2e4f9b6a323b8ff122807b (diff)
downloadupstream-19226502bf6393706defe7f049c587b32c9b4f33.tar.gz
upstream-19226502bf6393706defe7f049c587b32c9b4f33.tar.bz2
upstream-19226502bf6393706defe7f049c587b32c9b4f33.zip
brcm2708: update to latest patches from the RPi foundation
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/brcm2708/patches-4.19/950-0481-smsc95xx-dynamically-fix-up-TX-buffer-alignment-with.patch')
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0481-smsc95xx-dynamically-fix-up-TX-buffer-alignment-with.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/target/linux/brcm2708/patches-4.19/950-0481-smsc95xx-dynamically-fix-up-TX-buffer-alignment-with.patch b/target/linux/brcm2708/patches-4.19/950-0481-smsc95xx-dynamically-fix-up-TX-buffer-alignment-with.patch
new file mode 100644
index 0000000000..db7d9a9318
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.19/950-0481-smsc95xx-dynamically-fix-up-TX-buffer-alignment-with.patch
@@ -0,0 +1,62 @@
+From 706a1636883d35b9399be0003d9e36d0f46fd6c5 Mon Sep 17 00:00:00 2001
+From: P33M <p33m@github.com>
+Date: Wed, 1 May 2019 17:04:32 +0100
+Subject: [PATCH 481/725] smsc95xx: dynamically fix up TX buffer alignment with
+ padding bytes
+
+dwc_otg requires a 32-bit aligned buffer start address, otherwise
+expensive bounce buffers are used. The LAN951x hardware can skip up to
+3 bytes between the TX header and the start of frame data, which can
+be used to force alignment of the URB passed to dwc_otg.
+
+As found in https://github.com/raspberrypi/linux/issues/2924
+---
+ drivers/net/usb/smsc95xx.c | 12 +++++++-----
+ drivers/net/usb/smsc95xx.h | 2 +-
+ 2 files changed, 8 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/usb/smsc95xx.c
++++ b/drivers/net/usb/smsc95xx.c
+@@ -2082,7 +2082,9 @@ static struct sk_buff *smsc95xx_tx_fixup
+ struct sk_buff *skb, gfp_t flags)
+ {
+ bool csum = skb->ip_summed == CHECKSUM_PARTIAL;
+- int overhead = csum ? SMSC95XX_TX_OVERHEAD_CSUM : SMSC95XX_TX_OVERHEAD;
++ unsigned int align_bytes = -((uintptr_t)skb->data) & 0x3;
++ int overhead = csum ? SMSC95XX_TX_OVERHEAD_CSUM + align_bytes
++ : SMSC95XX_TX_OVERHEAD + align_bytes;
+ u32 tx_cmd_a, tx_cmd_b;
+
+ /* We do not advertise SG, so skbs should be already linearized */
+@@ -2116,16 +2118,16 @@ static struct sk_buff *smsc95xx_tx_fixup
+ }
+ }
+
+- skb_push(skb, 4);
+- tx_cmd_b = (u32)(skb->len - 4);
++ skb_push(skb, 4 + align_bytes);
++ tx_cmd_b = (u32)(skb->len - 4 - align_bytes);
+ if (csum)
+ tx_cmd_b |= TX_CMD_B_CSUM_ENABLE;
+ cpu_to_le32s(&tx_cmd_b);
+ memcpy(skb->data, &tx_cmd_b, 4);
+
+ skb_push(skb, 4);
+- tx_cmd_a = (u32)(skb->len - 8) | TX_CMD_A_FIRST_SEG_ |
+- TX_CMD_A_LAST_SEG_;
++ tx_cmd_a = (u32)(skb->len - 8 - align_bytes) | TX_CMD_A_FIRST_SEG_ |
++ (align_bytes << 16) | TX_CMD_A_LAST_SEG_;
+ cpu_to_le32s(&tx_cmd_a);
+ memcpy(skb->data, &tx_cmd_a, 4);
+
+--- a/drivers/net/usb/smsc95xx.h
++++ b/drivers/net/usb/smsc95xx.h
+@@ -21,7 +21,7 @@
+ #define _SMSC95XX_H
+
+ /* Tx command words */
+-#define TX_CMD_A_DATA_OFFSET_ (0x001F0000) /* Data Start Offset */
++#define TX_CMD_A_DATA_OFFSET_ (0x00030000) /* Data Start Offset */
+ #define TX_CMD_A_FIRST_SEG_ (0x00002000) /* First Segment */
+ #define TX_CMD_A_LAST_SEG_ (0x00001000) /* Last Segment */
+ #define TX_CMD_A_BUF_SIZE_ (0x000007FF) /* Buffer Size */