diff options
-rw-r--r-- | net/sched/cls_fw.c | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index a366537f82c6..63a3ce75c02e 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c | |||
@@ -29,11 +29,11 @@ | |||
29 | #include <net/act_api.h> | 29 | #include <net/act_api.h> |
30 | #include <net/pkt_cls.h> | 30 | #include <net/pkt_cls.h> |
31 | 31 | ||
32 | #define HTSIZE (PAGE_SIZE/sizeof(struct fw_filter *)) | 32 | #define HTSIZE 256 |
33 | 33 | ||
34 | struct fw_head { | 34 | struct fw_head { |
35 | struct fw_filter *ht[HTSIZE]; | 35 | u32 mask; |
36 | u32 mask; | 36 | struct fw_filter *ht[HTSIZE]; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | struct fw_filter { | 39 | struct fw_filter { |
@@ -46,30 +46,11 @@ struct fw_filter { | |||
46 | struct tcf_exts exts; | 46 | struct tcf_exts exts; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | static inline int fw_hash(u32 handle) | 49 | static u32 fw_hash(u32 handle) |
50 | { | 50 | { |
51 | if (HTSIZE == 4096) | 51 | handle ^= (handle >> 16); |
52 | return ((handle >> 24) & 0xFFF) ^ | 52 | handle ^= (handle >> 8); |
53 | ((handle >> 12) & 0xFFF) ^ | 53 | return handle % HTSIZE; |
54 | (handle & 0xFFF); | ||
55 | else if (HTSIZE == 2048) | ||
56 | return ((handle >> 22) & 0x7FF) ^ | ||
57 | ((handle >> 11) & 0x7FF) ^ | ||
58 | (handle & 0x7FF); | ||
59 | else if (HTSIZE == 1024) | ||
60 | return ((handle >> 20) & 0x3FF) ^ | ||
61 | ((handle >> 10) & 0x3FF) ^ | ||
62 | (handle & 0x3FF); | ||
63 | else if (HTSIZE == 512) | ||
64 | return (handle >> 27) ^ | ||
65 | ((handle >> 18) & 0x1FF) ^ | ||
66 | ((handle >> 9) & 0x1FF) ^ | ||
67 | (handle & 0x1FF); | ||
68 | else if (HTSIZE == 256) { | ||
69 | u8 *t = (u8 *) &handle; | ||
70 | return t[0] ^ t[1] ^ t[2] ^ t[3]; | ||
71 | } else | ||
72 | return handle & (HTSIZE - 1); | ||
73 | } | 54 | } |
74 | 55 | ||
75 | static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp, | 56 | static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp, |