Pragma unroll was introduced around GCC 8, whereas current xsk code in
ice that prepares loop_unrolled_for macro that is based on mentioned
pragma, compares GCC version against 4, which is wrong and Stephen
found this out by compiling kernel with GCC 5.4 [0].
Fix this mistake and check if GCC version is >= 8.
[0]: https://lore.kernel.org/netdev/20220307213659.47658125@canb.auug.org.au/
Fixes: 126cdfe100
("ice: xsk: Improve AF_XDP ZC Tx and use batching API")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://lore.kernel.org/r/20220307231353.56638-1-maciej.fijalkowski@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
78 lines
2.0 KiB
C
78 lines
2.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright (c) 2019, Intel Corporation. */
|
|
|
|
#ifndef _ICE_XSK_H_
|
|
#define _ICE_XSK_H_
|
|
#include "ice_txrx.h"
|
|
#include "ice.h"
|
|
|
|
#define PKTS_PER_BATCH 8
|
|
|
|
#ifdef __clang__
|
|
#define loop_unrolled_for _Pragma("clang loop unroll_count(8)") for
|
|
#elif __GNUC__ >= 8
|
|
#define loop_unrolled_for _Pragma("GCC unroll 8") for
|
|
#else
|
|
#define loop_unrolled_for for
|
|
#endif
|
|
|
|
struct ice_vsi;
|
|
|
|
#ifdef CONFIG_XDP_SOCKETS
|
|
int ice_xsk_pool_setup(struct ice_vsi *vsi, struct xsk_buff_pool *pool,
|
|
u16 qid);
|
|
int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget);
|
|
int ice_xsk_wakeup(struct net_device *netdev, u32 queue_id, u32 flags);
|
|
bool ice_alloc_rx_bufs_zc(struct ice_rx_ring *rx_ring, u16 count);
|
|
bool ice_xsk_any_rx_ring_ena(struct ice_vsi *vsi);
|
|
void ice_xsk_clean_rx_ring(struct ice_rx_ring *rx_ring);
|
|
void ice_xsk_clean_xdp_ring(struct ice_tx_ring *xdp_ring);
|
|
bool ice_xmit_zc(struct ice_tx_ring *xdp_ring, u32 budget, int napi_budget);
|
|
#else
|
|
static inline bool
|
|
ice_xmit_zc(struct ice_tx_ring __always_unused *xdp_ring,
|
|
u32 __always_unused budget,
|
|
int __always_unused napi_budget)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline int
|
|
ice_xsk_pool_setup(struct ice_vsi __always_unused *vsi,
|
|
struct xsk_buff_pool __always_unused *pool,
|
|
u16 __always_unused qid)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline int
|
|
ice_clean_rx_irq_zc(struct ice_rx_ring __always_unused *rx_ring,
|
|
int __always_unused budget)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline bool
|
|
ice_alloc_rx_bufs_zc(struct ice_rx_ring __always_unused *rx_ring,
|
|
u16 __always_unused count)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline bool ice_xsk_any_rx_ring_ena(struct ice_vsi __always_unused *vsi)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline int
|
|
ice_xsk_wakeup(struct net_device __always_unused *netdev,
|
|
u32 __always_unused queue_id, u32 __always_unused flags)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline void ice_xsk_clean_rx_ring(struct ice_rx_ring *rx_ring) { }
|
|
static inline void ice_xsk_clean_xdp_ring(struct ice_tx_ring *xdp_ring) { }
|
|
#endif /* CONFIG_XDP_SOCKETS */
|
|
#endif /* !_ICE_XSK_H_ */
|