]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
usb: gadget: add a new quirk to avoid skb_reserve in u_ether.c
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Mon, 22 Aug 2016 08:48:25 +0000 (17:48 +0900)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Wed, 31 Aug 2016 07:06:03 +0000 (10:06 +0300)
Some platforms (e.g. USB-DMAC on R-Car SoCs) has memory alignment
restriction. If memory alignment is not match, the usb peripheral
driver decides not to use the DMA controller. Then, the performance
is not good.

In the case of u_ether.c, since it calls skb_reserve() in rx_submit(),
it is possible to cause memory alignment mismatch.

So, this patch adds a new quirk "quirk_avoids_skb_reserve" to avoid
skb_reserve() calling in u_ether.c to improve performance.

A peripheral driver will set this flag and network gadget drivers
(e.g. f_ncm.c) will reference the flag via gadget_avoids_skb_reserve().

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

index 3cc93237ff98714cbe8cc18fbbc16dff1e382793..8e81f9eb95e40134f52cd49bd9c3cf5a948735f7 100644 (file)
@@ -346,6 +346,8 @@ struct usb_gadget_ops {
  *     or B-Peripheral wants to take host role.
  * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to
  *     MaxPacketSize.
+ * @quirk_avoids_skb_reserve: udc/platform wants to avoid skb_reserve() in
+ *     u_ether.c to improve performance.
  * @is_selfpowered: if the gadget is self-powered.
  * @deactivated: True if gadget is deactivated - in deactivated state it cannot
  *     be connected.
@@ -398,6 +400,7 @@ struct usb_gadget {
        unsigned                        quirk_altset_not_supp:1;
        unsigned                        quirk_stall_not_supp:1;
        unsigned                        quirk_zlp_not_supp:1;
+       unsigned                        quirk_avoids_skb_reserve:1;
        unsigned                        is_selfpowered:1;
        unsigned                        deactivated:1;
        unsigned                        connected:1;
@@ -473,6 +476,16 @@ static inline int gadget_is_zlp_supported(struct usb_gadget *g)
        return !g->quirk_zlp_not_supp;
 }
 
+/**
+ * gadget_avoids_skb_reserve - return true iff the hardware would like to avoid
+ *     skb_reserve to improve performance.
+ * @g: controller to check for quirk
+ */
+static inline int gadget_avoids_skb_reserve(struct usb_gadget *g)
+{
+       return g->quirk_avoids_skb_reserve;
+}
+
 /**
  * gadget_is_dualspeed - return true iff the hardware handles high speed
  * @g: controller that might support both high and full speeds