aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2016-08-22 04:48:25 -0400
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-08-31 03:06:03 -0400
commit60e7396f820fa67a007f2a2eb5d97d3e77a74881 (patch)
tree1bf8a1405d8ff640d478b7ca078720bdfa1f0269 /include/linux/usb
parenta00c9791a3e4f625840f1f0507ad3f191310abae (diff)
usb: gadget: add a new quirk to avoid skb_reserve in u_ether.c
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>
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/gadget.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 3cc93237ff98..8e81f9eb95e4 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -346,6 +346,8 @@ struct usb_gadget_ops {
346 * or B-Peripheral wants to take host role. 346 * or B-Peripheral wants to take host role.
347 * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to 347 * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to
348 * MaxPacketSize. 348 * MaxPacketSize.
349 * @quirk_avoids_skb_reserve: udc/platform wants to avoid skb_reserve() in
350 * u_ether.c to improve performance.
349 * @is_selfpowered: if the gadget is self-powered. 351 * @is_selfpowered: if the gadget is self-powered.
350 * @deactivated: True if gadget is deactivated - in deactivated state it cannot 352 * @deactivated: True if gadget is deactivated - in deactivated state it cannot
351 * be connected. 353 * be connected.
@@ -398,6 +400,7 @@ struct usb_gadget {
398 unsigned quirk_altset_not_supp:1; 400 unsigned quirk_altset_not_supp:1;
399 unsigned quirk_stall_not_supp:1; 401 unsigned quirk_stall_not_supp:1;
400 unsigned quirk_zlp_not_supp:1; 402 unsigned quirk_zlp_not_supp:1;
403 unsigned quirk_avoids_skb_reserve:1;
401 unsigned is_selfpowered:1; 404 unsigned is_selfpowered:1;
402 unsigned deactivated:1; 405 unsigned deactivated:1;
403 unsigned connected:1; 406 unsigned connected:1;
@@ -474,6 +477,16 @@ static inline int gadget_is_zlp_supported(struct usb_gadget *g)
474} 477}
475 478
476/** 479/**
480 * gadget_avoids_skb_reserve - return true iff the hardware would like to avoid
481 * skb_reserve to improve performance.
482 * @g: controller to check for quirk
483 */
484static inline int gadget_avoids_skb_reserve(struct usb_gadget *g)
485{
486 return g->quirk_avoids_skb_reserve;
487}
488
489/**
477 * gadget_is_dualspeed - return true iff the hardware handles high speed 490 * gadget_is_dualspeed - return true iff the hardware handles high speed
478 * @g: controller that might support both high and full speeds 491 * @g: controller that might support both high and full speeds
479 */ 492 */