Skip to content

Commit

Permalink
net: trans_start cleanups
Browse files Browse the repository at this point in the history
Now that core network takes care of trans_start updates, dont do it
in drivers themselves, if possible. Drivers can avoid one cache miss
(on dev->trans_start) in their start_xmit() handler.

Exceptions are NETIF_F_LLTX drivers

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed May 10, 2010
1 parent 2b0b05d commit 1ae5dc3
Show file tree
Hide file tree
Showing 168 changed files with 103 additions and 314 deletions.
1 change: 0 additions & 1 deletion drivers/net/3c501.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ static netdev_tx_t el_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* fire ... Trigger xmit. */
outb(AX_XMIT, AX_CMD);
lp->loading = 0;
dev->trans_start = jiffies;
if (el_debug > 2)
pr_debug(" queued xmit.\n");
dev_kfree_skb(skb);
Expand Down
7 changes: 1 addition & 6 deletions drivers/net/3c505.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ static void elp_timeout(struct net_device *dev)
(stat & ACRF) ? "interrupt" : "command");
if (elp_debug >= 1)
pr_debug("%s: status %#02x\n", dev->name, stat);
dev->trans_start = jiffies;
dev->trans_start = jiffies; /* prevent tx timeout */
dev->stats.tx_dropped++;
netif_wake_queue(dev);
}
Expand Down Expand Up @@ -1093,11 +1093,6 @@ static netdev_tx_t elp_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (elp_debug >= 3)
pr_debug("%s: packet of length %d sent\n", dev->name, (int) skb->len);

/*
* start the transmit timeout
*/
dev->trans_start = jiffies;

prime_rx(dev);
spin_unlock_irqrestore(&adapter->lock, flags);
netif_start_queue(dev);
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/3c507.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ static void el16_tx_timeout (struct net_device *dev)
outb (0, ioaddr + SIGNAL_CA); /* Issue channel-attn. */
lp->last_restart = dev->stats.tx_packets;
}
dev->trans_start = jiffies;
dev->trans_start = jiffies; /* prevent tx timeout */
netif_wake_queue (dev);
}

Expand All @@ -528,7 +528,6 @@ static netdev_tx_t el16_send_packet (struct sk_buff *skb,

hardware_send_packet (dev, buf, skb->len, length - skb->len);

dev->trans_start = jiffies;
/* Enable the 82586 interrupt input. */
outb (0x84, ioaddr + MISC_CTRL);

Expand Down
3 changes: 1 addition & 2 deletions drivers/net/3c509.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ el3_tx_timeout (struct net_device *dev)
dev->name, inb(ioaddr + TX_STATUS), inw(ioaddr + EL3_STATUS),
inw(ioaddr + TX_FREE));
dev->stats.tx_errors++;
dev->trans_start = jiffies;
dev->trans_start = jiffies; /* prevent tx timeout */
/* Issue TX_RESET and TX_START commands. */
outw(TxReset, ioaddr + EL3_CMD);
outw(TxEnable, ioaddr + EL3_CMD);
Expand Down Expand Up @@ -868,7 +868,6 @@ el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* ... and the packet rounded to a doubleword. */
outsl(ioaddr + TX_FIFO, skb->data, (skb->len + 3) >> 2);

dev->trans_start = jiffies;
if (inw(ioaddr + TX_FREE) > 1536)
netif_start_queue(dev);
else
Expand Down
4 changes: 1 addition & 3 deletions drivers/net/3c515.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ static void corkscrew_timeout(struct net_device *dev)
if (!(inw(ioaddr + EL3_STATUS) & CmdInProgress))
break;
outw(TxEnable, ioaddr + EL3_CMD);
dev->trans_start = jiffies;
dev->trans_start = jiffies; /* prevent tx timeout */
dev->stats.tx_errors++;
dev->stats.tx_dropped++;
netif_wake_queue(dev);
Expand Down Expand Up @@ -1055,7 +1055,6 @@ static netdev_tx_t corkscrew_start_xmit(struct sk_buff *skb,
prev_entry->status &= ~0x80000000;
netif_wake_queue(dev);
}
dev->trans_start = jiffies;
return NETDEV_TX_OK;
}
/* Put out the doubleword header... */
Expand Down Expand Up @@ -1091,7 +1090,6 @@ static netdev_tx_t corkscrew_start_xmit(struct sk_buff *skb,
outw(SetTxThreshold + (1536 >> 2), ioaddr + EL3_CMD);
#endif /* bus master */

dev->trans_start = jiffies;

/* Clear the Tx status stack. */
{
Expand Down
3 changes: 0 additions & 3 deletions drivers/net/3c523.c
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,6 @@ static netdev_tx_t elmc_send_packet(struct sk_buff *skb, struct net_device *dev)
p->scb->cmd = CUC_START;
p->xmit_cmds[0]->cmd_status = 0;
elmc_attn586();
dev->trans_start = jiffies;
if (!i) {
dev_kfree_skb(skb);
}
Expand All @@ -1176,7 +1175,6 @@ static netdev_tx_t elmc_send_packet(struct sk_buff *skb, struct net_device *dev)
p->xmit_cmds[0]->cmd_status = p->nop_cmds[next_nop]->cmd_status = 0;

p->nop_cmds[p->nop_point]->cmd_link = make16((p->xmit_cmds[0]));
dev->trans_start = jiffies;
p->nop_point = next_nop;
dev_kfree_skb(skb);
#endif
Expand All @@ -1190,7 +1188,6 @@ static netdev_tx_t elmc_send_packet(struct sk_buff *skb, struct net_device *dev)
= make16((p->nop_cmds[next_nop]));
p->nop_cmds[next_nop]->cmd_status = 0;
p->nop_cmds[p->xmit_count]->cmd_link = make16((p->xmit_cmds[p->xmit_count]));
dev->trans_start = jiffies;
p->xmit_count = next_nop;
if (p->xmit_count != p->xmit_last)
netif_wake_queue(dev);
Expand Down
4 changes: 1 addition & 3 deletions drivers/net/3c59x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ static void vortex_tx_timeout(struct net_device *dev)

/* Issue Tx Enable */
iowrite16(TxEnable, ioaddr + EL3_CMD);
dev->trans_start = jiffies;
dev->trans_start = jiffies; /* prevent tx timeout */

/* Switch to register set 7 for normal use. */
EL3WINDOW(7);
Expand Down Expand Up @@ -2063,7 +2063,6 @@ vortex_start_xmit(struct sk_buff *skb, struct net_device *dev)
}
}

dev->trans_start = jiffies;

/* Clear the Tx status stack. */
{
Expand Down Expand Up @@ -2174,7 +2173,6 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
}
iowrite16(DownUnstall, ioaddr + EL3_CMD);
spin_unlock_irqrestore(&vp->lock, flags);
dev->trans_start = jiffies;
return NETDEV_TX_OK;
}

Expand Down
5 changes: 2 additions & 3 deletions drivers/net/7990.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static int lance_reset (struct net_device *dev)

load_csrs (lp);
lance_init_ring (dev);
dev->trans_start = jiffies;
dev->trans_start = jiffies; /* prevent tx timeout */
status = init_restart_lance (lp);
#ifdef DEBUG_DRIVER
printk ("Lance restart=%d\n", status);
Expand Down Expand Up @@ -526,7 +526,7 @@ void lance_tx_timeout(struct net_device *dev)
{
printk("lance_tx_timeout\n");
lance_reset(dev);
dev->trans_start = jiffies;
dev->trans_start = jiffies; /* prevent tx timeout */
netif_wake_queue (dev);
}
EXPORT_SYMBOL_GPL(lance_tx_timeout);
Expand Down Expand Up @@ -574,7 +574,6 @@ int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
outs++;
/* Kick the lance: transmit now */
WRITERDP(lp, LE_C0_INEA | LE_C0_TDMD);
dev->trans_start = jiffies;
dev_kfree_skb (skb);

spin_lock_irqsave (&lp->devlock, flags);
Expand Down
1 change: 0 additions & 1 deletion drivers/net/8139cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,6 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
spin_unlock_irqrestore(&cp->lock, intr_flags);

cpw8(TxPoll, NormalTxPoll);
dev->trans_start = jiffies;

return NETDEV_TX_OK;
}
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/8139too.c
Original file line number Diff line number Diff line change
Expand Up @@ -1716,8 +1716,6 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
RTL_W32_F (TxStatus0 + (entry * sizeof (u32)),
tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));

dev->trans_start = jiffies;

tp->cur_tx++;

if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx)
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/82596.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ static void i596_tx_timeout (struct net_device *dev)
lp->last_restart = dev->stats.tx_packets;
}

dev->trans_start = jiffies;
dev->trans_start = jiffies; /* prevent tx timeout */
netif_wake_queue (dev);
}

Expand All @@ -1060,7 +1060,6 @@ static netdev_tx_t i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
struct tx_cmd *tx_cmd;
struct i596_tbd *tbd;
short length = skb->len;
dev->trans_start = jiffies;

DEB(DEB_STARTTX,printk(KERN_DEBUG "%s: i596_start_xmit(%x,%p) called\n",
dev->name, skb->len, skb->data));
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/a2065.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ static inline int lance_reset (struct net_device *dev)
load_csrs (lp);

lance_init_ring (dev);
dev->trans_start = jiffies;
dev->trans_start = jiffies; /* prevent tx timeout */
netif_start_queue(dev);

status = init_restart_lance (lp);
Expand Down Expand Up @@ -588,7 +588,6 @@ static netdev_tx_t lance_start_xmit (struct sk_buff *skb,

/* Kick the lance: transmit now */
ll->rdp = LE_C0_INEA | LE_C0_TDMD;
dev->trans_start = jiffies;
dev_kfree_skb (skb);

local_irq_restore(flags);
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/amd8111e.c
Original file line number Diff line number Diff line change
Expand Up @@ -1339,8 +1339,6 @@ static netdev_tx_t amd8111e_start_xmit(struct sk_buff *skb,
writel( VAL1 | TDMD0, lp->mmio + CMD0);
writel( VAL2 | RDMD0,lp->mmio + CMD0);

dev->trans_start = jiffies;

if(amd8111e_tx_queue_avail(lp) < 0){
netif_stop_queue(dev);
}
Expand Down
5 changes: 2 additions & 3 deletions drivers/net/appletalk/cops.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ static void cops_timeout(struct net_device *dev)
}
printk(KERN_WARNING "%s: Transmit timed out.\n", dev->name);
cops_jumpstart(dev); /* Restart the card. */
dev->trans_start = jiffies;
dev->trans_start = jiffies; /* prevent tx timeout */
netif_wake_queue(dev);
}

Expand Down Expand Up @@ -919,9 +919,8 @@ static netdev_tx_t cops_send_packet(struct sk_buff *skb,
/* Done sending packet, update counters and cleanup. */
dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len;
dev->trans_start = jiffies;
dev_kfree_skb (skb);
return NETDEV_TX_OK;
return NETDEV_TX_OK;
}

/*
Expand Down
1 change: 0 additions & 1 deletion drivers/net/arcnet/arcnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,6 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
}
}
retval = NETDEV_TX_OK;
dev->trans_start = jiffies;
lp->next_tx = txbuf;
} else {
retval = NETDEV_TX_BUSY;
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/ariadne.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,6 @@ static netdev_tx_t ariadne_start_xmit(struct sk_buff *skb,
lance->RAP = CSR0; /* PCnet-ISA Controller Status */
lance->RDP = INEA|TDMD;

dev->trans_start = jiffies;

if (lowb(priv->tx_ring[(entry+1) % TX_RING_SIZE]->TMD1) != 0) {
netif_stop_queue(dev);
priv->tx_full = 1;
Expand Down
1 change: 0 additions & 1 deletion drivers/net/arm/am79c961a.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ am79c961_sendpacket(struct sk_buff *skb, struct net_device *dev)

spin_lock_irqsave(&priv->chip_lock, flags);
write_rreg (dev->base_addr, CSR0, CSR0_TDMD|CSR0_IENA);
dev->trans_start = jiffies;
spin_unlock_irqrestore(&priv->chip_lock, flags);

/*
Expand Down
1 change: 0 additions & 1 deletion drivers/net/arm/at91_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,6 @@ static int at91ether_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Set length of the packet in the Transmit Control register */
at91_emac_write(AT91_EMAC_TCR, skb->len);

dev->trans_start = jiffies;
} else {
printk(KERN_ERR "at91_ether.c: at91ether_start_xmit() called, but device is busy!\n");
return NETDEV_TX_BUSY; /* if we return anything but zero, dev.c:1055 calls kfree_skb(skb)
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/arm/ep93xx_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,6 @@ static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev)
skb->len, DMA_TO_DEVICE);
dev_kfree_skb(skb);

dev->trans_start = jiffies;

spin_lock_irq(&ep->tx_pending_lock);
ep->tx_pending++;
if (ep->tx_pending == TX_QUEUE_ENTRIES)
Expand Down
1 change: 0 additions & 1 deletion drivers/net/arm/ether1.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,6 @@ ether1_sendpacket (struct sk_buff *skb, struct net_device *dev)
local_irq_restore(flags);

/* handle transmit */
dev->trans_start = jiffies;

/* check to see if we have room for a full sized ether frame */
tmp = priv(dev)->tx_head;
Expand Down
1 change: 0 additions & 1 deletion drivers/net/arm/ether3.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,6 @@ ether3_sendpacket(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_BUSY; /* unable to queue */
}

dev->trans_start = jiffies;
ptr = 0x600 * priv(dev)->tx_head;
priv(dev)->tx_head = next_ptr;
next_ptr *= 0x600;
Expand Down
1 change: 0 additions & 1 deletion drivers/net/arm/ixp4xx_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,6 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev)
/* NPE firmware pads short frames with zeros internally */
wmb();
queue_put_desc(TX_QUEUE(port->id), tx_desc_phys(port, n), desc);
dev->trans_start = jiffies;

if (qmgr_stat_below_low_watermark(txreadyq)) { /* empty */
#if DEBUG_TX
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/arm/ks8695net.c
Original file line number Diff line number Diff line change
Expand Up @@ -1302,8 +1302,6 @@ ks8695_start_xmit(struct sk_buff *skb, struct net_device *ndev)
if (++ksp->tx_ring_used == MAX_TX_DESC)
netif_stop_queue(ndev);

ndev->trans_start = jiffies;

/* Kick the TX DMA in case it decided to go IDLE */
ks8695_writereg(ksp, KS8695_DTSC, 0);

Expand Down
6 changes: 2 additions & 4 deletions drivers/net/arm/w90p910_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ static void w90p910_reset_mac(struct net_device *dev)

w90p910_init_desc(dev);

dev->trans_start = jiffies;
dev->trans_start = jiffies; /* prevent tx timeout */
ether->cur_tx = 0x0;
ether->finish_tx = 0x0;
ether->cur_rx = 0x0;
Expand All @@ -497,7 +497,7 @@ static void w90p910_reset_mac(struct net_device *dev)
w90p910_trigger_tx(dev);
w90p910_trigger_rx(dev);

dev->trans_start = jiffies;
dev->trans_start = jiffies; /* prevent tx timeout */

if (netif_queue_stopped(dev))
netif_wake_queue(dev);
Expand Down Expand Up @@ -634,8 +634,6 @@ static int w90p910_send_frame(struct net_device *dev,

txbd = &ether->tdesc->desclist[ether->cur_tx];

dev->trans_start = jiffies;

if (txbd->mode & TX_OWEN_DMA)
netif_stop_queue(dev);

Expand Down
3 changes: 1 addition & 2 deletions drivers/net/at1700.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ static void net_tx_timeout (struct net_device *dev)
outb (0x00, ioaddr + TX_START);
outb (0x03, ioaddr + COL16CNTL);

dev->trans_start = jiffies;
dev->trans_start = jiffies; /* prevent tx timeout */

lp->tx_started = 0;
lp->tx_queue_ready = 1;
Expand Down Expand Up @@ -636,7 +636,6 @@ static netdev_tx_t net_send_packet (struct sk_buff *skb,
outb (0x80 | lp->tx_queue, ioaddr + TX_START);
lp->tx_queue = 0;
lp->tx_queue_len = 0;
dev->trans_start = jiffies;
lp->tx_started = 1;
netif_start_queue (dev);
} else if (lp->tx_queue_len < 4096 - 1502)
Expand Down
5 changes: 2 additions & 3 deletions drivers/net/atarilance.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,8 @@ static void lance_tx_timeout (struct net_device *dev)
/* lance_restart, essentially */
lance_init_ring(dev);
REGA( CSR0 ) = CSR0_INEA | CSR0_INIT | CSR0_STRT;
dev->trans_start = jiffies;
netif_wake_queue (dev);
dev->trans_start = jiffies; /* prevent tx timeout */
netif_wake_queue(dev);
}

/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
Expand Down Expand Up @@ -836,7 +836,6 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )

/* Trigger an immediate send poll. */
DREG = CSR0_INEA | CSR0_TDMD;
dev->trans_start = jiffies;

if ((MEM->tx_head[(entry+1) & TX_RING_MOD_MASK].flag & TMD1_OWN) ==
TMD1_OWN_HOST)
Expand Down
1 change: 0 additions & 1 deletion drivers/net/atlx/atl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,6 @@ static netdev_tx_t atl2_xmit_frame(struct sk_buff *skb,
(adapter->txd_write_ptr >> 2));

mmiowb();
netdev->trans_start = jiffies;
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
}
Expand Down
Loading

0 comments on commit 1ae5dc3

Please sign in to comment.