aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2009-05-17 23:55:16 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-17 23:55:16 -0400
commit9d21493b4beb8f918ba248032fefa393074a5e2b (patch)
tree653590f3e325da5c4c1fc7d2c00bc196a3167f9d /include/linux/netdevice.h
parent0a305720ee597aad41af61e6b6844321d3e24251 (diff)
net: tx scalability works : trans_start
struct net_device trans_start field is a hot spot on SMP and high performance devices, particularly multi queues ones, because every transmitter dirties it. Is main use is tx watchdog and bonding alive checks. But as most devices dont use NETIF_F_LLTX, we have to lock a netdev_queue before calling their ndo_start_xmit(). So it makes sense to move trans_start from net_device to netdev_queue. Its update will occur on a already present (and in exclusive state) cache line, for free. We can do this transition smoothly. An old driver continue to update dev->trans_start, while an updated one updates txq->trans_start. Further patches could also put tx_bytes/tx_packets counters in netdev_queue to avoid dirtying dev->stats (vlan device comes to mind) Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 2af89b662cad..cd547d04a8ce 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -470,6 +470,10 @@ struct netdev_queue {
470 */ 470 */
471 spinlock_t _xmit_lock ____cacheline_aligned_in_smp; 471 spinlock_t _xmit_lock ____cacheline_aligned_in_smp;
472 int xmit_lock_owner; 472 int xmit_lock_owner;
473 /*
474 * please use this field instead of dev->trans_start
475 */
476 unsigned long trans_start;
473} ____cacheline_aligned_in_smp; 477} ____cacheline_aligned_in_smp;
474 478
475 479
@@ -819,6 +823,11 @@ struct net_device
819 * One part is mostly used on xmit path (device) 823 * One part is mostly used on xmit path (device)
820 */ 824 */
821 /* These may be needed for future network-power-down code. */ 825 /* These may be needed for future network-power-down code. */
826
827 /*
828 * trans_start here is expensive for high speed devices on SMP,
829 * please use netdev_queue->trans_start instead.
830 */
822 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 831 unsigned long trans_start; /* Time (in jiffies) of last Tx */
823 832
824 int watchdog_timeo; /* used by dev_watchdog() */ 833 int watchdog_timeo; /* used by dev_watchdog() */
@@ -1541,6 +1550,8 @@ static inline int netif_carrier_ok(const struct net_device *dev)
1541 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); 1550 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
1542} 1551}
1543 1552
1553extern unsigned long dev_trans_start(struct net_device *dev);
1554
1544extern void __netdev_watchdog_up(struct net_device *dev); 1555extern void __netdev_watchdog_up(struct net_device *dev);
1545 1556
1546extern void netif_carrier_on(struct net_device *dev); 1557extern void netif_carrier_on(struct net_device *dev);