Re: [PATCH bpf-next] net: Add a warning if NAPI cb missed xdp_do_flush().

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

 



On Fri, 29 Sep 2023 18:58:25 +0200 Sebastian Andrzej Siewior wrote:
> +#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_DEBUG_NET)
> +bool __dev_check_flush(void);
> +bool __cpu_map_check_flush(void);
> +
> +#else
> +static inline bool __dev_check_flush(void)
> +{
> +	return false;
> +}
> +
> +static inline bool __cpu_map_check_flush(void)
> +{
> +	return false;
> +}
> +#endif

I think you're going too hard with the ifdefs.
These functions are only called if DEBUG_NET, add if BPF on the call
site and spare us the static inlines for all the __ helpers.

>  static __always_inline int
>  bpf_probe_read_kernel_common(void *dst, u32 size, const void *unsafe_ptr)
>  {
> diff --git a/include/linux/filter.h b/include/linux/filter.h
> index 27406aee2d402..db095d731813e 100644
> --- a/include/linux/filter.h
> +++ b/include/linux/filter.h
> @@ -1025,6 +1025,14 @@ int xdp_do_redirect_frame(struct net_device *dev,
>  			  struct bpf_prog *prog);
>  void xdp_do_flush(void);
>  
> +#ifdef CONFIG_DEBUG_NET
> +void xdp_do_check_flushed(struct napi_struct *napi);
> +
> +#else
> +static inline void xdp_do_check_flushed(struct napi_struct *napi) { }
> +
> +#endif

Can you move this to net/core/dev.h? Or a new header under net/core
if you prefer? This looks internal to the stack.
Also nit: drop the empty lines inside the #ifdef?




[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