* [PATCH 1/2] 3C509: rx_bytes should not be increased when alloc_skb failed
@ 2008-05-20 9:13 Wang Chen
2008-05-20 9:23 ` [PATCH 2/2] ibmveth: make sure skb is not null Wang Chen
2008-05-22 18:02 ` [PATCH 1/2] 3C509: rx_bytes should not be increased when alloc_skb failed Jeff Garzik
0 siblings, 2 replies; 3+ messages in thread
From: Wang Chen @ 2008-05-20 9:13 UTC (permalink / raw)
To: becker, David S. Miller, Jeff Garzik, NETDEV
If alloc_skb failed, the recieved packet will be dropped. Do not increase
rx_bytes for dropped packet.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
drivers/net/3c509.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index e6c545f..fe6d841 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -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;
}
--
1.5.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] ibmveth: make sure skb is not null
2008-05-20 9:13 [PATCH 1/2] 3C509: rx_bytes should not be increased when alloc_skb failed Wang Chen
@ 2008-05-20 9:23 ` Wang Chen
2008-05-22 18:02 ` [PATCH 1/2] 3C509: rx_bytes should not be increased when alloc_skb failed Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Wang Chen @ 2008-05-20 9:23 UTC (permalink / raw)
To: santil, David S. Miller, Jeff Garzik, NETDEV
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 <wangchen@cn.fujitsu.com>
---
drivers/net/ibmveth.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 0052780..9d1523a 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -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;
--
1.5.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] 3C509: rx_bytes should not be increased when alloc_skb failed
2008-05-20 9:13 [PATCH 1/2] 3C509: rx_bytes should not be increased when alloc_skb failed Wang Chen
2008-05-20 9:23 ` [PATCH 2/2] ibmveth: make sure skb is not null Wang Chen
@ 2008-05-22 18:02 ` Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2008-05-22 18:02 UTC (permalink / raw)
To: Wang Chen; +Cc: becker, David S. Miller, NETDEV
Wang Chen wrote:
> If alloc_skb failed, the recieved packet will be dropped. Do not increase
> rx_bytes for dropped packet.
>
> Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
> ---
> drivers/net/3c509.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
> index e6c545f..fe6d841 100644
> --- a/drivers/net/3c509.c
> +++ b/drivers/net/3c509.c
> @@ -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;
applied
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-22 18:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-20 9:13 [PATCH 1/2] 3C509: rx_bytes should not be increased when alloc_skb failed Wang Chen
2008-05-20 9:23 ` [PATCH 2/2] ibmveth: make sure skb is not null Wang Chen
2008-05-22 18:02 ` [PATCH 1/2] 3C509: rx_bytes should not be increased when alloc_skb failed Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).