All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] asix: Fix support for C1 DUB-E100
@ 2013-12-11 10:50 Dean Jenkins
  2013-12-11 10:50 ` [PATCH 1/4] asix: Rename remaining and size for clarity Dean Jenkins
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Dean Jenkins @ 2013-12-11 10:50 UTC (permalink / raw)
  To: netdev, davem

A simple ping test shows that support for the C1 DUB-E100 is broken.

ping -c 200 -s 1965 -f 172.17.0.10

The -s 1965 forces the USB Ethernet adaptor to use a worse case 2049 octet
bulk transfer due to the transfer containing 2 Ethernet frames. Unfortunately
the URB buffer is 2048 bytes long so the last byte of the 2nd Ethernet frame
is lost.

The missing byte causes a "Bad Header" error message to be generated during 
the processing of the next socket buffer. However, the truncated frame has 1
byte erroneously appended from the next socket buffer and this now corrupted
RX frame is passed up to the network layer. Worse, the next socket buffer is
discarded with the probable loss of a good Ethernet frame.

The patchset consists of the following 4 patches which should apply cleanly
to the net-next git repo baseline at 5824d2d:

Dean Jenkins (4):
      asix: Rename remaining and size for clarity
      asix: Tidy-up asix_rx_fixup_internal() logic
      asix: On RX avoid creating bad Ethernet frames
      asix: C1 DUB-E100 double rx_urb_size to 4096

 drivers/net/usb/asix.h         |    2 +-
 drivers/net/usb/asix_common.c  |  104 ++++++++++++++++++++++++----------------
 drivers/net/usb/asix_devices.c |    5 +-
 3 files changed, 69 insertions(+), 42 deletions(-)

Summary of patches:

1. asix: Rename remaining and size for clarity

This patch effectively swaps the variables "remaining" and "size" to make the
code more understandable. A new local variable "copy_length" is added as the
transfer length from the socket buffer to the netdev buffer.

2. asix: Tidy-up asix_rx_fixup_internal() logic

This patch does a tidy-up of the asix_rx_fixup_internal() logic to remove
redundant logic. The tidy-up improves the implementation of the logic but
does not "fix" a logic flaw. In other words, the original code has redundant
logic.

3. asix: On RX avoid creating bad Ethernet frames

This patch prevents creation of a bad Ethernet frame in the netdev buffer
when the "Bad Header" error handling is triggered. The netdev buffer is
discarded to prevent consumption of the bad Ethernet frame. Also the current
socket buffer is not discarded so the next Ethernet frame can be processed.

Add a new error message to indicate a loss of synchronisation of the 32-bit
Data header word.

4. asix: C1 DUB-E100 double rx_urb_size to 4096

This patch prevents the truncation of the URB when the bulk transfer
contains 2 Ethernet frames by using a 4096 byte RX URB. In other words,
the 2048 URB size was too small.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-12-11 16:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-11 10:50 [PATCH 0/4] asix: Fix support for C1 DUB-E100 Dean Jenkins
2013-12-11 10:50 ` [PATCH 1/4] asix: Rename remaining and size for clarity Dean Jenkins
2013-12-11 10:50 ` [PATCH 2/4] asix: Tidy-up asix_rx_fixup_internal() logic Dean Jenkins
2013-12-11 10:50 ` [PATCH 3/4] asix: On RX avoid creating bad Ethernet frames Dean Jenkins
2013-12-11 10:50 ` [PATCH 4/4] asix: C1 DUB-E100 double rx_urb_size to 4096 Dean Jenkins
2013-12-11 11:30   ` David Laight
2013-12-11 12:28     ` Dean Jenkins
2013-12-11 12:45       ` David Laight
2013-12-11 15:13     ` Eric Dumazet
2013-12-11 16:28       ` David Laight

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.