diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-01-19 14:26:56 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-20 02:31:12 -0500 |
commit | cc7ec456f82da7f89a5b376e613b3ac4311b3e9a (patch) | |
tree | 534729db08c10f40c090261cdc191dd2303dfc5c /net/sched/act_api.c | |
parent | 7180a03118cac7256fb04f929fe34d0aeee92c40 (diff) |
net_sched: cleanups
Cleanup net/sched code to current CodingStyle and practices.
Reduce inline abuse
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_api.c')
-rw-r--r-- | net/sched/act_api.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 23b25f89e7e0..15873e14cb54 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -78,7 +78,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb, | |||
78 | struct tc_action *a, struct tcf_hashinfo *hinfo) | 78 | struct tc_action *a, struct tcf_hashinfo *hinfo) |
79 | { | 79 | { |
80 | struct tcf_common *p; | 80 | struct tcf_common *p; |
81 | int err = 0, index = -1,i = 0, s_i = 0, n_i = 0; | 81 | int err = 0, index = -1, i = 0, s_i = 0, n_i = 0; |
82 | struct nlattr *nest; | 82 | struct nlattr *nest; |
83 | 83 | ||
84 | read_lock_bh(hinfo->lock); | 84 | read_lock_bh(hinfo->lock); |
@@ -126,7 +126,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a, | |||
126 | { | 126 | { |
127 | struct tcf_common *p, *s_p; | 127 | struct tcf_common *p, *s_p; |
128 | struct nlattr *nest; | 128 | struct nlattr *nest; |
129 | int i= 0, n_i = 0; | 129 | int i = 0, n_i = 0; |
130 | 130 | ||
131 | nest = nla_nest_start(skb, a->order); | 131 | nest = nla_nest_start(skb, a->order); |
132 | if (nest == NULL) | 132 | if (nest == NULL) |
@@ -138,7 +138,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a, | |||
138 | while (p != NULL) { | 138 | while (p != NULL) { |
139 | s_p = p->tcfc_next; | 139 | s_p = p->tcfc_next; |
140 | if (ACT_P_DELETED == tcf_hash_release(p, 0, hinfo)) | 140 | if (ACT_P_DELETED == tcf_hash_release(p, 0, hinfo)) |
141 | module_put(a->ops->owner); | 141 | module_put(a->ops->owner); |
142 | n_i++; | 142 | n_i++; |
143 | p = s_p; | 143 | p = s_p; |
144 | } | 144 | } |
@@ -447,7 +447,8 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | |||
447 | nest = nla_nest_start(skb, TCA_OPTIONS); | 447 | nest = nla_nest_start(skb, TCA_OPTIONS); |
448 | if (nest == NULL) | 448 | if (nest == NULL) |
449 | goto nla_put_failure; | 449 | goto nla_put_failure; |
450 | if ((err = tcf_action_dump_old(skb, a, bind, ref)) > 0) { | 450 | err = tcf_action_dump_old(skb, a, bind, ref); |
451 | if (err > 0) { | ||
451 | nla_nest_end(skb, nest); | 452 | nla_nest_end(skb, nest); |
452 | return err; | 453 | return err; |
453 | } | 454 | } |
@@ -491,7 +492,7 @@ struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, | |||
491 | struct tc_action *a; | 492 | struct tc_action *a; |
492 | struct tc_action_ops *a_o; | 493 | struct tc_action_ops *a_o; |
493 | char act_name[IFNAMSIZ]; | 494 | char act_name[IFNAMSIZ]; |
494 | struct nlattr *tb[TCA_ACT_MAX+1]; | 495 | struct nlattr *tb[TCA_ACT_MAX + 1]; |
495 | struct nlattr *kind; | 496 | struct nlattr *kind; |
496 | int err; | 497 | int err; |
497 | 498 | ||
@@ -549,9 +550,9 @@ struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, | |||
549 | goto err_free; | 550 | goto err_free; |
550 | 551 | ||
551 | /* module count goes up only when brand new policy is created | 552 | /* module count goes up only when brand new policy is created |
552 | if it exists and is only bound to in a_o->init() then | 553 | * if it exists and is only bound to in a_o->init() then |
553 | ACT_P_CREATED is not returned (a zero is). | 554 | * ACT_P_CREATED is not returned (a zero is). |
554 | */ | 555 | */ |
555 | if (err != ACT_P_CREATED) | 556 | if (err != ACT_P_CREATED) |
556 | module_put(a_o->owner); | 557 | module_put(a_o->owner); |
557 | a->ops = a_o; | 558 | a->ops = a_o; |
@@ -569,7 +570,7 @@ err_out: | |||
569 | struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, | 570 | struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, |
570 | char *name, int ovr, int bind) | 571 | char *name, int ovr, int bind) |
571 | { | 572 | { |
572 | struct nlattr *tb[TCA_ACT_MAX_PRIO+1]; | 573 | struct nlattr *tb[TCA_ACT_MAX_PRIO + 1]; |
573 | struct tc_action *head = NULL, *act, *act_prev = NULL; | 574 | struct tc_action *head = NULL, *act, *act_prev = NULL; |
574 | int err; | 575 | int err; |
575 | int i; | 576 | int i; |
@@ -697,7 +698,7 @@ act_get_notify(struct net *net, u32 pid, struct nlmsghdr *n, | |||
697 | static struct tc_action * | 698 | static struct tc_action * |
698 | tcf_action_get_1(struct nlattr *nla, struct nlmsghdr *n, u32 pid) | 699 | tcf_action_get_1(struct nlattr *nla, struct nlmsghdr *n, u32 pid) |
699 | { | 700 | { |
700 | struct nlattr *tb[TCA_ACT_MAX+1]; | 701 | struct nlattr *tb[TCA_ACT_MAX + 1]; |
701 | struct tc_action *a; | 702 | struct tc_action *a; |
702 | int index; | 703 | int index; |
703 | int err; | 704 | int err; |
@@ -770,7 +771,7 @@ static int tca_action_flush(struct net *net, struct nlattr *nla, | |||
770 | struct tcamsg *t; | 771 | struct tcamsg *t; |
771 | struct netlink_callback dcb; | 772 | struct netlink_callback dcb; |
772 | struct nlattr *nest; | 773 | struct nlattr *nest; |
773 | struct nlattr *tb[TCA_ACT_MAX+1]; | 774 | struct nlattr *tb[TCA_ACT_MAX + 1]; |
774 | struct nlattr *kind; | 775 | struct nlattr *kind; |
775 | struct tc_action *a = create_a(0); | 776 | struct tc_action *a = create_a(0); |
776 | int err = -ENOMEM; | 777 | int err = -ENOMEM; |
@@ -821,7 +822,8 @@ static int tca_action_flush(struct net *net, struct nlattr *nla, | |||
821 | nlh->nlmsg_flags |= NLM_F_ROOT; | 822 | nlh->nlmsg_flags |= NLM_F_ROOT; |
822 | module_put(a->ops->owner); | 823 | module_put(a->ops->owner); |
823 | kfree(a); | 824 | kfree(a); |
824 | err = rtnetlink_send(skb, net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); | 825 | err = rtnetlink_send(skb, net, pid, RTNLGRP_TC, |
826 | n->nlmsg_flags & NLM_F_ECHO); | ||
825 | if (err > 0) | 827 | if (err > 0) |
826 | return 0; | 828 | return 0; |
827 | 829 | ||
@@ -842,14 +844,14 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, | |||
842 | u32 pid, int event) | 844 | u32 pid, int event) |
843 | { | 845 | { |
844 | int i, ret; | 846 | int i, ret; |
845 | struct nlattr *tb[TCA_ACT_MAX_PRIO+1]; | 847 | struct nlattr *tb[TCA_ACT_MAX_PRIO + 1]; |
846 | struct tc_action *head = NULL, *act, *act_prev = NULL; | 848 | struct tc_action *head = NULL, *act, *act_prev = NULL; |
847 | 849 | ||
848 | ret = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL); | 850 | ret = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL); |
849 | if (ret < 0) | 851 | if (ret < 0) |
850 | return ret; | 852 | return ret; |
851 | 853 | ||
852 | if (event == RTM_DELACTION && n->nlmsg_flags&NLM_F_ROOT) { | 854 | if (event == RTM_DELACTION && n->nlmsg_flags & NLM_F_ROOT) { |
853 | if (tb[1] != NULL) | 855 | if (tb[1] != NULL) |
854 | return tca_action_flush(net, tb[1], n, pid); | 856 | return tca_action_flush(net, tb[1], n, pid); |
855 | else | 857 | else |
@@ -892,7 +894,7 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, | |||
892 | /* now do the delete */ | 894 | /* now do the delete */ |
893 | tcf_action_destroy(head, 0); | 895 | tcf_action_destroy(head, 0); |
894 | ret = rtnetlink_send(skb, net, pid, RTNLGRP_TC, | 896 | ret = rtnetlink_send(skb, net, pid, RTNLGRP_TC, |
895 | n->nlmsg_flags&NLM_F_ECHO); | 897 | n->nlmsg_flags & NLM_F_ECHO); |
896 | if (ret > 0) | 898 | if (ret > 0) |
897 | return 0; | 899 | return 0; |
898 | return ret; | 900 | return ret; |
@@ -936,7 +938,7 @@ static int tcf_add_notify(struct net *net, struct tc_action *a, | |||
936 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; | 938 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
937 | NETLINK_CB(skb).dst_group = RTNLGRP_TC; | 939 | NETLINK_CB(skb).dst_group = RTNLGRP_TC; |
938 | 940 | ||
939 | err = rtnetlink_send(skb, net, pid, RTNLGRP_TC, flags&NLM_F_ECHO); | 941 | err = rtnetlink_send(skb, net, pid, RTNLGRP_TC, flags & NLM_F_ECHO); |
940 | if (err > 0) | 942 | if (err > 0) |
941 | err = 0; | 943 | err = 0; |
942 | return err; | 944 | return err; |
@@ -967,7 +969,7 @@ tcf_action_add(struct net *net, struct nlattr *nla, struct nlmsghdr *n, | |||
967 | 969 | ||
968 | /* dump then free all the actions after update; inserted policy | 970 | /* dump then free all the actions after update; inserted policy |
969 | * stays intact | 971 | * stays intact |
970 | * */ | 972 | */ |
971 | ret = tcf_add_notify(net, act, pid, seq, RTM_NEWACTION, n->nlmsg_flags); | 973 | ret = tcf_add_notify(net, act, pid, seq, RTM_NEWACTION, n->nlmsg_flags); |
972 | for (a = act; a; a = act) { | 974 | for (a = act; a; a = act) { |
973 | act = a->next; | 975 | act = a->next; |
@@ -993,8 +995,7 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
993 | return -EINVAL; | 995 | return -EINVAL; |
994 | } | 996 | } |
995 | 997 | ||
996 | /* n->nlmsg_flags&NLM_F_CREATE | 998 | /* n->nlmsg_flags & NLM_F_CREATE */ |
997 | * */ | ||
998 | switch (n->nlmsg_type) { | 999 | switch (n->nlmsg_type) { |
999 | case RTM_NEWACTION: | 1000 | case RTM_NEWACTION: |
1000 | /* we are going to assume all other flags | 1001 | /* we are going to assume all other flags |
@@ -1003,7 +1004,7 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
1003 | * but since we want avoid ambiguity (eg when flags | 1004 | * but since we want avoid ambiguity (eg when flags |
1004 | * is zero) then just set this | 1005 | * is zero) then just set this |
1005 | */ | 1006 | */ |
1006 | if (n->nlmsg_flags&NLM_F_REPLACE) | 1007 | if (n->nlmsg_flags & NLM_F_REPLACE) |
1007 | ovr = 1; | 1008 | ovr = 1; |
1008 | replay: | 1009 | replay: |
1009 | ret = tcf_action_add(net, tca[TCA_ACT_TAB], n, pid, ovr); | 1010 | ret = tcf_action_add(net, tca[TCA_ACT_TAB], n, pid, ovr); |
@@ -1028,7 +1029,7 @@ replay: | |||
1028 | static struct nlattr * | 1029 | static struct nlattr * |
1029 | find_dump_kind(const struct nlmsghdr *n) | 1030 | find_dump_kind(const struct nlmsghdr *n) |
1030 | { | 1031 | { |
1031 | struct nlattr *tb1, *tb2[TCA_ACT_MAX+1]; | 1032 | struct nlattr *tb1, *tb2[TCA_ACT_MAX + 1]; |
1032 | struct nlattr *tb[TCA_ACT_MAX_PRIO + 1]; | 1033 | struct nlattr *tb[TCA_ACT_MAX_PRIO + 1]; |
1033 | struct nlattr *nla[TCAA_MAX + 1]; | 1034 | struct nlattr *nla[TCAA_MAX + 1]; |
1034 | struct nlattr *kind; | 1035 | struct nlattr *kind; |
@@ -1071,9 +1072,8 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | |||
1071 | } | 1072 | } |
1072 | 1073 | ||
1073 | a_o = tc_lookup_action(kind); | 1074 | a_o = tc_lookup_action(kind); |
1074 | if (a_o == NULL) { | 1075 | if (a_o == NULL) |
1075 | return 0; | 1076 | return 0; |
1076 | } | ||
1077 | 1077 | ||
1078 | memset(&a, 0, sizeof(struct tc_action)); | 1078 | memset(&a, 0, sizeof(struct tc_action)); |
1079 | a.ops = a_o; | 1079 | a.ops = a_o; |