aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/u_ether.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/u_ether.c')
-rw-r--r--drivers/usb/gadget/u_ether.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 2ac1d2147325..dfed4c1d96c0 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -97,16 +97,17 @@ struct eth_dev {
97 97
98static unsigned qmult = 5; 98static unsigned qmult = 5;
99module_param(qmult, uint, S_IRUGO|S_IWUSR); 99module_param(qmult, uint, S_IRUGO|S_IWUSR);
100MODULE_PARM_DESC(qmult, "queue length multiplier at high speed"); 100MODULE_PARM_DESC(qmult, "queue length multiplier at high/super speed");
101 101
102#else /* full speed (low speed doesn't do bulk) */ 102#else /* full speed (low speed doesn't do bulk) */
103#define qmult 1 103#define qmult 1
104#endif 104#endif
105 105
106/* for dual-speed hardware, use deeper queues at highspeed */ 106/* for dual-speed hardware, use deeper queues at high/super speed */
107static inline int qlen(struct usb_gadget *gadget) 107static inline int qlen(struct usb_gadget *gadget)
108{ 108{
109 if (gadget_is_dualspeed(gadget) && gadget->speed == USB_SPEED_HIGH) 109 if (gadget_is_dualspeed(gadget) && (gadget->speed == USB_SPEED_HIGH ||
110 gadget->speed == USB_SPEED_SUPER))
110 return qmult * DEFAULT_QLEN; 111 return qmult * DEFAULT_QLEN;
111 else 112 else
112 return DEFAULT_QLEN; 113 return DEFAULT_QLEN;
@@ -598,9 +599,10 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
598 599
599 req->length = length; 600 req->length = length;
600 601
601 /* throttle highspeed IRQ rate back slightly */ 602 /* throttle high/super speed IRQ rate back slightly */
602 if (gadget_is_dualspeed(dev->gadget)) 603 if (gadget_is_dualspeed(dev->gadget))
603 req->no_interrupt = (dev->gadget->speed == USB_SPEED_HIGH) 604 req->no_interrupt = (dev->gadget->speed == USB_SPEED_HIGH ||
605 dev->gadget->speed == USB_SPEED_SUPER)
604 ? ((atomic_read(&dev->tx_qlen) % qmult) != 0) 606 ? ((atomic_read(&dev->tx_qlen) % qmult) != 0)
605 : 0; 607 : 0;
606 608
@@ -693,8 +695,8 @@ static int eth_stop(struct net_device *net)
693 usb_ep_disable(link->out_ep); 695 usb_ep_disable(link->out_ep);
694 if (netif_carrier_ok(net)) { 696 if (netif_carrier_ok(net)) {
695 DBG(dev, "host still using in/out endpoints\n"); 697 DBG(dev, "host still using in/out endpoints\n");
696 usb_ep_enable(link->in_ep, link->in); 698 usb_ep_enable(link->in_ep);
697 usb_ep_enable(link->out_ep, link->out); 699 usb_ep_enable(link->out_ep);
698 } 700 }
699 } 701 }
700 spin_unlock_irqrestore(&dev->lock, flags); 702 spin_unlock_irqrestore(&dev->lock, flags);
@@ -871,7 +873,7 @@ struct net_device *gether_connect(struct gether *link)
871 return ERR_PTR(-EINVAL); 873 return ERR_PTR(-EINVAL);
872 874
873 link->in_ep->driver_data = dev; 875 link->in_ep->driver_data = dev;
874 result = usb_ep_enable(link->in_ep, link->in); 876 result = usb_ep_enable(link->in_ep);
875 if (result != 0) { 877 if (result != 0) {
876 DBG(dev, "enable %s --> %d\n", 878 DBG(dev, "enable %s --> %d\n",
877 link->in_ep->name, result); 879 link->in_ep->name, result);
@@ -879,7 +881,7 @@ struct net_device *gether_connect(struct gether *link)
879 } 881 }
880 882
881 link->out_ep->driver_data = dev; 883 link->out_ep->driver_data = dev;
882 result = usb_ep_enable(link->out_ep, link->out); 884 result = usb_ep_enable(link->out_ep);
883 if (result != 0) { 885 if (result != 0) {
884 DBG(dev, "enable %s --> %d\n", 886 DBG(dev, "enable %s --> %d\n",
885 link->out_ep->name, result); 887 link->out_ep->name, result);
@@ -969,7 +971,7 @@ void gether_disconnect(struct gether *link)
969 } 971 }
970 spin_unlock(&dev->req_lock); 972 spin_unlock(&dev->req_lock);
971 link->in_ep->driver_data = NULL; 973 link->in_ep->driver_data = NULL;
972 link->in = NULL; 974 link->in_ep->desc = NULL;
973 975
974 usb_ep_disable(link->out_ep); 976 usb_ep_disable(link->out_ep);
975 spin_lock(&dev->req_lock); 977 spin_lock(&dev->req_lock);
@@ -984,7 +986,7 @@ void gether_disconnect(struct gether *link)
984 } 986 }
985 spin_unlock(&dev->req_lock); 987 spin_unlock(&dev->req_lock);
986 link->out_ep->driver_data = NULL; 988 link->out_ep->driver_data = NULL;
987 link->out = NULL; 989 link->out_ep->desc = NULL;
988 990
989 /* finish forgetting about this USB link episode */ 991 /* finish forgetting about this USB link episode */
990 dev->header_len = 0; 992 dev->header_len = 0;