[congwang:sch_bpf 2/3] kernel/bpf/skb_map.c:160:5: warning: no previous prototype for function 'skb_map_enqueue'

From: kernel test robot
Date: Wed Dec 29 2021 - 04:40:04 EST


tree: https://github.com/congwang/linux.git sch_bpf
head: 5fb0da1e47e0c68da0323a3e0399b2628a13e999
commit: bc7c943a32f707b17d62bcbf4cca59f3e0de8d65 [2/3] bpf: introduce skb map
config: x86_64-randconfig-r012-20211228 (https://download.01.org/0day-ci/archive/20211229/202112291719.wxZ293dn-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project cd284b7ac0615afc6e0f1a30da2777e361de27a3)
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://github.com/congwang/linux/commit/bc7c943a32f707b17d62bcbf4cca59f3e0de8d65
git remote add congwang https://github.com/congwang/linux.git
git fetch --no-tags congwang sch_bpf
git checkout bc7c943a32f707b17d62bcbf4cca59f3e0de8d65
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 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 >>):

>> kernel/bpf/skb_map.c:160:5: warning: no previous prototype for function 'skb_map_enqueue' [-Wmissing-prototypes]
int skb_map_enqueue(struct sk_buff *skb, struct bpf_map *map, u64 key)
^
kernel/bpf/skb_map.c:160:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int skb_map_enqueue(struct sk_buff *skb, struct bpf_map *map, u64 key)
^
static
>> kernel/bpf/skb_map.c:180:17: warning: no previous prototype for function 'skb_map_dequeue' [-Wmissing-prototypes]
struct sk_buff *skb_map_dequeue(struct bpf_map *map)
^
kernel/bpf/skb_map.c:180:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
struct sk_buff *skb_map_dequeue(struct bpf_map *map)
^
static
2 warnings generated.


vim +/skb_map_enqueue +160 kernel/bpf/skb_map.c

159
> 160 int skb_map_enqueue(struct sk_buff *skb, struct bpf_map *map, u64 key)
161 {
162 struct bpf_skb_map *pq = bpf_skb_map(map);
163 struct skb_map_node *n;
164 unsigned long flags;
165
166 if (atomic_inc_return(&pq->count) > pq->map.max_entries)
167 return -ENOBUFS;
168 n = alloc_skb_map_node(pq);
169 if (!n)
170 return -ENOMEM;
171 n->key = key;
172 n->skb = skb_get(skb);
173 raw_spin_lock_irqsave(&pq->lock, flags);
174 pq_push(&pq->root, &n->node);
175 raw_spin_unlock_irqrestore(&pq->lock, flags);
176 return 0;
177
178 }
179
> 180 struct sk_buff *skb_map_dequeue(struct bpf_map *map)
181 {
182 struct bpf_skb_map *pq = bpf_skb_map(map);
183 struct skb_map_node *n;
184 struct pq_node *node;
185 unsigned long flags;
186
187 raw_spin_lock_irqsave(&pq->lock, flags);
188 node = pq_pop(&pq->root);
189 if (!node) {
190 raw_spin_unlock_irqrestore(&pq->lock, flags);
191 return NULL;
192 }
193 raw_spin_unlock_irqrestore(&pq->lock, flags);
194 n = container_of(node, struct skb_map_node, node);
195 consume_skb(n->skb);
196 atomic_dec(&pq->count);
197 return n->skb;
198 }
199

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx