forked from Minki/linux
[PKT_SCHED]: annotate cls_u32
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e6f1cebf71
commit
0382b9c354
@ -201,8 +201,8 @@ enum
|
|||||||
|
|
||||||
struct tc_u32_key
|
struct tc_u32_key
|
||||||
{
|
{
|
||||||
__u32 mask;
|
__be32 mask;
|
||||||
__u32 val;
|
__be32 val;
|
||||||
int off;
|
int off;
|
||||||
int offmask;
|
int offmask;
|
||||||
};
|
};
|
||||||
@ -213,12 +213,12 @@ struct tc_u32_sel
|
|||||||
unsigned char offshift;
|
unsigned char offshift;
|
||||||
unsigned char nkeys;
|
unsigned char nkeys;
|
||||||
|
|
||||||
__u16 offmask;
|
__be16 offmask;
|
||||||
__u16 off;
|
__u16 off;
|
||||||
short offoff;
|
short offoff;
|
||||||
|
|
||||||
short hoff;
|
short hoff;
|
||||||
__u32 hmask;
|
__be32 hmask;
|
||||||
struct tc_u32_key keys[0];
|
struct tc_u32_key keys[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ static const struct tcf_ext_map u32_ext_map = {
|
|||||||
|
|
||||||
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, 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;
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ next_knode:
|
|||||||
|
|
||||||
for (i = n->sel.nkeys; i>0; i--, key++) {
|
for (i = n->sel.nkeys; i>0; i--, key++) {
|
||||||
|
|
||||||
if ((*(u32*)(ptr+key->off+(off2&key->offmask))^key->val)&key->mask) {
|
if ((*(__be32*)(ptr+key->off+(off2&key->offmask))^key->val)&key->mask) {
|
||||||
n = n->next;
|
n = n->next;
|
||||||
goto next_knode;
|
goto next_knode;
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ check_terminal:
|
|||||||
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,n->fshift);
|
sel = ht->divisor&u32_hash_fold(*(__be32*)(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;
|
||||||
@ -190,7 +190,7 @@ check_terminal:
|
|||||||
if (n->sel.flags&(TC_U32_OFFSET|TC_U32_VAROFFSET)) {
|
if (n->sel.flags&(TC_U32_OFFSET|TC_U32_VAROFFSET)) {
|
||||||
off2 = n->sel.off + 3;
|
off2 = n->sel.off + 3;
|
||||||
if (n->sel.flags&TC_U32_VAROFFSET)
|
if (n->sel.flags&TC_U32_VAROFFSET)
|
||||||
off2 += ntohs(n->sel.offmask & *(u16*)(ptr+n->sel.offoff)) >>n->sel.offshift;
|
off2 += ntohs(n->sel.offmask & *(__be16*)(ptr+n->sel.offoff)) >>n->sel.offshift;
|
||||||
off2 &= ~3;
|
off2 &= ~3;
|
||||||
}
|
}
|
||||||
if (n->sel.flags&TC_U32_EAT) {
|
if (n->sel.flags&TC_U32_EAT) {
|
||||||
|
@ -35,7 +35,7 @@ static int em_u32_match(struct sk_buff *skb, struct tcf_ematch *em,
|
|||||||
if (!tcf_valid_offset(skb, ptr, sizeof(u32)))
|
if (!tcf_valid_offset(skb, ptr, sizeof(u32)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return !(((*(u32*) ptr) ^ key->val) & key->mask);
|
return !(((*(__be32*) ptr) ^ key->val) & key->mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_ematch_ops em_u32_ops = {
|
static struct tcf_ematch_ops em_u32_ops = {
|
||||||
|
Loading…
Reference in New Issue
Block a user