Skip to content

Commit

Permalink
net sched: stylistic cleanups
Browse files Browse the repository at this point in the history
Signed-off-by: Jamal Hadi Salim <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
jhsmt authored and davem330 committed Sep 20, 2016
1 parent f71b109 commit 5a7a555
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 104 deletions.
16 changes: 6 additions & 10 deletions net/sched/act_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,8 @@ struct tc_action *tcf_action_init_1(struct net *net, struct nlattr *nla,
return ERR_PTR(err);
}

int tcf_action_init(struct net *net, struct nlattr *nla,
struct nlattr *est, char *name, int ovr,
int bind, struct list_head *actions)
int tcf_action_init(struct net *net, struct nlattr *nla, struct nlattr *est,
char *name, int ovr, int bind, struct list_head *actions)
{
struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];
struct tc_action *act;
Expand Down Expand Up @@ -923,9 +922,8 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct list_head *actions,
return err;
}

static int
tcf_action_add(struct net *net, struct nlattr *nla, struct nlmsghdr *n,
u32 portid, int ovr)
static int tcf_action_add(struct net *net, struct nlattr *nla,
struct nlmsghdr *n, u32 portid, int ovr)
{
int ret = 0;
LIST_HEAD(actions);
Expand Down Expand Up @@ -988,8 +986,7 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n)
return ret;
}

static struct nlattr *
find_dump_kind(const struct nlmsghdr *n)
static struct nlattr *find_dump_kind(const struct nlmsghdr *n)
{
struct nlattr *tb1, *tb2[TCA_ACT_MAX + 1];
struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];
Expand All @@ -1016,8 +1013,7 @@ find_dump_kind(const struct nlmsghdr *n)
return kind;
}

static int
tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
static int tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = sock_net(skb->sk);
struct nlmsghdr *nlh;
Expand Down
36 changes: 18 additions & 18 deletions net/sched/act_csum.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ static void *tcf_csum_skb_nextlayer(struct sk_buff *skb,
return (void *)(skb_network_header(skb) + ihl);
}

static int tcf_csum_ipv4_icmp(struct sk_buff *skb,
unsigned int ihl, unsigned int ipl)
static int tcf_csum_ipv4_icmp(struct sk_buff *skb, unsigned int ihl,
unsigned int ipl)
{
struct icmphdr *icmph;

Expand Down Expand Up @@ -152,8 +152,8 @@ static int tcf_csum_ipv4_igmp(struct sk_buff *skb,
return 1;
}

static int tcf_csum_ipv6_icmp(struct sk_buff *skb,
unsigned int ihl, unsigned int ipl)
static int tcf_csum_ipv6_icmp(struct sk_buff *skb, unsigned int ihl,
unsigned int ipl)
{
struct icmp6hdr *icmp6h;
const struct ipv6hdr *ip6h;
Expand All @@ -174,8 +174,8 @@ static int tcf_csum_ipv6_icmp(struct sk_buff *skb,
return 1;
}

static int tcf_csum_ipv4_tcp(struct sk_buff *skb,
unsigned int ihl, unsigned int ipl)
static int tcf_csum_ipv4_tcp(struct sk_buff *skb, unsigned int ihl,
unsigned int ipl)
{
struct tcphdr *tcph;
const struct iphdr *iph;
Expand All @@ -195,8 +195,8 @@ static int tcf_csum_ipv4_tcp(struct sk_buff *skb,
return 1;
}

static int tcf_csum_ipv6_tcp(struct sk_buff *skb,
unsigned int ihl, unsigned int ipl)
static int tcf_csum_ipv6_tcp(struct sk_buff *skb, unsigned int ihl,
unsigned int ipl)
{
struct tcphdr *tcph;
const struct ipv6hdr *ip6h;
Expand All @@ -217,8 +217,8 @@ static int tcf_csum_ipv6_tcp(struct sk_buff *skb,
return 1;
}

static int tcf_csum_ipv4_udp(struct sk_buff *skb,
unsigned int ihl, unsigned int ipl, int udplite)
static int tcf_csum_ipv4_udp(struct sk_buff *skb, unsigned int ihl,
unsigned int ipl, int udplite)
{
struct udphdr *udph;
const struct iphdr *iph;
Expand Down Expand Up @@ -270,8 +270,8 @@ static int tcf_csum_ipv4_udp(struct sk_buff *skb,
return 1;
}

static int tcf_csum_ipv6_udp(struct sk_buff *skb,
unsigned int ihl, unsigned int ipl, int udplite)
static int tcf_csum_ipv6_udp(struct sk_buff *skb, unsigned int ihl,
unsigned int ipl, int udplite)
{
struct udphdr *udph;
const struct ipv6hdr *ip6h;
Expand Down Expand Up @@ -380,8 +380,8 @@ static int tcf_csum_ipv4(struct sk_buff *skb, u32 update_flags)
return 0;
}

static int tcf_csum_ipv6_hopopts(struct ipv6_opt_hdr *ip6xh,
unsigned int ixhl, unsigned int *pl)
static int tcf_csum_ipv6_hopopts(struct ipv6_opt_hdr *ip6xh, unsigned int ixhl,
unsigned int *pl)
{
int off, len, optlen;
unsigned char *xh = (void *)ip6xh;
Expand Down Expand Up @@ -494,8 +494,8 @@ static int tcf_csum_ipv6(struct sk_buff *skb, u32 update_flags)
return 0;
}

static int tcf_csum(struct sk_buff *skb,
const struct tc_action *a, struct tcf_result *res)
static int tcf_csum(struct sk_buff *skb, const struct tc_action *a,
struct tcf_result *res)
{
struct tcf_csum *p = to_tcf_csum(a);
int action;
Expand Down Expand Up @@ -531,8 +531,8 @@ static int tcf_csum(struct sk_buff *skb,
return TC_ACT_SHOT;
}

static int tcf_csum_dump(struct sk_buff *skb,
struct tc_action *a, int bind, int ref)
static int tcf_csum_dump(struct sk_buff *skb, struct tc_action *a, int bind,
int ref)
{
unsigned char *b = skb_tail_pointer(skb);
struct tcf_csum *p = to_tcf_csum(a);
Expand Down
3 changes: 2 additions & 1 deletion net/sched/act_gact.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ static void tcf_gact_stats_update(struct tc_action *a, u64 bytes, u32 packets,
int action = READ_ONCE(gact->tcf_action);
struct tcf_t *tm = &gact->tcf_tm;

_bstats_cpu_update(this_cpu_ptr(gact->common.cpu_bstats), bytes, packets);
_bstats_cpu_update(this_cpu_ptr(gact->common.cpu_bstats), bytes,
packets);
if (action == TC_ACT_SHOT)
this_cpu_ptr(gact->common.cpu_qstats)->drops += packets;

Expand Down
3 changes: 2 additions & 1 deletion net/sched/act_mirred.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
return retval;
}

static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind,
int ref)
{
unsigned char *b = skb_tail_pointer(skb);
struct tcf_mirred *m = to_mirred(a);
Expand Down
10 changes: 4 additions & 6 deletions net/sched/act_police.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ static int tcf_act_police(struct sk_buff *skb, const struct tc_action *a,
return police->tcf_action;
}

static int
tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
static int tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a,
int bind, int ref)
{
unsigned char *b = skb_tail_pointer(skb);
struct tcf_police *police = to_police(a);
Expand Down Expand Up @@ -349,14 +349,12 @@ static struct pernet_operations police_net_ops = {
.size = sizeof(struct tc_action_net),
};

static int __init
police_init_module(void)
static int __init police_init_module(void)
{
return tcf_register_action(&act_police_ops, &police_net_ops);
}

static void __exit
police_cleanup_module(void)
static void __exit police_cleanup_module(void)
{
tcf_unregister_action(&act_police_ops, &police_net_ops);
}
Expand Down
18 changes: 10 additions & 8 deletions net/sched/cls_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,15 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
if (err == 0) {
struct tcf_proto *next = rtnl_dereference(tp->next);

tfilter_notify(net, skb, n, tp, fh, RTM_DELTFILTER);
tfilter_notify(net, skb, n, tp, fh,
RTM_DELTFILTER);
if (tcf_destroy(tp, false))
RCU_INIT_POINTER(*back, next);
}
goto errout;
case RTM_GETTFILTER:
err = tfilter_notify(net, skb, n, tp, fh, RTM_NEWTFILTER);
err = tfilter_notify(net, skb, n, tp, fh,
RTM_NEWTFILTER);
goto errout;
default:
err = -EINVAL;
Expand Down Expand Up @@ -448,7 +450,8 @@ static int tcf_node_dump(struct tcf_proto *tp, unsigned long n,
struct net *net = sock_net(a->skb->sk);

return tcf_fill_node(net, a->skb, tp, n, NETLINK_CB(a->cb->skb).portid,
a->cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWTFILTER);
a->cb->nlh->nlmsg_seq, NLM_F_MULTI,
RTM_NEWTFILTER);
}

/* called with RTNL */
Expand Down Expand Up @@ -552,16 +555,15 @@ void tcf_exts_destroy(struct tcf_exts *exts)
EXPORT_SYMBOL(tcf_exts_destroy);

int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
struct nlattr *rate_tlv, struct tcf_exts *exts, bool ovr)
struct nlattr *rate_tlv, struct tcf_exts *exts, bool ovr)
{
#ifdef CONFIG_NET_CLS_ACT
{
struct tc_action *act;

if (exts->police && tb[exts->police]) {
act = tcf_action_init_1(net, tb[exts->police], rate_tlv,
"police", ovr,
TCA_ACT_BIND);
"police", ovr, TCA_ACT_BIND);
if (IS_ERR(act))
return PTR_ERR(act);

Expand All @@ -573,8 +575,8 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
int err, i = 0;

err = tcf_action_init(net, tb[exts->action], rate_tlv,
NULL, ovr,
TCA_ACT_BIND, &actions);
NULL, ovr, TCA_ACT_BIND,
&actions);
if (err)
return err;
list_for_each_entry(act, &actions, list)
Expand Down
6 changes: 4 additions & 2 deletions net/sched/cls_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ static const struct nla_policy bpf_policy[TCA_BPF_MAX + 1] = {
[TCA_BPF_CLASSID] = { .type = NLA_U32 },
[TCA_BPF_FLAGS] = { .type = NLA_U32 },
[TCA_BPF_FD] = { .type = NLA_U32 },
[TCA_BPF_NAME] = { .type = NLA_NUL_STRING, .len = CLS_BPF_NAME_LEN },
[TCA_BPF_NAME] = { .type = NLA_NUL_STRING,
.len = CLS_BPF_NAME_LEN },
[TCA_BPF_OPS_LEN] = { .type = NLA_U16 },
[TCA_BPF_OPS] = { .type = NLA_BINARY,
.len = sizeof(struct sock_filter) * BPF_MAXINSNS },
Expand Down Expand Up @@ -409,7 +410,8 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,
goto errout;
}

ret = cls_bpf_modify_existing(net, tp, prog, base, tb, tca[TCA_RATE], ovr);
ret = cls_bpf_modify_existing(net, tp, prog, base, tb, tca[TCA_RATE],
ovr);
if (ret < 0)
goto errout;

Expand Down
21 changes: 14 additions & 7 deletions net/sched/cls_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,23 @@ static u32 flow_get_dst(const struct sk_buff *skb, const struct flow_keys *flow)
return addr_fold(skb_dst(skb)) ^ (__force u16) tc_skb_protocol(skb);
}

static u32 flow_get_proto(const struct sk_buff *skb, const struct flow_keys *flow)
static u32 flow_get_proto(const struct sk_buff *skb,
const struct flow_keys *flow)
{
return flow->basic.ip_proto;
}

static u32 flow_get_proto_src(const struct sk_buff *skb, const struct flow_keys *flow)
static u32 flow_get_proto_src(const struct sk_buff *skb,
const struct flow_keys *flow)
{
if (flow->ports.ports)
return ntohs(flow->ports.src);

return addr_fold(skb->sk);
}

static u32 flow_get_proto_dst(const struct sk_buff *skb, const struct flow_keys *flow)
static u32 flow_get_proto_dst(const struct sk_buff *skb,
const struct flow_keys *flow)
{
if (flow->ports.ports)
return ntohs(flow->ports.dst);
Expand Down Expand Up @@ -149,7 +152,8 @@ static u32 flow_get_nfct(const struct sk_buff *skb)
})
#endif

static u32 flow_get_nfct_src(const struct sk_buff *skb, const struct flow_keys *flow)
static u32 flow_get_nfct_src(const struct sk_buff *skb,
const struct flow_keys *flow)
{
switch (tc_skb_protocol(skb)) {
case htons(ETH_P_IP):
Expand All @@ -161,7 +165,8 @@ static u32 flow_get_nfct_src(const struct sk_buff *skb, const struct flow_keys *
return flow_get_src(skb, flow);
}

static u32 flow_get_nfct_dst(const struct sk_buff *skb, const struct flow_keys *flow)
static u32 flow_get_nfct_dst(const struct sk_buff *skb,
const struct flow_keys *flow)
{
switch (tc_skb_protocol(skb)) {
case htons(ETH_P_IP):
Expand All @@ -173,14 +178,16 @@ static u32 flow_get_nfct_dst(const struct sk_buff *skb, const struct flow_keys *
return flow_get_dst(skb, flow);
}

static u32 flow_get_nfct_proto_src(const struct sk_buff *skb, const struct flow_keys *flow)
static u32 flow_get_nfct_proto_src(const struct sk_buff *skb,
const struct flow_keys *flow)
{
return ntohs(CTTUPLE(skb, src.u.all));
fallback:
return flow_get_proto_src(skb, flow);
}

static u32 flow_get_nfct_proto_dst(const struct sk_buff *skb, const struct flow_keys *flow)
static u32 flow_get_nfct_proto_dst(const struct sk_buff *skb,
const struct flow_keys *flow)
{
return ntohs(CTTUPLE(skb, dst.u.all));
fallback:
Expand Down
3 changes: 2 additions & 1 deletion net/sched/cls_flower.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
tc.type = TC_SETUP_CLSFLOWER;
tc.cls_flower = &offload;

err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol, &tc);
err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol,
&tc);

if (tc_skip_sw(flags))
return err;
Expand Down
10 changes: 5 additions & 5 deletions net/sched/cls_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static u32 fw_hash(u32 handle)
}

static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res)
struct tcf_result *res)
{
struct fw_head *head = rcu_dereference_bh(tp->root);
struct fw_filter *f;
Expand Down Expand Up @@ -188,7 +188,8 @@ static const struct nla_policy fw_policy[TCA_FW_MAX + 1] = {

static int
fw_change_attrs(struct net *net, struct tcf_proto *tp, struct fw_filter *f,
struct nlattr **tb, struct nlattr **tca, unsigned long base, bool ovr)
struct nlattr **tb, struct nlattr **tca, unsigned long base,
bool ovr)
{
struct fw_head *head = rtnl_dereference(tp->root);
struct tcf_exts e;
Expand Down Expand Up @@ -237,9 +238,8 @@ fw_change_attrs(struct net *net, struct tcf_proto *tp, struct fw_filter *f,

static int fw_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base,
u32 handle,
struct nlattr **tca,
unsigned long *arg, bool ovr)
u32 handle, struct nlattr **tca, unsigned long *arg,
bool ovr)
{
struct fw_head *head = rtnl_dereference(tp->root);
struct fw_filter *f = (struct fw_filter *) *arg;
Expand Down
9 changes: 3 additions & 6 deletions net/sched/cls_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ static int route4_init(struct tcf_proto *tp)
return 0;
}

static void
route4_delete_filter(struct rcu_head *head)
static void route4_delete_filter(struct rcu_head *head)
{
struct route4_filter *f = container_of(head, struct route4_filter, rcu);

Expand Down Expand Up @@ -474,10 +473,8 @@ static int route4_set_parms(struct net *net, struct tcf_proto *tp,
}

static int route4_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base,
u32 handle,
struct nlattr **tca,
unsigned long *arg, bool ovr)
struct tcf_proto *tp, unsigned long base, u32 handle,
struct nlattr **tca, unsigned long *arg, bool ovr)
{
struct route4_head *head = rtnl_dereference(tp->root);
struct route4_filter __rcu **fp;
Expand Down
Loading

0 comments on commit 5a7a555

Please sign in to comment.