Skip to content

Commit

Permalink
net: remove dev->trans_start
Browse files Browse the repository at this point in the history
previous patches removed all direct accesses to dev->trans_start,
so change the netif_trans_update helper to update trans_start of
netdev queue 0 instead and then remove trans_start from struct net_device.

AFAICS a lot of the netif_trans_update() invocations are now useless
because they occur in ndo_start_xmit and driver doesn't set LLTX
(i.e. stack already took care of the update).

As I can't test any of them it seems better to just leave them alone.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Westphal authored and David S. Miller committed May 4, 2016
1 parent 860e953 commit 9b36627
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/i40e/i40e_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static void i40e_tx_timeout(struct net_device *netdev)
unsigned long trans_start;

q = netdev_get_tx_queue(netdev, i);
trans_start = q->trans_start ? : netdev->trans_start;
trans_start = q->trans_start;
if (netif_xmit_stopped(q) &&
time_after(jiffies,
(trans_start + netdev->watchdog_timeo))) {
Expand Down
15 changes: 5 additions & 10 deletions include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ struct netdev_queue {
spinlock_t _xmit_lock ____cacheline_aligned_in_smp;
int xmit_lock_owner;
/*
* please use this field instead of dev->trans_start
* Time (in jiffies) of last Tx
*/
unsigned long trans_start;

Expand Down Expand Up @@ -1545,7 +1545,6 @@ enum netdev_priv_flags {
*
* @offload_fwd_mark: Offload device fwding mark
*
* @trans_start: Time (in jiffies) of last Tx
* @watchdog_timeo: Represents the timeout that is used by
* the watchdog (see dev_watchdog())
* @watchdog_timer: List of timers
Expand Down Expand Up @@ -1794,13 +1793,6 @@ struct net_device {
#endif

/* These may be needed for future network-power-down code. */

/*
* trans_start here is expensive for high speed devices on SMP,
* please use netdev_queue->trans_start instead.
*/
unsigned long trans_start;

struct timer_list watchdog_timer;

int __percpu *pcpu_refcnt;
Expand Down Expand Up @@ -3484,7 +3476,10 @@ static inline void txq_trans_update(struct netdev_queue *txq)
/* legacy drivers only, netdev_start_xmit() sets txq->trans_start */
static inline void netif_trans_update(struct net_device *dev)
{
dev->trans_start = jiffies;
struct netdev_queue *txq = netdev_get_tx_queue(dev, 0);

if (txq->trans_start != jiffies)
txq->trans_start = jiffies;
}

/**
Expand Down
10 changes: 3 additions & 7 deletions net/sched/sch_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,12 @@ unsigned long dev_trans_start(struct net_device *dev)

if (is_vlan_dev(dev))
dev = vlan_dev_real_dev(dev);
res = dev->trans_start;
for (i = 0; i < dev->num_tx_queues; i++) {
res = netdev_get_tx_queue(dev, 0)->trans_start;
for (i = 1; i < dev->num_tx_queues; i++) {
val = netdev_get_tx_queue(dev, i)->trans_start;
if (val && time_after(val, res))
res = val;
}
dev->trans_start = res;

return res;
}
Expand All @@ -256,10 +255,7 @@ static void dev_watchdog(unsigned long arg)
struct netdev_queue *txq;

txq = netdev_get_tx_queue(dev, i);
/*
* old device drivers set dev->trans_start
*/
trans_start = txq->trans_start ? : dev->trans_start;
trans_start = txq->trans_start;
if (netif_xmit_stopped(txq) &&
time_after(jiffies, (trans_start +
dev->watchdog_timeo))) {
Expand Down

0 comments on commit 9b36627

Please sign in to comment.