Commit 63e4b45c authored by Georgi Valkov's avatar Georgi Valkov Committed by Jakub Kicinski

ipheth: fix EOVERFLOW in ipheth_rcvbulk_callback

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: f33d9e2b ("usbnet: ipheth: fix connectivity with iOS 14")
Signed-off-by: default avatarGeorgi Valkov <gvalkov@abv.bg>
Tested-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Link: https://lore.kernel.org/all/B60B8A4B-92A0-49B3-805D-809A2433B46C@abv.bg/
Link: https://lore.kernel.org/all/24851bd2769434a5fc24730dce8e8a984c5a4505.1643699778.git.jan.kiszka@siemens.com/Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 479f5547
...@@ -121,7 +121,7 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone) ...@@ -121,7 +121,7 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone)
if (tx_buf == NULL) if (tx_buf == NULL)
goto free_rx_urb; 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); GFP_KERNEL, &rx_urb->transfer_dma);
if (rx_buf == NULL) if (rx_buf == NULL)
goto free_tx_buf; goto free_tx_buf;
...@@ -146,7 +146,7 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone) ...@@ -146,7 +146,7 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone)
static void ipheth_free_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); iphone->rx_urb->transfer_dma);
usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->tx_buf, usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->tx_buf,
iphone->tx_urb->transfer_dma); iphone->tx_urb->transfer_dma);
...@@ -317,7 +317,7 @@ static int ipheth_rx_submit(struct ipheth_device *dev, gfp_t mem_flags) ...@@ -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_fill_bulk_urb(dev->rx_urb, udev,
usb_rcvbulkpipe(udev, dev->bulk_in), usb_rcvbulkpipe(udev, dev->bulk_in),
dev->rx_buf, IPHETH_BUF_SIZE, dev->rx_buf, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN,
ipheth_rcvbulk_callback, ipheth_rcvbulk_callback,
dev); dev);
dev->rx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; dev->rx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment