Commit 421340eb authored by Jamal Hadi Salim's avatar Jamal Hadi Salim Committed by David S. Miller

[PKT_SCHED]: New version of u32 classifier hashing workaround.

This version does not change user visible structures.
Signed-off-by: default avatarJamal Hadi Salim <hadi@znyx.com>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent 5fc1b9f8
...@@ -222,9 +222,6 @@ struct tc_u32_sel ...@@ -222,9 +222,6 @@ struct tc_u32_sel
unsigned char flags; unsigned char flags;
unsigned char offshift; unsigned char offshift;
unsigned char nkeys; unsigned char nkeys;
#ifdef fix_u32_bug
unsigned char fshift; /* fold shift */
#endif
__u16 offmask; __u16 offmask;
__u16 off; __u16 off;
......
...@@ -72,6 +72,7 @@ struct tc_u_knode ...@@ -72,6 +72,7 @@ struct tc_u_knode
struct tcf_police *police; struct tcf_police *police;
#endif #endif
#endif #endif
u8 fshift;
struct tcf_result res; struct tcf_result res;
struct tc_u_hnode *ht_down; struct tc_u_hnode *ht_down;
struct tc_u32_sel sel; struct tc_u32_sel sel;
...@@ -99,10 +100,10 @@ struct tc_u_common ...@@ -99,10 +100,10 @@ struct tc_u_common
static struct tc_u_common *u32_list; static struct tc_u_common *u32_list;
static __inline__ unsigned u32_hash_fold(u32 key, struct tc_u32_sel *sel) static __inline__ unsigned u32_hash_fold(u32 key, struct tc_u32_sel *sel, u8 fshift)
{ {
#ifdef fix_u32_bug #ifndef fix_u32_bug
unsigned h = (key & sel->hmask)>>sel->fshift; unsigned h = (key & sel->hmask)>>fshift;
#else #else
unsigned h = (key & sel->hmask); unsigned h = (key & sel->hmask);
...@@ -206,7 +207,7 @@ static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_re ...@@ -206,7 +207,7 @@ static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_re
ht = n->ht_down; ht = n->ht_down;
sel = 0; sel = 0;
if (ht->divisor) if (ht->divisor)
sel = ht->divisor&u32_hash_fold(*(u32*)(ptr+n->sel.hoff), &n->sel); sel = ht->divisor&u32_hash_fold(*(u32*)(ptr+n->sel.hoff), &n->sel,n->fshift);
if (!(n->sel.flags&(TC_U32_VAROFFSET|TC_U32_OFFSET|TC_U32_EAT))) if (!(n->sel.flags&(TC_U32_VAROFFSET|TC_U32_OFFSET|TC_U32_EAT)))
goto next_ht; goto next_ht;
...@@ -701,6 +702,17 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle, ...@@ -701,6 +702,17 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key)); memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key));
n->ht_up = ht; n->ht_up = ht;
n->handle = handle; n->handle = handle;
{
u8 i = 0;
u32 mask = s->hmask;
if (mask) {
while (!(mask & 1)) {
i++;
mask>>=1;
}
}
n->fshift = i;
}
err = u32_set_parms(tp->q, base, ht, n, tb, tca[TCA_RATE-1]); err = u32_set_parms(tp->q, base, ht, n, tb, tca[TCA_RATE-1]);
if (err == 0) { if (err == 0) {
struct tc_u_knode **ins; struct tc_u_knode **ins;
......
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