提交 ba058174 编写于 作者: D Daniel Borkmann

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: b02e5a0e ("xsk: Propagate napi_id to XDP socket Rx path")
Reported-by: NStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: NDaniel 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
上级 df542285
...@@ -135,7 +135,7 @@ static inline void sk_mark_napi_id(struct sock *sk, const struct sk_buff *skb) ...@@ -135,7 +135,7 @@ static inline void sk_mark_napi_id(struct sock *sk, const struct sk_buff *skb)
sk_rx_queue_set(sk, skb); sk_rx_queue_set(sk, skb);
} }
static inline void __sk_mark_napi_id_once_xdp(struct sock *sk, unsigned int napi_id) static inline void __sk_mark_napi_id_once(struct sock *sk, unsigned int napi_id)
{ {
#ifdef CONFIG_NET_RX_BUSY_POLL #ifdef CONFIG_NET_RX_BUSY_POLL
if (!READ_ONCE(sk->sk_napi_id)) if (!READ_ONCE(sk->sk_napi_id))
...@@ -147,13 +147,17 @@ static inline void __sk_mark_napi_id_once_xdp(struct sock *sk, unsigned int napi ...@@ -147,13 +147,17 @@ static inline void __sk_mark_napi_id_once_xdp(struct sock *sk, unsigned int napi
static inline void sk_mark_napi_id_once(struct sock *sk, static inline void sk_mark_napi_id_once(struct sock *sk,
const struct sk_buff *skb) const struct sk_buff *skb)
{ {
__sk_mark_napi_id_once_xdp(sk, skb->napi_id); #ifdef CONFIG_NET_RX_BUSY_POLL
__sk_mark_napi_id_once(sk, skb->napi_id);
#endif
} }
static inline void sk_mark_napi_id_once_xdp(struct sock *sk, static inline void sk_mark_napi_id_once_xdp(struct sock *sk,
const struct xdp_buff *xdp) const struct xdp_buff *xdp)
{ {
__sk_mark_napi_id_once_xdp(sk, xdp->rxq->napi_id); #ifdef CONFIG_NET_RX_BUSY_POLL
__sk_mark_napi_id_once(sk, xdp->rxq->napi_id);
#endif
} }
#endif /* _LINUX_NET_BUSY_POLL_H */ #endif /* _LINUX_NET_BUSY_POLL_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册