Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103388
b: refs/heads/master
c: b0e1e64
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Jul 9, 2008
1 parent 325ccd5 commit bee7817
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 78 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 555353cfa1aee293de445bfa6de43276138ddd82
refs/heads/master: b0e1e6462df3c5944010b3328a546d8fe5d932cd
2 changes: 1 addition & 1 deletion trunk/drivers/isdn/i4l/isdn_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ isdn_net_unbind_channel(isdn_net_local * lp)
BEWARE! This chunk of code cannot be called from hardware
interrupt handler. I hope it is true. --ANK
*/
qdisc_reset(lp->netdev->dev->qdisc);
qdisc_reset(lp->netdev->dev->tx_queue.qdisc);
}
lp->dialstate = 0;
dev->rx_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL;
Expand Down
10 changes: 3 additions & 7 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ static inline void napi_synchronize(const struct napi_struct *n)
struct netdev_queue {
spinlock_t lock;
struct net_device *dev;
struct Qdisc *qdisc;
struct Qdisc *qdisc_sleeping;
struct list_head qdisc_list;
};

/*
Expand Down Expand Up @@ -634,13 +637,6 @@ struct net_device

struct Qdisc *qdisc_ingress;

/*
* Cache line mostly used on queue transmit path (qdisc)
*/
/* device queue lock */
struct Qdisc *qdisc;
struct Qdisc *qdisc_sleeping;
struct list_head qdisc_list;
unsigned long tx_queue_len; /* Max frames per queue allowed */

/* Partially transmitted GSO packet. */
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/net/irda/irda_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ int irda_device_is_receiving(struct net_device *dev);
/* Interface for internal use */
static inline int irda_device_txqueue_empty(const struct net_device *dev)
{
return skb_queue_empty(&dev->qdisc->q);
return skb_queue_empty(&dev->tx_queue.qdisc->q);
}
int irda_device_set_raw_mode(struct net_device* self, int status);
struct net_device *alloc_irdadev(int sizeof_priv);
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1720,14 +1720,14 @@ int dev_queue_xmit(struct sk_buff *skb)
* also serializes access to the device queue.
*/

q = rcu_dereference(dev->qdisc);
q = rcu_dereference(txq->qdisc);
#ifdef CONFIG_NET_CLS_ACT
skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_EGRESS);
#endif
if (q->enqueue) {
/* Grab device queue */
spin_lock(&txq->lock);
q = dev->qdisc;
q = txq->qdisc;
if (q->enqueue) {
/* reset queue_mapping to zero */
skb_set_queue_mapping(skb, 0);
Expand Down
8 changes: 6 additions & 2 deletions trunk/net/core/link_watch.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ static void rfc2863_policy(struct net_device *dev)

static int linkwatch_urgent_event(struct net_device *dev)
{
struct netdev_queue *txq = &dev->tx_queue;

return netif_running(dev) && netif_carrier_ok(dev) &&
dev->qdisc != dev->qdisc_sleeping;
txq->qdisc != txq->qdisc_sleeping;
}


Expand Down Expand Up @@ -181,7 +183,9 @@ static void __linkwatch_run_queue(int urgent_only)
rfc2863_policy(dev);
if (dev->flags & IFF_UP) {
if (netif_carrier_ok(dev)) {
WARN_ON(dev->qdisc_sleeping == &noop_qdisc);
struct netdev_queue *txq = &dev->tx_queue;

WARN_ON(txq->qdisc_sleeping == &noop_qdisc);
dev_activate(dev);
} else
dev_deactivate(dev);
Expand Down
6 changes: 4 additions & 2 deletions trunk/net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
int type, u32 pid, u32 seq, u32 change,
unsigned int flags)
{
struct netdev_queue *txq;
struct ifinfomsg *ifm;
struct nlmsghdr *nlh;
struct net_device_stats *stats;
Expand Down Expand Up @@ -635,8 +636,9 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
if (dev->master)
NLA_PUT_U32(skb, IFLA_MASTER, dev->master->ifindex);

if (dev->qdisc_sleeping)
NLA_PUT_STRING(skb, IFLA_QDISC, dev->qdisc_sleeping->ops->id);
txq = &dev->tx_queue;
if (txq->qdisc_sleeping)
NLA_PUT_STRING(skb, IFLA_QDISC, txq->qdisc_sleeping->ops->id);

if (1) {
struct rtnl_link_ifmap map = {
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTER
/* Check if a valid qdisc is available */
static inline int addrconf_qdisc_ok(struct net_device *dev)
{
return (dev->qdisc != &noop_qdisc);
struct netdev_queue *txq = &dev->tx_queue;
return (txq->qdisc != &noop_qdisc);
}

/* Check if a route is valid prefix route */
Expand Down
20 changes: 13 additions & 7 deletions trunk/net/mac80211/wme.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,10 @@ static struct Qdisc_ops wme_qdisc_ops __read_mostly =

void ieee80211_install_qdisc(struct net_device *dev)
{
struct netdev_queue *txq = &dev->tx_queue;
struct Qdisc *qdisc;

qdisc = qdisc_create_dflt(dev, &dev->tx_queue,
qdisc = qdisc_create_dflt(dev, txq,
&wme_qdisc_ops, TC_H_ROOT);
if (!qdisc) {
printk(KERN_ERR "%s: qdisc installation failed\n", dev->name);
Expand All @@ -587,15 +588,17 @@ void ieee80211_install_qdisc(struct net_device *dev)
qdisc->handle = 0x80010000;

qdisc_lock_tree(dev);
list_add_tail(&qdisc->list, &dev->qdisc_list);
dev->qdisc_sleeping = qdisc;
list_add_tail(&qdisc->list, &txq->qdisc_list);
txq->qdisc_sleeping = qdisc;
qdisc_unlock_tree(dev);
}


int ieee80211_qdisc_installed(struct net_device *dev)
{
return dev->qdisc_sleeping->ops == &wme_qdisc_ops;
struct netdev_queue *txq = &dev->tx_queue;

return txq->qdisc_sleeping->ops == &wme_qdisc_ops;
}


Expand All @@ -614,8 +617,9 @@ int ieee80211_ht_agg_queue_add(struct ieee80211_local *local,
struct sta_info *sta, u16 tid)
{
int i;
struct netdev_queue *txq = &local->mdev->tx_queue;
struct ieee80211_sched_data *q =
qdisc_priv(local->mdev->qdisc_sleeping);
qdisc_priv(txq->qdisc_sleeping);
DECLARE_MAC_BUF(mac);

/* prepare the filter and save it for the SW queue
Expand Down Expand Up @@ -655,8 +659,9 @@ void ieee80211_ht_agg_queue_remove(struct ieee80211_local *local,
u8 requeue)
{
struct ieee80211_hw *hw = &local->hw;
struct netdev_queue *txq = &local->mdev->tx_queue;
struct ieee80211_sched_data *q =
qdisc_priv(local->mdev->qdisc_sleeping);
qdisc_priv(txq->qdisc_sleeping);
int agg_queue = sta->tid_to_tx_q[tid];

/* return the qdisc to the pool */
Expand All @@ -671,7 +676,8 @@ void ieee80211_ht_agg_queue_remove(struct ieee80211_local *local,

void ieee80211_requeue(struct ieee80211_local *local, int queue)
{
struct Qdisc *root_qd = local->mdev->qdisc_sleeping;
struct netdev_queue *txq = &local->mdev->tx_queue;
struct Qdisc *root_qd = txq->qdisc_sleeping;
struct ieee80211_sched_data *q = qdisc_priv(root_qd);
struct Qdisc *qdisc = q->queues[queue];
struct sk_buff *skb = NULL;
Expand Down
7 changes: 5 additions & 2 deletions trunk/net/sched/cls_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)

/* Find qdisc */
if (!parent) {
q = dev->qdisc_sleeping;
struct netdev_queue *dev_queue = &dev->tx_queue;
q = dev_queue->qdisc_sleeping;
parent = q->handle;
} else {
q = qdisc_lookup(dev, TC_H_MAJ(t->tcm_parent));
Expand Down Expand Up @@ -390,6 +391,7 @@ static int tcf_node_dump(struct tcf_proto *tp, unsigned long n,
static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = sock_net(skb->sk);
struct netdev_queue *dev_queue;
int t;
int s_t;
struct net_device *dev;
Expand All @@ -408,8 +410,9 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
if ((dev = dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)
return skb->len;

dev_queue = &dev->tx_queue;
if (!tcm->tcm_parent)
q = dev->qdisc_sleeping;
q = dev_queue->qdisc_sleeping;
else
q = qdisc_lookup(dev, TC_H_MAJ(tcm->tcm_parent));
if (!q)
Expand Down
34 changes: 22 additions & 12 deletions trunk/net/sched/sch_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,10 @@ EXPORT_SYMBOL(unregister_qdisc);

struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle)
{
struct netdev_queue *dev_queue = &dev->tx_queue;
struct Qdisc *q;

list_for_each_entry(q, &dev->qdisc_list, list) {
list_for_each_entry(q, &dev_queue->qdisc_list, list) {
if (q->handle == handle)
return q;
}
Expand Down Expand Up @@ -441,6 +442,7 @@ static u32 qdisc_alloc_handle(struct net_device *dev)
static struct Qdisc *
dev_graft_qdisc(struct net_device *dev, struct Qdisc *qdisc)
{
struct netdev_queue *dev_queue;
struct Qdisc *oqdisc;

if (dev->flags & IFF_UP)
Expand All @@ -459,8 +461,8 @@ dev_graft_qdisc(struct net_device *dev, struct Qdisc *qdisc)
}

} else {

oqdisc = dev->qdisc_sleeping;
dev_queue = &dev->tx_queue;
oqdisc = dev_queue->qdisc_sleeping;

/* Prune old scheduler */
if (oqdisc && atomic_read(&oqdisc->refcnt) <= 1)
Expand All @@ -469,8 +471,8 @@ dev_graft_qdisc(struct net_device *dev, struct Qdisc *qdisc)
/* ... and graft new one */
if (qdisc == NULL)
qdisc = &noop_qdisc;
dev->qdisc_sleeping = qdisc;
dev->qdisc = &noop_qdisc;
dev_queue->qdisc_sleeping = qdisc;
dev_queue->qdisc = &noop_qdisc;
}

qdisc_unlock_tree(dev);
Expand Down Expand Up @@ -633,7 +635,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
}
}
qdisc_lock_tree(dev);
list_add_tail(&sch->list, &dev->qdisc_list);
list_add_tail(&sch->list, &dev_queue->qdisc_list);
qdisc_unlock_tree(dev);

return sch;
Expand Down Expand Up @@ -740,7 +742,8 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
q = dev->qdisc_ingress;
}
} else {
q = dev->qdisc_sleeping;
struct netdev_queue *dev_queue = &dev->tx_queue;
q = dev_queue->qdisc_sleeping;
}
if (!q)
return -ENOENT;
Expand Down Expand Up @@ -814,7 +817,8 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
q = dev->qdisc_ingress;
}
} else {
q = dev->qdisc_sleeping;
struct netdev_queue *dev_queue = &dev->tx_queue;
q = dev_queue->qdisc_sleeping;
}

/* It may be default qdisc, ignore it */
Expand Down Expand Up @@ -1015,12 +1019,14 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
read_lock(&dev_base_lock);
idx = 0;
for_each_netdev(&init_net, dev) {
struct netdev_queue *dev_queue;
if (idx < s_idx)
goto cont;
if (idx > s_idx)
s_q_idx = 0;
q_idx = 0;
list_for_each_entry(q, &dev->qdisc_list, list) {
dev_queue = &dev->tx_queue;
list_for_each_entry(q, &dev_queue->qdisc_list, list) {
if (q_idx < s_q_idx) {
q_idx++;
continue;
Expand Down Expand Up @@ -1054,6 +1060,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
{
struct net *net = sock_net(skb->sk);
struct netdev_queue *dev_queue;
struct tcmsg *tcm = NLMSG_DATA(n);
struct nlattr *tca[TCA_MAX + 1];
struct net_device *dev;
Expand Down Expand Up @@ -1091,6 +1098,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)

/* Step 1. Determine qdisc handle X:0 */

dev_queue = &dev->tx_queue;
if (pid != TC_H_ROOT) {
u32 qid1 = TC_H_MAJ(pid);

Expand All @@ -1101,7 +1109,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
} else if (qid1) {
qid = qid1;
} else if (qid == 0)
qid = dev->qdisc_sleeping->handle;
qid = dev_queue->qdisc_sleeping->handle;

/* Now qid is genuine qdisc handle consistent
both with parent and child.
Expand All @@ -1112,7 +1120,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
pid = TC_H_MAKE(qid, pid);
} else {
if (qid == 0)
qid = dev->qdisc_sleeping->handle;
qid = dev_queue->qdisc_sleeping->handle;
}

/* OK. Locate qdisc */
Expand Down Expand Up @@ -1248,6 +1256,7 @@ static int qdisc_class_dump(struct Qdisc *q, unsigned long cl, struct qdisc_walk
static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = sock_net(skb->sk);
struct netdev_queue *dev_queue;
int t;
int s_t;
struct net_device *dev;
Expand All @@ -1266,7 +1275,8 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
s_t = cb->args[0];
t = 0;

list_for_each_entry(q, &dev->qdisc_list, list) {
dev_queue = &dev->tx_queue;
list_for_each_entry(q, &dev_queue->qdisc_list, list) {
if (t < s_t || !q->ops->cl_ops ||
(tcm->tcm_parent &&
TC_H_MAJ(tcm->tcm_parent) != q->handle)) {
Expand Down
Loading

0 comments on commit bee7817

Please sign in to comment.