You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
drivers:net: Remove unnecessary OOM messages after netdev_alloc_skb
Emitting netdev_alloc_skb and netdev_alloc_skb_ip_align OOM messages is unnecessary as there is already a dump_stack after allocation failures. Other trivial changes around these removals: Convert a few comparisons of pointer to 0 to !pointer. Change flow to remove unnecessary label. Remove now unused variable. Hoist assignment from if. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
e8f83e5ec7
commit
720a43efd3
@@ -338,11 +338,8 @@ static void shm_rx_work_func(struct work_struct *rx_work)
|
|||||||
/* Get a suitable CAIF packet and copy in data. */
|
/* Get a suitable CAIF packet and copy in data. */
|
||||||
skb = netdev_alloc_skb(pshm_drv->pshm_dev->pshm_netdev,
|
skb = netdev_alloc_skb(pshm_drv->pshm_dev->pshm_netdev,
|
||||||
frm_pck_len + 1);
|
frm_pck_len + 1);
|
||||||
|
if (skb == NULL)
|
||||||
if (skb == NULL) {
|
|
||||||
pr_info("OOM: Try next frame in descriptor\n");
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
p = skb_put(skb, frm_pck_len);
|
p = skb_put(skb, frm_pck_len);
|
||||||
memcpy(p, pbuf->desc_vptr + frm_pck_ofs, frm_pck_len);
|
memcpy(p, pbuf->desc_vptr + frm_pck_ofs, frm_pck_len);
|
||||||
|
|||||||
@@ -188,10 +188,9 @@ static int desc_list_init(struct net_device *dev)
|
|||||||
|
|
||||||
/* allocate a new skb for next time receive */
|
/* allocate a new skb for next time receive */
|
||||||
new_skb = netdev_alloc_skb(dev, PKT_BUF_SZ + NET_IP_ALIGN);
|
new_skb = netdev_alloc_skb(dev, PKT_BUF_SZ + NET_IP_ALIGN);
|
||||||
if (!new_skb) {
|
if (!new_skb)
|
||||||
pr_notice("init: low on mem - packet dropped\n");
|
|
||||||
goto init_error;
|
goto init_error;
|
||||||
}
|
|
||||||
skb_reserve(new_skb, NET_IP_ALIGN);
|
skb_reserve(new_skb, NET_IP_ALIGN);
|
||||||
/* Invidate the data cache of skb->data range when it is write back
|
/* Invidate the data cache of skb->data range when it is write back
|
||||||
* cache. It will prevent overwritting the new data from DMA
|
* cache. It will prevent overwritting the new data from DMA
|
||||||
@@ -1236,7 +1235,6 @@ static void bfin_mac_rx(struct net_device *dev)
|
|||||||
|
|
||||||
new_skb = netdev_alloc_skb(dev, PKT_BUF_SZ + NET_IP_ALIGN);
|
new_skb = netdev_alloc_skb(dev, PKT_BUF_SZ + NET_IP_ALIGN);
|
||||||
if (!new_skb) {
|
if (!new_skb) {
|
||||||
netdev_notice(dev, "rx: low on mem - packet dropped\n");
|
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -318,8 +318,6 @@ static int lance_rx (struct net_device *dev)
|
|||||||
struct sk_buff *skb = netdev_alloc_skb(dev, len + 2);
|
struct sk_buff *skb = netdev_alloc_skb(dev, len + 2);
|
||||||
|
|
||||||
if (!skb) {
|
if (!skb) {
|
||||||
printk ("%s: Memory squeeze, deferring packet.\n",
|
|
||||||
dev->name);
|
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
rd->mblength = 0;
|
rd->mblength = 0;
|
||||||
rd->rmd1_bits = LE_R1_OWN;
|
rd->rmd1_bits = LE_R1_OWN;
|
||||||
|
|||||||
@@ -293,7 +293,6 @@ static int lance_rx(struct net_device *dev)
|
|||||||
struct sk_buff *skb = netdev_alloc_skb(dev, len + 2);
|
struct sk_buff *skb = netdev_alloc_skb(dev, len + 2);
|
||||||
|
|
||||||
if (!skb) {
|
if (!skb) {
|
||||||
netdev_warn(dev, "Memory squeeze, deferring packet\n");
|
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
rd->mblength = 0;
|
rd->mblength = 0;
|
||||||
rd->rmd1_bits = LE_R1_OWN;
|
rd->rmd1_bits = LE_R1_OWN;
|
||||||
|
|||||||
@@ -528,7 +528,6 @@ am79c961_rx(struct net_device *dev, struct dev_priv *priv)
|
|||||||
dev->stats.rx_packets++;
|
dev->stats.rx_packets++;
|
||||||
} else {
|
} else {
|
||||||
am_writeword (dev, hdraddr + 2, RMD_OWN);
|
am_writeword (dev, hdraddr + 2, RMD_OWN);
|
||||||
printk (KERN_WARNING "%s: memory squeeze, dropping packet.\n", dev->name);
|
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,7 +193,6 @@ static int ariadne_rx(struct net_device *dev)
|
|||||||
|
|
||||||
skb = netdev_alloc_skb(dev, pkt_len + 2);
|
skb = netdev_alloc_skb(dev, pkt_len + 2);
|
||||||
if (skb == NULL) {
|
if (skb == NULL) {
|
||||||
netdev_warn(dev, "Memory squeeze, deferring packet\n");
|
|
||||||
for (i = 0; i < RX_RING_SIZE; i++)
|
for (i = 0; i < RX_RING_SIZE; i++)
|
||||||
if (lowb(priv->rx_ring[(entry + i) % RX_RING_SIZE]->RMD1) & RF_OWN)
|
if (lowb(priv->rx_ring[(entry + i) % RX_RING_SIZE]->RMD1) & RF_OWN)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -996,8 +996,6 @@ static int lance_rx( struct net_device *dev )
|
|||||||
else {
|
else {
|
||||||
skb = netdev_alloc_skb(dev, pkt_len + 2);
|
skb = netdev_alloc_skb(dev, pkt_len + 2);
|
||||||
if (skb == NULL) {
|
if (skb == NULL) {
|
||||||
DPRINTK( 1, ( "%s: Memory squeeze, deferring packet.\n",
|
|
||||||
dev->name ));
|
|
||||||
for( i = 0; i < RX_RING_SIZE; i++ )
|
for( i = 0; i < RX_RING_SIZE; i++ )
|
||||||
if (MEM->rx_head[(entry+i) & RX_RING_MOD_MASK].flag &
|
if (MEM->rx_head[(entry+i) & RX_RING_MOD_MASK].flag &
|
||||||
RMD1_OWN_CHIP)
|
RMD1_OWN_CHIP)
|
||||||
|
|||||||
@@ -727,7 +727,6 @@ static int au1000_rx(struct net_device *dev)
|
|||||||
frmlen -= 4; /* Remove FCS */
|
frmlen -= 4; /* Remove FCS */
|
||||||
skb = netdev_alloc_skb(dev, frmlen + 2);
|
skb = netdev_alloc_skb(dev, frmlen + 2);
|
||||||
if (skb == NULL) {
|
if (skb == NULL) {
|
||||||
netdev_err(dev, "Memory squeeze, dropping packet.\n");
|
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -607,8 +607,6 @@ static int lance_rx(struct net_device *dev)
|
|||||||
skb = netdev_alloc_skb(dev, len + 2);
|
skb = netdev_alloc_skb(dev, len + 2);
|
||||||
|
|
||||||
if (skb == 0) {
|
if (skb == 0) {
|
||||||
printk("%s: Memory squeeze, deferring packet.\n",
|
|
||||||
dev->name);
|
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
*rds_ptr(rd, mblength, lp->type) = 0;
|
*rds_ptr(rd, mblength, lp->type) = 0;
|
||||||
*rds_ptr(rd, rmd1, lp->type) =
|
*rds_ptr(rd, rmd1, lp->type) =
|
||||||
|
|||||||
@@ -1166,7 +1166,6 @@ static void pcnet32_rx_entry(struct net_device *dev,
|
|||||||
skb = netdev_alloc_skb(dev, pkt_len + NET_IP_ALIGN);
|
skb = netdev_alloc_skb(dev, pkt_len + NET_IP_ALIGN);
|
||||||
|
|
||||||
if (skb == NULL) {
|
if (skb == NULL) {
|
||||||
netif_err(lp, drv, dev, "Memory squeeze, dropping packet\n");
|
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -812,9 +812,6 @@ static int lance_rx( struct net_device *dev )
|
|||||||
else {
|
else {
|
||||||
skb = netdev_alloc_skb(dev, pkt_len + 2);
|
skb = netdev_alloc_skb(dev, pkt_len + 2);
|
||||||
if (skb == NULL) {
|
if (skb == NULL) {
|
||||||
DPRINTK( 1, ( "%s: Memory squeeze, deferring packet.\n",
|
|
||||||
dev->name ));
|
|
||||||
|
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
head->msg_length = 0;
|
head->msg_length = 0;
|
||||||
head->flag |= RMD1_OWN_CHIP;
|
head->flag |= RMD1_OWN_CHIP;
|
||||||
|
|||||||
@@ -536,8 +536,6 @@ static void lance_rx_dvma(struct net_device *dev)
|
|||||||
skb = netdev_alloc_skb(dev, len + 2);
|
skb = netdev_alloc_skb(dev, len + 2);
|
||||||
|
|
||||||
if (skb == NULL) {
|
if (skb == NULL) {
|
||||||
printk(KERN_INFO "%s: Memory squeeze, deferring packet.\n",
|
|
||||||
dev->name);
|
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
rd->mblength = 0;
|
rd->mblength = 0;
|
||||||
rd->rmd1_bits = LE_R1_OWN;
|
rd->rmd1_bits = LE_R1_OWN;
|
||||||
@@ -708,8 +706,6 @@ static void lance_rx_pio(struct net_device *dev)
|
|||||||
skb = netdev_alloc_skb(dev, len + 2);
|
skb = netdev_alloc_skb(dev, len + 2);
|
||||||
|
|
||||||
if (skb == NULL) {
|
if (skb == NULL) {
|
||||||
printk(KERN_INFO "%s: Memory squeeze, deferring packet.\n",
|
|
||||||
dev->name);
|
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
sbus_writew(0, &rd->mblength);
|
sbus_writew(0, &rd->mblength);
|
||||||
sbus_writeb(LE_R1_OWN, &rd->rmd1_bits);
|
sbus_writeb(LE_R1_OWN, &rd->rmd1_bits);
|
||||||
|
|||||||
@@ -1420,11 +1420,9 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
|
|||||||
packet_size = ((prrs->word1 >> RRS_PKT_SIZE_SHIFT) &
|
packet_size = ((prrs->word1 >> RRS_PKT_SIZE_SHIFT) &
|
||||||
RRS_PKT_SIZE_MASK) - 4; /* CRC */
|
RRS_PKT_SIZE_MASK) - 4; /* CRC */
|
||||||
skb = netdev_alloc_skb_ip_align(netdev, packet_size);
|
skb = netdev_alloc_skb_ip_align(netdev, packet_size);
|
||||||
if (skb == NULL) {
|
if (skb == NULL)
|
||||||
netdev_warn(netdev,
|
|
||||||
"Memory squeeze, deferring packet\n");
|
|
||||||
goto skip_pkt;
|
goto skip_pkt;
|
||||||
}
|
|
||||||
memcpy(skb->data, (u8 *)(prrs + 1), packet_size);
|
memcpy(skb->data, (u8 *)(prrs + 1), packet_size);
|
||||||
skb_put(skb, packet_size);
|
skb_put(skb, packet_size);
|
||||||
skb->protocol = eth_type_trans(skb, netdev);
|
skb->protocol = eth_type_trans(skb, netdev);
|
||||||
|
|||||||
@@ -437,9 +437,6 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
|
|||||||
/* alloc new buffer */
|
/* alloc new buffer */
|
||||||
skb = netdev_alloc_skb_ip_align(netdev, rx_size);
|
skb = netdev_alloc_skb_ip_align(netdev, rx_size);
|
||||||
if (NULL == skb) {
|
if (NULL == skb) {
|
||||||
printk(KERN_WARNING
|
|
||||||
"%s: Mem squeeze, deferring packet.\n",
|
|
||||||
netdev->name);
|
|
||||||
/*
|
/*
|
||||||
* Check that some rx space is free. If not,
|
* Check that some rx space is free. If not,
|
||||||
* free one and mark stats->rx_dropped++.
|
* free one and mark stats->rx_dropped++.
|
||||||
|
|||||||
@@ -245,10 +245,8 @@ static int bgmac_dma_rx_skb_for_slot(struct bgmac *bgmac,
|
|||||||
|
|
||||||
/* Alloc skb */
|
/* Alloc skb */
|
||||||
slot->skb = netdev_alloc_skb(bgmac->net_dev, BGMAC_RX_BUF_SIZE);
|
slot->skb = netdev_alloc_skb(bgmac->net_dev, BGMAC_RX_BUF_SIZE);
|
||||||
if (!slot->skb) {
|
if (!slot->skb)
|
||||||
bgmac_err(bgmac, "Allocation of skb failed!\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
/* Poison - if everything goes fine, hardware will overwrite it */
|
/* Poison - if everything goes fine, hardware will overwrite it */
|
||||||
rx = (struct bgmac_rx_header *)slot->skb->data;
|
rx = (struct bgmac_rx_header *)slot->skb->data;
|
||||||
|
|||||||
@@ -831,11 +831,8 @@ static int sbdma_add_rcvbuffer(struct sbmac_softc *sc, struct sbmacdma *d,
|
|||||||
sb_new = netdev_alloc_skb(dev, ENET_PACKET_SIZE +
|
sb_new = netdev_alloc_skb(dev, ENET_PACKET_SIZE +
|
||||||
SMP_CACHE_BYTES * 2 +
|
SMP_CACHE_BYTES * 2 +
|
||||||
NET_IP_ALIGN);
|
NET_IP_ALIGN);
|
||||||
if (sb_new == NULL) {
|
if (sb_new == NULL)
|
||||||
pr_info("%s: sk_buff allocation failed\n",
|
|
||||||
d->sbdma_eth->sbm_dev->name);
|
|
||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
}
|
|
||||||
|
|
||||||
sbdma_align_skb(sb_new, SMP_CACHE_BYTES, NET_IP_ALIGN);
|
sbdma_align_skb(sb_new, SMP_CACHE_BYTES, NET_IP_ALIGN);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,7 +209,6 @@ static void at91ether_rx(struct net_device *dev)
|
|||||||
netif_rx(skb);
|
netif_rx(skb);
|
||||||
} else {
|
} else {
|
||||||
lp->stats.rx_dropped++;
|
lp->stats.rx_dropped++;
|
||||||
netdev_notice(dev, "Memory squeeze, dropping packet.\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lp->rx_ring[lp->rx_tail].ctrl & MACB_BIT(RX_MHASH_MATCH))
|
if (lp->rx_ring[lp->rx_tail].ctrl & MACB_BIT(RX_MHASH_MATCH))
|
||||||
|
|||||||
@@ -478,9 +478,6 @@ dma_rx(struct net_device *dev)
|
|||||||
/* Malloc up new buffer. */
|
/* Malloc up new buffer. */
|
||||||
skb = netdev_alloc_skb(dev, length + 2);
|
skb = netdev_alloc_skb(dev, length + 2);
|
||||||
if (skb == NULL) {
|
if (skb == NULL) {
|
||||||
/* I don't think we want to do this to a stressed system */
|
|
||||||
cs89_dbg(0, err, "%s: Memory squeeze, dropping packet\n",
|
|
||||||
dev->name);
|
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
|
|
||||||
/* AKPM: advance bp to the next frame */
|
/* AKPM: advance bp to the next frame */
|
||||||
@@ -731,9 +728,6 @@ net_rx(struct net_device *dev)
|
|||||||
/* Malloc up new buffer. */
|
/* Malloc up new buffer. */
|
||||||
skb = netdev_alloc_skb(dev, length + 2);
|
skb = netdev_alloc_skb(dev, length + 2);
|
||||||
if (skb == NULL) {
|
if (skb == NULL) {
|
||||||
#if 0 /* Again, this seems a cruel thing to do */
|
|
||||||
pr_warn("%s: Memory squeeze, dropping packet\n", dev->name);
|
|
||||||
#endif
|
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -580,12 +580,9 @@ alloc_list (struct net_device *dev)
|
|||||||
|
|
||||||
skb = netdev_alloc_skb_ip_align(dev, np->rx_buf_sz);
|
skb = netdev_alloc_skb_ip_align(dev, np->rx_buf_sz);
|
||||||
np->rx_skbuff[i] = skb;
|
np->rx_skbuff[i] = skb;
|
||||||
if (skb == NULL) {
|
if (skb == NULL)
|
||||||
printk (KERN_ERR
|
|
||||||
"%s: alloc_list: allocate Rx buffer error! ",
|
|
||||||
dev->name);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
/* Rubicon now supports 40 bits of addressing space. */
|
/* Rubicon now supports 40 bits of addressing space. */
|
||||||
np->rx_ring[i].fraginfo =
|
np->rx_ring[i].fraginfo =
|
||||||
cpu_to_le64 ( pci_map_single (
|
cpu_to_le64 ( pci_map_single (
|
||||||
|
|||||||
@@ -743,8 +743,6 @@ fec_enet_rx(struct net_device *ndev, int budget)
|
|||||||
skb = netdev_alloc_skb(ndev, pkt_len - 4 + NET_IP_ALIGN);
|
skb = netdev_alloc_skb(ndev, pkt_len - 4 + NET_IP_ALIGN);
|
||||||
|
|
||||||
if (unlikely(!skb)) {
|
if (unlikely(!skb)) {
|
||||||
printk("%s: Memory squeeze, dropping packet.\n",
|
|
||||||
ndev->name);
|
|
||||||
ndev->stats.rx_dropped++;
|
ndev->stats.rx_dropped++;
|
||||||
} else {
|
} else {
|
||||||
skb_reserve(skb, NET_IP_ALIGN);
|
skb_reserve(skb, NET_IP_ALIGN);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user