Skip to content

Commit

Permalink
sky2: check drop truncated packets
Browse files Browse the repository at this point in the history
If packet larger than MTU is received, the driver uses hardware to
truncate the packet. Use the status registers to catch/drop them.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Stephen Hemminger authored and Jeff Garzik committed Jul 10, 2007
1 parent f4331a6 commit 7174953
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/net/sky2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2109,6 +2109,9 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
if (!(status & GMR_FS_RX_OK))
goto resubmit;

if (status >> 16 != length)
goto len_mismatch;

if (length < copybreak)
skb = receive_copy(sky2, re, length);
else
Expand All @@ -2118,6 +2121,11 @@ static struct sk_buff *sky2_receive(struct net_device *dev,

return skb;

len_mismatch:
/* Truncation of overlength packets
causes PHY length to not match MAC length */
++sky2->net_stats.rx_length_errors;

error:
++sky2->net_stats.rx_errors;
if (status & GMR_FS_RX_FF_OV) {
Expand Down

0 comments on commit 7174953

Please sign in to comment.