All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [kkdwivedi:fermata 52/53] net/ipv4/tcp_bpf_tx.c:123:17: sparse: sparse: symbol 'bpf_tcp_tx_bind' was not declared. Should it be static?
Date: Tue, 06 Oct 2026 10:53:42 +0200	[thread overview]
Message-ID: <202610061007.ac9y37pq-lkp@intel.com> (raw)

tree:   https://github.com/kkdwivedi/linux fermata
head:   00ca9ce5685ac6da21cec48b9b0a8a0d6c11af32
commit: 4d3549efcca0f67eef10e27e81a64dc8d73ed461 [52/53] tcp: Hand a socket's push to a BPF worker thread
config: openrisc-randconfig-r2301-20261006 (https://download.01.org/0day-ci/archive/20261006/202610061007.ac9y37pq-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/202610061007.ac9y37pq-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/202610061007.ac9y37pq-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> net/ipv4/tcp_bpf_tx.c:123:17: sparse: sparse: symbol 'bpf_tcp_tx_bind' was not declared. Should it be static?
>> net/ipv4/tcp_bpf_tx.c:153:17: sparse: sparse: symbol 'bpf_tcp_tx_unbind' was not declared. Should it be static?
>> net/ipv4/tcp_bpf_tx.c:181:17: sparse: sparse: symbol 'bpf_tcp_tx_poll' was not declared. Should it be static?
>> net/ipv4/tcp_bpf_tx.c:204:17: sparse: sparse: symbol 'bpf_tcp_tx_pushes' was not declared. Should it be static?
>> net/ipv4/tcp_bpf_tx.c:229:17: sparse: sparse: symbol 'bpf_tcp_tx_sock_bind' was not declared. Should it be static?
>> net/ipv4/tcp_bpf_tx.c:241:17: sparse: sparse: symbol 'bpf_tcp_tx_sock_bind_fd' was not declared. Should it be static?

vim +/bpf_tcp_tx_bind +123 net/ipv4/tcp_bpf_tx.c

   113	
   114	/**
   115	 * bpf_tcp_tx_bind - make a BPF thread the TX worker of a CPU
   116	 * @cpu: the CPU whose worker it is; sockets are bound to CPUs
   117	 * @waitq: the queue to signal when a socket is put on the worker's list
   118	 * @flags: must be 0
   119	 *
   120	 * Binding a CPU that has a worker replaces it; sockets queued for the
   121	 * previous worker are signalled to the new one.
   122	 */
 > 123	__bpf_kfunc int bpf_tcp_tx_bind(u32 cpu, struct bpf_waitq *waitq, u64 flags)
   124	{
   125		struct tcp_bpf_tx_worker *w;
   126		struct bpf_waitq_kern *kern, *old;
   127	
   128		if (flags || cpu >= nr_cpu_ids)
   129			return -EINVAL;
   130		kern = bpf_waitq_get(waitq);
   131		if (!kern)
   132			return -EINVAL;
   133		w = per_cpu_ptr(&tcp_bpf_tx_workers, cpu);
   134		old = rcu_replace_pointer(w->waitq, kern, true);
   135		if (old) {
   136			synchronize_rcu();
   137			bpf_waitq_put(old);
   138		}
   139		spin_lock_bh(&w->lock);
   140		if (!list_empty(&w->sockets))
   141			bpf_waitq_signal(kern, 1);
   142		spin_unlock_bh(&w->lock);
   143		return 0;
   144	}
   145	
   146	/**
   147	 * bpf_tcp_tx_unbind - take a CPU's TX worker away
   148	 * @cpu: the CPU
   149	 *
   150	 * Pushes the sockets still queued for the worker here, in the caller's
   151	 * context. Bound sockets push inline from then on.
   152	 */
 > 153	__bpf_kfunc int bpf_tcp_tx_unbind(u32 cpu)
   154	{
   155		struct tcp_bpf_tx_worker *w;
   156		struct bpf_waitq_kern *old;
   157		struct sock *sk;
   158	
   159		if (cpu >= nr_cpu_ids)
   160			return -EINVAL;
   161		w = per_cpu_ptr(&tcp_bpf_tx_workers, cpu);
   162		old = rcu_replace_pointer(w->waitq, NULL, true);
   163		if (old) {
   164			synchronize_rcu();
   165			bpf_waitq_put(old);
   166		}
   167		while ((sk = tcp_bpf_tx_dequeue(w)))
   168			tcp_bpf_tx_push(sk);
   169		return 0;
   170	}
   171	
   172	/**
   173	 * bpf_tcp_tx_poll - push the sockets queued for a CPU's worker
   174	 * @cpu: the CPU whose worker the caller is
   175	 * @budget: at most this many sockets
   176	 *
   177	 * Each socket is locked and its pending frames pushed as its owner would
   178	 * have pushed them, from the calling thread. Returns the number pushed; the
   179	 * caller sleeps on the worker's wait queue when that is 0.
   180	 */
 > 181	__bpf_kfunc int bpf_tcp_tx_poll(u32 cpu, u32 budget)
   182	{
   183		struct tcp_bpf_tx_worker *w;
   184		struct sock *sk;
   185		u32 n = 0;
   186	
   187		if (cpu >= nr_cpu_ids)
   188			return -EINVAL;
   189		w = per_cpu_ptr(&tcp_bpf_tx_workers, cpu);
   190		WRITE_ONCE(w->polling, current);
   191		while (n < budget && (sk = tcp_bpf_tx_dequeue(w))) {
   192			tcp_bpf_tx_push(sk);
   193			n++;
   194		}
   195		WRITE_ONCE(w->polling, NULL);
   196		w->pushes += n;
   197		return n;
   198	}
   199	
   200	/**
   201	 * bpf_tcp_tx_pushes - how many pushes a CPU's worker has done
   202	 * @cpu: the CPU
   203	 */
 > 204	__bpf_kfunc u64 bpf_tcp_tx_pushes(u32 cpu)
   205	{
   206		if (cpu >= nr_cpu_ids)
   207			return 0;
   208		return per_cpu_ptr(&tcp_bpf_tx_workers, cpu)->pushes;
   209	}
   210	
   211	static int tcp_bpf_tx_sock_set(struct sock *sk, s32 cpu)
   212	{
   213		if (!sk || sk->sk_protocol != IPPROTO_TCP)
   214			return -EINVAL;
   215		if (cpu >= (s32)nr_cpu_ids)
   216			return -EINVAL;
   217		WRITE_ONCE(tcp_sk(sk)->bpf_tx_cpu1, cpu < 0 ? 0 : cpu + 1);
   218		return 0;
   219	}
   220	
   221	/**
   222	 * bpf_tcp_tx_sock_bind - send a socket's pushes to a CPU's TX worker
   223	 * @skops: the sockops context, whose socket it is
   224	 * @cpu: the CPU, or -1 to push inline again
   225	 *
   226	 * Takes effect at the socket's next push. A CPU without a worker pushes
   227	 * inline until one is bound.
   228	 */
 > 229	__bpf_kfunc int bpf_tcp_tx_sock_bind(struct bpf_sock_ops *skops, s32 cpu)
   230	{
   231		struct bpf_sock_ops_kern *kern = (struct bpf_sock_ops_kern *)skops;
   232	
   233		return tcp_bpf_tx_sock_set(kern->sk, cpu);
   234	}
   235	
   236	/**
   237	 * bpf_tcp_tx_sock_bind_fd - send a socket's pushes to a CPU's TX worker
   238	 * @fd: a TCP socket of the calling process
   239	 * @cpu: the CPU, or -1 to push inline again
   240	 */
 > 241	__bpf_kfunc int bpf_tcp_tx_sock_bind_fd(int fd, s32 cpu)
   242	{
   243		struct socket *sock;
   244		int err;
   245	
   246		sock = sockfd_lookup(fd, &err);
   247		if (!sock)
   248			return err;
   249		err = tcp_bpf_tx_sock_set(sock->sk, cpu);
   250		sockfd_put(sock);
   251		return err;
   252	}
   253	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2026-10-06  8:53 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=202610061007.ac9y37pq-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.