[PATCH net-next v4 2/4] usbnet: ipheth: transmit URBs without trailing padding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The behaviour of the official iOS tethering driver on macOS is to not
transmit any trailing padding at the end of URBs. This is applicable
to both NCM and legacy modes, including older devices.

Adapt the driver to not include trailing padding in TX URBs, matching
the behaviour of the official macOS driver.

Signed-off-by: Foster Snowhill <forst@xxxxxx>
Tested-by: Georgi Valkov <gvalkov@xxxxxxxxx>
---
Tested by Georgi Valkov on iPhone 3G (iOS 4.2.1), iPhone 4s (iOS 8.4),
iPhone 7 Plus (iOS 15.7.6).

Tested by Foster Snowhill on iPhone Xs Max (iOS 16.5).

Additionally both Georgi and Foster did USB traffic captures with the
devices above on macOS 13.4, this confirmed the macOS driver behaviour.

v4:
  No code change.
  Factored out from "usbnet: ipheth: add CDC NCM support".
v3: n/a
  Part of https://lore.kernel.org/netdev/20230527130309.34090-2-forst@xxxxxx/
v2: n/a
  Part of https://lore.kernel.org/netdev/20230525194255.4516-2-forst@xxxxxx/
v1: n/a
  Part of https://lore.kernel.org/netdev/20230516210127.35841-1-forst@xxxxxx/
---
 drivers/net/usb/ipheth.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 8875a3d0e..dd809e247 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -373,12 +373,10 @@ static netdev_tx_t ipheth_tx(struct sk_buff *skb, struct net_device *net)
 	}
 
 	memcpy(dev->tx_buf, skb->data, skb->len);
-	if (skb->len < IPHETH_BUF_SIZE)
-		memset(dev->tx_buf + skb->len, 0, IPHETH_BUF_SIZE - skb->len);
 
 	usb_fill_bulk_urb(dev->tx_urb, udev,
 			  usb_sndbulkpipe(udev, dev->bulk_out),
-			  dev->tx_buf, IPHETH_BUF_SIZE,
+			  dev->tx_buf, skb->len,
 			  ipheth_sndbulk_callback,
 			  dev);
 	dev->tx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
-- 
2.40.1




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux