net: usb: pegasus: Do not drop long Ethernet frames
Subsystems (5)
PATCH 1/1 net: usb: pegasus: Do not drop long Ethernet frames
The D-Link DSB-650TX (2001:4002) is unable to receive Ethernet frames that are longer than 1518 octets, for example, Ethernet frames that contain 802.1Q VLAN tags.
The frames are sent to the pegasus driver via USB but the driver discards them because they have the Long_pkt field set to 1 in the received status report. The function read_bulk_callback of the pegasus driver treats such received "packets" (in the terminology of the hardware) as errors but the field simply does just indicate that the Ethernet frame (MAC destination to FCS) is longer than 1518 octets.
It seems that in the 1990s there was a distinction between "giant" (> 1518) and "runt" (< 64) frames and the hardware includes flags to indicate this distinction. It seems that the purpose of the distinction "giant" frames was to not allow infinitely long frames due to transmission errors and to allow hardware to have an upper limit of the frame size. However, the hardware already has such limit with its 2048 octet receive buffer and, therefore, Long_pkt is merely a convention and should not be treated as a receive error.
Actually, the hardware is even able to receive Ethernet frames with 2048 octets which exceeds the claimed limit frame size limit of the driver of 1536 octets (PEGASUS_MTU).
--- drivers/net/usb/pegasus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/usb/pegasus.c +2 -2
@@ -499,11 +499,11 @@ static void read_bulk_callback(struct urb *urb) goto goon; rx_status = buf[count -2 ]; -if (rx_status &0x1e ) { +if (rx_status &0x1c ) {netif_dbg (pegasus, rx_err, net,"RX packet error %x\n" , rx_status); net->stats.rx_errors++; -if (rx_status &0x06 )/* long or runt */ +if (rx_status &0x04 )/* runt */ net->stats.rx_length_errors++;if (rx_status &0x08 ) net->stats.rx_crc_errors++;
Signature · 1 line
2.30.2
Quoted 34 lines · Matthias-Christian Ott
The D-Link DSB-650TX (2001:4002) is unable to receive Ethernet frames that are longer than 1518 octets, for example, Ethernet frames that contain 802.1Q VLAN tags.
The frames are sent to the pegasus driver via USB but the driver discards them because they have the
Long_pktfield set to 1 in the received status report. The functionread_bulk_callbackof the pegasus driver treats such received "packets" (in the terminology of the hardware) as errors but the field simply does just indicate that the Ethernet frame (MAC destination to FCS) is longer than 1518 octets.It seems that in the 1990s there was a distinction between "giant" (> 1518) and "runt" (< 64) frames and the hardware includes flags to indicate this distinction. It seems that the purpose of the distinction "giant" frames was to not allow infinitely long frames due to transmission errors and to allow hardware to have an upper limit of the frame size. However, the hardware already has such limit with its 2048 octet receive buffer and, therefore,
Long_pktis merely a convention and should not be treated as a receive error.Actually, the hardware is even able to receive Ethernet frames with 2048 octets which exceeds the claimed limit frame size limit of the driver of 1536 octets (
PEGASUS_MTU).Signed-off-by Matthias-Christian Ott <[email protected]>--- drivers/net/usb/pegasus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/usb/pegasus.c +0
-0
drivers/net/usb/pegasus.c static void read_bulk_callback(struct urb *urb) · line 506
Quoted 10 lines
drivers/net/usb/pegasus.c +2
-2@@ -499,11 +499,11 @@ static void read_bulk_callback(struct urb *urb) goto goon; rx_status = buf[count -2 ]; -if (rx_status &0x1e ) { +if (rx_status &0x1c ) {netif_dbg (pegasus, rx_err, net,"RX packet error %x\n" , rx_status); net->stats.rx_errors++; -if (rx_status &0x06 )/* long or runt */ +if (rx_status &0x04 )/* runt */
I've nothing against this patch, but if you are working on the driver, it would be nice to replace these hex numbers with #defines using BIT, or FIELD. It will make the code more readable.
Andrew
Quoted 37 lines · Andrew Lunn
Quoted 36 lines · Matthias-Christian Ott
The D-Link DSB-650TX (2001:4002) is unable to receive Ethernet frames that are longer than 1518 octets, for example, Ethernet frames that contain 802.1Q VLAN tags.
The frames are sent to the pegasus driver via USB but the driver discards them because they have the
Long_pktfield set to 1 in the received status report. The functionread_bulk_callbackof the pegasus driver treats such received "packets" (in the terminology of the hardware) as errors but the field simply does just indicate that the Ethernet frame (MAC destination to FCS) is longer than 1518 octets.It seems that in the 1990s there was a distinction between "giant" (> 1518) and "runt" (< 64) frames and the hardware includes flags to indicate this distinction. It seems that the purpose of the distinction "giant" frames was to not allow infinitely long frames due to transmission errors and to allow hardware to have an upper limit of the frame size. However, the hardware already has such limit with its 2048 octet receive buffer and, therefore,
Long_pktis merely a convention and should not be treated as a receive error.Actually, the hardware is even able to receive Ethernet frames with 2048 octets which exceeds the claimed limit frame size limit of the driver of 1536 octets (
PEGASUS_MTU).Signed-off-by Matthias-Christian Ott <[email protected]>--- drivers/net/usb/pegasus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/usb/pegasus.c +0
-0@@ -499,11 +499,11 @@ static void read_bulk_callback(struct urb *urb) goto goon;
Quoted 12 lines
drivers/net/usb/pegasus.c static void read_bulk_callback(struct urb *urb) · line 506
Quoted 8 lines
drivers/net/usb/pegasus.c +2
-2rx_status = buf[count -2 ]; -if (rx_status &0x1e ) { +if (rx_status &0x1c ) {netif_dbg (pegasus, rx_err, net,"RX packet error %x\n" , rx_status); net->stats.rx_errors++; -if (rx_status &0x06 )/* long or runt */ +if (rx_status &0x04 )/* runt */ I've nothing against this patch, but if you are working on the driver, it would be nice to replace these hex numbers with #defines using BIT, or FIELD. It will make the code more readable.
Replacing the constants with macros is on my list of things that I want to do. In this case, I did not do it because I wanted to a have small patch that gets easily accepted and allows me to figure out the current process to submit patches after years of inactivity.
Kind regards,
Matthias-Christian Ott
Quoted 8 lines
Quoted 3 lines
I've nothing against this patch, but if you are working on the driver, it would be nice to replace these hex numbers with #defines using BIT, or FIELD. It will make the code more readable.
Replacing the constants with macros is on my list of things that I want to do. In this case, I did not do it because I wanted to a have small patch that gets easily accepted and allows me to figure out the current process to submit patches after years of inactivity.
Agreed, keep fixes simple.
A few other hints. If you consider this a fix which should be back ported, please add a Fixes: tag, where the issue started. This can be back as far as the first commit for the driver. Fixes should also be sent to the net tree, not net-next. See the netdev FAQ about the two different trees.
Andrew
Quoted 9 lines · Andrew Lunn
Quoted 8 lines
Quoted 3 lines
I've nothing against this patch, but if you are working on the driver, it would be nice to replace these hex numbers with #defines using BIT, or FIELD. It will make the code more readable.
Replacing the constants with macros is on my list of things that I want to do. In this case, I did not do it because I wanted to a have small patch that gets easily accepted and allows me to figure out the current process to submit patches after years of inactivity.
Quoted 7 lines
Agreed, keep fixes simple.
A few other hints. If you consider this a fix which should be back ported, please add a Fixes: tag, where the issue started. This can be back as far as the first commit for the driver. Fixes should also be sent to the net tree, not net-next. See the netdev FAQ about the two different trees.
I made a v2 of the patch and also added the prefix flag to indicate that the patch is destined for the "next" tree. There is still something that can be improved a about it, please let me know. Otherwise, I will also resend the other patch that I sent for the driver to indicate that it is destined for the "next" tree.
Kind regards,
Matthias-Christian Ott
Petko Manolov
maintainerQuoted 51 lines · Matthias-Christian Ott
Quoted 37 lines · Andrew Lunn
Quoted 36 lines · Matthias-Christian Ott
The D-Link DSB-650TX (2001:4002) is unable to receive Ethernet frames that are longer than 1518 octets, for example, Ethernet frames that contain 802.1Q VLAN tags.
The frames are sent to the pegasus driver via USB but the driver discards them because they have the
Long_pktfield set to 1 in the received status report. The functionread_bulk_callbackof the pegasus driver treats such received "packets" (in the terminology of the hardware) as errors but the field simply does just indicate that the Ethernet frame (MAC destination to FCS) is longer than 1518 octets.It seems that in the 1990s there was a distinction between "giant" (> 1518) and "runt" (< 64) frames and the hardware includes flags to indicate this distinction. It seems that the purpose of the distinction "giant" frames was to not allow infinitely long frames due to transmission errors and to allow hardware to have an upper limit of the frame size. However, the hardware already has such limit with its 2048 octet receive buffer and, therefore,
Long_pktis merely a convention and should not be treated as a receive error.Actually, the hardware is even able to receive Ethernet frames with 2048 octets which exceeds the claimed limit frame size limit of the driver of 1536 octets (
PEGASUS_MTU).Signed-off-by Matthias-Christian Ott <[email protected]>--- drivers/net/usb/pegasus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/usb/pegasus.c +0
-0@@ -499,11 +499,11 @@ static void read_bulk_callback(struct urb *urb) goto goon;Quoted 12 lines
drivers/net/usb/pegasus.c static void read_bulk_callback(struct urb *urb) · line 506
Quoted 8 lines
drivers/net/usb/pegasus.c +2
-2rx_status = buf[count -2 ]; -if (rx_status &0x1e ) { +if (rx_status &0x1c ) {netif_dbg (pegasus, rx_err, net,"RX packet error %x\n" , rx_status); net->stats.rx_errors++; -if (rx_status &0x06 )/* long or runt */ +if (rx_status &0x04 )/* runt */ I've nothing against this patch, but if you are working on the driver, it would be nice to replace these hex numbers with #defines using BIT, or FIELD. It will make the code more readable.
Quoted 4 lines
Replacing the constants with macros is on my list of things that I want to do. In this case, I did not do it because I wanted to a have small patch that gets easily accepted and allows me to figure out the current process to submit patches after years of inactivity.
To be honest, that's due to the fact the original code was submitted more than 20 years ago, when the driver acceptance criteria were a lot more relaxed than they are now. Ideally, these constants should be replaced with human readable macros, something which i never got around doing.
If you are in the mood, you could send two patch series, one that fixes the constants and another that fixes the packet size bug. As is often the case, one of them may get mainlined right away, while the other is being debated for a while.
cheers,
Petko
Hello!
Quoted 20 lines · Matthias-Christian Ott
The D-Link DSB-650TX (2001:4002) is unable to receive Ethernet frames that are longer than 1518 octets, for example, Ethernet frames that contain 802.1Q VLAN tags.
The frames are sent to the pegasus driver via USB but the driver discards them because they have the
Long_pktfield set to 1 in the received status report. The functionread_bulk_callbackof the pegasus driver treats such received "packets" (in the terminology of the hardware) as errors but the field simply does just indicate that the Ethernet frame (MAC destination to FCS) is longer than 1518 octets.It seems that in the 1990s there was a distinction between "giant" (> 1518) and "runt" (< 64) frames and the hardware includes flags to indicate this distinction. It seems that the purpose of the distinction "giant" frames was to not allow infinitely long frames due to transmission errors and to allow hardware to have an upper limit of the frame size. However, the hardware already has such limit with its 2048 octet receive buffer and, therefore,
Long_pktis merely a convention and should not be treated as a receive error.
Quoted 2 lines
Actually, the hardware is even able to receive Ethernet frames with 2048 octets which exceeds the claimed limit frame size limit of the driver of
^^^^^ ^^^^^
Too many limits. :-)
Quoted 3 lines
1536 octets (
PEGASUS_MTU).Signed-off-by Matthias-Christian Ott <[email protected]>
[...]
MBR, Sergey
Quoted 4 lines · Sergei Shtylyov
Quoted 2 lines
Actually, the hardware is even able to receive Ethernet frames with 2048 octets which exceeds the claimed limit frame size limit of the driver of
^^^^^ ^^^^^ Too many limits. :-)
Thank you for pointing this out. Indeed, this sentence does make sense. :) Unfortunately, the patch was already merged and it seems that I can't change its commit message anymore. Nonetheless, thank you for reviewing it.
Kind regards,
Matthias-Christian Ott