18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Copyright (c) 2019, Intel Corporation. */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef _ICE_XSK_H_
58c2ecf20Sopenharmony_ci#define _ICE_XSK_H_
68c2ecf20Sopenharmony_ci#include "ice_txrx.h"
78c2ecf20Sopenharmony_ci#include "ice.h"
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cistruct ice_vsi;
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifdef CONFIG_XDP_SOCKETS
128c2ecf20Sopenharmony_ciint ice_xsk_pool_setup(struct ice_vsi *vsi, struct xsk_buff_pool *pool,
138c2ecf20Sopenharmony_ci		       u16 qid);
148c2ecf20Sopenharmony_ciint ice_clean_rx_irq_zc(struct ice_ring *rx_ring, int budget);
158c2ecf20Sopenharmony_cibool ice_clean_tx_irq_zc(struct ice_ring *xdp_ring, int budget);
168c2ecf20Sopenharmony_ciint ice_xsk_wakeup(struct net_device *netdev, u32 queue_id, u32 flags);
178c2ecf20Sopenharmony_cibool ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, u16 count);
188c2ecf20Sopenharmony_cibool ice_xsk_any_rx_ring_ena(struct ice_vsi *vsi);
198c2ecf20Sopenharmony_civoid ice_xsk_clean_rx_ring(struct ice_ring *rx_ring);
208c2ecf20Sopenharmony_civoid ice_xsk_clean_xdp_ring(struct ice_ring *xdp_ring);
218c2ecf20Sopenharmony_ci#else
228c2ecf20Sopenharmony_cistatic inline int
238c2ecf20Sopenharmony_ciice_xsk_pool_setup(struct ice_vsi __always_unused *vsi,
248c2ecf20Sopenharmony_ci		   struct xsk_buff_pool __always_unused *pool,
258c2ecf20Sopenharmony_ci		   u16 __always_unused qid)
268c2ecf20Sopenharmony_ci{
278c2ecf20Sopenharmony_ci	return -EOPNOTSUPP;
288c2ecf20Sopenharmony_ci}
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistatic inline int
318c2ecf20Sopenharmony_ciice_clean_rx_irq_zc(struct ice_ring __always_unused *rx_ring,
328c2ecf20Sopenharmony_ci		    int __always_unused budget)
338c2ecf20Sopenharmony_ci{
348c2ecf20Sopenharmony_ci	return 0;
358c2ecf20Sopenharmony_ci}
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cistatic inline bool
388c2ecf20Sopenharmony_ciice_clean_tx_irq_zc(struct ice_ring __always_unused *xdp_ring,
398c2ecf20Sopenharmony_ci		    int __always_unused budget)
408c2ecf20Sopenharmony_ci{
418c2ecf20Sopenharmony_ci	return false;
428c2ecf20Sopenharmony_ci}
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistatic inline bool
458c2ecf20Sopenharmony_ciice_alloc_rx_bufs_zc(struct ice_ring __always_unused *rx_ring,
468c2ecf20Sopenharmony_ci		     u16 __always_unused count)
478c2ecf20Sopenharmony_ci{
488c2ecf20Sopenharmony_ci	return false;
498c2ecf20Sopenharmony_ci}
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_cistatic inline bool ice_xsk_any_rx_ring_ena(struct ice_vsi __always_unused *vsi)
528c2ecf20Sopenharmony_ci{
538c2ecf20Sopenharmony_ci	return false;
548c2ecf20Sopenharmony_ci}
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cistatic inline int
578c2ecf20Sopenharmony_ciice_xsk_wakeup(struct net_device __always_unused *netdev,
588c2ecf20Sopenharmony_ci	       u32 __always_unused queue_id, u32 __always_unused flags)
598c2ecf20Sopenharmony_ci{
608c2ecf20Sopenharmony_ci	return -EOPNOTSUPP;
618c2ecf20Sopenharmony_ci}
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#define ice_xsk_clean_rx_ring(rx_ring) do {} while (0)
648c2ecf20Sopenharmony_ci#define ice_xsk_clean_xdp_ring(xdp_ring) do {} while (0)
658c2ecf20Sopenharmony_ci#endif /* CONFIG_XDP_SOCKETS */
668c2ecf20Sopenharmony_ci#endif /* !_ICE_XSK_H_ */
67