net: asix: don't pad odd-length TX packets
authorStephen Warren <swarren@nvidia.com>
Thu, 27 Feb 2014 20:27:02 +0000 (13:27 -0700)
committerTom Rini <trini@ti.com>
Fri, 7 Mar 2014 15:59:06 +0000 (10:59 -0500)
For Ethernet/USB RX packets, the ASIX HW pads odd-sized packets so that
they have an even size. Currently, asix_recv() does remove this padding,
and asic_send() adds equivalent padding in the TX path. However, the HW
does not appear to need this packing for TX packets in practical testing
with "ASIX Elec. Corp. AX88x72A 000001" Vendor: 0x0b95 Product 0x7720
Version 0.1. The Linux kernel does no such padding for the TX path.

Remove the padding from the TX path:

* For consistency with the Linux kernel.
* NVIDIA has a Tegra simulator which validates that the length of USB
  packets sent to an ASIX device matches the packet length value inside
  the packet data. Having U-Boot and the kernel do the same thing when
  creating the TX packets simplifies the simulator's validation.

Cc: Lucas Stach <dev@lynxeye.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
Tested-by: Marek Vasut <marex@denx.de>
Tested-by: Gerhard Sittig <gsi@denx.de>
drivers/usb/eth/asix.c

index 659533a8d4e45b7f0cf9f57ce93c1c0d252c86e3..ce133f00698de8ef6346604079c202f07e1534ba 100644 (file)
@@ -468,8 +468,6 @@ static int asix_send(struct eth_device *eth, void *packet, int length)
 
        memcpy(msg, &packet_len, sizeof(packet_len));
        memcpy(msg + sizeof(packet_len), (void *)packet, length);
-       if (length & 1)
-               length++;
 
        err = usb_bulk_msg(dev->pusb_dev,
                                usb_sndbulkpipe(dev->pusb_dev, dev->ep_out),