diff options
Diffstat (limited to 'net/sched/em_meta.c')
-rw-r--r-- | net/sched/em_meta.c | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index 34da5e29ea1a..49130e8abff0 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c | |||
@@ -47,7 +47,7 @@ | |||
47 | * on the meta type. Obviously, the length of the data must also | 47 | * on the meta type. Obviously, the length of the data must also |
48 | * be provided for non-numeric types. | 48 | * be provided for non-numeric types. |
49 | * | 49 | * |
50 | * Additionaly, type dependant modifiers such as shift operators | 50 | * Additionally, type dependent modifiers such as shift operators |
51 | * or mask may be applied to extend the functionaliy. As of now, | 51 | * or mask may be applied to extend the functionaliy. As of now, |
52 | * the variable length type supports shifting the byte string to | 52 | * the variable length type supports shifting the byte string to |
53 | * the right, eating up any number of octets and thus supporting | 53 | * the right, eating up any number of octets and thus supporting |
@@ -73,21 +73,18 @@ | |||
73 | #include <net/pkt_cls.h> | 73 | #include <net/pkt_cls.h> |
74 | #include <net/sock.h> | 74 | #include <net/sock.h> |
75 | 75 | ||
76 | struct meta_obj | 76 | struct meta_obj { |
77 | { | ||
78 | unsigned long value; | 77 | unsigned long value; |
79 | unsigned int len; | 78 | unsigned int len; |
80 | }; | 79 | }; |
81 | 80 | ||
82 | struct meta_value | 81 | struct meta_value { |
83 | { | ||
84 | struct tcf_meta_val hdr; | 82 | struct tcf_meta_val hdr; |
85 | unsigned long val; | 83 | unsigned long val; |
86 | unsigned int len; | 84 | unsigned int len; |
87 | }; | 85 | }; |
88 | 86 | ||
89 | struct meta_match | 87 | struct meta_match { |
90 | { | ||
91 | struct meta_value lvalue; | 88 | struct meta_value lvalue; |
92 | struct meta_value rvalue; | 89 | struct meta_value rvalue; |
93 | }; | 90 | }; |
@@ -255,7 +252,7 @@ META_COLLECTOR(int_rtclassid) | |||
255 | if (unlikely(skb_dst(skb) == NULL)) | 252 | if (unlikely(skb_dst(skb) == NULL)) |
256 | *err = -1; | 253 | *err = -1; |
257 | else | 254 | else |
258 | #ifdef CONFIG_NET_CLS_ROUTE | 255 | #ifdef CONFIG_IP_ROUTE_CLASSID |
259 | dst->value = skb_dst(skb)->tclassid; | 256 | dst->value = skb_dst(skb)->tclassid; |
260 | #else | 257 | #else |
261 | dst->value = 0; | 258 | dst->value = 0; |
@@ -267,7 +264,7 @@ META_COLLECTOR(int_rtiif) | |||
267 | if (unlikely(skb_rtable(skb) == NULL)) | 264 | if (unlikely(skb_rtable(skb) == NULL)) |
268 | *err = -1; | 265 | *err = -1; |
269 | else | 266 | else |
270 | dst->value = skb_rtable(skb)->fl.iif; | 267 | dst->value = skb_rtable(skb)->rt_iif; |
271 | } | 268 | } |
272 | 269 | ||
273 | /************************************************************************** | 270 | /************************************************************************** |
@@ -404,7 +401,7 @@ META_COLLECTOR(int_sk_sndbuf) | |||
404 | META_COLLECTOR(int_sk_alloc) | 401 | META_COLLECTOR(int_sk_alloc) |
405 | { | 402 | { |
406 | SKIP_NONLOCAL(skb); | 403 | SKIP_NONLOCAL(skb); |
407 | dst->value = skb->sk->sk_allocation; | 404 | dst->value = (__force int) skb->sk->sk_allocation; |
408 | } | 405 | } |
409 | 406 | ||
410 | META_COLLECTOR(int_sk_route_caps) | 407 | META_COLLECTOR(int_sk_route_caps) |
@@ -483,8 +480,7 @@ META_COLLECTOR(int_sk_write_pend) | |||
483 | * Meta value collectors assignment table | 480 | * Meta value collectors assignment table |
484 | **************************************************************************/ | 481 | **************************************************************************/ |
485 | 482 | ||
486 | struct meta_ops | 483 | struct meta_ops { |
487 | { | ||
488 | void (*get)(struct sk_buff *, struct tcf_pkt_info *, | 484 | void (*get)(struct sk_buff *, struct tcf_pkt_info *, |
489 | struct meta_value *, struct meta_obj *, int *); | 485 | struct meta_value *, struct meta_obj *, int *); |
490 | }; | 486 | }; |
@@ -494,7 +490,7 @@ struct meta_ops | |||
494 | 490 | ||
495 | /* Meta value operations table listing all meta value collectors and | 491 | /* Meta value operations table listing all meta value collectors and |
496 | * assigns them to a type and meta id. */ | 492 | * assigns them to a type and meta id. */ |
497 | static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = { | 493 | static struct meta_ops __meta_ops[TCF_META_TYPE_MAX + 1][TCF_META_ID_MAX + 1] = { |
498 | [TCF_META_TYPE_VAR] = { | 494 | [TCF_META_TYPE_VAR] = { |
499 | [META_ID(DEV)] = META_FUNC(var_dev), | 495 | [META_ID(DEV)] = META_FUNC(var_dev), |
500 | [META_ID(SK_BOUND_IF)] = META_FUNC(var_sk_bound_if), | 496 | [META_ID(SK_BOUND_IF)] = META_FUNC(var_sk_bound_if), |
@@ -550,7 +546,7 @@ static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = { | |||
550 | } | 546 | } |
551 | }; | 547 | }; |
552 | 548 | ||
553 | static inline struct meta_ops * meta_ops(struct meta_value *val) | 549 | static inline struct meta_ops *meta_ops(struct meta_value *val) |
554 | { | 550 | { |
555 | return &__meta_ops[meta_type(val)][meta_id(val)]; | 551 | return &__meta_ops[meta_type(val)][meta_id(val)]; |
556 | } | 552 | } |
@@ -649,9 +645,8 @@ static int meta_int_dump(struct sk_buff *skb, struct meta_value *v, int tlv) | |||
649 | { | 645 | { |
650 | if (v->len == sizeof(unsigned long)) | 646 | if (v->len == sizeof(unsigned long)) |
651 | NLA_PUT(skb, tlv, sizeof(unsigned long), &v->val); | 647 | NLA_PUT(skb, tlv, sizeof(unsigned long), &v->val); |
652 | else if (v->len == sizeof(u32)) { | 648 | else if (v->len == sizeof(u32)) |
653 | NLA_PUT_U32(skb, tlv, v->val); | 649 | NLA_PUT_U32(skb, tlv, v->val); |
654 | } | ||
655 | 650 | ||
656 | return 0; | 651 | return 0; |
657 | 652 | ||
@@ -663,8 +658,7 @@ nla_put_failure: | |||
663 | * Type specific operations table | 658 | * Type specific operations table |
664 | **************************************************************************/ | 659 | **************************************************************************/ |
665 | 660 | ||
666 | struct meta_type_ops | 661 | struct meta_type_ops { |
667 | { | ||
668 | void (*destroy)(struct meta_value *); | 662 | void (*destroy)(struct meta_value *); |
669 | int (*compare)(struct meta_obj *, struct meta_obj *); | 663 | int (*compare)(struct meta_obj *, struct meta_obj *); |
670 | int (*change)(struct meta_value *, struct nlattr *); | 664 | int (*change)(struct meta_value *, struct nlattr *); |
@@ -672,7 +666,7 @@ struct meta_type_ops | |||
672 | int (*dump)(struct sk_buff *, struct meta_value *, int); | 666 | int (*dump)(struct sk_buff *, struct meta_value *, int); |
673 | }; | 667 | }; |
674 | 668 | ||
675 | static struct meta_type_ops __meta_type_ops[TCF_META_TYPE_MAX+1] = { | 669 | static struct meta_type_ops __meta_type_ops[TCF_META_TYPE_MAX + 1] = { |
676 | [TCF_META_TYPE_VAR] = { | 670 | [TCF_META_TYPE_VAR] = { |
677 | .destroy = meta_var_destroy, | 671 | .destroy = meta_var_destroy, |
678 | .compare = meta_var_compare, | 672 | .compare = meta_var_compare, |
@@ -688,7 +682,7 @@ static struct meta_type_ops __meta_type_ops[TCF_META_TYPE_MAX+1] = { | |||
688 | } | 682 | } |
689 | }; | 683 | }; |
690 | 684 | ||
691 | static inline struct meta_type_ops * meta_type_ops(struct meta_value *v) | 685 | static inline struct meta_type_ops *meta_type_ops(struct meta_value *v) |
692 | { | 686 | { |
693 | return &__meta_type_ops[meta_type(v)]; | 687 | return &__meta_type_ops[meta_type(v)]; |
694 | } | 688 | } |
@@ -713,7 +707,7 @@ static int meta_get(struct sk_buff *skb, struct tcf_pkt_info *info, | |||
713 | return err; | 707 | return err; |
714 | 708 | ||
715 | if (meta_type_ops(v)->apply_extras) | 709 | if (meta_type_ops(v)->apply_extras) |
716 | meta_type_ops(v)->apply_extras(v, dst); | 710 | meta_type_ops(v)->apply_extras(v, dst); |
717 | 711 | ||
718 | return 0; | 712 | return 0; |
719 | } | 713 | } |
@@ -732,12 +726,12 @@ static int em_meta_match(struct sk_buff *skb, struct tcf_ematch *m, | |||
732 | r = meta_type_ops(&meta->lvalue)->compare(&l_value, &r_value); | 726 | r = meta_type_ops(&meta->lvalue)->compare(&l_value, &r_value); |
733 | 727 | ||
734 | switch (meta->lvalue.hdr.op) { | 728 | switch (meta->lvalue.hdr.op) { |
735 | case TCF_EM_OPND_EQ: | 729 | case TCF_EM_OPND_EQ: |
736 | return !r; | 730 | return !r; |
737 | case TCF_EM_OPND_LT: | 731 | case TCF_EM_OPND_LT: |
738 | return r < 0; | 732 | return r < 0; |
739 | case TCF_EM_OPND_GT: | 733 | case TCF_EM_OPND_GT: |
740 | return r > 0; | 734 | return r > 0; |
741 | } | 735 | } |
742 | 736 | ||
743 | return 0; | 737 | return 0; |
@@ -771,7 +765,7 @@ static inline int meta_change_data(struct meta_value *dst, struct nlattr *nla) | |||
771 | 765 | ||
772 | static inline int meta_is_supported(struct meta_value *val) | 766 | static inline int meta_is_supported(struct meta_value *val) |
773 | { | 767 | { |
774 | return (!meta_id(val) || meta_ops(val)->get); | 768 | return !meta_id(val) || meta_ops(val)->get; |
775 | } | 769 | } |
776 | 770 | ||
777 | static const struct nla_policy meta_policy[TCA_EM_META_MAX + 1] = { | 771 | static const struct nla_policy meta_policy[TCA_EM_META_MAX + 1] = { |