diff mbox

cdc-ether: clean packet filter upon probe

Message ID 1406202989-8047-1-git-send-email-oneukum@suse.de
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Oliver Neukum July 24, 2014, 11:56 a.m. UTC
There are devices that don't do reset all the way. So the packet filter should
be set to a sane initial value. Failure to do so leads to intermittent failures
of DHCP on some systems under some conditions.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
---
 drivers/net/usb/cdc_ether.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

David Miller July 28, 2014, 5:30 a.m. UTC | #1
From: Oliver Neukum <oneukum@suse.de>
Date: Thu, 24 Jul 2014 13:56:29 +0200

> +			1000 /* out of thin air */

Just use USB_CTRL_SET_TIMEOUT if you can't come up with a specific
reason to use another value.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Oliver Neukum July 28, 2014, 9:22 a.m. UTC | #2
On Sun, 2014-07-27 at 22:30 -0700, David Miller wrote:
> From: Oliver Neukum <oneukum@suse.de>
> Date: Thu, 24 Jul 2014 13:56:29 +0200
> 
> > +			1000 /* out of thin air */
> 
> Just use USB_CTRL_SET_TIMEOUT if you can't come up with a specific
> reason to use another value.
> 
> Thanks.

Certainly

	Sorry
		Oliver


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 9ea4bfe..ef8f8f8 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -341,6 +341,22 @@  next_desc:
 		usb_driver_release_interface(driver, info->data);
 		return -ENODEV;
 	}
+
+	/* Some devices don't initialise properly. In particular
+	 * the packet filter is not reset. There are devices that
+	 * don't do reset all the way. So the packet filter should
+	 * be set to a sane initial value.
+	 */
+	usb_control_msg(dev->udev,
+			usb_sndctrlpipe(dev->udev, 0),
+			USB_CDC_SET_ETHERNET_PACKET_FILTER,
+			USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+			USB_CDC_PACKET_TYPE_ALL_MULTICAST | USB_CDC_PACKET_TYPE_DIRECTED | USB_CDC_PACKET_TYPE_BROADCAST,
+			intf->cur_altsetting->desc.bInterfaceNumber,
+			NULL,
+			0,
+			1000 /* out of thin air */
+		);
 	return 0;
 
 bad_desc: