Commit 5a7a5555 authored by Jamal Hadi Salim's avatar Jamal Hadi Salim Committed by David S. Miller

net sched: stylistic cleanups

Signed-off-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f71b109f
...@@ -592,9 +592,8 @@ struct tc_action *tcf_action_init_1(struct net *net, struct nlattr *nla, ...@@ -592,9 +592,8 @@ struct tc_action *tcf_action_init_1(struct net *net, struct nlattr *nla,
return ERR_PTR(err); return ERR_PTR(err);
} }
int tcf_action_init(struct net *net, struct nlattr *nla, int tcf_action_init(struct net *net, struct nlattr *nla, struct nlattr *est,
struct nlattr *est, char *name, int ovr, char *name, int ovr, int bind, struct list_head *actions)
int bind, struct list_head *actions)
{ {
struct nlattr *tb[TCA_ACT_MAX_PRIO + 1]; struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];
struct tc_action *act; struct tc_action *act;
...@@ -923,9 +922,8 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct list_head *actions, ...@@ -923,9 +922,8 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct list_head *actions,
return err; return err;
} }
static int static int tcf_action_add(struct net *net, struct nlattr *nla,
tcf_action_add(struct net *net, struct nlattr *nla, struct nlmsghdr *n, struct nlmsghdr *n, u32 portid, int ovr)
u32 portid, int ovr)
{ {
int ret = 0; int ret = 0;
LIST_HEAD(actions); LIST_HEAD(actions);
...@@ -988,8 +986,7 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n) ...@@ -988,8 +986,7 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n)
return ret; return ret;
} }
static struct nlattr * static struct nlattr *find_dump_kind(const struct nlmsghdr *n)
find_dump_kind(const struct nlmsghdr *n)
{ {
struct nlattr *tb1, *tb2[TCA_ACT_MAX + 1]; struct nlattr *tb1, *tb2[TCA_ACT_MAX + 1];
struct nlattr *tb[TCA_ACT_MAX_PRIO + 1]; struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];
...@@ -1016,8 +1013,7 @@ find_dump_kind(const struct nlmsghdr *n) ...@@ -1016,8 +1013,7 @@ find_dump_kind(const struct nlmsghdr *n)
return kind; return kind;
} }
static int static int tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
{ {
struct net *net = sock_net(skb->sk); struct net *net = sock_net(skb->sk);
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
......
...@@ -116,8 +116,8 @@ static void *tcf_csum_skb_nextlayer(struct sk_buff *skb, ...@@ -116,8 +116,8 @@ static void *tcf_csum_skb_nextlayer(struct sk_buff *skb,
return (void *)(skb_network_header(skb) + ihl); return (void *)(skb_network_header(skb) + ihl);
} }
static int tcf_csum_ipv4_icmp(struct sk_buff *skb, static int tcf_csum_ipv4_icmp(struct sk_buff *skb, unsigned int ihl,
unsigned int ihl, unsigned int ipl) unsigned int ipl)
{ {
struct icmphdr *icmph; struct icmphdr *icmph;
...@@ -152,8 +152,8 @@ static int tcf_csum_ipv4_igmp(struct sk_buff *skb, ...@@ -152,8 +152,8 @@ static int tcf_csum_ipv4_igmp(struct sk_buff *skb,
return 1; return 1;
} }
static int tcf_csum_ipv6_icmp(struct sk_buff *skb, static int tcf_csum_ipv6_icmp(struct sk_buff *skb, unsigned int ihl,
unsigned int ihl, unsigned int ipl) unsigned int ipl)
{ {
struct icmp6hdr *icmp6h; struct icmp6hdr *icmp6h;
const struct ipv6hdr *ip6h; const struct ipv6hdr *ip6h;
...@@ -174,8 +174,8 @@ static int tcf_csum_ipv6_icmp(struct sk_buff *skb, ...@@ -174,8 +174,8 @@ static int tcf_csum_ipv6_icmp(struct sk_buff *skb,
return 1; return 1;
} }
static int tcf_csum_ipv4_tcp(struct sk_buff *skb, static int tcf_csum_ipv4_tcp(struct sk_buff *skb, unsigned int ihl,
unsigned int ihl, unsigned int ipl) unsigned int ipl)
{ {
struct tcphdr *tcph; struct tcphdr *tcph;
const struct iphdr *iph; const struct iphdr *iph;
...@@ -195,8 +195,8 @@ static int tcf_csum_ipv4_tcp(struct sk_buff *skb, ...@@ -195,8 +195,8 @@ static int tcf_csum_ipv4_tcp(struct sk_buff *skb,
return 1; return 1;
} }
static int tcf_csum_ipv6_tcp(struct sk_buff *skb, static int tcf_csum_ipv6_tcp(struct sk_buff *skb, unsigned int ihl,
unsigned int ihl, unsigned int ipl) unsigned int ipl)
{ {
struct tcphdr *tcph; struct tcphdr *tcph;
const struct ipv6hdr *ip6h; const struct ipv6hdr *ip6h;
...@@ -217,8 +217,8 @@ static int tcf_csum_ipv6_tcp(struct sk_buff *skb, ...@@ -217,8 +217,8 @@ static int tcf_csum_ipv6_tcp(struct sk_buff *skb,
return 1; return 1;
} }
static int tcf_csum_ipv4_udp(struct sk_buff *skb, static int tcf_csum_ipv4_udp(struct sk_buff *skb, unsigned int ihl,
unsigned int ihl, unsigned int ipl, int udplite) unsigned int ipl, int udplite)
{ {
struct udphdr *udph; struct udphdr *udph;
const struct iphdr *iph; const struct iphdr *iph;
...@@ -270,8 +270,8 @@ static int tcf_csum_ipv4_udp(struct sk_buff *skb, ...@@ -270,8 +270,8 @@ static int tcf_csum_ipv4_udp(struct sk_buff *skb,
return 1; return 1;
} }
static int tcf_csum_ipv6_udp(struct sk_buff *skb, static int tcf_csum_ipv6_udp(struct sk_buff *skb, unsigned int ihl,
unsigned int ihl, unsigned int ipl, int udplite) unsigned int ipl, int udplite)
{ {
struct udphdr *udph; struct udphdr *udph;
const struct ipv6hdr *ip6h; const struct ipv6hdr *ip6h;
...@@ -380,8 +380,8 @@ static int tcf_csum_ipv4(struct sk_buff *skb, u32 update_flags) ...@@ -380,8 +380,8 @@ static int tcf_csum_ipv4(struct sk_buff *skb, u32 update_flags)
return 0; return 0;
} }
static int tcf_csum_ipv6_hopopts(struct ipv6_opt_hdr *ip6xh, static int tcf_csum_ipv6_hopopts(struct ipv6_opt_hdr *ip6xh, unsigned int ixhl,
unsigned int ixhl, unsigned int *pl) unsigned int *pl)
{ {
int off, len, optlen; int off, len, optlen;
unsigned char *xh = (void *)ip6xh; unsigned char *xh = (void *)ip6xh;
...@@ -494,8 +494,8 @@ static int tcf_csum_ipv6(struct sk_buff *skb, u32 update_flags) ...@@ -494,8 +494,8 @@ static int tcf_csum_ipv6(struct sk_buff *skb, u32 update_flags)
return 0; return 0;
} }
static int tcf_csum(struct sk_buff *skb, static int tcf_csum(struct sk_buff *skb, const struct tc_action *a,
const struct tc_action *a, struct tcf_result *res) struct tcf_result *res)
{ {
struct tcf_csum *p = to_tcf_csum(a); struct tcf_csum *p = to_tcf_csum(a);
int action; int action;
...@@ -531,8 +531,8 @@ static int tcf_csum(struct sk_buff *skb, ...@@ -531,8 +531,8 @@ static int tcf_csum(struct sk_buff *skb,
return TC_ACT_SHOT; return TC_ACT_SHOT;
} }
static int tcf_csum_dump(struct sk_buff *skb, static int tcf_csum_dump(struct sk_buff *skb, struct tc_action *a, int bind,
struct tc_action *a, int bind, int ref) int ref)
{ {
unsigned char *b = skb_tail_pointer(skb); unsigned char *b = skb_tail_pointer(skb);
struct tcf_csum *p = to_tcf_csum(a); struct tcf_csum *p = to_tcf_csum(a);
......
...@@ -156,7 +156,8 @@ static void tcf_gact_stats_update(struct tc_action *a, u64 bytes, u32 packets, ...@@ -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); int action = READ_ONCE(gact->tcf_action);
struct tcf_t *tm = &gact->tcf_tm; 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) if (action == TC_ACT_SHOT)
this_cpu_ptr(gact->common.cpu_qstats)->drops += packets; this_cpu_ptr(gact->common.cpu_qstats)->drops += packets;
......
...@@ -204,7 +204,8 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a, ...@@ -204,7 +204,8 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
return retval; 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); unsigned char *b = skb_tail_pointer(skb);
struct tcf_mirred *m = to_mirred(a); struct tcf_mirred *m = to_mirred(a);
......
...@@ -263,8 +263,8 @@ static int tcf_act_police(struct sk_buff *skb, const struct tc_action *a, ...@@ -263,8 +263,8 @@ static int tcf_act_police(struct sk_buff *skb, const struct tc_action *a,
return police->tcf_action; return police->tcf_action;
} }
static int static int tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a,
tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) int bind, int ref)
{ {
unsigned char *b = skb_tail_pointer(skb); unsigned char *b = skb_tail_pointer(skb);
struct tcf_police *police = to_police(a); struct tcf_police *police = to_police(a);
...@@ -349,14 +349,12 @@ static struct pernet_operations police_net_ops = { ...@@ -349,14 +349,12 @@ static struct pernet_operations police_net_ops = {
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
static int __init static int __init police_init_module(void)
police_init_module(void)
{ {
return tcf_register_action(&act_police_ops, &police_net_ops); return tcf_register_action(&act_police_ops, &police_net_ops);
} }
static void __exit static void __exit police_cleanup_module(void)
police_cleanup_module(void)
{ {
tcf_unregister_action(&act_police_ops, &police_net_ops); tcf_unregister_action(&act_police_ops, &police_net_ops);
} }
......
...@@ -344,13 +344,15 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n) ...@@ -344,13 +344,15 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
if (err == 0) { if (err == 0) {
struct tcf_proto *next = rtnl_dereference(tp->next); 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)) if (tcf_destroy(tp, false))
RCU_INIT_POINTER(*back, next); RCU_INIT_POINTER(*back, next);
} }
goto errout; goto errout;
case RTM_GETTFILTER: 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; goto errout;
default: default:
err = -EINVAL; err = -EINVAL;
...@@ -448,7 +450,8 @@ static int tcf_node_dump(struct tcf_proto *tp, unsigned long n, ...@@ -448,7 +450,8 @@ static int tcf_node_dump(struct tcf_proto *tp, unsigned long n,
struct net *net = sock_net(a->skb->sk); struct net *net = sock_net(a->skb->sk);
return tcf_fill_node(net, a->skb, tp, n, NETLINK_CB(a->cb->skb).portid, 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 */ /* called with RTNL */
...@@ -552,7 +555,7 @@ void tcf_exts_destroy(struct tcf_exts *exts) ...@@ -552,7 +555,7 @@ void tcf_exts_destroy(struct tcf_exts *exts)
EXPORT_SYMBOL(tcf_exts_destroy); EXPORT_SYMBOL(tcf_exts_destroy);
int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, 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 #ifdef CONFIG_NET_CLS_ACT
{ {
...@@ -560,8 +563,7 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, ...@@ -560,8 +563,7 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
if (exts->police && tb[exts->police]) { if (exts->police && tb[exts->police]) {
act = tcf_action_init_1(net, tb[exts->police], rate_tlv, act = tcf_action_init_1(net, tb[exts->police], rate_tlv,
"police", ovr, "police", ovr, TCA_ACT_BIND);
TCA_ACT_BIND);
if (IS_ERR(act)) if (IS_ERR(act))
return PTR_ERR(act); return PTR_ERR(act);
...@@ -573,8 +575,8 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, ...@@ -573,8 +575,8 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
int err, i = 0; int err, i = 0;
err = tcf_action_init(net, tb[exts->action], rate_tlv, err = tcf_action_init(net, tb[exts->action], rate_tlv,
NULL, ovr, NULL, ovr, TCA_ACT_BIND,
TCA_ACT_BIND, &actions); &actions);
if (err) if (err)
return err; return err;
list_for_each_entry(act, &actions, list) list_for_each_entry(act, &actions, list)
......
...@@ -55,7 +55,8 @@ static const struct nla_policy bpf_policy[TCA_BPF_MAX + 1] = { ...@@ -55,7 +55,8 @@ static const struct nla_policy bpf_policy[TCA_BPF_MAX + 1] = {
[TCA_BPF_CLASSID] = { .type = NLA_U32 }, [TCA_BPF_CLASSID] = { .type = NLA_U32 },
[TCA_BPF_FLAGS] = { .type = NLA_U32 }, [TCA_BPF_FLAGS] = { .type = NLA_U32 },
[TCA_BPF_FD] = { .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_LEN] = { .type = NLA_U16 },
[TCA_BPF_OPS] = { .type = NLA_BINARY, [TCA_BPF_OPS] = { .type = NLA_BINARY,
.len = sizeof(struct sock_filter) * BPF_MAXINSNS }, .len = sizeof(struct sock_filter) * BPF_MAXINSNS },
...@@ -409,7 +410,8 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb, ...@@ -409,7 +410,8 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,
goto errout; 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) if (ret < 0)
goto errout; goto errout;
......
...@@ -87,12 +87,14 @@ static u32 flow_get_dst(const struct sk_buff *skb, const struct flow_keys *flow) ...@@ -87,12 +87,14 @@ 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); 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; 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) if (flow->ports.ports)
return ntohs(flow->ports.src); return ntohs(flow->ports.src);
...@@ -100,7 +102,8 @@ static u32 flow_get_proto_src(const struct sk_buff *skb, const struct flow_keys ...@@ -100,7 +102,8 @@ static u32 flow_get_proto_src(const struct sk_buff *skb, const struct flow_keys
return addr_fold(skb->sk); 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) if (flow->ports.ports)
return ntohs(flow->ports.dst); return ntohs(flow->ports.dst);
...@@ -149,7 +152,8 @@ static u32 flow_get_nfct(const struct sk_buff *skb) ...@@ -149,7 +152,8 @@ static u32 flow_get_nfct(const struct sk_buff *skb)
}) })
#endif #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)) { switch (tc_skb_protocol(skb)) {
case htons(ETH_P_IP): case htons(ETH_P_IP):
...@@ -161,7 +165,8 @@ static u32 flow_get_nfct_src(const struct sk_buff *skb, const struct flow_keys * ...@@ -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); 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)) { switch (tc_skb_protocol(skb)) {
case htons(ETH_P_IP): case htons(ETH_P_IP):
...@@ -173,14 +178,16 @@ static u32 flow_get_nfct_dst(const struct sk_buff *skb, const struct flow_keys * ...@@ -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); 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)); return ntohs(CTTUPLE(skb, src.u.all));
fallback: fallback:
return flow_get_proto_src(skb, flow); 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)); return ntohs(CTTUPLE(skb, dst.u.all));
fallback: fallback:
......
...@@ -241,7 +241,8 @@ static int fl_hw_replace_filter(struct tcf_proto *tp, ...@@ -241,7 +241,8 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
tc.type = TC_SETUP_CLSFLOWER; tc.type = TC_SETUP_CLSFLOWER;
tc.cls_flower = &offload; 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)) if (tc_skip_sw(flags))
return err; return err;
......
...@@ -57,7 +57,7 @@ static u32 fw_hash(u32 handle) ...@@ -57,7 +57,7 @@ static u32 fw_hash(u32 handle)
} }
static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp, 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_head *head = rcu_dereference_bh(tp->root);
struct fw_filter *f; struct fw_filter *f;
...@@ -188,7 +188,8 @@ static const struct nla_policy fw_policy[TCA_FW_MAX + 1] = { ...@@ -188,7 +188,8 @@ static const struct nla_policy fw_policy[TCA_FW_MAX + 1] = {
static int static int
fw_change_attrs(struct net *net, struct tcf_proto *tp, struct fw_filter *f, 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 fw_head *head = rtnl_dereference(tp->root);
struct tcf_exts e; struct tcf_exts e;
...@@ -237,9 +238,8 @@ fw_change_attrs(struct net *net, struct tcf_proto *tp, struct fw_filter *f, ...@@ -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, static int fw_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base, struct tcf_proto *tp, unsigned long base,
u32 handle, u32 handle, struct nlattr **tca, unsigned long *arg,
struct nlattr **tca, bool ovr)
unsigned long *arg, bool ovr)
{ {
struct fw_head *head = rtnl_dereference(tp->root); struct fw_head *head = rtnl_dereference(tp->root);
struct fw_filter *f = (struct fw_filter *) *arg; struct fw_filter *f = (struct fw_filter *) *arg;
......
...@@ -268,8 +268,7 @@ static int route4_init(struct tcf_proto *tp) ...@@ -268,8 +268,7 @@ static int route4_init(struct tcf_proto *tp)
return 0; return 0;
} }
static void static void route4_delete_filter(struct rcu_head *head)
route4_delete_filter(struct rcu_head *head)
{ {
struct route4_filter *f = container_of(head, struct route4_filter, rcu); struct route4_filter *f = container_of(head, struct route4_filter, rcu);
...@@ -474,10 +473,8 @@ static int route4_set_parms(struct net *net, struct tcf_proto *tp, ...@@ -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, static int route4_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base, struct tcf_proto *tp, unsigned long base, u32 handle,
u32 handle, struct nlattr **tca, unsigned long *arg, bool ovr)
struct nlattr **tca,
unsigned long *arg, bool ovr)
{ {
struct route4_head *head = rtnl_dereference(tp->root); struct route4_head *head = rtnl_dereference(tp->root);
struct route4_filter __rcu **fp; struct route4_filter __rcu **fp;
......
...@@ -50,14 +50,13 @@ struct tcindex_data { ...@@ -50,14 +50,13 @@ struct tcindex_data {
struct rcu_head rcu; struct rcu_head rcu;
}; };
static inline int static inline int tcindex_filter_is_set(struct tcindex_filter_result *r)
tcindex_filter_is_set(struct tcindex_filter_result *r)
{ {
return tcf_exts_is_predicative(&r->exts) || r->res.classid; return tcf_exts_is_predicative(&r->exts) || r->res.classid;
} }
static struct tcindex_filter_result * static struct tcindex_filter_result *tcindex_lookup(struct tcindex_data *p,
tcindex_lookup(struct tcindex_data *p, u16 key) u16 key)
{ {
if (p->perfect) { if (p->perfect) {
struct tcindex_filter_result *f = p->perfect + key; struct tcindex_filter_result *f = p->perfect + key;
...@@ -144,7 +143,8 @@ static void tcindex_destroy_rexts(struct rcu_head *head) ...@@ -144,7 +143,8 @@ static void tcindex_destroy_rexts(struct rcu_head *head)
static void tcindex_destroy_fexts(struct rcu_head *head) static void tcindex_destroy_fexts(struct rcu_head *head)
{ {
struct tcindex_filter *f = container_of(head, struct tcindex_filter, rcu); struct tcindex_filter *f = container_of(head, struct tcindex_filter,
rcu);
tcf_exts_destroy(&f->result.exts); tcf_exts_destroy(&f->result.exts);
kfree(f); kfree(f);
...@@ -550,7 +550,7 @@ static bool tcindex_destroy(struct tcf_proto *tp, bool force) ...@@ -550,7 +550,7 @@ static bool tcindex_destroy(struct tcf_proto *tp, bool force)
static int tcindex_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, static int tcindex_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
struct sk_buff *skb, struct tcmsg *t) struct sk_buff *skb, struct tcmsg *t)
{ {
struct tcindex_data *p = rtnl_dereference(tp->root); struct tcindex_data *p = rtnl_dereference(tp->root);
struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh; struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh;
......
...@@ -104,7 +104,8 @@ static inline unsigned int u32_hash_fold(__be32 key, ...@@ -104,7 +104,8 @@ static inline unsigned int u32_hash_fold(__be32 key,
return h; return h;
} }
static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp, struct tcf_result *res) static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res)
{ {
struct { struct {
struct tc_u_knode *knode; struct tc_u_knode *knode;
...@@ -256,8 +257,7 @@ static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp, struct ...@@ -256,8 +257,7 @@ static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp, struct
return -1; return -1;
} }
static struct tc_u_hnode * static struct tc_u_hnode *u32_lookup_ht(struct tc_u_common *tp_c, u32 handle)
u32_lookup_ht(struct tc_u_common *tp_c, u32 handle)
{ {
struct tc_u_hnode *ht; struct tc_u_hnode *ht;
...@@ -270,8 +270,7 @@ u32_lookup_ht(struct tc_u_common *tp_c, u32 handle) ...@@ -270,8 +270,7 @@ u32_lookup_ht(struct tc_u_common *tp_c, u32 handle)
return ht; return ht;
} }
static struct tc_u_knode * static struct tc_u_knode *u32_lookup_key(struct tc_u_hnode *ht, u32 handle)
u32_lookup_key(struct tc_u_hnode *ht, u32 handle)
{ {
unsigned int sel; unsigned int sel;
struct tc_u_knode *n = NULL; struct tc_u_knode *n = NULL;
...@@ -360,8 +359,7 @@ static int u32_init(struct tcf_proto *tp) ...@@ -360,8 +359,7 @@ static int u32_init(struct tcf_proto *tp)
return 0; return 0;
} }
static int u32_destroy_key(struct tcf_proto *tp, static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n,
struct tc_u_knode *n,
bool free_pf) bool free_pf)
{ {
tcf_exts_destroy(&n->exts); tcf_exts_destroy(&n->exts);
...@@ -448,9 +446,8 @@ static void u32_remove_hw_knode(struct tcf_proto *tp, u32 handle) ...@@ -448,9 +446,8 @@ static void u32_remove_hw_knode(struct tcf_proto *tp, u32 handle)
} }
} }
static int u32_replace_hw_hnode(struct tcf_proto *tp, static int u32_replace_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h,
struct tc_u_hnode *h, u32 flags)
u32 flags)
{ {
struct net_device *dev = tp->q->dev_queue->dev; struct net_device *dev = tp->q->dev_queue->dev;
struct tc_cls_u32_offload u32_offload = {0}; struct tc_cls_u32_offload u32_offload = {0};
...@@ -496,9 +493,8 @@ static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h) ...@@ -496,9 +493,8 @@ static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h)
} }
} }
static int u32_replace_hw_knode(struct tcf_proto *tp, static int u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,
struct tc_u_knode *n, u32 flags)
u32 flags)
{ {
struct net_device *dev = tp->q->dev_queue->dev; struct net_device *dev = tp->q->dev_queue->dev;
struct tc_cls_u32_offload u32_offload = {0}; struct tc_cls_u32_offload u32_offload = {0};
...@@ -763,8 +759,7 @@ static int u32_set_parms(struct net *net, struct tcf_proto *tp, ...@@ -763,8 +759,7 @@ static int u32_set_parms(struct net *net, struct tcf_proto *tp,
return err; return err;
} }
static void u32_replace_knode(struct tcf_proto *tp, static void u32_replace_knode(struct tcf_proto *tp, struct tc_u_common *tp_c,
struct tc_u_common *tp_c,
struct tc_u_knode *n) struct tc_u_knode *n)
{ {
struct tc_u_knode __rcu **ins; struct tc_u_knode __rcu **ins;
...@@ -845,8 +840,7 @@ static struct tc_u_knode *u32_init_knode(struct tcf_proto *tp, ...@@ -845,8 +840,7 @@ static struct tc_u_knode *u32_init_knode(struct tcf_proto *tp,
static int u32_change(struct net *net, struct sk_buff *in_skb, static int u32_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base, u32 handle, struct tcf_proto *tp, unsigned long base, u32 handle,
struct nlattr **tca, struct nlattr **tca, unsigned long *arg, bool ovr)
unsigned long *arg, bool ovr)
{ {
struct tc_u_common *tp_c = tp->data; struct tc_u_common *tp_c = tp->data;
struct tc_u_hnode *ht; struct tc_u_hnode *ht;
...@@ -1088,7 +1082,7 @@ static void u32_walk(struct tcf_proto *tp, struct tcf_walker *arg) ...@@ -1088,7 +1082,7 @@ static void u32_walk(struct tcf_proto *tp, struct tcf_walker *arg)
} }
static int u32_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, static int u32_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
struct sk_buff *skb, struct tcmsg *t) struct sk_buff *skb, struct tcmsg *t)
{ {
struct tc_u_knode *n = (struct tc_u_knode *)fh; struct tc_u_knode *n = (struct tc_u_knode *)fh;
struct tc_u_hnode *ht_up, *ht_down; struct tc_u_hnode *ht_up, *ht_down;
......
...@@ -389,7 +389,8 @@ static __u8 __detect_linklayer(struct tc_ratespec *r, __u32 *rtab) ...@@ -389,7 +389,8 @@ static __u8 __detect_linklayer(struct tc_ratespec *r, __u32 *rtab)
static struct qdisc_rate_table *qdisc_rtab_list; static struct qdisc_rate_table *qdisc_rtab_list;
struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *tab) struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
struct nlattr *tab)
{ {
struct qdisc_rate_table *rtab; struct qdisc_rate_table *rtab;
...@@ -541,7 +542,8 @@ static int qdisc_dump_stab(struct sk_buff *skb, struct qdisc_size_table *stab) ...@@ -541,7 +542,8 @@ static int qdisc_dump_stab(struct sk_buff *skb, struct qdisc_size_table *stab)
return -1; return -1;
} }
void __qdisc_calculate_pkt_len(struct sk_buff *skb, const struct qdisc_size_table *stab) void __qdisc_calculate_pkt_len(struct sk_buff *skb,
const struct qdisc_size_table *stab)
{ {
int pkt_len, slot; int pkt_len, slot;
...@@ -888,10 +890,10 @@ static struct lock_class_key qdisc_rx_lock; ...@@ -888,10 +890,10 @@ static struct lock_class_key qdisc_rx_lock;
Parameters are passed via opt. Parameters are passed via opt.
*/ */
static struct Qdisc * static struct Qdisc *qdisc_create(struct net_device *dev,
qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, struct netdev_queue *dev_queue,
struct Qdisc *p, u32 parent, u32 handle, struct Qdisc *p, u32 parent, u32 handle,
struct nlattr **tca, int *errp) struct nlattr **tca, int *errp)
{ {
int err; int err;
struct nlattr *kind = tca[TCA_KIND]; struct nlattr *kind = tca[TCA_KIND];
...@@ -1073,7 +1075,8 @@ struct check_loop_arg { ...@@ -1073,7 +1075,8 @@ struct check_loop_arg {
int depth; int depth;
}; };
static int check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w); static int check_loop_fn(struct Qdisc *q, unsigned long cl,
struct qdisc_walker *w);
static int check_loop(struct Qdisc *q, struct Qdisc *p, int depth) static int check_loop(struct Qdisc *q, struct Qdisc *p, int depth)
{ {
...@@ -1450,7 +1453,8 @@ static int tc_dump_qdisc_root(struct Qdisc *root, struct sk_buff *skb, ...@@ -1450,7 +1453,8 @@ static int tc_dump_qdisc_root(struct Qdisc *root, struct sk_buff *skb,
} else { } else {
if (!tc_qdisc_dump_ignore(q) && if (!tc_qdisc_dump_ignore(q) &&
tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).portid, tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) cb->nlh->nlmsg_seq, NLM_F_MULTI,
RTM_NEWQDISC) <= 0)
goto done; goto done;
q_idx++; q_idx++;
} }
...@@ -1471,7 +1475,8 @@ static int tc_dump_qdisc_root(struct Qdisc *root, struct sk_buff *skb, ...@@ -1471,7 +1475,8 @@ static int tc_dump_qdisc_root(struct Qdisc *root, struct sk_buff *skb,
} }
if (!tc_qdisc_dump_ignore(q) && if (!tc_qdisc_dump_ignore(q) &&
tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).portid, tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) cb->nlh->nlmsg_seq, NLM_F_MULTI,
RTM_NEWQDISC) <= 0)
goto done; goto done;
q_idx++; q_idx++;
} }
...@@ -1505,7 +1510,8 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -1505,7 +1510,8 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
s_q_idx = 0; s_q_idx = 0;
q_idx = 0; q_idx = 0;
if (tc_dump_qdisc_root(dev->qdisc, skb, cb, &q_idx, s_q_idx, true) < 0) if (tc_dump_qdisc_root(dev->qdisc, skb, cb, &q_idx, s_q_idx,
true) < 0)
goto done; goto done;
dev_queue = dev_ingress_queue(dev); dev_queue = dev_ingress_queue(dev);
...@@ -1640,7 +1646,8 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n) ...@@ -1640,7 +1646,8 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n)
if (cops->delete) if (cops->delete)
err = cops->delete(q, cl); err = cops->delete(q, cl);
if (err == 0) if (err == 0)
tclass_notify(net, skb, n, q, cl, RTM_DELTCLASS); tclass_notify(net, skb, n, q, cl,
RTM_DELTCLASS);
goto out; goto out;
case RTM_GETTCLASS: case RTM_GETTCLASS:
err = tclass_notify(net, skb, n, q, cl, RTM_NEWTCLASS); err = tclass_notify(net, skb, n, q, cl, RTM_NEWTCLASS);
...@@ -1738,12 +1745,14 @@ struct qdisc_dump_args { ...@@ -1738,12 +1745,14 @@ struct qdisc_dump_args {
struct netlink_callback *cb; struct netlink_callback *cb;
}; };
static int qdisc_class_dump(struct Qdisc *q, unsigned long cl, struct qdisc_walker *arg) static int qdisc_class_dump(struct Qdisc *q, unsigned long cl,
struct qdisc_walker *arg)
{ {
struct qdisc_dump_args *a = (struct qdisc_dump_args *)arg; struct qdisc_dump_args *a = (struct qdisc_dump_args *)arg;
return tc_fill_tclass(a->skb, q, cl, NETLINK_CB(a->cb->skb).portid, return tc_fill_tclass(a->skb, q, cl, NETLINK_CB(a->cb->skb).portid,
a->cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWTCLASS); a->cb->nlh->nlmsg_seq, NLM_F_MULTI,
RTM_NEWTCLASS);
} }
static int tc_dump_tclass_qdisc(struct Qdisc *q, struct sk_buff *skb, static int tc_dump_tclass_qdisc(struct Qdisc *q, struct sk_buff *skb,
...@@ -1976,10 +1985,12 @@ static int __init pktsched_init(void) ...@@ -1976,10 +1985,12 @@ static int __init pktsched_init(void)
rtnl_register(PF_UNSPEC, RTM_NEWQDISC, tc_modify_qdisc, NULL, NULL); rtnl_register(PF_UNSPEC, RTM_NEWQDISC, tc_modify_qdisc, NULL, NULL);
rtnl_register(PF_UNSPEC, RTM_DELQDISC, tc_get_qdisc, NULL, NULL); rtnl_register(PF_UNSPEC, RTM_DELQDISC, tc_get_qdisc, NULL, NULL);
rtnl_register(PF_UNSPEC, RTM_GETQDISC, tc_get_qdisc, tc_dump_qdisc, NULL); rtnl_register(PF_UNSPEC, RTM_GETQDISC, tc_get_qdisc, tc_dump_qdisc,
NULL);
rtnl_register(PF_UNSPEC, RTM_NEWTCLASS, tc_ctl_tclass, NULL, NULL); rtnl_register(PF_UNSPEC, RTM_NEWTCLASS, tc_ctl_tclass, NULL, NULL);
rtnl_register(PF_UNSPEC, RTM_DELTCLASS, tc_ctl_tclass, NULL, NULL); rtnl_register(PF_UNSPEC, RTM_DELTCLASS, tc_ctl_tclass, NULL, NULL);
rtnl_register(PF_UNSPEC, RTM_GETTCLASS, tc_ctl_tclass, tc_dump_tclass, NULL); rtnl_register(PF_UNSPEC, RTM_GETTCLASS, tc_ctl_tclass, tc_dump_tclass,
NULL);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment