1 From 3e65efcca87a9bb5f3b864e0a43d167bc0a8688c Mon Sep 17 00:00:00 2001
2 From: Foster Snowhill <forst@pen.gy>
3 Date: Wed, 7 Jun 2023 15:57:00 +0200
4 Subject: [PATCH 2/4] usbnet: ipheth: transmit URBs without trailing padding
6 The behaviour of the official iOS tethering driver on macOS is to not
7 transmit any trailing padding at the end of URBs. This is applicable
8 to both NCM and legacy modes, including older devices.
10 Adapt the driver to not include trailing padding in TX URBs, matching
11 the behaviour of the official macOS driver.
13 Signed-off-by: Foster Snowhill <forst@pen.gy>
14 Tested-by: Georgi Valkov <gvalkov@gmail.com>
15 Signed-off-by: David S. Miller <davem@davemloft.net>
17 drivers/net/usb/ipheth.c | 4 +---
18 1 file changed, 1 insertion(+), 3 deletions(-)
20 --- a/drivers/net/usb/ipheth.c
21 +++ b/drivers/net/usb/ipheth.c
22 @@ -373,12 +373,10 @@ static netdev_tx_t ipheth_tx(struct sk_b
25 memcpy(dev->tx_buf, skb->data, skb->len);
26 - if (skb->len < IPHETH_BUF_SIZE)
27 - memset(dev->tx_buf + skb->len, 0, IPHETH_BUF_SIZE - skb->len);
29 usb_fill_bulk_urb(dev->tx_urb, udev,
30 usb_sndbulkpipe(udev, dev->bulk_out),
31 - dev->tx_buf, IPHETH_BUF_SIZE,
32 + dev->tx_buf, skb->len,
33 ipheth_sndbulk_callback,
35 dev->tx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;