Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net, xdp, xsk: fix __sk_mark_napi_id_once napi_id error

Stephen reported the following build error for !CONFIG_NET_RX_BUSY_POLL
built kernels:

In file included from fs/select.c:32:
include/net/busy_poll.h: In function 'sk_mark_napi_id_once':
include/net/busy_poll.h:150:36: error: 'const struct sk_buff' has no member named 'napi_id'
150 | __sk_mark_napi_id_once_xdp(sk, skb->napi_id);
| ^~

Fix it by wrapping a CONFIG_NET_RX_BUSY_POLL around the helpers.

Fixes: b02e5a0ebb17 ("xsk: Propagate napi_id to XDP socket Rx path")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Björn Töpel <bjorn.topel@intel.com>
Link: https://lore.kernel.org/linux-next/20201201190746.7d3357fb@canb.auug.org.au

+7 -3
+7 -3
include/net/busy_poll.h
··· 135 135 sk_rx_queue_set(sk, skb); 136 136 } 137 137 138 - static inline void __sk_mark_napi_id_once_xdp(struct sock *sk, unsigned int napi_id) 138 + static inline void __sk_mark_napi_id_once(struct sock *sk, unsigned int napi_id) 139 139 { 140 140 #ifdef CONFIG_NET_RX_BUSY_POLL 141 141 if (!READ_ONCE(sk->sk_napi_id)) ··· 147 147 static inline void sk_mark_napi_id_once(struct sock *sk, 148 148 const struct sk_buff *skb) 149 149 { 150 - __sk_mark_napi_id_once_xdp(sk, skb->napi_id); 150 + #ifdef CONFIG_NET_RX_BUSY_POLL 151 + __sk_mark_napi_id_once(sk, skb->napi_id); 152 + #endif 151 153 } 152 154 153 155 static inline void sk_mark_napi_id_once_xdp(struct sock *sk, 154 156 const struct xdp_buff *xdp) 155 157 { 156 - __sk_mark_napi_id_once_xdp(sk, xdp->rxq->napi_id); 158 + #ifdef CONFIG_NET_RX_BUSY_POLL 159 + __sk_mark_napi_id_once(sk, xdp->rxq->napi_id); 160 + #endif 157 161 } 158 162 159 163 #endif /* _LINUX_NET_BUSY_POLL_H */