0003-btf-emit-xdp-buff.patch 797 B

123456789101112131415161718192021222324
  1. --- a/net/core/xdp.c
  2. +++ b/net/core/xdp.c
  3. @@ -12,6 +12,7 @@
  4. #include <linux/idr.h>
  5. #include <linux/rhashtable.h>
  6. #include <linux/bug.h>
  7. +#include <linux/btf.h>
  8. #include <net/page_pool.h>
  9. #include <net/xdp.h>
  10. @@ -387,6 +388,13 @@
  11. void xdp_return_buff(struct xdp_buff *xdp)
  12. {
  13. __xdp_return(xdp->data, &xdp->rxq->mem, true, xdp);
  14. + /* xdp_buff is referenced via BTF_ID_LIST_SINGLE(bpf_xdp_output_btf_ids)
  15. + * in net/core/filter.c but is not otherwise emitted into vmlinux BTF,
  16. + * so resolve_btfids aborts with "unresolved symbol xdp_buff". Force BTF
  17. + * emission here where the struct is complete (this file includes both
  18. + * <net/xdp.h> for the type and <linux/btf.h> for BTF_TYPE_EMIT). */
  19. + BTF_TYPE_EMIT(struct xdp_buff);
  20. +
  21. }
  22. /* Only called for MEM_TYPE_PAGE_POOL see xdp.h */