aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/asix_devices.c
diff options
context:
space:
mode:
authorLucas Stach <dev@lynxeye.de>2013-01-15 23:24:07 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-18 14:13:29 -0500
commit8b5b6f5413e97c3e8bafcdd67553d508f4f698cd (patch)
treefb90f82d9232e927f0656f3cb9cb0226e030c31c /drivers/net/usb/asix_devices.c
parent5620df65d81292c5fb1beba8d380ef58cd98b53f (diff)
net: asix: handle packets crossing URB boundaries
ASIX AX88772B started to pack data even more tightly. Packets and the ASIX packet header may now cross URB boundaries. To handle this we have to introduce some state between individual calls to asix_rx_fixup(). Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/asix_devices.c')
-rw-r--r--drivers/net/usb/asix_devices.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 0ecc3bc6c3d7..37de7db56d63 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -495,9 +495,19 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
495 dev->rx_urb_size = 2048; 495 dev->rx_urb_size = 2048;
496 } 496 }
497 497
498 dev->driver_priv = kzalloc(sizeof(struct asix_common_private), GFP_KERNEL);
499 if (!dev->driver_priv)
500 return -ENOMEM;
501
498 return 0; 502 return 0;
499} 503}
500 504
505void ax88772_unbind(struct usbnet *dev, struct usb_interface *intf)
506{
507 if (dev->driver_priv)
508 kfree(dev->driver_priv);
509}
510
501static const struct ethtool_ops ax88178_ethtool_ops = { 511static const struct ethtool_ops ax88178_ethtool_ops = {
502 .get_drvinfo = asix_get_drvinfo, 512 .get_drvinfo = asix_get_drvinfo,
503 .get_link = asix_get_link, 513 .get_link = asix_get_link,
@@ -829,6 +839,10 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
829 dev->rx_urb_size = 2048; 839 dev->rx_urb_size = 2048;
830 } 840 }
831 841
842 dev->driver_priv = kzalloc(sizeof(struct asix_common_private), GFP_KERNEL);
843 if (!dev->driver_priv)
844 return -ENOMEM;
845
832 return 0; 846 return 0;
833} 847}
834 848
@@ -875,23 +889,25 @@ static const struct driver_info hawking_uf200_info = {
875static const struct driver_info ax88772_info = { 889static const struct driver_info ax88772_info = {
876 .description = "ASIX AX88772 USB 2.0 Ethernet", 890 .description = "ASIX AX88772 USB 2.0 Ethernet",
877 .bind = ax88772_bind, 891 .bind = ax88772_bind,
892 .unbind = ax88772_unbind,
878 .status = asix_status, 893 .status = asix_status,
879 .link_reset = ax88772_link_reset, 894 .link_reset = ax88772_link_reset,
880 .reset = ax88772_reset, 895 .reset = ax88772_reset,
881 .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR | FLAG_MULTI_PACKET, 896 .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR | FLAG_MULTI_PACKET,
882 .rx_fixup = asix_rx_fixup, 897 .rx_fixup = asix_rx_fixup_common,
883 .tx_fixup = asix_tx_fixup, 898 .tx_fixup = asix_tx_fixup,
884}; 899};
885 900
886static const struct driver_info ax88772b_info = { 901static const struct driver_info ax88772b_info = {
887 .description = "ASIX AX88772B USB 2.0 Ethernet", 902 .description = "ASIX AX88772B USB 2.0 Ethernet",
888 .bind = ax88772_bind, 903 .bind = ax88772_bind,
904 .unbind = ax88772_unbind,
889 .status = asix_status, 905 .status = asix_status,
890 .link_reset = ax88772_link_reset, 906 .link_reset = ax88772_link_reset,
891 .reset = ax88772_reset, 907 .reset = ax88772_reset,
892 .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR | 908 .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR |
893 FLAG_MULTI_PACKET, 909 FLAG_MULTI_PACKET,
894 .rx_fixup = asix_rx_fixup, 910 .rx_fixup = asix_rx_fixup_common,
895 .tx_fixup = asix_tx_fixup, 911 .tx_fixup = asix_tx_fixup,
896 .data = FLAG_EEPROM_MAC, 912 .data = FLAG_EEPROM_MAC,
897}; 913};
@@ -899,11 +915,12 @@ static const struct driver_info ax88772b_info = {
899static const struct driver_info ax88178_info = { 915static const struct driver_info ax88178_info = {
900 .description = "ASIX AX88178 USB 2.0 Ethernet", 916 .description = "ASIX AX88178 USB 2.0 Ethernet",
901 .bind = ax88178_bind, 917 .bind = ax88178_bind,
918 .unbind = ax88772_unbind,
902 .status = asix_status, 919 .status = asix_status,
903 .link_reset = ax88178_link_reset, 920 .link_reset = ax88178_link_reset,
904 .reset = ax88178_reset, 921 .reset = ax88178_reset,
905 .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR, 922 .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR,
906 .rx_fixup = asix_rx_fixup, 923 .rx_fixup = asix_rx_fixup_common,
907 .tx_fixup = asix_tx_fixup, 924 .tx_fixup = asix_tx_fixup,
908}; 925};
909 926