[toke:xdp-traffic-gen-01 6/10] net/core/filter.c:3993:53: error: passing argument 1 of 'dev_map_enqueue_multi' from incompatible pointer type

From: kernel test robot
Date: Tue Nov 16 2021 - 23:03:41 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git xdp-traffic-gen-01
head: a7f4d7f9e215d1e540f81f6cd3f5b46d970c5449
commit: e55a74b240bfe62c2e3b65455611e472636d9fb3 [6/10] xdp: Move conversion to xdp_frame out of map functions
config: arc-randconfig-r043-20211116 (attached as .config)
compiler: arceb-elf-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=e55a74b240bfe62c2e3b65455611e472636d9fb3
git remote add toke https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git
git fetch --no-tags toke xdp-traffic-gen-01
git checkout e55a74b240bfe62c2e3b65455611e472636d9fb3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc

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

All errors (new ones prefixed by >>):

net/core/filter.c: In function 'xdp_do_redirect':
>> net/core/filter.c:3993:53: error: passing argument 1 of 'dev_map_enqueue_multi' from incompatible pointer type [-Werror=incompatible-pointer-types]
3993 | err = dev_map_enqueue_multi(xdpf, dev, map,
| ^~~~
| |
| struct xdp_frame *
In file included from include/linux/bpf-cgroup.h:5,
from include/linux/cgroup-defs.h:22,
from include/linux/cgroup.h:28,
from include/net/netprio_cgroup.h:11,
from include/linux/netdevice.h:41,
from include/net/sock.h:46,
from include/linux/sock_diag.h:8,
from net/core/filter.c:26:
include/linux/bpf.h:1827:44: note: expected 'struct xdp_buff *' but argument is of type 'struct xdp_frame *'
1827 | int dev_map_enqueue_multi(struct xdp_buff *xdp, struct net_device *dev_rx,
| ~~~~~~~~~~~~~~~~~^~~
>> net/core/filter.c:3996:52: error: passing argument 2 of 'dev_map_enqueue' from incompatible pointer type [-Werror=incompatible-pointer-types]
3996 | err = dev_map_enqueue(fwd, xdpf, dev);
| ^~~~
| |
| struct xdp_frame *
In file included from include/linux/bpf-cgroup.h:5,
from include/linux/cgroup-defs.h:22,
from include/linux/cgroup.h:28,
from include/net/netprio_cgroup.h:11,
from include/linux/netdevice.h:41,
from include/net/sock.h:46,
from include/linux/sock_diag.h:8,
from net/core/filter.c:26:
include/linux/bpf.h:1820:67: note: expected 'struct xdp_buff *' but argument is of type 'struct xdp_frame *'
1820 | int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp,
| ~~~~~~~~~~~~~~~~~^~~
>> net/core/filter.c:4000:44: error: passing argument 2 of 'cpu_map_enqueue' from incompatible pointer type [-Werror=incompatible-pointer-types]
4000 | err = cpu_map_enqueue(fwd, xdpf, dev);
| ^~~~
| |
| struct xdp_frame *
In file included from include/linux/bpf-cgroup.h:5,
from include/linux/cgroup-defs.h:22,
from include/linux/cgroup.h:28,
from include/net/netprio_cgroup.h:11,
from include/linux/netdevice.h:41,
from include/net/sock.h:46,
from include/linux/sock_diag.h:8,
from net/core/filter.c:26:
include/linux/bpf.h:1855:52: note: expected 'struct xdp_buff *' but argument is of type 'struct xdp_frame *'
1855 | struct xdp_buff *xdp,
| ~~~~~~~~~~~~~~~~~^~~
>> net/core/filter.c:4010:52: error: passing argument 2 of 'dev_xdp_enqueue' from incompatible pointer type [-Werror=incompatible-pointer-types]
4010 | err = dev_xdp_enqueue(fwd, xdpf, dev);
| ^~~~
| |
| struct xdp_frame *
In file included from include/linux/bpf-cgroup.h:5,
from include/linux/cgroup-defs.h:22,
from include/linux/cgroup.h:28,
from include/net/netprio_cgroup.h:11,
from include/linux/netdevice.h:41,
from include/net/sock.h:46,
from include/linux/sock_diag.h:8,
from net/core/filter.c:26:
include/linux/bpf.h:1813:62: note: expected 'struct xdp_buff *' but argument is of type 'struct xdp_frame *'
1813 | int dev_xdp_enqueue(struct net_device *dev, struct xdp_buff *xdp,
| ~~~~~~~~~~~~~~~~~^~~
cc1: some warnings being treated as errors


vim +/dev_map_enqueue_multi +3993 net/core/filter.c

3960
3961 int xdp_do_redirect(struct net_device *dev, struct xdp_buff *xdp,
3962 struct bpf_prog *xdp_prog)
3963 {
3964 struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info);
3965 enum bpf_map_type map_type = ri->map_type;
3966 void *fwd = ri->tgt_value;
3967 u32 map_id = ri->map_id;
3968 struct xdp_frame *xdpf;
3969 struct bpf_map *map;
3970 int err;
3971
3972 ri->map_id = 0; /* Valid map id idr range: [1,INT_MAX[ */
3973 ri->map_type = BPF_MAP_TYPE_UNSPEC;
3974
3975 if (map_type == BPF_MAP_TYPE_XSKMAP) {
3976 err = __xsk_map_redirect(fwd, xdp);
3977 goto out;
3978 }
3979
3980 xdpf = xdp_convert_buff_to_frame(xdp);
3981 if (unlikely(!xdpf)) {
3982 err = -EOVERFLOW;
3983 goto err;
3984 }
3985
3986 switch (map_type) {
3987 case BPF_MAP_TYPE_DEVMAP:
3988 fallthrough;
3989 case BPF_MAP_TYPE_DEVMAP_HASH:
3990 map = READ_ONCE(ri->map);
3991 if (unlikely(map)) {
3992 WRITE_ONCE(ri->map, NULL);
> 3993 err = dev_map_enqueue_multi(xdpf, dev, map,
3994 ri->flags & BPF_F_EXCLUDE_INGRESS);
3995 } else {
> 3996 err = dev_map_enqueue(fwd, xdpf, dev);
3997 }
3998 break;
3999 case BPF_MAP_TYPE_CPUMAP:
> 4000 err = cpu_map_enqueue(fwd, xdpf, dev);
4001 break;
4002 break;
4003 case BPF_MAP_TYPE_UNSPEC:
4004 if (map_id == INT_MAX) {
4005 fwd = dev_get_by_index_rcu(dev_net(dev), ri->tgt_index);
4006 if (unlikely(!fwd)) {
4007 err = -EINVAL;
4008 break;
4009 }
> 4010 err = dev_xdp_enqueue(fwd, xdpf, dev);
4011 break;
4012 }
4013 fallthrough;
4014 default:
4015 err = -EBADRQC;
4016 }
4017
4018 out:
4019 if (unlikely(err))
4020 goto err;
4021
4022 _trace_xdp_redirect_map(dev, xdp_prog, fwd, map_type, map_id, ri->tgt_index);
4023 return 0;
4024 err:
4025 _trace_xdp_redirect_map_err(dev, xdp_prog, fwd, map_type, map_id, ri->tgt_index, err);
4026 return err;
4027 }
4028 EXPORT_SYMBOL_GPL(xdp_do_redirect);
4029

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

Attachment: .config.gz
Description: application/gzip