提交 ab35cd4b 编写于 作者: E Eric Dumazet 提交者: David S. Miller

sch_teql: Use net_device internal stats

We can slightly reduce size of teqlN structure, not duplicating stats
structure in teql_master but using stats field from net_device.stats
for tx_errors and from netdev_queue for tx_bytes/tx_packets/tx_dropped
values.
Signed-off-by: NEric Dumazet <dada1@cosmosbay.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0cefafad
...@@ -58,7 +58,6 @@ struct teql_master ...@@ -58,7 +58,6 @@ struct teql_master
struct net_device *dev; struct net_device *dev;
struct Qdisc *slaves; struct Qdisc *slaves;
struct list_head master_list; struct list_head master_list;
struct net_device_stats stats;
}; };
struct teql_sched_data struct teql_sched_data
...@@ -272,6 +271,7 @@ static inline int teql_resolve(struct sk_buff *skb, ...@@ -272,6 +271,7 @@ static inline int teql_resolve(struct sk_buff *skb,
static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev) static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct teql_master *master = netdev_priv(dev); struct teql_master *master = netdev_priv(dev);
struct netdev_queue *txq = netdev_get_tx_queue(dev, 0);
struct Qdisc *start, *q; struct Qdisc *start, *q;
int busy; int busy;
int nores; int nores;
...@@ -311,8 +311,8 @@ static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -311,8 +311,8 @@ static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
__netif_tx_unlock(slave_txq); __netif_tx_unlock(slave_txq);
master->slaves = NEXT_SLAVE(q); master->slaves = NEXT_SLAVE(q);
netif_wake_queue(dev); netif_wake_queue(dev);
master->stats.tx_packets++; txq->tx_packets++;
master->stats.tx_bytes += length; txq->tx_bytes += length;
return 0; return 0;
} }
__netif_tx_unlock(slave_txq); __netif_tx_unlock(slave_txq);
...@@ -339,10 +339,10 @@ static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -339,10 +339,10 @@ static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
netif_stop_queue(dev); netif_stop_queue(dev);
return 1; return 1;
} }
master->stats.tx_errors++; dev->stats.tx_errors++;
drop: drop:
master->stats.tx_dropped++; txq->tx_dropped++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
return 0; return 0;
} }
...@@ -395,12 +395,6 @@ static int teql_master_close(struct net_device *dev) ...@@ -395,12 +395,6 @@ static int teql_master_close(struct net_device *dev)
return 0; return 0;
} }
static struct net_device_stats *teql_master_stats(struct net_device *dev)
{
struct teql_master *m = netdev_priv(dev);
return &m->stats;
}
static int teql_master_mtu(struct net_device *dev, int new_mtu) static int teql_master_mtu(struct net_device *dev, int new_mtu)
{ {
struct teql_master *m = netdev_priv(dev); struct teql_master *m = netdev_priv(dev);
...@@ -425,7 +419,6 @@ static const struct net_device_ops teql_netdev_ops = { ...@@ -425,7 +419,6 @@ static const struct net_device_ops teql_netdev_ops = {
.ndo_open = teql_master_open, .ndo_open = teql_master_open,
.ndo_stop = teql_master_close, .ndo_stop = teql_master_close,
.ndo_start_xmit = teql_master_xmit, .ndo_start_xmit = teql_master_xmit,
.ndo_get_stats = teql_master_stats,
.ndo_change_mtu = teql_master_mtu, .ndo_change_mtu = teql_master_mtu,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册