aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-07-13 01:09:18 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-13 01:09:18 -0400
commit1e75896294d282ecd5b1717fcb3f6aa2908d5946 (patch)
treee4e886bf5852fde01f085af272cd280e37f0843a /drivers/net
parentc2fed9965c60e1f989f57889357c557f7b907ab7 (diff)
be2net: account for skb allocation failures
If we cannot allocate new skbs in RX completion handler, we should increase netdevice rx_dropped counter, not spam console messages. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/benet/be.h1
-rw-r--r--drivers/net/benet/be_ethtool.c1
-rw-r--r--drivers/net/benet/be_main.c4
3 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 9aa1534c7d88..72ec00f2d032 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -199,6 +199,7 @@ struct be_rx_stats {
199 u32 rx_polls; /* number of times NAPI called poll function */ 199 u32 rx_polls; /* number of times NAPI called poll function */
200 u32 rx_events; /* number of ucast rx completion events */ 200 u32 rx_events; /* number of ucast rx completion events */
201 u32 rx_compl; /* number of rx completion entries processed */ 201 u32 rx_compl; /* number of rx completion entries processed */
202 ulong rx_dropped; /* number of skb allocation errors */
202 ulong rx_jiffies; 203 ulong rx_jiffies;
203 u64 rx_bytes; 204 u64 rx_bytes;
204 u64 rx_bytes_prev; 205 u64 rx_bytes_prev;
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index 30c1386027f8..7fd8130d86ea 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -102,6 +102,7 @@ static const struct be_ethtool_stat et_rx_stats[] = {
102 {DRVSTAT_RX_INFO(rx_compl)}, 102 {DRVSTAT_RX_INFO(rx_compl)},
103 {DRVSTAT_RX_INFO(rx_mcast_pkts)}, 103 {DRVSTAT_RX_INFO(rx_mcast_pkts)},
104 {DRVSTAT_RX_INFO(rx_post_fail)}, 104 {DRVSTAT_RX_INFO(rx_post_fail)},
105 {DRVSTAT_RX_INFO(rx_dropped)},
105 {ERXSTAT_INFO(rx_drops_no_fragments)} 106 {ERXSTAT_INFO(rx_drops_no_fragments)}
106}; 107};
107#define ETHTOOL_RXSTATS_NUM (ARRAY_SIZE(et_rx_stats)) 108#define ETHTOOL_RXSTATS_NUM (ARRAY_SIZE(et_rx_stats))
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 4ebd7000b0cf..f7d6d9de6a01 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -431,6 +431,7 @@ void netdev_stats_update(struct be_adapter *adapter)
431 pkts += rx_stats(rxo)->rx_pkts; 431 pkts += rx_stats(rxo)->rx_pkts;
432 bytes += rx_stats(rxo)->rx_bytes; 432 bytes += rx_stats(rxo)->rx_bytes;
433 mcast += rx_stats(rxo)->rx_mcast_pkts; 433 mcast += rx_stats(rxo)->rx_mcast_pkts;
434 drops += rx_stats(rxo)->rx_dropped;
434 /* no space in linux buffers: best possible approximation */ 435 /* no space in linux buffers: best possible approximation */
435 if (adapter->generation == BE_GEN3) { 436 if (adapter->generation == BE_GEN3) {
436 if (!(lancer_chip(adapter))) { 437 if (!(lancer_chip(adapter))) {
@@ -1181,8 +1182,7 @@ static void be_rx_compl_process(struct be_adapter *adapter,
1181 1182
1182 skb = netdev_alloc_skb_ip_align(netdev, BE_HDR_LEN); 1183 skb = netdev_alloc_skb_ip_align(netdev, BE_HDR_LEN);
1183 if (unlikely(!skb)) { 1184 if (unlikely(!skb)) {
1184 if (net_ratelimit()) 1185 rxo->stats.rx_dropped++;
1185 dev_warn(&adapter->pdev->dev, "skb alloc failed\n");
1186 be_rx_compl_discard(adapter, rxo, rxcp); 1186 be_rx_compl_discard(adapter, rxo, rxcp);
1187 return; 1187 return;
1188 } 1188 }