dm9601: improve support for dm962x based devices
Peter Korsgaard
maintainercover dm9601: improve support for dm962x based devices
This series contain a number of improvements/fixes for the USB 2.0 dm962x based devices. Two of them are bugfixes, so are also marked for stable.
Peter Korsgaard (4):
dm9601: add support for dm9621a based dongle
dm9601: fix reception of full size ethernet frames on dm9620/dm9621a
dm9601: make it clear that dm9620/dm9621a are also supported
dm9601: work around tx fifo sync issue on dm962x
drivers/net/usb/Kconfig | 6 +++--- drivers/net/usb/dm9601.c | 44 ++++++++++++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 15 deletions(-)
Signature · 1 line
1.8.5.1
Peter Korsgaard
maintainerPATCH 1/4 dm9601: add support for dm9621a based dongle
dm9621a is functionally identical to dm9620, so the existing handling can directly be used.
Thanks to Davicom for sending me a dongle.
--- drivers/net/usb/dm9601.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/usb/dm9601.c +4 -0
@@ -594,6 +594,10 @@ static const struct usb_device_id products[] = { USB_DEVICE(0x0a46, 0x9620), /* DM9620 USB to Fast Ethernet Adapter */ .driver_info = (unsigned long)&dm9601_info, }, + { + USB_DEVICE(0x0a46, 0x9621), /* DM9621A USB to Fast Ethernet Adapter */ + .driver_info = (unsigned long)&dm9601_info, + }, {}, // END };
Signature · 1 line
1.8.5.1
Re: [PATCH 1/4] dm9601: add support for dm9621a based dongle
From: Peter Korsgaard <[email protected]>
Date: Mon, 16 Dec 2013 11:35:32 +0100
Quoted 6 lines
dm9621a is functionally identical to dm9620, so the existing handling can directly be used.
Thanks to Davicom for sending me a dongle.
Signed-off-by Peter Korsgaard <[email protected]>
Applied.
Peter Korsgaard
maintainerPATCH 2/4 dm9601: fix reception of full size ethernet frames on dm9620/dm9621a
In reply to Peter Korsgaarddm9620/dm9621a require room for 4 byte padding even in dm9601 (3 byte header) mode.
--- drivers/net/usb/dm9601.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/usb/dm9601.c +6 -1
@@ -364,7 +364,12 @@ static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) dev->net->ethtool_ops = &dm9601_ethtool_ops; dev->net->hard_header_len +=DM_TX_OVERHEAD ; dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; - dev->rx_urb_size = dev->net->mtu +ETH_HLEN +DM_RX_OVERHEAD ; + +/* dm9620/21a require room for 4 byte padding, even in dm9601 +* mode, so we need +1 to be able to receive full size +* ethernet frames. +*/ + dev->rx_urb_size = dev->net->mtu +ETH_HLEN +DM_RX_OVERHEAD +1 ; dev->mii.dev = dev->net; dev->mii.mdio_read = dm9601_mdio_read;
Signature · 1 line
1.8.5.1
Re: [PATCH 2/4] dm9601: fix reception of full size ethernet frames on dm9620/dm9621a
From: Peter Korsgaard <[email protected]>
Date: Mon, 16 Dec 2013 11:35:33 +0100
Quoted 5 lines
dm9620/dm9621a require room for 4 byte padding even in dm9601 (3 byte header) mode.
Cc <[email protected]>Signed-off-by Peter Korsgaard <[email protected]>
Applied.
Peter Korsgaard
maintainerPATCH 3/4 dm9601: make it clear that dm9620/dm9621a are also supported
In reply to Peter KorsgaardThe driver nowadays also support dm9620/dm9621a based USB 2.0 ethernet adapters, so adjust module/driver description and Kconfig help text to match.
--- drivers/net/usb/Kconfig | 6 +++--- drivers/net/usb/dm9601.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/usb/Kconfig +3 -3
@@ -276,12 +276,12 @@ config USB_NET_CDC_MBIM module will be called cdc_mbim. config USB_NET_DM9601 - tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices" + tristate "Davicom DM96xx based USB 10/100 ethernet devices" depends on USB_USBNET select CRC32 help - This option adds support for Davicom DM9601 based USB 1.1 - 10/100 Ethernet adapters. + This option adds support for Davicom DM9601/DM9620/DM9621A + based USB 10/100 Ethernet adapters. config USB_NET_SR9700 tristate "CoreChip-sz SR9700 based USB 1.1 10/100 ethernet devices"
drivers/net/usb/dm9601.c +3 -3
@@ -1,5 +1,5 @@/* -* Davicom DM9601 USB 1.1 10/100Mbps ethernet devices +* Davicom DM96xx USB 10/100Mbps ethernet devices * * Peter Korsgaard <[email protected]> *
@@ -548,7 +548,7 @@ static int dm9601_link_reset(struct usbnet *dev) }static const struct driver_info dm9601_info = { - .description ="Davicom DM9601 USB Ethernet" , + .description ="Davicom DM96xx USB 10/100 Ethernet" , .flags =FLAG_ETHER |FLAG_LINK_INTR , .bind = dm9601_bind, .rx_fixup = dm9601_rx_fixup,
@@ -621,5 +621,5 @@ static struct usb_driver dm9601_driver = {module_usb_driver (dm9601_driver);MODULE_AUTHOR ("Peter Korsgaard <[email protected]>" ); -MODULE_DESCRIPTION ("Davicom DM9601 USB 1.1 ethernet devices" ); +MODULE_DESCRIPTION ("Davicom DM96xx USB 10/100 ethernet devices" );MODULE_LICENSE ("GPL" );
Signature · 1 line
1.8.5.1
Re: [PATCH 3/4] dm9601: make it clear that dm9620/dm9621a are also supported
From: Peter Korsgaard <[email protected]>
Date: Mon, 16 Dec 2013 11:35:34 +0100
Quoted 5 lines
The driver nowadays also support dm9620/dm9621a based USB 2.0 ethernet adapters, so adjust module/driver description and
Kconfighelp text to match.Signed-off-by Peter Korsgaard <[email protected]>
Applied.
Peter Korsgaard
maintainerPATCH 4/4 dm9601: work around tx fifo sync issue on dm962x
In reply to Peter KorsgaardCertain dm962x revisions contain an bug, where if a USB bulk transfer retry (E.G. if bulk crc mismatch) happens right after a transfer with odd or maxpacket length, the internal tx hardware fifo gets out of sync causing the interface to stop working.
Work around it by adding up to 3 bytes of padding to ensure this situation cannot trigger.
This workaround also means we never pass multiple-of-maxpacket size skb's to usbnet, so the length adjustment to handle usbnet's padding of those can be removed.
--- drivers/net/usb/dm9601.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
drivers/net/usb/dm9601.c +19 -8
@@ -473,7 +473,7 @@ static int dm9601_rx_fixup(struct usbnet *dev, struct sk_buff *skb)static struct sk_buff *dm9601_tx_fixup (struct usbnet *dev,struct sk_buff *skb,gfp_t flags) { -int len; +int len, pad;/* format: b1: packet length low
@@ -481,12 +481,23 @@ static struct sk_buff *dm9601_tx_fixup(struct usbnet *dev, struct sk_buff *skb,b3..n: packet data */ - len = skb->len; + len = skb->len +DM_TX_OVERHEAD ; + +/* workaround for dm962x errata with tx fifo getting out of +* sync if a USB bulk transfer retry happens right after a +* packet with odd / maxpacket length by adding up to 3 bytes +* padding. +*/ +while ((len &1 ) || !(len % dev->maxpacket)) + len++; -if (skb_headroom (skb) <DM_TX_OVERHEAD ) { + len -=DM_TX_OVERHEAD ;/* hw header doesn't count as part of length */ + pad = len - skb->len; + +if (skb_headroom (skb) <DM_TX_OVERHEAD ||skb_tailroom (skb) < pad) {struct sk_buff *skb2; - skb2 =skb_copy_expand (skb,DM_TX_OVERHEAD ,0 , flags); + skb2 =skb_copy_expand (skb,DM_TX_OVERHEAD , pad, flags);dev_kfree_skb_any (skb); skb = skb2;if (!skb)
@@ -495,10 +506,10 @@ static struct sk_buff *dm9601_tx_fixup(struct usbnet *dev, struct sk_buff *skb,__skb_push (skb,DM_TX_OVERHEAD ); -/* usbnet adds padding if length is a multiple of packet size -if so, adjust length value in header */ -if ((skb->len % dev->maxpacket) ==0 ) - len++; +if (pad) { +memset (skb->data + skb->len,0 , pad); +__skb_put (skb, pad); + } skb->data[0 ] = len; skb->data[1 ] = len >>8 ;
Signature · 1 line
1.8.5.1
Re: [PATCH 4/4] dm9601: work around tx fifo sync issue on dm962x
From: Peter Korsgaard <[email protected]>
Date: Mon, 16 Dec 2013 11:35:35 +0100
Quoted 8 lines
Certain dm962x revisions contain an bug, where if a USB bulk transfer retry (E.G. if bulk crc mismatch) happens right after a transfer with odd or maxpacket length, the internal tx hardware fifo gets out of sync causing the interface to stop working.
Work around it by adding up to 3 bytes of padding to ensure this situation cannot trigger.
Quoted 7 lines
This workaround also means we never pass multiple-of-maxpacket size skb's to usbnet, so the length adjustment to handle usbnet's padding of those can be removed.
Cc <[email protected]>Reported-by Joseph Chang <[email protected]>Signed-off-by Peter Korsgaard <[email protected]>
Applied.