3C509: rx_bytes should not be increased when alloc_skb failed
Subsystems (2)
PATCH 1/2 3C509: rx_bytes should not be increased when alloc_skb failed
If alloc_skb failed, the recieved packet will be dropped. Do not increase rx_bytes for dropped packet.
Signed-off-by Wang Chen <[email protected]>
--- drivers/net/3c509.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/3c509.c +1 -1
@@ -1063,7 +1063,6 @@ el3_rx(struct net_device *dev)struct sk_buff *skb; skb =dev_alloc_skb (pkt_len+5 ); - dev->stats.rx_bytes += pkt_len;if (el3_debug >4 )printk ("Receiving packet size %d status %4.4x.\n" , pkt_len, rx_status);
@@ -1078,6 +1077,7 @@ el3_rx(struct net_device *dev) skb->protocol =eth_type_trans (skb,dev);netif_rx (skb); dev->last_rx = jiffies; + dev->stats.rx_bytes += pkt_len; dev->stats.rx_packets++;continue ; }
Signature · 1 line
1.5.3.4
PATCH 2/2 ibmveth: make sure skb is not null
There is no assurance to guarantee ibmveth_rxq_get_buffer won't return a NULL. So add an assertion here.
No device, not tested.
Signed-off-by Wang Chen <[email protected]>
--- drivers/net/ibmveth.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/ibmveth.c +1 -0
@@ -945,6 +945,7 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)int csum_good =ibmveth_rxq_csum_good (adapter); skb =ibmveth_rxq_get_buffer (adapter); +ibmveth_assert (skb !=NULL );if (csum_good) skb->ip_summed =CHECKSUM_UNNECESSARY ;
Signature · 1 line
1.5.3.4
Jeff Garzik
AppliedQuoted 21 lines · Wang Chen
If
alloc_skbfailed, the recieved packet will be dropped. Do not increaserx_bytesfor dropped packet.Signed-off-by Wang Chen <[email protected]>--- drivers/net/3c509.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/net/3c509.c +0
-1@@ -1063,7 +1063,6 @@ el3_rx(struct net_device *dev)struct sk_buff *skb; skb =dev_alloc_skb (pkt_len+5 ); - dev->stats.rx_bytes += pkt_len;if (el3_debug >4 )printk ("Receiving packet size %d status %4.4x.\n" , pkt_len, rx_status);
drivers/net/3c509.c el3_rx(struct net_device *dev) · line 1082
Quoted 6 lines
drivers/net/3c509.c +1
-0@@ -1078,6 +1077,7 @@ el3_rx(struct net_device *dev) skb->protocol =eth_type_trans (skb,dev);netif_rx (skb); dev->last_rx = jiffies; + dev->stats.rx_bytes += pkt_len; dev->stats.rx_packets++;continue ;
applied