net: usbnet: Do not align IP header for raw IP mode
usbnet driver supports ethernet mode by default. Since ethernet header
is 14 bytes therefore driver makes IP header 4-byte aligned to avoid
performance hit due to IP header accesses from linux network stack becomes
unaligned.
In raw IP mode, IP header is 4-byte aligned as there is no ethernet header.
Hence there is no need for 4-byte IP header alignment. This improves the
embedded rmnet throughout on rx data path.
While testing peak throughput using iperf on downlink direction, this patch
improves the performance from 56Mbps to 99Mbps when 100Mbps was pushed.
Change-Id: I4faa4274fedc5fc4fa57e595d0a95f1e90614172
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index c3a756d..2620108 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -35,6 +35,7 @@
#include <linux/module.h>
#include <linux/init.h>
+#include <linux/if_arp.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ctype.h>
@@ -332,7 +333,9 @@
usb_free_urb (urb);
return -ENOMEM;
}
- skb_reserve (skb, NET_IP_ALIGN);
+
+ if (dev->net->type != ARPHRD_RAWIP)
+ skb_reserve(skb, NET_IP_ALIGN);
entry = (struct skb_data *) skb->cb;
entry->urb = urb;