* [PATCH] ipheth: fix EOVERFLOW in ipheth_rcvbulk_callback
@ 2022-01-31 18:58 Jan Kiszka
2022-02-01 5:14 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2022-01-31 18:58 UTC (permalink / raw)
To: Jakub Kicinski, David S. Miller, Georgi Valkov
Cc: linux-usb, Linux Netdev List, Linux Kernel Mailing List, stable
From: Georgi Valkov <gvalkov@abv.bg>
When rx_buf is allocated we need to account for IPHETH_IP_ALIGN,
which reduces the usable size by 2 bytes. Otherwise we have 1512
bytes usable instead of 1514, and if we receive more than 1512
bytes, ipheth_rcvbulk_callback is called with status -EOVERFLOW,
after which the driver malfunctiones and all communication stops.
Resolves ipheth 2-1:4.2: ipheth_rcvbulk_callback: urb status: -75
Fixes: f33d9e2b48a3 ("usbnet: ipheth: fix connectivity with iOS 14")
Signed-off-by: Georgi Valkov <gvalkov@abv.bg>
Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
---
drivers/net/usb/ipheth.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index cd33955df0b6..6a769df0b421 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -121,7 +121,7 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone)
if (tx_buf == NULL)
goto free_rx_urb;
- rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE,
+ rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN,
GFP_KERNEL, &rx_urb->transfer_dma);
if (rx_buf == NULL)
goto free_tx_buf;
@@ -146,7 +146,7 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone)
static void ipheth_free_urbs(struct ipheth_device *iphone)
{
- usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->rx_buf,
+ usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN, iphone->rx_buf,
iphone->rx_urb->transfer_dma);
usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->tx_buf,
iphone->tx_urb->transfer_dma);
@@ -317,7 +317,7 @@ static int ipheth_rx_submit(struct ipheth_device *dev, gfp_t mem_flags)
usb_fill_bulk_urb(dev->rx_urb, udev,
usb_rcvbulkpipe(udev, dev->bulk_in),
- dev->rx_buf, IPHETH_BUF_SIZE,
+ dev->rx_buf, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN,
ipheth_rcvbulk_callback,
dev);
dev->rx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ipheth: fix EOVERFLOW in ipheth_rcvbulk_callback
2022-01-31 18:58 [PATCH] ipheth: fix EOVERFLOW in ipheth_rcvbulk_callback Jan Kiszka
@ 2022-02-01 5:14 ` Jakub Kicinski
2022-02-01 6:44 ` Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2022-02-01 5:14 UTC (permalink / raw)
To: Jan Kiszka
Cc: David S. Miller, Georgi Valkov, linux-usb, Linux Netdev List,
Linux Kernel Mailing List, stable
On Mon, 31 Jan 2022 19:58:14 +0100 Jan Kiszka wrote:
> From: Georgi Valkov <gvalkov@abv.bg>
>
> When rx_buf is allocated we need to account for IPHETH_IP_ALIGN,
> which reduces the usable size by 2 bytes. Otherwise we have 1512
> bytes usable instead of 1514, and if we receive more than 1512
> bytes, ipheth_rcvbulk_callback is called with status -EOVERFLOW,
> after which the driver malfunctiones and all communication stops.
>
> Resolves ipheth 2-1:4.2: ipheth_rcvbulk_callback: urb status: -75
>
> Fixes: f33d9e2b48a3 ("usbnet: ipheth: fix connectivity with iOS 14")
> Signed-off-by: Georgi Valkov <gvalkov@abv.bg>
> Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
Hm, I'm starting to suspect this patch is cursed..
> diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
> index cd33955df0b6..6a769df0b421 100644
> --- a/drivers/net/usb/ipheth.c
> +++ b/drivers/net/usb/ipheth.c
> @@ -121,7 +121,7 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone)
> if (tx_buf == NULL)
There is an extra space character at the start of each line of context.
> goto free_rx_urb;
>
> - rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE,
But not on the changed lines.
> + rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN,
> GFP_KERNEL, &rx_urb->transfer_dma);
> if (rx_buf == NULL)
> goto free_tx_buf;
> @@ -146,7 +146,7 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone)
>
> static void ipheth_free_urbs(struct ipheth_device *iphone)
> {
> - usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->rx_buf,
Pretty clear here in how the opening bracket does not align after the -.
> + usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN, iphone->rx_buf,
> iphone->rx_urb->transfer_dma);
> usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->tx_buf,
> iphone->tx_urb->transfer_dma);
> @@ -317,7 +317,7 @@ static int ipheth_rx_submit(struct ipheth_device *dev, gfp_t mem_flags)
>
> usb_fill_bulk_urb(dev->rx_urb, udev,
> usb_rcvbulkpipe(udev, dev->bulk_in),
> - dev->rx_buf, IPHETH_BUF_SIZE,
> + dev->rx_buf, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN,
> ipheth_rcvbulk_callback,
> dev);
> dev->rx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ipheth: fix EOVERFLOW in ipheth_rcvbulk_callback
2022-02-01 5:14 ` Jakub Kicinski
@ 2022-02-01 6:44 ` Jan Kiszka
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2022-02-01 6:44 UTC (permalink / raw)
To: Jakub Kicinski
Cc: David S. Miller, Georgi Valkov, linux-usb, Linux Netdev List,
Linux Kernel Mailing List, stable
On 01.02.22 06:14, Jakub Kicinski wrote:
> On Mon, 31 Jan 2022 19:58:14 +0100 Jan Kiszka wrote:
>> From: Georgi Valkov <gvalkov@abv.bg>
>>
>> When rx_buf is allocated we need to account for IPHETH_IP_ALIGN,
>> which reduces the usable size by 2 bytes. Otherwise we have 1512
>> bytes usable instead of 1514, and if we receive more than 1512
>> bytes, ipheth_rcvbulk_callback is called with status -EOVERFLOW,
>> after which the driver malfunctiones and all communication stops.
>>
>> Resolves ipheth 2-1:4.2: ipheth_rcvbulk_callback: urb status: -75
>>
>> Fixes: f33d9e2b48a3 ("usbnet: ipheth: fix connectivity with iOS 14")
>> Signed-off-by: Georgi Valkov <gvalkov@abv.bg>
>> Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
>
> Hm, I'm starting to suspect this patch is cursed..
>
>> diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
>> index cd33955df0b6..6a769df0b421 100644
>> --- a/drivers/net/usb/ipheth.c
>> +++ b/drivers/net/usb/ipheth.c
>> @@ -121,7 +121,7 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone)
>> if (tx_buf == NULL)
>
> There is an extra space character at the start of each line of context.
>
>> goto free_rx_urb;
>>
>> - rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE,
>
> But not on the changed lines.
>
>> + rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN,
>> GFP_KERNEL, &rx_urb->transfer_dma);
>> if (rx_buf == NULL)
>> goto free_tx_buf;
>> @@ -146,7 +146,7 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone)
>>
>> static void ipheth_free_urbs(struct ipheth_device *iphone)
>> {
>> - usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->rx_buf,
>
> Pretty clear here in how the opening bracket does not align after the -.
>
>> + usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN, iphone->rx_buf,
>> iphone->rx_urb->transfer_dma);
>> usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->tx_buf,
>> iphone->tx_urb->transfer_dma);
>> @@ -317,7 +317,7 @@ static int ipheth_rx_submit(struct ipheth_device *dev, gfp_t mem_flags)
>>
>> usb_fill_bulk_urb(dev->rx_urb, udev,
>> usb_rcvbulkpipe(udev, dev->bulk_in),
>> - dev->rx_buf, IPHETH_BUF_SIZE,
>> + dev->rx_buf, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN,
>> ipheth_rcvbulk_callback,
>> dev);
>> dev->rx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
>
Sorry, a submission tool regressed here unnoticed (grrrr!). Will resend.
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-01 6:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31 18:58 [PATCH] ipheth: fix EOVERFLOW in ipheth_rcvbulk_callback Jan Kiszka
2022-02-01 5:14 ` Jakub Kicinski
2022-02-01 6:44 ` Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).