diff options
-rw-r--r-- | drivers/net/greth.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/net/greth.c b/drivers/net/greth.c index 869e38d6f41..9386bce9dea 100644 --- a/drivers/net/greth.c +++ b/drivers/net/greth.c | |||
@@ -870,10 +870,9 @@ static int greth_rx_gbit(struct net_device *dev, int limit) | |||
870 | } | 870 | } |
871 | } | 871 | } |
872 | 872 | ||
873 | /* Allocate new skb to replace current */ | 873 | /* Allocate new skb to replace current, not needed if the |
874 | newskb = netdev_alloc_skb(dev, MAX_FRAME_SIZE + NET_IP_ALIGN); | 874 | * current skb can be reused */ |
875 | 875 | if (!bad && (newskb=netdev_alloc_skb(dev, MAX_FRAME_SIZE + NET_IP_ALIGN))) { | |
876 | if (!bad && newskb) { | ||
877 | skb_reserve(newskb, NET_IP_ALIGN); | 876 | skb_reserve(newskb, NET_IP_ALIGN); |
878 | 877 | ||
879 | dma_addr = dma_map_single(greth->dev, | 878 | dma_addr = dma_map_single(greth->dev, |
@@ -910,11 +909,22 @@ static int greth_rx_gbit(struct net_device *dev, int limit) | |||
910 | if (net_ratelimit()) | 909 | if (net_ratelimit()) |
911 | dev_warn(greth->dev, "Could not create DMA mapping, dropping packet\n"); | 910 | dev_warn(greth->dev, "Could not create DMA mapping, dropping packet\n"); |
912 | dev_kfree_skb(newskb); | 911 | dev_kfree_skb(newskb); |
912 | /* reusing current skb, so it is a drop */ | ||
913 | dev->stats.rx_dropped++; | 913 | dev->stats.rx_dropped++; |
914 | } | 914 | } |
915 | } else if (bad) { | ||
916 | /* Bad Frame transfer, the skb is reused */ | ||
917 | dev->stats.rx_dropped++; | ||
915 | } else { | 918 | } else { |
919 | /* Failed Allocating a new skb. This is rather stupid | ||
920 | * but the current "filled" skb is reused, as if | ||
921 | * transfer failure. One could argue that RX descriptor | ||
922 | * table handling should be divided into cleaning and | ||
923 | * filling as the TX part of the driver | ||
924 | */ | ||
916 | if (net_ratelimit()) | 925 | if (net_ratelimit()) |
917 | dev_warn(greth->dev, "Could not allocate SKB, dropping packet\n"); | 926 | dev_warn(greth->dev, "Could not allocate SKB, dropping packet\n"); |
927 | /* reusing current skb, so it is a drop */ | ||
918 | dev->stats.rx_dropped++; | 928 | dev->stats.rx_dropped++; |
919 | } | 929 | } |
920 | 930 | ||