Commit 72b25a91 authored by David S. Miller's avatar David S. Miller

pkt_sched: Get rid of u32_list.

The u32_list is just an indirect way of maintaining a reference
to a U32 node on a per-qdisc basis.

Just add an explicit node pointer for u32 to struct Qdisc an do
away with this global list.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8913336a
...@@ -56,6 +56,8 @@ struct Qdisc ...@@ -56,6 +56,8 @@ struct Qdisc
int (*reshape_fail)(struct sk_buff *skb, int (*reshape_fail)(struct sk_buff *skb,
struct Qdisc *q); struct Qdisc *q);
void *u32_node;
/* This field is deprecated, but it is still used by CBQ /* This field is deprecated, but it is still used by CBQ
* and it will live until better solution will be invented. * and it will live until better solution will be invented.
*/ */
......
...@@ -75,7 +75,6 @@ struct tc_u_hnode ...@@ -75,7 +75,6 @@ struct tc_u_hnode
struct tc_u_common struct tc_u_common
{ {
struct tc_u_common *next;
struct tc_u_hnode *hlist; struct tc_u_hnode *hlist;
struct Qdisc *q; struct Qdisc *q;
int refcnt; int refcnt;
...@@ -87,8 +86,6 @@ static const struct tcf_ext_map u32_ext_map = { ...@@ -87,8 +86,6 @@ static const struct tcf_ext_map u32_ext_map = {
.police = TCA_U32_POLICE .police = TCA_U32_POLICE
}; };
static struct tc_u_common *u32_list;
static __inline__ unsigned u32_hash_fold(__be32 key, struct tc_u32_sel *sel, u8 fshift) static __inline__ unsigned u32_hash_fold(__be32 key, struct tc_u32_sel *sel, u8 fshift)
{ {
unsigned h = ntohl(key & sel->hmask)>>fshift; unsigned h = ntohl(key & sel->hmask)>>fshift;
...@@ -287,9 +284,7 @@ static int u32_init(struct tcf_proto *tp) ...@@ -287,9 +284,7 @@ static int u32_init(struct tcf_proto *tp)
struct tc_u_hnode *root_ht; struct tc_u_hnode *root_ht;
struct tc_u_common *tp_c; struct tc_u_common *tp_c;
for (tp_c = u32_list; tp_c; tp_c = tp_c->next) tp_c = tp->q->u32_node;
if (tp_c->q == tp->q)
break;
root_ht = kzalloc(sizeof(*root_ht), GFP_KERNEL); root_ht = kzalloc(sizeof(*root_ht), GFP_KERNEL);
if (root_ht == NULL) if (root_ht == NULL)
...@@ -307,8 +302,7 @@ static int u32_init(struct tcf_proto *tp) ...@@ -307,8 +302,7 @@ static int u32_init(struct tcf_proto *tp)
return -ENOBUFS; return -ENOBUFS;
} }
tp_c->q = tp->q; tp_c->q = tp->q;
tp_c->next = u32_list; tp->q->u32_node = tp_c;
u32_list = tp_c;
} }
tp_c->refcnt++; tp_c->refcnt++;
...@@ -402,14 +396,8 @@ static void u32_destroy(struct tcf_proto *tp) ...@@ -402,14 +396,8 @@ static void u32_destroy(struct tcf_proto *tp)
if (--tp_c->refcnt == 0) { if (--tp_c->refcnt == 0) {
struct tc_u_hnode *ht; struct tc_u_hnode *ht;
struct tc_u_common **tp_cp;
for (tp_cp = &u32_list; *tp_cp; tp_cp = &(*tp_cp)->next) { tp->q->u32_node = NULL;
if (*tp_cp == tp_c) {
*tp_cp = tp_c->next;
break;
}
}
for (ht = tp_c->hlist; ht; ht = ht->next) { for (ht = tp_c->hlist; ht; ht = ht->next) {
ht->refcnt--; ht->refcnt--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment