Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a91c0ba8 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: usbnet: Add mechanism to throttle usb0 RX traffic in USB SS"

parents fb82ed65 6da027eb
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -1698,7 +1698,7 @@ static const struct driver_info ax88179_info = {
	.link_reset = ax88179_link_reset,
	.reset = ax88179_reset,
	.stop = ax88179_stop,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP | FLAG_THROTTLE_RX,
	.rx_fixup = ax88179_rx_fixup,
	.tx_fixup = ax88179_tx_fixup,
};
@@ -1711,7 +1711,7 @@ static const struct driver_info ax88178a_info = {
	.link_reset = ax88179_link_reset,
	.reset = ax88179_reset,
	.stop = ax88179_stop,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP | FLAG_THROTTLE_RX,
	.rx_fixup = ax88179_rx_fixup,
	.tx_fixup = ax88179_tx_fixup,
};
@@ -1724,7 +1724,7 @@ static const struct driver_info cypress_GX3_info = {
	.link_reset = ax88179_link_reset,
	.reset = ax88179_reset,
	.stop = ax88179_stop,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP | FLAG_THROTTLE_RX,
	.rx_fixup = ax88179_rx_fixup,
	.tx_fixup = ax88179_tx_fixup,
};
@@ -1737,7 +1737,7 @@ static const struct driver_info dlink_dub1312_info = {
	.link_reset = ax88179_link_reset,
	.reset = ax88179_reset,
	.stop = ax88179_stop,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP | FLAG_THROTTLE_RX,
	.rx_fixup = ax88179_rx_fixup,
	.tx_fixup = ax88179_tx_fixup,
};
@@ -1750,7 +1750,7 @@ static const struct driver_info sitecom_info = {
	.link_reset = ax88179_link_reset,
	.reset = ax88179_reset,
	.stop = ax88179_stop,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP | FLAG_THROTTLE_RX,
	.rx_fixup = ax88179_rx_fixup,
	.tx_fixup = ax88179_tx_fixup,
};
@@ -1763,7 +1763,7 @@ static const struct driver_info samsung_info = {
	.link_reset = ax88179_link_reset,
	.reset = ax88179_reset,
	.stop = ax88179_stop,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP | FLAG_THROTTLE_RX,
	.rx_fixup = ax88179_rx_fixup,
	.tx_fixup = ax88179_tx_fixup,
};
@@ -1776,7 +1776,7 @@ static const struct driver_info lenovo_info = {
	.link_reset = ax88179_link_reset,
	.reset = ax88179_reset,
	.stop = ax88179_stop,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
	.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP | FLAG_THROTTLE_RX,
	.rx_fixup = ax88179_rx_fixup,
	.tx_fixup = ax88179_tx_fixup,
};
@@ -1789,7 +1789,7 @@ static const struct driver_info belkin_info = {
	.link_reset = ax88179_link_reset,
	.reset	= ax88179_reset,
	.stop	= ax88179_stop,
	.flags	= FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
	.flags	= FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP | FLAG_THROTTLE_RX,
	.rx_fixup = ax88179_rx_fixup,
	.tx_fixup = ax88179_tx_fixup,
};
+11 −3
Original line number Diff line number Diff line
@@ -75,6 +75,10 @@ static int msg_level = -1;
module_param (msg_level, int, 0);
MODULE_PARM_DESC (msg_level, "Override default message level");

static int usb0_rx_skb_threshold = 500;
module_param(usb0_rx_skb_threshold, int, 0644);
MODULE_PARM_DESC(usb0_rx_skb_threshold, "Throttle rx traffic in USB3");

/*-------------------------------------------------------------------------*/

/* handles CDC Ethernet and many other network "bulk data" interfaces */
@@ -654,10 +658,14 @@ static void rx_complete (struct urb *urb)
		if (netif_running (dev->net) &&
		    !test_bit (EVENT_RX_HALT, &dev->flags) &&
		    state != unlink_start) {
			if ((!(dev->driver_info->flags & FLAG_THROTTLE_RX)) ||
				((dev->driver_info->flags & FLAG_THROTTLE_RX) &&
				(dev->done.qlen < usb0_rx_skb_threshold))) {
				rx_submit(dev, urb, GFP_ATOMIC);
				usb_mark_last_busy(dev->udev);
				return;
			}
		}
		usb_free_urb (urb);
	}
	netif_dbg(dev, rx_err, dev->net, "no read resubmitted\n");
+1 −0
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ struct driver_info {
#define FLAG_MULTI_PACKET	0x2000
#define FLAG_RX_ASSEMBLE	0x4000	/* rx packets may span >1 frames */
#define FLAG_NOARP		0x8000	/* device can't do ARP */
#define FLAG_THROTTLE_RX	0x10000 /* Throttle RX traffic in USB SS */

	/* init device ... can sleep, or cause probe() failure */
	int	(*bind)(struct usbnet *, struct usb_interface *);