Re: [OpenWrt-Devel] [PATCH] generic: add 8139cp fixes, enable hardware csum/tso on 4.0+

2015-10-14 Thread David Woodhouse
On Thu, 2015-10-08 at 10:08 +0200, John Crispin wrote:
> 
> correction, one has a SoB, the other has a description. having both 
> in both patches would be nice

Yeah, sorry about the missing SoB.

Although the "missing" description was intentional — it was just the
one line in the subject. I have added more words in the resubmission,
although it's not clear they really help :)

Hopefully better now with the versions I posted yesterday, which I also
updated to reflect the fact that we now have a 4.3 kernel.

-- 
dwmw2



smime.p7s
Description: S/MIME cryptographic signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] generic: add 8139cp fixes, enable hardware csum/tso on 4.0+

2015-10-13 Thread David Woodhouse
This contains two sets of fixes for the 8139cp driver.

For all kernel versions older than 4.3, we can apply the fixes from the
4.3-rc4 kernel. In particular, these fix the TX timeout recovery which
is causing my Geos to lock up until the hardware watchdog kicks in.

For 4.0 and later kernels, we can also apply the additional improvements
which are going into 4.4 to fix and enable hardware checksum/TSO
offload. Backporting those to older kernels is non-trivial.

Signed-off-by: David Woodhouse 
---
 .../patches-3.18/760-8139cp-fixes-from-4.3.patch   | 367 +
 .../patches-4.0/760-8139cp-fixes-from-4.3.patch| 367 +
 .../patches-4.0/761-8139cp-fixes-from-4.4.patch| 105 ++
 .../patches-4.1/760-8139cp-fixes-from-4.3.patch| 367 +
 .../patches-4.1/761-8139cp-fixes-from-4.4.patch| 105 ++
 .../patches-4.3/761-8139cp-fixes-from-4.4.patch| 105 ++
 6 files changed, 1416 insertions(+)
 create mode 100644 
target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch
 create mode 100644 
target/linux/generic/patches-4.0/760-8139cp-fixes-from-4.3.patch
 create mode 100644 
target/linux/generic/patches-4.0/761-8139cp-fixes-from-4.4.patch
 create mode 100644 
target/linux/generic/patches-4.1/760-8139cp-fixes-from-4.3.patch
 create mode 100644 
target/linux/generic/patches-4.1/761-8139cp-fixes-from-4.4.patch
 create mode 100644 
target/linux/generic/patches-4.3/761-8139cp-fixes-from-4.4.patch

diff --git a/target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch 
b/target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch
new file mode 100644
index 000..de4c127
--- /dev/null
+++ b/target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch
@@ -0,0 +1,367 @@
+commit 41b976414c88016e2c9d9b2f6667ee67a998d388
+Author: David Woodhouse 
+Date:   Wed Sep 23 09:45:31 2015 +0100
+
+8139cp: Dump contents of descriptor ring on TX timeout
+
+We are seeing unexplained TX timeouts under heavy load. Let's try to get
+a better idea of what's going on.
+
+Signed-off-by: David Woodhouse 
+Signed-off-by: David S. Miller 
+
+commit 7f4c685633e2df9ba10d49a31dda13715745db37
+Author: David Woodhouse 
+Date:   Wed Sep 23 09:45:16 2015 +0100
+
+8139cp: Fix DMA unmapping of transmitted buffers
+
+The low 16 bits of the 'opts1' field in the TX descriptor are supposed
+to still contain the buffer length when the descriptor is handed back to
+us. In practice, at least on my hardware, they don't. So stash the
+original value of the opts1 field and get the length to unmap from
+there.
+
+There are other ways we could have worked out the length, but I actually
+want a stash of the opts1 field anyway so that I can dump it alongside
+the contents of the descriptor ring when we suffer a TX timeout.
+
+Signed-off-by: David Woodhouse 
+Signed-off-by: David S. Miller 
+
+commit 0a5aeee0b79fa99d8e04c98dd4e87d4f52aa497b
+Author: David Woodhouse 
+Date:   Wed Sep 23 09:44:57 2015 +0100
+
+8139cp: Reduce duplicate csum/tso code in cp_start_xmit()
+
+We calculate the value of the opts1 descriptor field in three different
+places. With two different behaviours when given an invalid packet to
+be checksummed — none of them correct. Sort that out.
+
+Signed-off-by: David Woodhouse 
+Signed-off-by: David S. Miller 
+
+commit a3b804043f490aeec57d8ca5baccdd35e6250857
+Author: David Woodhouse 
+Date:   Wed Sep 23 09:44:38 2015 +0100
+
+8139cp: Fix TSO/scatter-gather descriptor setup
+
+When sending a TSO frame in multiple buffers, we were neglecting to set
+the first descriptor up in TSO mode.
+
+Signed-off-by: David Woodhouse 
+Signed-off-by: David S. Miller 
+
+commit 26b0bad6ac3a0167792dc4ffb276c29bc597d239
+Author: David Woodhouse 
+Date:   Wed Sep 23 09:44:06 2015 +0100
+
+8139cp: Fix tx_queued debug message to print correct slot numbers
+
+After a certain amount of staring at the debug output of this driver, I
+realised it was lying to me.
+
+Signed-off-by: David Woodhouse 
+Signed-off-by: David S. Miller 
+
+commit aaa0062ecf4877a26dea66bee1039c6eaf906c94
+Author: David Woodhouse 
+Date:   Wed Sep 23 09:43:41 2015 +0100
+
+8139cp: Do not re-enable RX interrupts in cp_tx_timeout()
+
+If an RX interrupt was already received but NAPI has not yet run when
+the RX timeout happens, we end up in cp_tx_timeout() with RX interrupts
+already 

Re: [OpenWrt-Devel] [PATCH] generic: add 8139cp fixes, enable hardware csum/tso on 4.0+

2015-10-08 Thread John Crispin
Hi,

SoB is missing from this and the CC backport patch

John

On 05/10/2015 22:26, David Woodhouse wrote:
> For all kernels, add the fixes which are already in 4.3-rc4.
> 
> For 4.0+, also add the fixes currently in net-next which fix and enable
> hardware checksum and TSO support.
> 
> ---
>  .../patches-3.18/760-8139cp-fixes-from-4.3.patch   | 367 
> +
>  .../patches-4.0/760-8139cp-fixes-from-4.3.patch| 367 
> +
>  .../patches-4.0/761-8139cp-fixes-from-4.4.patch| 105 ++
>  .../patches-4.1/760-8139cp-fixes-from-4.3.patch| 367 
> +
>  .../patches-4.1/761-8139cp-fixes-from-4.4.patch| 105 ++
>  5 files changed, 1311 insertions(+)
>  create mode 100644 
> target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch
>  create mode 100644 
> target/linux/generic/patches-4.0/760-8139cp-fixes-from-4.3.patch
>  create mode 100644 
> target/linux/generic/patches-4.0/761-8139cp-fixes-from-4.4.patch
>  create mode 100644 
> target/linux/generic/patches-4.1/760-8139cp-fixes-from-4.3.patch
>  create mode 100644 
> target/linux/generic/patches-4.1/761-8139cp-fixes-from-4.4.patch
> 
> diff --git 
> a/target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch 
> b/target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch
> new file mode 100644
> index 000..de4c127
> --- /dev/null
> +++ b/target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch
> @@ -0,0 +1,367 @@
> +commit 41b976414c88016e2c9d9b2f6667ee67a998d388
> +Author: David Woodhouse 
> +Date:   Wed Sep 23 09:45:31 2015 +0100
> +
> +8139cp: Dump contents of descriptor ring on TX timeout
> +
> +We are seeing unexplained TX timeouts under heavy load. Let's try to get
> +a better idea of what's going on.
> +
> +Signed-off-by: David Woodhouse 
> +Signed-off-by: David S. Miller 
> +
> +commit 7f4c685633e2df9ba10d49a31dda13715745db37
> +Author: David Woodhouse 
> +Date:   Wed Sep 23 09:45:16 2015 +0100
> +
> +8139cp: Fix DMA unmapping of transmitted buffers
> +
> +The low 16 bits of the 'opts1' field in the TX descriptor are supposed
> +to still contain the buffer length when the descriptor is handed back to
> +us. In practice, at least on my hardware, they don't. So stash the
> +original value of the opts1 field and get the length to unmap from
> +there.
> +
> +There are other ways we could have worked out the length, but I actually
> +want a stash of the opts1 field anyway so that I can dump it alongside
> +the contents of the descriptor ring when we suffer a TX timeout.
> +
> +Signed-off-by: David Woodhouse 
> +Signed-off-by: David S. Miller 
> +
> +commit 0a5aeee0b79fa99d8e04c98dd4e87d4f52aa497b
> +Author: David Woodhouse 
> +Date:   Wed Sep 23 09:44:57 2015 +0100
> +
> +8139cp: Reduce duplicate csum/tso code in cp_start_xmit()
> +
> +We calculate the value of the opts1 descriptor field in three different
> +places. With two different behaviours when given an invalid packet to
> +be checksummed — none of them correct. Sort that out.
> +
> +Signed-off-by: David Woodhouse 
> +Signed-off-by: David S. Miller 
> +
> +commit a3b804043f490aeec57d8ca5baccdd35e6250857
> +Author: David Woodhouse 
> +Date:   Wed Sep 23 09:44:38 2015 +0100
> +
> +8139cp: Fix TSO/scatter-gather descriptor setup
> +
> +When sending a TSO frame in multiple buffers, we were neglecting to set
> +the first descriptor up in TSO mode.
> +
> +Signed-off-by: David Woodhouse 
> +Signed-off-by: David S. Miller 
> +
> +commit 26b0bad6ac3a0167792dc4ffb276c29bc597d239
> +Author: David Woodhouse 
> +Date:   Wed Sep 23 09:44:06 2015 +0100
> +
> +8139cp: Fix tx_queued debug message to print correct slot numbers
> +
> +After a certain amount of staring at the debug output of this driver, I
> +realised it was lying to me.
> +
> +Signed-off-by: David Woodhouse 
> +Signed-off-by: David S. Miller 
> +
> +commit aaa0062ecf4877a26dea66bee1039c6eaf906c94
> +Author: David Woodhouse 
> +Date:   Wed Sep 23 09:43:41 2015 +0100
> +
> +8139cp: Do not re-enable RX interrupts in cp_tx_timeout()
> +
> +If an RX interrupt was already received but NAPI has not yet run when
> +the RX timeout happens, we end up in cp_tx_timeout() with RX interrupts
> +already disabled. Blindly re-enabling them will cause an IRQ storm.
> +
> +(This is made particularly horrid by the fact that cp_interrupt() always
> +returns that 

Re: [OpenWrt-Devel] [PATCH] generic: add 8139cp fixes, enable hardware csum/tso on 4.0+

2015-10-08 Thread John Crispin

correction, one has a SoB, the other has a description. having both in
both patches would be nice

John


On 08/10/2015 10:06, John Crispin wrote:
> Hi,
> 
> SoB is missing from this and the CC backport patch
> 
>   John
> 


> On 05/10/2015 22:26, David Woodhouse wrote:
>> For all kernels, add the fixes which are already in 4.3-rc4.
>>
>> For 4.0+, also add the fixes currently in net-next which fix and enable
>> hardware checksum and TSO support.
>>
>> ---
>>  .../patches-3.18/760-8139cp-fixes-from-4.3.patch   | 367 
>> +
>>  .../patches-4.0/760-8139cp-fixes-from-4.3.patch| 367 
>> +
>>  .../patches-4.0/761-8139cp-fixes-from-4.4.patch| 105 ++
>>  .../patches-4.1/760-8139cp-fixes-from-4.3.patch| 367 
>> +
>>  .../patches-4.1/761-8139cp-fixes-from-4.4.patch| 105 ++
>>  5 files changed, 1311 insertions(+)
>>  create mode 100644 
>> target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch
>>  create mode 100644 
>> target/linux/generic/patches-4.0/760-8139cp-fixes-from-4.3.patch
>>  create mode 100644 
>> target/linux/generic/patches-4.0/761-8139cp-fixes-from-4.4.patch
>>  create mode 100644 
>> target/linux/generic/patches-4.1/760-8139cp-fixes-from-4.3.patch
>>  create mode 100644 
>> target/linux/generic/patches-4.1/761-8139cp-fixes-from-4.4.patch
>>
>> diff --git 
>> a/target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch 
>> b/target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch
>> new file mode 100644
>> index 000..de4c127
>> --- /dev/null
>> +++ b/target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch
>> @@ -0,0 +1,367 @@
>> +commit 41b976414c88016e2c9d9b2f6667ee67a998d388
>> +Author: David Woodhouse 
>> +Date:   Wed Sep 23 09:45:31 2015 +0100
>> +
>> +8139cp: Dump contents of descriptor ring on TX timeout
>> +
>> +We are seeing unexplained TX timeouts under heavy load. Let's try to get
>> +a better idea of what's going on.
>> +
>> +Signed-off-by: David Woodhouse 
>> +Signed-off-by: David S. Miller 
>> +
>> +commit 7f4c685633e2df9ba10d49a31dda13715745db37
>> +Author: David Woodhouse 
>> +Date:   Wed Sep 23 09:45:16 2015 +0100
>> +
>> +8139cp: Fix DMA unmapping of transmitted buffers
>> +
>> +The low 16 bits of the 'opts1' field in the TX descriptor are supposed
>> +to still contain the buffer length when the descriptor is handed back to
>> +us. In practice, at least on my hardware, they don't. So stash the
>> +original value of the opts1 field and get the length to unmap from
>> +there.
>> +
>> +There are other ways we could have worked out the length, but I actually
>> +want a stash of the opts1 field anyway so that I can dump it alongside
>> +the contents of the descriptor ring when we suffer a TX timeout.
>> +
>> +Signed-off-by: David Woodhouse 
>> +Signed-off-by: David S. Miller 
>> +
>> +commit 0a5aeee0b79fa99d8e04c98dd4e87d4f52aa497b
>> +Author: David Woodhouse 
>> +Date:   Wed Sep 23 09:44:57 2015 +0100
>> +
>> +8139cp: Reduce duplicate csum/tso code in cp_start_xmit()
>> +
>> +We calculate the value of the opts1 descriptor field in three different
>> +places. With two different behaviours when given an invalid packet to
>> +be checksummed — none of them correct. Sort that out.
>> +
>> +Signed-off-by: David Woodhouse 
>> +Signed-off-by: David S. Miller 
>> +
>> +commit a3b804043f490aeec57d8ca5baccdd35e6250857
>> +Author: David Woodhouse 
>> +Date:   Wed Sep 23 09:44:38 2015 +0100
>> +
>> +8139cp: Fix TSO/scatter-gather descriptor setup
>> +
>> +When sending a TSO frame in multiple buffers, we were neglecting to set
>> +the first descriptor up in TSO mode.
>> +
>> +Signed-off-by: David Woodhouse 
>> +Signed-off-by: David S. Miller 
>> +
>> +commit 26b0bad6ac3a0167792dc4ffb276c29bc597d239
>> +Author: David Woodhouse 
>> +Date:   Wed Sep 23 09:44:06 2015 +0100
>> +
>> +8139cp: Fix tx_queued debug message to print correct slot numbers
>> +
>> +After a certain amount of staring at the debug output of this driver, I
>> +realised it was lying to me.
>> +
>> +Signed-off-by: David Woodhouse 
>> +Signed-off-by: David S. Miller 
>> +
>> +commit aaa0062ecf4877a26dea66bee1039c6eaf906c94
>> +Author: David Woodhouse 
>> +Date:   Wed Sep 23 09:43:41 2015 +0100
>> +
>> +8139cp: Do not re-enable RX interrupts in cp_tx_timeout()
>> +
>> +If an RX interrupt was already received but NAPI has not 

[OpenWrt-Devel] [PATCH] generic: add 8139cp fixes, enable hardware csum/tso on 4.0+

2015-10-05 Thread David Woodhouse
For all kernels, add the fixes which are already in 4.3-rc4.

For 4.0+, also add the fixes currently in net-next which fix and enable
hardware checksum and TSO support.

---
 .../patches-3.18/760-8139cp-fixes-from-4.3.patch   | 367 +
 .../patches-4.0/760-8139cp-fixes-from-4.3.patch| 367 +
 .../patches-4.0/761-8139cp-fixes-from-4.4.patch| 105 ++
 .../patches-4.1/760-8139cp-fixes-from-4.3.patch| 367 +
 .../patches-4.1/761-8139cp-fixes-from-4.4.patch| 105 ++
 5 files changed, 1311 insertions(+)
 create mode 100644 
target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch
 create mode 100644 
target/linux/generic/patches-4.0/760-8139cp-fixes-from-4.3.patch
 create mode 100644 
target/linux/generic/patches-4.0/761-8139cp-fixes-from-4.4.patch
 create mode 100644 
target/linux/generic/patches-4.1/760-8139cp-fixes-from-4.3.patch
 create mode 100644 
target/linux/generic/patches-4.1/761-8139cp-fixes-from-4.4.patch

diff --git a/target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch 
b/target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch
new file mode 100644
index 000..de4c127
--- /dev/null
+++ b/target/linux/generic/patches-3.18/760-8139cp-fixes-from-4.3.patch
@@ -0,0 +1,367 @@
+commit 41b976414c88016e2c9d9b2f6667ee67a998d388
+Author: David Woodhouse 
+Date:   Wed Sep 23 09:45:31 2015 +0100
+
+8139cp: Dump contents of descriptor ring on TX timeout
+
+We are seeing unexplained TX timeouts under heavy load. Let's try to get
+a better idea of what's going on.
+
+Signed-off-by: David Woodhouse 
+Signed-off-by: David S. Miller 
+
+commit 7f4c685633e2df9ba10d49a31dda13715745db37
+Author: David Woodhouse 
+Date:   Wed Sep 23 09:45:16 2015 +0100
+
+8139cp: Fix DMA unmapping of transmitted buffers
+
+The low 16 bits of the 'opts1' field in the TX descriptor are supposed
+to still contain the buffer length when the descriptor is handed back to
+us. In practice, at least on my hardware, they don't. So stash the
+original value of the opts1 field and get the length to unmap from
+there.
+
+There are other ways we could have worked out the length, but I actually
+want a stash of the opts1 field anyway so that I can dump it alongside
+the contents of the descriptor ring when we suffer a TX timeout.
+
+Signed-off-by: David Woodhouse 
+Signed-off-by: David S. Miller 
+
+commit 0a5aeee0b79fa99d8e04c98dd4e87d4f52aa497b
+Author: David Woodhouse 
+Date:   Wed Sep 23 09:44:57 2015 +0100
+
+8139cp: Reduce duplicate csum/tso code in cp_start_xmit()
+
+We calculate the value of the opts1 descriptor field in three different
+places. With two different behaviours when given an invalid packet to
+be checksummed — none of them correct. Sort that out.
+
+Signed-off-by: David Woodhouse 
+Signed-off-by: David S. Miller 
+
+commit a3b804043f490aeec57d8ca5baccdd35e6250857
+Author: David Woodhouse 
+Date:   Wed Sep 23 09:44:38 2015 +0100
+
+8139cp: Fix TSO/scatter-gather descriptor setup
+
+When sending a TSO frame in multiple buffers, we were neglecting to set
+the first descriptor up in TSO mode.
+
+Signed-off-by: David Woodhouse 
+Signed-off-by: David S. Miller 
+
+commit 26b0bad6ac3a0167792dc4ffb276c29bc597d239
+Author: David Woodhouse 
+Date:   Wed Sep 23 09:44:06 2015 +0100
+
+8139cp: Fix tx_queued debug message to print correct slot numbers
+
+After a certain amount of staring at the debug output of this driver, I
+realised it was lying to me.
+
+Signed-off-by: David Woodhouse 
+Signed-off-by: David S. Miller 
+
+commit aaa0062ecf4877a26dea66bee1039c6eaf906c94
+Author: David Woodhouse 
+Date:   Wed Sep 23 09:43:41 2015 +0100
+
+8139cp: Do not re-enable RX interrupts in cp_tx_timeout()
+
+If an RX interrupt was already received but NAPI has not yet run when
+the RX timeout happens, we end up in cp_tx_timeout() with RX interrupts
+already disabled. Blindly re-enabling them will cause an IRQ storm.
+
+(This is made particularly horrid by the fact that cp_interrupt() always
+returns that it's handled the interrupt, even when it hasn't actually
+done anything. If it didn't do that, the core IRQ code would have
+detected the storm and handled it, I'd have had a clear smoking gun
+backtrace instead of just a spontaneously resetting router, and I'd have
+at *least* two days of my life back. Changing the return value of