Commit 05f6b0ff authored by Yoshihiro Shimoda's avatar Yoshihiro Shimoda Committed by Felipe Balbi

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: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 60e7396f
...@@ -82,6 +82,7 @@ struct eth_dev { ...@@ -82,6 +82,7 @@ struct eth_dev {
#define WORK_RX_MEMORY 0 #define WORK_RX_MEMORY 0
bool zlp; bool zlp;
bool no_skb_reserve;
u8 host_mac[ETH_ALEN]; u8 host_mac[ETH_ALEN];
u8 dev_mac[ETH_ALEN]; u8 dev_mac[ETH_ALEN];
}; };
...@@ -233,7 +234,8 @@ rx_submit(struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags) ...@@ -233,7 +234,8 @@ rx_submit(struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags)
* but on at least one, checksumming fails otherwise. Note: * but on at least one, checksumming fails otherwise. Note:
* RNDIS headers involve variable numbers of LE32 values. * RNDIS headers involve variable numbers of LE32 values.
*/ */
skb_reserve(skb, NET_IP_ALIGN); if (likely(!dev->no_skb_reserve))
skb_reserve(skb, NET_IP_ALIGN);
req->buf = skb->data; req->buf = skb->data;
req->length = size; req->length = size;
...@@ -1063,6 +1065,7 @@ struct net_device *gether_connect(struct gether *link) ...@@ -1063,6 +1065,7 @@ struct net_device *gether_connect(struct gether *link)
if (result == 0) { if (result == 0) {
dev->zlp = link->is_zlp_ok; dev->zlp = link->is_zlp_ok;
dev->no_skb_reserve = link->no_skb_reserve;
DBG(dev, "qlen %d\n", qlen(dev->gadget, dev->qmult)); DBG(dev, "qlen %d\n", qlen(dev->gadget, dev->qmult));
dev->header_len = link->header_len; dev->header_len = link->header_len;
......
...@@ -64,6 +64,7 @@ struct gether { ...@@ -64,6 +64,7 @@ struct gether {
struct usb_ep *out_ep; struct usb_ep *out_ep;
bool is_zlp_ok; bool is_zlp_ok;
bool no_skb_reserve;
u16 cdc_filter; u16 cdc_filter;
......
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