|
@@ -63,6 +63,8 @@ struct eth_dev {
|
|
|
|
|
|
struct sk_buff_head rx_frames;
|
|
|
|
|
|
+ unsigned qmult;
|
|
|
+
|
|
|
unsigned header_len;
|
|
|
struct sk_buff *(*wrap)(struct gether *, struct sk_buff *skb);
|
|
|
int (*unwrap)(struct gether *,
|
|
@@ -84,12 +86,8 @@ struct eth_dev {
|
|
|
|
|
|
#define DEFAULT_QLEN 2 /* double buffering by default */
|
|
|
|
|
|
-static unsigned qmult = 5;
|
|
|
-module_param(qmult, uint, S_IRUGO|S_IWUSR);
|
|
|
-MODULE_PARM_DESC(qmult, "queue length multiplier at high/super speed");
|
|
|
-
|
|
|
/* for dual-speed hardware, use deeper queues at high/super speed */
|
|
|
-static inline int qlen(struct usb_gadget *gadget)
|
|
|
+static inline int qlen(struct usb_gadget *gadget, unsigned qmult)
|
|
|
{
|
|
|
if (gadget_is_dualspeed(gadget) && (gadget->speed == USB_SPEED_HIGH ||
|
|
|
gadget->speed == USB_SPEED_SUPER))
|
|
@@ -588,7 +586,7 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
|
|
|
if (gadget_is_dualspeed(dev->gadget))
|
|
|
req->no_interrupt = (dev->gadget->speed == USB_SPEED_HIGH ||
|
|
|
dev->gadget->speed == USB_SPEED_SUPER)
|
|
|
- ? ((atomic_read(&dev->tx_qlen) % qmult) != 0)
|
|
|
+ ? ((atomic_read(&dev->tx_qlen) % dev->qmult) != 0)
|
|
|
: 0;
|
|
|
|
|
|
retval = usb_ep_queue(in, req, GFP_ATOMIC);
|
|
@@ -697,16 +695,6 @@ static int eth_stop(struct net_device *net)
|
|
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
|
|
-/* initial value, changed by "ifconfig usb0 hw ether xx:xx:xx:xx:xx:xx" */
|
|
|
-static char *dev_addr;
|
|
|
-module_param(dev_addr, charp, S_IRUGO);
|
|
|
-MODULE_PARM_DESC(dev_addr, "Device Ethernet Address");
|
|
|
-
|
|
|
-/* this address is invisible to ifconfig */
|
|
|
-static char *host_addr;
|
|
|
-module_param(host_addr, charp, S_IRUGO);
|
|
|
-MODULE_PARM_DESC(host_addr, "Host Ethernet Address");
|
|
|
-
|
|
|
static int get_ether_addr(const char *str, u8 *dev_addr)
|
|
|
{
|
|
|
if (str) {
|
|
@@ -755,8 +743,9 @@ static struct device_type gadget_type = {
|
|
|
*
|
|
|
* Returns negative errno, or zero on success
|
|
|
*/
|
|
|
-struct eth_dev *gether_setup_name(struct usb_gadget *g, u8 ethaddr[ETH_ALEN],
|
|
|
- const char *netname)
|
|
|
+struct eth_dev *gether_setup_name(struct usb_gadget *g,
|
|
|
+ const char *dev_addr, const char *host_addr,
|
|
|
+ u8 ethaddr[ETH_ALEN], unsigned qmult, const char *netname)
|
|
|
{
|
|
|
struct eth_dev *dev;
|
|
|
struct net_device *net;
|
|
@@ -777,6 +766,7 @@ struct eth_dev *gether_setup_name(struct usb_gadget *g, u8 ethaddr[ETH_ALEN],
|
|
|
|
|
|
/* network device setup */
|
|
|
dev->net = net;
|
|
|
+ dev->qmult = qmult;
|
|
|
snprintf(net->name, sizeof(net->name), "%s%%d", netname);
|
|
|
|
|
|
if (get_ether_addr(dev_addr, net->dev_addr))
|
|
@@ -815,6 +805,7 @@ struct eth_dev *gether_setup_name(struct usb_gadget *g, u8 ethaddr[ETH_ALEN],
|
|
|
|
|
|
return dev;
|
|
|
}
|
|
|
+EXPORT_SYMBOL(gether_setup_name);
|
|
|
|
|
|
/**
|
|
|
* gether_cleanup - remove Ethernet-over-USB device
|
|
@@ -831,6 +822,7 @@ void gether_cleanup(struct eth_dev *dev)
|
|
|
flush_work(&dev->work);
|
|
|
free_netdev(dev->net);
|
|
|
}
|
|
|
+EXPORT_SYMBOL(gether_cleanup);
|
|
|
|
|
|
/**
|
|
|
* gether_connect - notify network layer that USB link is active
|
|
@@ -873,11 +865,12 @@ struct net_device *gether_connect(struct gether *link)
|
|
|
}
|
|
|
|
|
|
if (result == 0)
|
|
|
- result = alloc_requests(dev, link, qlen(dev->gadget));
|
|
|
+ result = alloc_requests(dev, link, qlen(dev->gadget,
|
|
|
+ dev->qmult));
|
|
|
|
|
|
if (result == 0) {
|
|
|
dev->zlp = link->is_zlp_ok;
|
|
|
- DBG(dev, "qlen %d\n", qlen(dev->gadget));
|
|
|
+ DBG(dev, "qlen %d\n", qlen(dev->gadget, dev->qmult));
|
|
|
|
|
|
dev->header_len = link->header_len;
|
|
|
dev->unwrap = link->unwrap;
|
|
@@ -910,6 +903,7 @@ fail0:
|
|
|
return ERR_PTR(result);
|
|
|
return dev->net;
|
|
|
}
|
|
|
+EXPORT_SYMBOL(gether_connect);
|
|
|
|
|
|
/**
|
|
|
* gether_disconnect - notify network layer that USB link is inactive
|
|
@@ -980,3 +974,7 @@ void gether_disconnect(struct gether *link)
|
|
|
dev->port_usb = NULL;
|
|
|
spin_unlock(&dev->lock);
|
|
|
}
|
|
|
+EXPORT_SYMBOL(gether_disconnect);
|
|
|
+
|
|
|
+MODULE_LICENSE("GPL");
|
|
|
+MODULE_AUTHOR("David Brownell");
|