Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e758962 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

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: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c2fed996
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -199,6 +199,7 @@ struct be_rx_stats {
	u32 rx_polls;	/* number of times NAPI called poll function */
	u32 rx_polls;	/* number of times NAPI called poll function */
	u32 rx_events;	/* number of ucast rx completion events  */
	u32 rx_events;	/* number of ucast rx completion events  */
	u32 rx_compl;	/* number of rx completion entries processed */
	u32 rx_compl;	/* number of rx completion entries processed */
	ulong rx_dropped; /* number of skb allocation errors */
	ulong rx_jiffies;
	ulong rx_jiffies;
	u64 rx_bytes;
	u64 rx_bytes;
	u64 rx_bytes_prev;
	u64 rx_bytes_prev;
+1 −0
Original line number Original line Diff line number Diff line
@@ -102,6 +102,7 @@ static const struct be_ethtool_stat et_rx_stats[] = {
	{DRVSTAT_RX_INFO(rx_compl)},
	{DRVSTAT_RX_INFO(rx_compl)},
	{DRVSTAT_RX_INFO(rx_mcast_pkts)},
	{DRVSTAT_RX_INFO(rx_mcast_pkts)},
	{DRVSTAT_RX_INFO(rx_post_fail)},
	{DRVSTAT_RX_INFO(rx_post_fail)},
	{DRVSTAT_RX_INFO(rx_dropped)},
	{ERXSTAT_INFO(rx_drops_no_fragments)}
	{ERXSTAT_INFO(rx_drops_no_fragments)}
};
};
#define ETHTOOL_RXSTATS_NUM (ARRAY_SIZE(et_rx_stats))
#define ETHTOOL_RXSTATS_NUM (ARRAY_SIZE(et_rx_stats))
+2 −2
Original line number Original line Diff line number Diff line
@@ -431,6 +431,7 @@ void netdev_stats_update(struct be_adapter *adapter)
		pkts += rx_stats(rxo)->rx_pkts;
		pkts += rx_stats(rxo)->rx_pkts;
		bytes += rx_stats(rxo)->rx_bytes;
		bytes += rx_stats(rxo)->rx_bytes;
		mcast += rx_stats(rxo)->rx_mcast_pkts;
		mcast += rx_stats(rxo)->rx_mcast_pkts;
		drops += rx_stats(rxo)->rx_dropped;
		/*  no space in linux buffers: best possible approximation */
		/*  no space in linux buffers: best possible approximation */
		if (adapter->generation == BE_GEN3) {
		if (adapter->generation == BE_GEN3) {
			if (!(lancer_chip(adapter))) {
			if (!(lancer_chip(adapter))) {
@@ -1181,8 +1182,7 @@ static void be_rx_compl_process(struct be_adapter *adapter,


	skb = netdev_alloc_skb_ip_align(netdev, BE_HDR_LEN);
	skb = netdev_alloc_skb_ip_align(netdev, BE_HDR_LEN);
	if (unlikely(!skb)) {
	if (unlikely(!skb)) {
		if (net_ratelimit())
		rxo->stats.rx_dropped++;
			dev_warn(&adapter->pdev->dev, "skb alloc failed\n");
		be_rx_compl_discard(adapter, rxo, rxcp);
		be_rx_compl_discard(adapter, rxo, rxcp);
		return;
		return;
	}
	}