tc: cls_bpf: rename bpf_len to bpf_num_ops
It was suggested by DaveM to change the name as "len" might indicate unit bytes. Suggested-by: David Miller <davem@davemloft.net> Signed-off-by: Jiri Pirko <jiri@resnulli.us> Acked-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
d23b8ad8ab
Коммит
33e9fcc666
|
@ -37,7 +37,7 @@ struct cls_bpf_prog {
|
||||||
struct tcf_result res;
|
struct tcf_result res;
|
||||||
struct list_head link;
|
struct list_head link;
|
||||||
u32 handle;
|
u32 handle;
|
||||||
u16 bpf_len;
|
u16 bpf_num_ops;
|
||||||
struct tcf_proto *tp;
|
struct tcf_proto *tp;
|
||||||
struct rcu_head rcu;
|
struct rcu_head rcu;
|
||||||
};
|
};
|
||||||
|
@ -160,7 +160,7 @@ static int cls_bpf_modify_existing(struct net *net, struct tcf_proto *tp,
|
||||||
struct tcf_exts exts;
|
struct tcf_exts exts;
|
||||||
struct sock_fprog_kern tmp;
|
struct sock_fprog_kern tmp;
|
||||||
struct bpf_prog *fp;
|
struct bpf_prog *fp;
|
||||||
u16 bpf_size, bpf_len;
|
u16 bpf_size, bpf_num_ops;
|
||||||
u32 classid;
|
u32 classid;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -173,13 +173,13 @@ static int cls_bpf_modify_existing(struct net *net, struct tcf_proto *tp,
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
classid = nla_get_u32(tb[TCA_BPF_CLASSID]);
|
classid = nla_get_u32(tb[TCA_BPF_CLASSID]);
|
||||||
bpf_len = nla_get_u16(tb[TCA_BPF_OPS_LEN]);
|
bpf_num_ops = nla_get_u16(tb[TCA_BPF_OPS_LEN]);
|
||||||
if (bpf_len > BPF_MAXINSNS || bpf_len == 0) {
|
if (bpf_num_ops > BPF_MAXINSNS || bpf_num_ops == 0) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
bpf_size = bpf_len * sizeof(*bpf_ops);
|
bpf_size = bpf_num_ops * sizeof(*bpf_ops);
|
||||||
bpf_ops = kzalloc(bpf_size, GFP_KERNEL);
|
bpf_ops = kzalloc(bpf_size, GFP_KERNEL);
|
||||||
if (bpf_ops == NULL) {
|
if (bpf_ops == NULL) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
@ -188,14 +188,14 @@ static int cls_bpf_modify_existing(struct net *net, struct tcf_proto *tp,
|
||||||
|
|
||||||
memcpy(bpf_ops, nla_data(tb[TCA_BPF_OPS]), bpf_size);
|
memcpy(bpf_ops, nla_data(tb[TCA_BPF_OPS]), bpf_size);
|
||||||
|
|
||||||
tmp.len = bpf_len;
|
tmp.len = bpf_num_ops;
|
||||||
tmp.filter = bpf_ops;
|
tmp.filter = bpf_ops;
|
||||||
|
|
||||||
ret = bpf_prog_create(&fp, &tmp);
|
ret = bpf_prog_create(&fp, &tmp);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto errout_free;
|
goto errout_free;
|
||||||
|
|
||||||
prog->bpf_len = bpf_len;
|
prog->bpf_num_ops = bpf_num_ops;
|
||||||
prog->bpf_ops = bpf_ops;
|
prog->bpf_ops = bpf_ops;
|
||||||
prog->filter = fp;
|
prog->filter = fp;
|
||||||
prog->res.classid = classid;
|
prog->res.classid = classid;
|
||||||
|
@ -303,10 +303,10 @@ static int cls_bpf_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
|
||||||
|
|
||||||
if (nla_put_u32(skb, TCA_BPF_CLASSID, prog->res.classid))
|
if (nla_put_u32(skb, TCA_BPF_CLASSID, prog->res.classid))
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
if (nla_put_u16(skb, TCA_BPF_OPS_LEN, prog->bpf_len))
|
if (nla_put_u16(skb, TCA_BPF_OPS_LEN, prog->bpf_num_ops))
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
nla = nla_reserve(skb, TCA_BPF_OPS, prog->bpf_len *
|
nla = nla_reserve(skb, TCA_BPF_OPS, prog->bpf_num_ops *
|
||||||
sizeof(struct sock_filter));
|
sizeof(struct sock_filter));
|
||||||
if (nla == NULL)
|
if (nla == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче