1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2019-2020, Mellanox Technologies inc. All rights reserved. */
3 
4 #ifndef __MLX5_EN_XSK_POOL_H__
5 #define __MLX5_EN_XSK_POOL_H__
6 
7 #include "en.h"
8 
mlx5e_xsk_get_pool(struct mlx5e_params * params,struct mlx5e_xsk * xsk,u16 ix)9 static inline struct xsk_buff_pool *mlx5e_xsk_get_pool(struct mlx5e_params *params,
10 						       struct mlx5e_xsk *xsk, u16 ix)
11 {
12 	if (!xsk || !xsk->pools)
13 		return NULL;
14 
15 	if (unlikely(ix >= params->num_channels))
16 		return NULL;
17 
18 	return xsk->pools[ix];
19 }
20 
21 struct mlx5e_xsk_param;
22 void mlx5e_build_xsk_param(struct xsk_buff_pool *pool, struct mlx5e_xsk_param *xsk);
23 
24 /* .ndo_bpf callback. */
25 int mlx5e_xsk_setup_pool(struct net_device *dev, struct xsk_buff_pool *pool, u16 qid);
26 
27 #endif /* __MLX5_EN_XSK_POOL_H__ */
28