Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: u_ether: add a flag to avoid skb_reserve() calling

This patch adds a flag "no_skb_reserve" in struct eth_dev.
So, if a peripheral driver sets the quirk_avoids_skb_reserve flag,
upper network gadget drivers (e.g. f_ncm.c) can avoid skb_reserve()
calling using the flag as well.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>

authored by

Yoshihiro Shimoda and committed by
Felipe Balbi
05f6b0ff 60e7396f

+5 -1
+4 -1
drivers/usb/gadget/function/u_ether.c
··· 82 82 #define WORK_RX_MEMORY 0 83 83 84 84 bool zlp; 85 + bool no_skb_reserve; 85 86 u8 host_mac[ETH_ALEN]; 86 87 u8 dev_mac[ETH_ALEN]; 87 88 }; ··· 234 233 * but on at least one, checksumming fails otherwise. Note: 235 234 * RNDIS headers involve variable numbers of LE32 values. 236 235 */ 237 - skb_reserve(skb, NET_IP_ALIGN); 236 + if (likely(!dev->no_skb_reserve)) 237 + skb_reserve(skb, NET_IP_ALIGN); 238 238 239 239 req->buf = skb->data; 240 240 req->length = size; ··· 1065 1063 1066 1064 if (result == 0) { 1067 1065 dev->zlp = link->is_zlp_ok; 1066 + dev->no_skb_reserve = link->no_skb_reserve; 1068 1067 DBG(dev, "qlen %d\n", qlen(dev->gadget, dev->qmult)); 1069 1068 1070 1069 dev->header_len = link->header_len;
+1
drivers/usb/gadget/function/u_ether.h
··· 64 64 struct usb_ep *out_ep; 65 65 66 66 bool is_zlp_ok; 67 + bool no_skb_reserve; 67 68 68 69 u16 cdc_filter; 69 70