Re: [PATCH bpf-next] bpf: Allow to use kfunc XDP hints and frags together

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

 



On Thu, Sep 14, 2023 at 10:37:11AM +0200, Larysa Zaremba wrote:
> There is no fundamental reason, why multi-buffer XDP and XDP kfunc RX hints
> cannot coexist in a single program.
> 
> Allow those features to be used together by modifying the flags conditions.
> 
> Suggested-by: Stanislav Fomichev <sdf@xxxxxxxxxx>
> Link: https://lore.kernel.org/bpf/CAKH8qBuzgtJj=OKMdsxEkyML36VsAuZpcrsXcyqjdKXSJCBq=Q@xxxxxxxxxxxxxx/
> Signed-off-by: Larysa Zaremba <larysa.zaremba@xxxxxxxxx>

Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@xxxxxxxxx>

Though it would be worth spelling out something in the commit msg about
additional check you're adding (frags flag can't go without dev bound)

> ---
>  kernel/bpf/offload.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/bpf/offload.c b/kernel/bpf/offload.c
> index ee35f33a96d1..43aded96c79b 100644
> --- a/kernel/bpf/offload.c
> +++ b/kernel/bpf/offload.c
> @@ -232,7 +232,11 @@ int bpf_prog_dev_bound_init(struct bpf_prog *prog, union bpf_attr *attr)
>  	    attr->prog_type != BPF_PROG_TYPE_XDP)
>  		return -EINVAL;
>  
> -	if (attr->prog_flags & ~BPF_F_XDP_DEV_BOUND_ONLY)
> +	if (attr->prog_flags & ~(BPF_F_XDP_DEV_BOUND_ONLY | BPF_F_XDP_HAS_FRAGS))
> +		return -EINVAL;
> +
> +	if (attr->prog_flags & BPF_F_XDP_HAS_FRAGS &&
> +	    !(attr->prog_flags & BPF_F_XDP_DEV_BOUND_ONLY))
>  		return -EINVAL;
>  
>  	if (attr->prog_type == BPF_PROG_TYPE_SCHED_CLS &&
> -- 
> 2.41.0
> 
> 




[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