浏览代码

net: dont update dev->trans_start

Second round of drivers for Gb cards (and NIU one I forgot in the 10GB round)

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>
Eric Dumazet 16 年之前
父节点
当前提交
cdd0db058d

+ 0 - 1
drivers/net/acenic.c

@@ -2573,7 +2573,6 @@ restart:
 			netif_wake_queue(dev);
 			netif_wake_queue(dev);
 	}
 	}
 
 
-	dev->trans_start = jiffies;
 	return NETDEV_TX_OK;
 	return NETDEV_TX_OK;
 
 
 overflow:
 overflow:

+ 0 - 1
drivers/net/atl1c/atl1c_main.c

@@ -2113,7 +2113,6 @@ static int atl1c_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 	atl1c_tx_map(adapter, skb, tpd, type);
 	atl1c_tx_map(adapter, skb, tpd, type);
 	atl1c_tx_queue(adapter, skb, tpd, type);
 	atl1c_tx_queue(adapter, skb, tpd, type);
 
 
-	netdev->trans_start = jiffies;
 	spin_unlock_irqrestore(&adapter->tx_lock, flags);
 	spin_unlock_irqrestore(&adapter->tx_lock, flags);
 	return NETDEV_TX_OK;
 	return NETDEV_TX_OK;
 }
 }

+ 1 - 1
drivers/net/atl1e/atl1e_main.c

@@ -1893,7 +1893,7 @@ static int atl1e_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 	atl1e_tx_map(adapter, skb, tpd);
 	atl1e_tx_map(adapter, skb, tpd);
 	atl1e_tx_queue(adapter, tpd_req, tpd);
 	atl1e_tx_queue(adapter, tpd_req, tpd);
 
 
-	netdev->trans_start = jiffies;
+	netdev->trans_start = jiffies; /* NETIF_F_LLTX driver :( */
 	spin_unlock_irqrestore(&adapter->tx_lock, flags);
 	spin_unlock_irqrestore(&adapter->tx_lock, flags);
 	return NETDEV_TX_OK;
 	return NETDEV_TX_OK;
 }
 }

+ 0 - 1
drivers/net/atlx/atl1.c

@@ -2431,7 +2431,6 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 	atl1_tx_queue(adapter, count, ptpd);
 	atl1_tx_queue(adapter, count, ptpd);
 	atl1_update_mailbox(adapter);
 	atl1_update_mailbox(adapter);
 	mmiowb();
 	mmiowb();
-	netdev->trans_start = jiffies;
 	return NETDEV_TX_OK;
 	return NETDEV_TX_OK;
 }
 }
 
 

+ 0 - 1
drivers/net/bnx2.c

@@ -6211,7 +6211,6 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	mmiowb();
 	mmiowb();
 
 
 	txr->tx_prod = prod;
 	txr->tx_prod = prod;
-	dev->trans_start = jiffies;
 
 
 	if (unlikely(bnx2_tx_avail(bp, txr) <= MAX_SKB_FRAGS)) {
 	if (unlikely(bnx2_tx_avail(bp, txr) <= MAX_SKB_FRAGS)) {
 		netif_tx_stop_queue(txq);
 		netif_tx_stop_queue(txq);

+ 3 - 5
drivers/net/dl2k.c

@@ -539,7 +539,7 @@ rio_tx_timeout (struct net_device *dev)
 		dev->name, readl (ioaddr + TxStatus));
 		dev->name, readl (ioaddr + TxStatus));
 	rio_free_tx(dev, 0);
 	rio_free_tx(dev, 0);
 	dev->if_port = 0;
 	dev->if_port = 0;
-	dev->trans_start = jiffies;
+	dev->trans_start = jiffies; /* prevent tx timeout */
 }
 }
 
 
  /* allocate and initialize Tx and Rx descriptors */
  /* allocate and initialize Tx and Rx descriptors */
@@ -610,7 +610,7 @@ start_xmit (struct sk_buff *skb, struct net_device *dev)
 
 
 	if (np->link_status == 0) {	/* Link Down */
 	if (np->link_status == 0) {	/* Link Down */
 		dev_kfree_skb(skb);
 		dev_kfree_skb(skb);
-		return 0;
+		return NETDEV_TX_OK;
 	}
 	}
 	ioaddr = dev->base_addr;
 	ioaddr = dev->base_addr;
 	entry = np->cur_tx % TX_RING_SIZE;
 	entry = np->cur_tx % TX_RING_SIZE;
@@ -665,9 +665,7 @@ start_xmit (struct sk_buff *skb, struct net_device *dev)
 		writel (0, dev->base_addr + TFDListPtr1);
 		writel (0, dev->base_addr + TFDListPtr1);
 	}
 	}
 
 
-	/* NETDEV WATCHDOG timer */
-	dev->trans_start = jiffies;
-	return 0;
+	return NETDEV_TX_OK;
 }
 }
 
 
 static irqreturn_t
 static irqreturn_t

+ 0 - 1
drivers/net/e1000/e1000_main.c

@@ -3365,7 +3365,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 
 
 	if (count) {
 	if (count) {
 		e1000_tx_queue(adapter, tx_ring, tx_flags, count);
 		e1000_tx_queue(adapter, tx_ring, tx_flags, count);
-		netdev->trans_start = jiffies;
 		/* Make sure there is space in the ring for the next send. */
 		/* Make sure there is space in the ring for the next send. */
 		e1000_maybe_stop_tx(netdev, tx_ring, MAX_SKB_FRAGS + 2);
 		e1000_maybe_stop_tx(netdev, tx_ring, MAX_SKB_FRAGS + 2);
 
 

+ 0 - 1
drivers/net/e1000e/netdev.c

@@ -4149,7 +4149,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 	count = e1000_tx_map(adapter, skb, first, max_per_txd, nr_frags, mss);
 	count = e1000_tx_map(adapter, skb, first, max_per_txd, nr_frags, mss);
 	if (count) {
 	if (count) {
 		e1000_tx_queue(adapter, tx_flags, count);
 		e1000_tx_queue(adapter, tx_flags, count);
-		netdev->trans_start = jiffies;
 		/* Make sure there is space in the ring for the next send. */
 		/* Make sure there is space in the ring for the next send. */
 		e1000_maybe_stop_tx(netdev, MAX_SKB_FRAGS + 2);
 		e1000_maybe_stop_tx(netdev, MAX_SKB_FRAGS + 2);
 
 

+ 1 - 2
drivers/net/hamachi.c

@@ -1163,7 +1163,7 @@ static void hamachi_tx_timeout(struct net_device *dev)
 	hmp->rx_ring[RX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing);
 	hmp->rx_ring[RX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing);
 
 
 	/* Trigger an immediate transmit demand. */
 	/* Trigger an immediate transmit demand. */
-	dev->trans_start = jiffies;
+	dev->trans_start = jiffies; /* prevent tx timeout */
 	hmp->stats.tx_errors++;
 	hmp->stats.tx_errors++;
 
 
 	/* Restart the chip's Tx/Rx processes . */
 	/* Restart the chip's Tx/Rx processes . */
@@ -1364,7 +1364,6 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		hmp->tx_full = 1;
 		hmp->tx_full = 1;
 		netif_stop_queue(dev);
 		netif_stop_queue(dev);
 	}
 	}
-	dev->trans_start = jiffies;
 
 
 	if (hamachi_debug > 4) {
 	if (hamachi_debug > 4) {
 		printk(KERN_DEBUG "%s: Hamachi transmit frame #%d queued in slot %d.\n",
 		printk(KERN_DEBUG "%s: Hamachi transmit frame #%d queued in slot %d.\n",

+ 0 - 1
drivers/net/igb/igb_main.c

@@ -3344,7 +3344,6 @@ static int igb_xmit_frame_ring_adv(struct sk_buff *skb,
 	if (count) {
 	if (count) {
 		igb_tx_queue_adv(adapter, tx_ring, tx_flags, count,
 		igb_tx_queue_adv(adapter, tx_ring, tx_flags, count,
 			         skb->len, hdr_len);
 			         skb->len, hdr_len);
-		netdev->trans_start = jiffies;
 		/* Make sure there is space in the ring for the next send. */
 		/* Make sure there is space in the ring for the next send. */
 		igb_maybe_stop_tx(netdev, tx_ring, MAX_SKB_FRAGS + 4);
 		igb_maybe_stop_tx(netdev, tx_ring, MAX_SKB_FRAGS + 4);
 	} else {
 	} else {

+ 0 - 1
drivers/net/igbvf/netdev.c

@@ -2270,7 +2270,6 @@ static int igbvf_xmit_frame_ring_adv(struct sk_buff *skb,
 	if (count) {
 	if (count) {
 		igbvf_tx_queue_adv(adapter, tx_ring, tx_flags, count,
 		igbvf_tx_queue_adv(adapter, tx_ring, tx_flags, count,
 		                   skb->len, hdr_len);
 		                   skb->len, hdr_len);
-		netdev->trans_start = jiffies;
 		/* Make sure there is space in the ring for the next send. */
 		/* Make sure there is space in the ring for the next send. */
 		igbvf_maybe_stop_tx(netdev, MAX_SKB_FRAGS + 4);
 		igbvf_maybe_stop_tx(netdev, MAX_SKB_FRAGS + 4);
 	} else {
 	} else {

+ 0 - 1
drivers/net/jme.c

@@ -1939,7 +1939,6 @@ jme_start_xmit(struct sk_buff *skb, struct net_device *netdev)
 				TXCS_SELECT_QUEUE0 |
 				TXCS_SELECT_QUEUE0 |
 				TXCS_QUEUE0S |
 				TXCS_QUEUE0S |
 				TXCS_ENABLE);
 				TXCS_ENABLE);
-	netdev->trans_start = jiffies;
 
 
 	tx_dbg(jme, "xmit: %d+%d@%lu\n", idx,
 	tx_dbg(jme, "xmit: %d+%d@%lu\n", idx,
 			skb_shinfo(skb)->nr_frags + 2,
 			skb_shinfo(skb)->nr_frags + 2,

+ 0 - 2
drivers/net/niu.c

@@ -6777,8 +6777,6 @@ static int niu_start_xmit(struct sk_buff *skb, struct net_device *dev)
 			netif_tx_wake_queue(txq);
 			netif_tx_wake_queue(txq);
 	}
 	}
 
 
-	dev->trans_start = jiffies;
-
 out:
 out:
 	return NETDEV_TX_OK;
 	return NETDEV_TX_OK;
 
 

+ 2 - 4
drivers/net/ns83820.c

@@ -1204,9 +1204,7 @@ again:
 	if (stopped && (dev->tx_done_idx != tx_done_idx) && start_tx_okay(dev))
 	if (stopped && (dev->tx_done_idx != tx_done_idx) && start_tx_okay(dev))
 		netif_start_queue(ndev);
 		netif_start_queue(ndev);
 
 
-	/* set the transmit start time to catch transmit timeouts */
-	ndev->trans_start = jiffies;
-	return 0;
+	return NETDEV_TX_OK;
 }
 }
 
 
 static void ns83820_update_stats(struct ns83820 *dev)
 static void ns83820_update_stats(struct ns83820 *dev)
@@ -1626,7 +1624,7 @@ static void ns83820_tx_watch(unsigned long data)
 		);
 		);
 #endif
 #endif
 
 
-	if (time_after(jiffies, ndev->trans_start + 1*HZ) &&
+	if (time_after(jiffies, dev_trans_start(ndev) + 1*HZ) &&
 	    dev->tx_done_idx != dev->tx_free_idx) {
 	    dev->tx_done_idx != dev->tx_free_idx) {
 		printk(KERN_DEBUG "%s: ns83820_tx_watch: %u %u %d\n",
 		printk(KERN_DEBUG "%s: ns83820_tx_watch: %u %u %d\n",
 			ndev->name,
 			ndev->name,

+ 0 - 1
drivers/net/qla3xxx.c

@@ -2617,7 +2617,6 @@ static int ql3xxx_send(struct sk_buff *skb, struct net_device *ndev)
 			    &port_regs->CommonRegs.reqQProducerIndex,
 			    &port_regs->CommonRegs.reqQProducerIndex,
 			    qdev->req_producer_index);
 			    qdev->req_producer_index);
 
 
-	ndev->trans_start = jiffies;
 	if (netif_msg_tx_queued(qdev))
 	if (netif_msg_tx_queued(qdev))
 		printk(KERN_DEBUG PFX "%s: tx queued, slot %d, len %d\n",
 		printk(KERN_DEBUG PFX "%s: tx queued, slot %d, len %d\n",
 		       ndev->name, qdev->req_producer_index, skb->len);
 		       ndev->name, qdev->req_producer_index, skb->len);

+ 0 - 2
drivers/net/r8169.c

@@ -3279,8 +3279,6 @@ static int rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC));
 	status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC));
 	txd->opts1 = cpu_to_le32(status);
 	txd->opts1 = cpu_to_le32(status);
 
 
-	dev->trans_start = jiffies;
-
 	tp->cur_tx += frags + 1;
 	tp->cur_tx += frags + 1;
 
 
 	smp_wmb();
 	smp_wmb();

+ 0 - 2
drivers/net/sis190.c

@@ -1204,8 +1204,6 @@ static int sis190_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 
 	SIS_W32(TxControl, 0x1a00 | CmdReset | CmdTxEnb);
 	SIS_W32(TxControl, 0x1a00 | CmdReset | CmdTxEnb);
 
 
-	dev->trans_start = jiffies;
-
 	dirty_tx = tp->dirty_tx;
 	dirty_tx = tp->dirty_tx;
 	if ((tp->cur_tx - NUM_TX_DESC) == dirty_tx) {
 	if ((tp->cur_tx - NUM_TX_DESC) == dirty_tx) {
 		netif_stop_queue(dev);
 		netif_stop_queue(dev);

+ 0 - 2
drivers/net/skge.c

@@ -2837,8 +2837,6 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
 		netif_stop_queue(dev);
 		netif_stop_queue(dev);
 	}
 	}
 
 
-	dev->trans_start = jiffies;
-
 	return NETDEV_TX_OK;
 	return NETDEV_TX_OK;
 }
 }
 
 

+ 0 - 1
drivers/net/sky2.c

@@ -1690,7 +1690,6 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
 
 
 	sky2_put_idx(hw, txqaddr[sky2->port], sky2->tx_prod);
 	sky2_put_idx(hw, txqaddr[sky2->port], sky2->tx_prod);
 
 
-	dev->trans_start = jiffies;
 	return NETDEV_TX_OK;
 	return NETDEV_TX_OK;
 
 
 mapping_unwind:
 mapping_unwind:

+ 2 - 6
drivers/net/tg3.c

@@ -5194,9 +5194,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	}
 	}
 
 
 out_unlock:
 out_unlock:
-    	mmiowb();
-
-	dev->trans_start = jiffies;
+	mmiowb();
 
 
 	return NETDEV_TX_OK;
 	return NETDEV_TX_OK;
 }
 }
@@ -5407,9 +5405,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
 	}
 	}
 
 
 out_unlock:
 out_unlock:
-    	mmiowb();
-
-	dev->trans_start = jiffies;
+	mmiowb();
 
 
 	return NETDEV_TX_OK;
 	return NETDEV_TX_OK;
 }
 }

+ 1 - 2
drivers/net/yellowfin.c

@@ -717,7 +717,7 @@ static void yellowfin_tx_timeout(struct net_device *dev)
 	if (yp->cur_tx - yp->dirty_tx < TX_QUEUE_SIZE)
 	if (yp->cur_tx - yp->dirty_tx < TX_QUEUE_SIZE)
 		netif_wake_queue (dev);		/* Typical path */
 		netif_wake_queue (dev);		/* Typical path */
 
 
-	dev->trans_start = jiffies;
+	dev->trans_start = jiffies; /* prevent tx timeout */
 	dev->stats.tx_errors++;
 	dev->stats.tx_errors++;
 }
 }
 
 
@@ -876,7 +876,6 @@ static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		netif_start_queue (dev);		/* Typical path */
 		netif_start_queue (dev);		/* Typical path */
 	else
 	else
 		yp->tx_full = 1;
 		yp->tx_full = 1;
-	dev->trans_start = jiffies;
 
 
 	if (yellowfin_debug > 4) {
 	if (yellowfin_debug > 4) {
 		printk(KERN_DEBUG "%s: Yellowfin transmit frame #%d queued in slot %d.\n",
 		printk(KERN_DEBUG "%s: Yellowfin transmit frame #%d queued in slot %d.\n",