[toke:xdp-queueing-04 3/12] kernel/bpf/pifomap.c:354:22: warning: no previous prototype for '__pifo_map_dequeue'

From: kernel test robot
Date: Sat Apr 09 2022 - 21:03:35 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git xdp-queueing-04
head: d67202baf237752a91366c8ba9bd801942e5fdaf
commit: fe606924ca53da2ffef87d4234ef54a5f1b66fbb [3/12] bpf: Add a PIFO map type for queueing packets
config: nios2-randconfig-r011-20220410 (https://download.01.org/0day-ci/archive/20220410/202204100818.si982aTb-lkp@xxxxxxxxx/config)
compiler: nios2-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git/commit/?id=fe606924ca53da2ffef87d4234ef54a5f1b66fbb
git remote add toke https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git
git fetch --no-tags toke xdp-queueing-04
git checkout fe606924ca53da2ffef87d4234ef54a5f1b66fbb
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nios2 SHELL=/bin/bash kernel/bpf/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from include/linux/kernel.h:26,
from include/linux/cpumask.h:10,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/spinlock.h:62,
from kernel/bpf/pifomap.c:5:
kernel/bpf/pifomap.c: In function '__pifo_map_enqueue':
kernel/bpf/pifomap.c:308:47: error: 'index' undeclared (first use in this function); did you mean 'q_index'?
308 | q_index = rank - min(queue->min_rank, index);
| ^~~~~
include/linux/minmax.h:20:46: note: in definition of macro '__typecheck'
20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^
include/linux/minmax.h:36:31: note: in expansion of macro '__safe_cmp'
36 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp'
45 | #define min(x, y) __careful_cmp(x, y, <)
| ^~~~~~~~~~~~~
kernel/bpf/pifomap.c:308:26: note: in expansion of macro 'min'
308 | q_index = rank - min(queue->min_rank, index);
| ^~~
kernel/bpf/pifomap.c:308:47: note: each undeclared identifier is reported only once for each function it appears in
308 | q_index = rank - min(queue->min_rank, index);
| ^~~~~
include/linux/minmax.h:20:46: note: in definition of macro '__typecheck'
20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^
include/linux/minmax.h:36:31: note: in expansion of macro '__safe_cmp'
36 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp'
45 | #define min(x, y) __careful_cmp(x, y, <)
| ^~~~~~~~~~~~~
kernel/bpf/pifomap.c:308:26: note: in expansion of macro 'min'
308 | q_index = rank - min(queue->min_rank, index);
| ^~~
include/linux/minmax.h:36:9: error: first argument to '__builtin_choose_expr' not a constant
36 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp'
45 | #define min(x, y) __careful_cmp(x, y, <)
| ^~~~~~~~~~~~~
kernel/bpf/pifomap.c:308:26: note: in expansion of macro 'min'
308 | q_index = rank - min(queue->min_rank, index);
| ^~~
kernel/bpf/pifomap.c: At top level:
>> kernel/bpf/pifomap.c:354:22: warning: no previous prototype for '__pifo_map_dequeue' [-Wmissing-prototypes]
354 | union bpf_pifo_item *__pifo_map_dequeue(struct bpf_pifo_map *pifo, u64 flags, u64 *rank, bool xdp)
| ^~~~~~~~~~~~~~~~~~


vim +/__pifo_map_dequeue +354 kernel/bpf/pifomap.c

353
> 354 union bpf_pifo_item *__pifo_map_dequeue(struct bpf_pifo_map *pifo, u64 flags, u64 *rank, bool xdp)
355 {
356 struct bpf_pifo_queue *queue = pifo->queue;
357 struct bpf_pifo_bucket *bucket;
358 union bpf_pifo_item *item;
359 unsigned long bucket_idx;
360
361 lockdep_assert_held(&pifo->lock);
362
363 if (flags) {
364 *rank = -EINVAL;
365 return NULL;
366 }
367
368 bucket_idx = pifo_find_first_bucket(queue);
369 if (bucket_idx == -1) {
370 *rank = -ENOENT;
371 return NULL;
372 }
373 bucket = &queue->buckets[bucket_idx];
374
375 if (WARN_ON_ONCE(!bucket->tail)) {
376 *rank = -EFAULT;
377 return NULL;
378 }
379
380 item = bucket->head;
381 if (xdp)
382 bucket->head = (union bpf_pifo_item *)item->frame.next;
383 else
384 bucket->head = (union bpf_pifo_item *)item->elem.next;
385
386 if (!bucket->head) {
387 bucket->tail = NULL;
388 pifo_clear_bit(queue, bucket_idx);
389 }
390 pifo->num_queued--;
391 bucket->elem_count--;
392
393 *rank = bucket_idx + queue->min_rank;
394 return item;
395 }
396

--
0-DAY CI Kernel Test Service
https://01.org/lkp