Re: [PATCH v4 bpf-next/net 2/5] bpf: Support bpf_setsockopt() for BPF_CGROUP_INET_SOCK_CREATE.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 2, 2025 at 12:10 PM Martin KaFai Lau <martin.lau@xxxxxxxxx> wrote:
>
> On 8/28/25 6:00 PM, Kuniyuki Iwashima wrote:
> > +BPF_CALL_5(bpf_unlocked_sock_setsockopt, struct sock *, sk, int, level,
> > +        int, optname, char *, optval, int, optlen)
> > +{
> > +     return __bpf_setsockopt(sk, level, optname, optval, optlen);
> > +}
> > +
> > +static const struct bpf_func_proto bpf_unlocked_sock_setsockopt_proto = {
>
> nit. There is a bpf_unlocked_"sk"_{get,set}sockopt_proto which its .func is also
> taking "struct sock *". This one is sock_create specific, how about renaming it
> to bpf_sock_create_{get,set}sockopt_proto. The same for the its .func.

Sounds better to me :)
Will rename both.

>
>
> > +     .func           = bpf_unlocked_sock_setsockopt,
> > +     .gpl_only       = false,
> > +     .ret_type       = RET_INTEGER,
> > +     .arg1_type      = ARG_PTR_TO_CTX,
> > +     .arg2_type      = ARG_ANYTHING,
> > +     .arg3_type      = ARG_ANYTHING,
> > +     .arg4_type      = ARG_PTR_TO_MEM | MEM_RDONLY,
> > +     .arg5_type      = ARG_CONST_SIZE,
> > +};
> > +
> > +BPF_CALL_5(bpf_unlocked_sock_getsockopt, struct sock *, sk, int, level,
> > +        int, optname, char *, optval, int, optlen)
> > +{
> > +     return __bpf_getsockopt(sk, level, optname, optval, optlen);
> > +}
> > +
> > +static const struct bpf_func_proto bpf_unlocked_sock_getsockopt_proto = {
> > +     .func           = bpf_unlocked_sock_getsockopt,
> > +     .gpl_only       = false,
> > +     .ret_type       = RET_INTEGER,
> > +     .arg1_type      = ARG_PTR_TO_CTX,
> > +     .arg2_type      = ARG_ANYTHING,
> > +     .arg3_type      = ARG_ANYTHING,
> > +     .arg4_type      = ARG_PTR_TO_UNINIT_MEM,
> > +     .arg5_type      = ARG_CONST_SIZE,
> > +};
>





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux