From: kernel test robot <lkp@intel.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [kkdwivedi:fermata 51/53] net/core/bpf_xdp_xmit.c:50:17: sparse: sparse: symbol 'bpf_xdp_xmit' was not declared. Should it be static?
Date: Tue, 06 Oct 2026 09:42:03 +0200 [thread overview]
Message-ID: <202610060937.Tdp8i48Q-lkp@intel.com> (raw)
tree: https://github.com/kkdwivedi/linux fermata
head: 00ca9ce5685ac6da21cec48b9b0a8a0d6c11af32
commit: 1b42184dd7689f6237a0f659b39ea8d56198fd35 [51/53] bpf: Add bpf_xdp_xmit() to transmit arena bytes as an XDP frame
config: openrisc-randconfig-r2301-20261006 (https://download.01.org/0day-ci/archive/20261006/202610060937.Tdp8i48Q-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 12.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261006/202610060937.Tdp8i48Q-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202610060937.Tdp8i48Q-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> net/core/bpf_xdp_xmit.c:50:17: sparse: sparse: symbol 'bpf_xdp_xmit' was not declared. Should it be static?
>> net/core/bpf_xdp_xmit.c:110:17: sparse: sparse: symbol 'bpf_xdp_xmit_flush' was not declared. Should it be static?
vim +/bpf_xdp_xmit +50 net/core/bpf_xdp_xmit.c
38
39 /**
40 * bpf_xdp_xmit - transmit bytes from arena memory as an XDP frame
41 * @ifindex: the device, in the initial network namespace
42 * @buf__arena: the frame, from its Ethernet header on, in arena memory
43 * @len: its length in bytes, at most BPF_XDP_XMIT_MAX
44 * @flags: BPF_XDP_XMIT_F_NO_FLUSH to queue without ringing the doorbell
45 * @aux: the calling program (implicit)
46 *
47 * Returns 0 once the frame is queued on the device, -ENOSPC when the
48 * device's queue is full, or another -errno.
49 */
> 50 __bpf_kfunc int bpf_xdp_xmit(u32 ifindex, void *buf__arena, u32 len, u64 flags,
51 struct bpf_prog_aux *aux)
52 {
53 u64 start = bpf_arena_get_kern_vm_start(aux->arena), addr = (u64)(long)buf__arena;
54 unsigned int size = SKB_DATA_ALIGN(sizeof(struct xdp_frame) + BPF_XDP_XMIT_HEADROOM + len) +
55 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
56 struct net_device *dev;
57 struct xdp_frame *xdpf;
58 void *p, *data;
59 int ret;
60
61 if (flags & ~BPF_XDP_XMIT_F_NO_FLUSH)
62 return -EINVAL;
63 if (len < ETH_HLEN || len > BPF_XDP_XMIT_MAX)
64 return -EINVAL;
65 if (!aux->arena || addr < start || addr + len > start + SZ_4G)
66 return -EFAULT;
67 for (p = buf__arena; p < buf__arena + len; p += PAGE_SIZE - offset_in_page(p))
68 if (!vmalloc_to_page(p))
69 return -EFAULT;
70
71 local_bh_disable();
72 rcu_read_lock();
73 dev = dev_get_by_index_rcu(&init_net, ifindex);
74 if (!dev || !dev->netdev_ops->ndo_xdp_xmit) {
75 ret = -ENODEV;
76 goto out;
77 }
78 xdpf = netdev_alloc_frag(size);
79 if (!xdpf) {
80 ret = -ENOMEM;
81 goto out;
82 }
83 memset(xdpf, 0, sizeof(*xdpf));
84 data = (void *)xdpf + sizeof(*xdpf) + BPF_XDP_XMIT_HEADROOM;
85 memcpy(data, buf__arena, len);
86 xdpf->data = data;
87 xdpf->len = len;
88 xdpf->headroom = BPF_XDP_XMIT_HEADROOM;
89 xdpf->frame_sz = size;
90 xdpf->mem_type = MEM_TYPE_PAGE_SHARED;
91 ret = dev->netdev_ops->ndo_xdp_xmit(dev, 1, &xdpf,
92 flags & BPF_XDP_XMIT_F_NO_FLUSH ? 0 : XDP_XMIT_FLUSH);
93 if (ret == 1) {
94 ret = 0;
95 } else {
96 xdp_return_frame(xdpf);
97 if (ret >= 0)
98 ret = -ENOSPC;
99 }
100 out:
101 rcu_read_unlock();
102 local_bh_enable();
103 return ret;
104 }
105
106 /**
107 * bpf_xdp_xmit_flush - ring the doorbell for frames queued without a flush
108 * @ifindex: the device, in the initial network namespace
109 */
> 110 __bpf_kfunc int bpf_xdp_xmit_flush(u32 ifindex)
111 {
112 struct net_device *dev;
113 int ret;
114
115 local_bh_disable();
116 rcu_read_lock();
117 dev = dev_get_by_index_rcu(&init_net, ifindex);
118 if (!dev || !dev->netdev_ops->ndo_xdp_xmit) {
119 ret = -ENODEV;
120 goto out;
121 }
122 ret = dev->netdev_ops->ndo_xdp_xmit(dev, 0, NULL, XDP_XMIT_FLUSH);
123 if (ret > 0)
124 ret = 0;
125 out:
126 rcu_read_unlock();
127 local_bh_enable();
128 return ret;
129 }
130
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-10-06 7:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202610060937.Tdp8i48Q-lkp@intel.com \
--to=lkp@intel.com \
--cc=memxor@gmail.com \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.