1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2019 Mellanox Technologies. */
3 
4 #ifndef __MLX5_EN_XSK_UMEM_H__
5 #define __MLX5_EN_XSK_UMEM_H__
6 
7 #include "en.h"
8 
mlx5e_xsk_get_umem(struct mlx5e_params * params,struct mlx5e_xsk * xsk,u16 ix)9 static inline struct xdp_umem *mlx5e_xsk_get_umem(struct mlx5e_params *params,
10 						  struct mlx5e_xsk *xsk, u16 ix)
11 {
12 	if (!xsk || !xsk->umems)
13 		return NULL;
14 
15 	if (unlikely(ix >= params->num_channels))
16 		return NULL;
17 
18 	return xsk->umems[ix];
19 }
20 
21 struct mlx5e_xsk_param;
22 void mlx5e_build_xsk_param(struct xdp_umem *umem, struct mlx5e_xsk_param *xsk);
23 
24 /* .ndo_bpf callback. */
25 int mlx5e_xsk_setup_umem(struct net_device *dev, struct xdp_umem *umem, u16 qid);
26 
27 int mlx5e_xsk_resize_reuseq(struct xdp_umem *umem, u32 nentries);
28 
29 u16 mlx5e_xsk_first_unused_channel(struct mlx5e_params *params, struct mlx5e_xsk *xsk);
30 
31 #endif /* __MLX5_EN_XSK_UMEM_H__ */
32