Skip to content

Commit

Permalink
net: use symbolic values for ndo_start_xmit() return codes
Browse files Browse the repository at this point in the history
Convert magic values 1 and -1 to NETDEV_TX_BUSY and NETDEV_TX_LOCKED respectively.

0 (NETDEV_TX_OK) is not changed to keep the noise down, except in very few cases
where its in direct proximity to one of the other values.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Jun 13, 2009
1 parent 5b2c4b9 commit 5b54814
Show file tree
Hide file tree
Showing 81 changed files with 109 additions and 109 deletions.
6 changes: 3 additions & 3 deletions drivers/isdn/i4l/isdn_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb)
lp = isdn_net_get_locked_lp(nd);
if (!lp) {
printk(KERN_WARNING "%s: all channels busy - requeuing!\n", ndev->name);
return 1;
return NETDEV_TX_BUSY;
}
/* we have our lp locked from now on */

Expand Down Expand Up @@ -1273,14 +1273,14 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
spin_unlock_irqrestore(&dev->lock, flags);
isdn_net_dial(); /* Initiate dialing */
netif_stop_queue(ndev);
return 1; /* let upper layer requeue skb packet */
return NETDEV_TX_BUSY; /* let upper layer requeue skb packet */
}
#endif
/* Initiate dialing */
spin_unlock_irqrestore(&dev->lock, flags);
isdn_net_dial();
isdn_net_device_stop_queue(lp);
return 1;
return NETDEV_TX_BUSY;
} else {
isdn_net_unreachable(ndev, skb,
"No phone number");
Expand Down
4 changes: 2 additions & 2 deletions drivers/message/fusion/mptlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device *dev)

printk (KERN_ERR "%s: no tx context available: %u\n",
__func__, priv->mpt_txfidx_tail);
return 1;
return NETDEV_TX_BUSY;
}

mf = mpt_get_msg_frame(LanCtx, mpt_dev);
Expand All @@ -713,7 +713,7 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device *dev)

printk (KERN_ERR "%s: Unable to alloc request frame\n",
__func__);
return 1;
return NETDEV_TX_BUSY;
}

ctx = priv->mpt_txfidx[priv->mpt_txfidx_tail--];
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/3c505.c
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ static int elp_start_xmit(struct sk_buff *skb, struct net_device *dev)
pr_debug("%s: failed to transmit packet\n", dev->name);
}
spin_unlock_irqrestore(&adapter->lock, flags);
return 1;
return NETDEV_TX_BUSY;
}
if (elp_debug >= 3)
pr_debug("%s: packet of length %d sent\n", dev->name, (int) skb->len);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/3c515.c
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ static int corkscrew_start_xmit(struct sk_buff *skb,
int i;

if (vp->tx_full) /* No room to transmit with */
return 1;
return NETDEV_TX_BUSY;
if (vp->cur_tx != 0)
prev_entry = &vp->tx_ring[(vp->cur_tx - 1) % TX_RING_SIZE];
else
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/3c527.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ static int mc32_send_packet(struct sk_buff *skb, struct net_device *dev)
netif_stop_queue(dev);

if(atomic_read(&lp->tx_count)==0) {
return 1;
return NETDEV_TX_BUSY;
}

if (skb_padto(skb, ETH_ZLEN)) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/3c59x.c
Original file line number Diff line number Diff line change
Expand Up @@ -2107,7 +2107,7 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
pr_warning("%s: BUG! Tx Ring full, refusing to send buffer.\n",
dev->name);
netif_stop_queue(dev);
return 1;
return NETDEV_TX_BUSY;
}

vp->tx_skbuff[entry] = skb;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/7990.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
unsigned long flags;

if (!TX_BUFFS_AVAIL)
return -1;
return NETDEV_TX_LOCKED;

netif_stop_queue (dev);

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/8139cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
spin_unlock_irqrestore(&cp->lock, intr_flags);
pr_err(PFX "%s: BUG! Tx Ring full when queue awake!\n",
dev->name);
return 1;
return NETDEV_TX_BUSY;
}

#if CP_VLAN_TAG_USED
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/a2065.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)

if (!TX_BUFFS_AVAIL){
local_irq_restore(flags);
return -1;
return NETDEV_TX_LOCKED;
}

#ifdef DEBUG_DRIVER
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/arm/at91_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ static int at91ether_start_xmit(struct sk_buff *skb, struct net_device *dev)
dev->trans_start = jiffies;
} else {
printk(KERN_ERR "at91_ether.c: at91ether_start_xmit() called, but device is busy!\n");
return 1; /* if we return anything but zero, dev.c:1055 calls kfree_skb(skb)
return NETDEV_TX_BUSY; /* if we return anything but zero, dev.c:1055 calls kfree_skb(skb)
on this skb, he also reports -ENETDOWN and printk's, so either
we free and return(0) or don't free and return 1 */
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/arm/ether3.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ ether3_sendpacket(struct sk_buff *skb, struct net_device *dev)

if (priv(dev)->tx_tail == next_ptr) {
local_irq_restore(flags);
return 1; /* unable to queue */
return NETDEV_TX_BUSY; /* unable to queue */
}

dev->trans_start = jiffies;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/au1000_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ static int au1000_tx(struct sk_buff *skb, struct net_device *dev)
/* We've wrapped around and the transmitter is still busy */
netif_stop_queue(dev);
aup->tx_full = 1;
return 1;
return NETDEV_TX_BUSY;
}
else if (buff_stat & TX_T_DONE) {
update_tx_stats(dev, ptxd->status);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/cassini.c
Original file line number Diff line number Diff line change
Expand Up @@ -2934,7 +2934,7 @@ static int cas_start_xmit(struct sk_buff *skb, struct net_device *dev)
* individual queues.
*/
if (cas_xmit_tx_ringN(cp, ring++ & N_TX_RINGS_MASK, skb))
return 1;
return NETDEV_TX_BUSY;
dev->trans_start = jiffies;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/cs89x0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)

spin_unlock_irq(&lp->lock);
if (net_debug) printk("cs89x0: Tx buffer not free!\n");
return 1;
return NETDEV_TX_BUSY;
}
/* Write the contents of the packet */
writewords(dev->base_addr, TX_FRAME_PORT,skb->data,(skb->len+1) >>1);
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/de600.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ static int de600_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (free_tx_pages <= 0) { /* Do timeouts, to avoid hangs. */
tickssofar = jiffies - dev->trans_start;
if (tickssofar < 5)
return 1;
return NETDEV_TX_BUSY;
/* else */
printk(KERN_WARNING "%s: transmit timed out (%d), %s?\n", dev->name, tickssofar, "network cable problem");
/* Restart the adapter. */
spin_lock_irqsave(&de600_lock, flags);
if (adapter_init(dev)) {
spin_unlock_irqrestore(&de600_lock, flags);
return 1;
return NETDEV_TX_BUSY;
}
spin_unlock_irqrestore(&de600_lock, flags);
}
Expand All @@ -199,7 +199,7 @@ static int de600_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (was_down || (de600_read_byte(READ_DATA, dev) != 0xde)) {
if (adapter_init(dev)) {
spin_unlock_irqrestore(&de600_lock, flags);
return 1;
return NETDEV_TX_BUSY;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/de620.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ static int de620_start_xmit(struct sk_buff *skb, struct net_device *dev)
case (TXBF0 | TXBF1): /* NONE!!! */
printk(KERN_WARNING "%s: No tx-buffer available!\n", dev->name);
spin_unlock_irqrestore(&de620_lock, flags);
return 1;
return NETDEV_TX_BUSY;
}
de620_write_block(dev, buffer, skb->len, len-skb->len);

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/defxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -3318,7 +3318,7 @@ static int dfx_xmt_queue_pkt(
{
skb_pull(skb,3);
spin_unlock_irqrestore(&bp->lock, flags);
return(1); /* requeue packet for later */
return NETDEV_TX_BUSY; /* requeue packet for later */
}

/*
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/depca.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (TX_BUFFS_AVAIL)
netif_start_queue(dev);
} else
status = -1;
status = NETDEV_TX_LOCKED;

out:
return status;
Expand Down Expand Up @@ -1839,7 +1839,7 @@ static int load_packet(struct net_device *dev, struct sk_buff *skb)

lp->tx_new = (++end) & lp->txRingMask; /* update current pointers */
} else {
status = -1;
status = NETDEV_TX_LOCKED;
}

return status;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/dm9000.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ dm9000_start_xmit(struct sk_buff *skb, struct net_device *dev)
dm9000_dbg(db, 3, "%s:\n", __func__);

if (db->tx_pkt_cnt > 1)
return 1;
return NETDEV_TX_BUSY;

spin_lock_irqsave(&db->lock, flags);

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/e100.c
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,7 @@ static int e100_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
/* This is a hard error - log it. */
DPRINTK(TX_ERR, DEBUG, "Out of Tx resources, returning skb\n");
netif_stop_queue(netdev);
return 1;
return NETDEV_TX_BUSY;
}

netdev->trans_start = jiffies;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ewrk3.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ static int ewrk3_queue_pkt (struct sk_buff *skb, struct net_device *dev)
err_out:
ENABLE_IRQs;
spin_unlock_irq (&lp->hw_lock);
return 1;
return NETDEV_TX_BUSY;
}

/*
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/fec.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)

if (!fep->link) {
/* Link is down or autonegotiation is in progress. */
return 1;
return NETDEV_TX_BUSY;
}

spin_lock_irqsave(&fep->hw_lock, flags);
Expand All @@ -305,7 +305,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
*/
printk("%s: tx queue full!.\n", dev->name);
spin_unlock_irqrestore(&fep->hw_lock, flags);
return 1;
return NETDEV_TX_BUSY;
}

/* Clear all of the status flags */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/hamachi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev)
status=readw(hmp->base + TxStatus);
if( !(status & 0x0001) || (status & 0x0002))
writew(0x0001, hmp->base + TxCmd);
return 1;
return NETDEV_TX_BUSY;
}

/* Caution: the write order is important here, set the field
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/hamradio/baycom_epp.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ static int baycom_send_packet(struct sk_buff *skb, struct net_device *dev)
return 0;
}
if (bc->skb)
return -1;
return NETDEV_TX_LOCKED;
/* strip KISS byte */
if (skb->len >= HDLCDRV_MAXFLEN+1 || skb->len < 3) {
dev_kfree_skb(skb);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/hamradio/hdlcdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ static int hdlcdrv_send_packet(struct sk_buff *skb, struct net_device *dev)
return 0;
}
if (sm->skb)
return -1;
return NETDEV_TX_LOCKED;
netif_stop_queue(dev);
sm->skb = skb;
return 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/hamradio/mkiss.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ static int ax_xmit(struct sk_buff *skb, struct net_device *dev)

if (!netif_running(dev)) {
printk(KERN_ERR "mkiss: %s: xmit call when iface is down\n", dev->name);
return 1;
return NETDEV_TX_BUSY;
}

if (netif_queue_stopped(dev)) {
Expand All @@ -541,7 +541,7 @@ static int ax_xmit(struct sk_buff *skb, struct net_device *dev)
*/
if (time_before(jiffies, dev->trans_start + 20 * HZ)) {
/* 20 sec timeout not reached */
return 1;
return NETDEV_TX_BUSY;
}

printk(KERN_ERR "mkiss: %s: transmit timed out, %s?\n", dev->name,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ibm_newemac/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,7 @@ static int emac_start_xmit_sg(struct sk_buff *skb, struct net_device *ndev)
stop_queue:
netif_stop_queue(ndev);
DBG2(dev, "stopped TX queue" NL);
return 1;
return NETDEV_TX_BUSY;
}

/* Tx lock BHs */
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/irda/au1k_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,13 @@ static int au1k_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev)
printk(KERN_DEBUG "%s: tx_full\n", dev->name);
netif_stop_queue(dev);
aup->tx_full = 1;
return 1;
return NETDEV_TX_BUSY;
}
else if (((aup->tx_head + 1) & (NUM_IR_DESC - 1)) == aup->tx_tail) {
printk(KERN_DEBUG "%s: tx_full\n", dev->name);
netif_stop_queue(dev);
aup->tx_full = 1;
return 1;
return NETDEV_TX_BUSY;
}

pDB = aup->tx_db_inuse[aup->tx_head];
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/irda/sir_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
* stopped so the network layer will retry after the
* fsm completes and wakes the queue.
*/
return 1;
return NETDEV_TX_BUSY;
}
else if (unlikely(err)) {
/* other fatal error - forget the speed change and
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/lib8390.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ static int __ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
spin_unlock(&ei_local->page_lock);
enable_irq_lockdep_irqrestore(dev->irq, &flags);
dev->stats.tx_errors++;
return 1;
return NETDEV_TX_BUSY;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/mac89x0.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ net_send_packet(struct sk_buff *skb, struct net_device *dev)
/* Gasp! It hasn't. But that shouldn't happen since
we're waiting for TxOk, so return 1 and requeue this packet. */
local_irq_restore(flags);
return 1;
return NETDEV_TX_BUSY;
}

/* Write the contents of the packet */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/macb.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
"BUG! Tx Ring full when queue awake!\n");
dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n",
bp->tx_head, bp->tx_tail);
return 1;
return NETDEV_TX_BUSY;
}

entry = bp->tx_head;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/mace.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev)
netif_stop_queue(dev);
mp->tx_fullup = 1;
spin_unlock_irqrestore(&mp->lock, flags);
return 1; /* can't take it at the moment */
return NETDEV_TX_BUSY; /* can't take it at the moment */
}
spin_unlock_irqrestore(&mp->lock, flags);

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/myri10ge/myri10ge.c
Original file line number Diff line number Diff line change
Expand Up @@ -2687,7 +2687,7 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev)
/* we are out of transmit resources */
tx->stop_queue++;
netif_tx_stop_queue(netdev_queue);
return 1;
return NETDEV_TX_BUSY;
}

/* Setup checksum offloading, if needed */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/myri_sbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ static int myri_start_xmit(struct sk_buff *skb, struct net_device *dev)

if (!TX_BUFFS_AVAIL(head, tail)) {
DTX(("no buffs available, returning 1\n"));
return 1;
return NETDEV_TX_BUSY;
}

spin_lock_irqsave(&mp->irq_lock, flags);
Expand Down
Loading

0 comments on commit 5b54814

Please sign in to comment.