tree: https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git xdp-queueing-01 head: 7cdc645073a59261514e56e1a4c6d0dac1b24b32 commit: de44bbfd9cf981baab181c006dc363c5f412d94c [4/9] bpf: Add helpers to dequeue from a PIFO map config: sparc-defconfig (attached as .config) compiler: sparc-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=de44bbfd9cf981baab181c006dc363c5f412d94c git remote add toke https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git git fetch --no-tags toke xdp-queueing-01 git checkout de44bbfd9cf981baab181c006dc363c5f412d94c # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=sparc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): net/core/filter.c: In function 'xdp_do_redirect': net/core/filter.c:3992:31: error: implicit declaration of function 'pifo_map_enqueue'; did you mean 'cpu_map_enqueue'? [-Werror=implicit-function-declaration] 3992 | err = pifo_map_enqueue(map, xdp, ri->tgt_index); | ^~~~~~~~~~~~~~~~ | cpu_map_enqueue net/core/filter.c: In function '____bpf_packet_dequeue': >> net/core/filter.c:4153:31: error: implicit declaration of function 'pifo_map_dequeue' [-Werror=implicit-function-declaration] 4153 | return (unsigned long)pifo_map_dequeue(map, flags); | ^~~~~~~~~~~~~~~~ net/core/filter.c: At top level: net/core/filter.c:10088:35: error: 'bpf_prog_test_run_dequeue' undeclared here (not in a function); did you mean 'bpf_prog_test_run_syscall'? 10088 | .test_run = bpf_prog_test_run_dequeue, | ^~~~~~~~~~~~~~~~~~~~~~~~~ | bpf_prog_test_run_syscall cc1: some warnings being treated as errors vim +/pifo_map_dequeue +4153 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 bpf_map *map; 3969 int err; 3970 3971 ri->map_id = 0; /* Valid map id idr range: [1,INT_MAX[ */ 3972 ri->map_type = BPF_MAP_TYPE_UNSPEC; 3973 3974 switch (map_type) { 3975 case BPF_MAP_TYPE_DEVMAP: 3976 fallthrough; 3977 case BPF_MAP_TYPE_DEVMAP_HASH: 3978 map = READ_ONCE(ri->map); 3979 if (unlikely(map)) { 3980 WRITE_ONCE(ri->map, NULL); 3981 err = dev_map_enqueue_multi(xdp, dev, map, 3982 ri->flags & BPF_F_EXCLUDE_INGRESS); 3983 } else { 3984 err = dev_map_enqueue(fwd, xdp, dev); 3985 } 3986 break; 3987 case BPF_MAP_TYPE_PIFO: 3988 map = READ_ONCE(ri->map); 3989 if (unlikely(!map)) 3990 err = -EINVAL; 3991 else > 3992 err = pifo_map_enqueue(map, xdp, ri->tgt_index); 3993 break; 3994 case BPF_MAP_TYPE_CPUMAP: 3995 err = cpu_map_enqueue(fwd, xdp, dev); 3996 break; 3997 case BPF_MAP_TYPE_XSKMAP: 3998 err = __xsk_map_redirect(fwd, xdp); 3999 break; 4000 case BPF_MAP_TYPE_UNSPEC: 4001 if (map_id == INT_MAX) { 4002 fwd = dev_get_by_index_rcu(dev_net(dev), ri->tgt_index); 4003 if (unlikely(!fwd)) { 4004 err = -EINVAL; 4005 break; 4006 } 4007 err = dev_xdp_enqueue(fwd, xdp, dev); 4008 break; 4009 } 4010 fallthrough; 4011 default: 4012 err = -EBADRQC; 4013 } 4014 4015 if (unlikely(err)) 4016 goto err; 4017 4018 _trace_xdp_redirect_map(dev, xdp_prog, fwd, map_type, map_id, ri->tgt_index); 4019 return 0; 4020 err: 4021 _trace_xdp_redirect_map_err(dev, xdp_prog, fwd, map_type, map_id, ri->tgt_index, err); 4022 return err; 4023 } 4024 EXPORT_SYMBOL_GPL(xdp_do_redirect); 4025 4026 static int xdp_do_generic_redirect_map(struct net_device *dev, 4027 struct sk_buff *skb, 4028 struct xdp_buff *xdp, 4029 struct bpf_prog *xdp_prog, 4030 void *fwd, 4031 enum bpf_map_type map_type, u32 map_id) 4032 { 4033 struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info); 4034 struct bpf_map *map; 4035 int err; 4036 4037 switch (map_type) { 4038 case BPF_MAP_TYPE_DEVMAP: 4039 fallthrough; 4040 case BPF_MAP_TYPE_DEVMAP_HASH: 4041 map = READ_ONCE(ri->map); 4042 if (unlikely(map)) { 4043 WRITE_ONCE(ri->map, NULL); 4044 err = dev_map_redirect_multi(dev, skb, xdp_prog, map, 4045 ri->flags & BPF_F_EXCLUDE_INGRESS); 4046 } else { 4047 err = dev_map_generic_redirect(fwd, skb, xdp_prog); 4048 } 4049 if (unlikely(err)) 4050 goto err; 4051 break; 4052 case BPF_MAP_TYPE_XSKMAP: 4053 err = xsk_generic_rcv(fwd, xdp); 4054 if (err) 4055 goto err; 4056 consume_skb(skb); 4057 break; 4058 case BPF_MAP_TYPE_CPUMAP: 4059 err = cpu_map_generic_redirect(fwd, skb); 4060 if (unlikely(err)) 4061 goto err; 4062 break; 4063 default: 4064 err = -EBADRQC; 4065 goto err; 4066 } 4067 4068 _trace_xdp_redirect_map(dev, xdp_prog, fwd, map_type, map_id, ri->tgt_index); 4069 return 0; 4070 err: 4071 _trace_xdp_redirect_map_err(dev, xdp_prog, fwd, map_type, map_id, ri->tgt_index, err); 4072 return err; 4073 } 4074 4075 int xdp_do_generic_redirect(struct net_device *dev, struct sk_buff *skb, 4076 struct xdp_buff *xdp, struct bpf_prog *xdp_prog) 4077 { 4078 struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info); 4079 enum bpf_map_type map_type = ri->map_type; 4080 void *fwd = ri->tgt_value; 4081 u32 map_id = ri->map_id; 4082 int err; 4083 4084 ri->map_id = 0; /* Valid map id idr range: [1,INT_MAX[ */ 4085 ri->map_type = BPF_MAP_TYPE_UNSPEC; 4086 4087 if (map_type == BPF_MAP_TYPE_UNSPEC && map_id == INT_MAX) { 4088 fwd = dev_get_by_index_rcu(dev_net(dev), ri->tgt_index); 4089 if (unlikely(!fwd)) { 4090 err = -EINVAL; 4091 goto err; 4092 } 4093 4094 err = xdp_ok_fwd_dev(fwd, skb->len); 4095 if (unlikely(err)) 4096 goto err; 4097 4098 skb->dev = fwd; 4099 _trace_xdp_redirect(dev, xdp_prog, ri->tgt_index); 4100 generic_xdp_tx(skb, xdp_prog); 4101 return 0; 4102 } 4103 4104 return xdp_do_generic_redirect_map(dev, skb, xdp, xdp_prog, fwd, map_type, map_id); 4105 err: 4106 _trace_xdp_redirect_err(dev, xdp_prog, ri->tgt_index, err); 4107 return err; 4108 } 4109 4110 BPF_CALL_2(bpf_xdp_redirect, u32, ifindex, u64, flags) 4111 { 4112 struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info); 4113 4114 if (unlikely(flags)) 4115 return XDP_ABORTED; 4116 4117 /* NB! Map type UNSPEC and map_id == INT_MAX (never generated 4118 * by map_idr) is used for ifindex based XDP redirect. 4119 */ 4120 ri->tgt_index = ifindex; 4121 ri->map_id = INT_MAX; 4122 ri->map_type = BPF_MAP_TYPE_UNSPEC; 4123 4124 return XDP_REDIRECT; 4125 } 4126 4127 static const struct bpf_func_proto bpf_xdp_redirect_proto = { 4128 .func = bpf_xdp_redirect, 4129 .gpl_only = false, 4130 .ret_type = RET_INTEGER, 4131 .arg1_type = ARG_ANYTHING, 4132 .arg2_type = ARG_ANYTHING, 4133 }; 4134 4135 BPF_CALL_3(bpf_xdp_redirect_map, struct bpf_map *, map, u32, ifindex, 4136 u64, flags) 4137 { 4138 return map->ops->map_redirect(map, ifindex, flags); 4139 } 4140 4141 static const struct bpf_func_proto bpf_xdp_redirect_map_proto = { 4142 .func = bpf_xdp_redirect_map, 4143 .gpl_only = false, 4144 .ret_type = RET_INTEGER, 4145 .arg1_type = ARG_CONST_MAP_PTR, 4146 .arg2_type = ARG_ANYTHING, 4147 .arg3_type = ARG_ANYTHING, 4148 }; 4149 4150 BPF_CALL_3(bpf_packet_dequeue, struct dequeue_data *, ctx, struct bpf_map *, map, 4151 u64, flags) 4152 { > 4153 return (unsigned long)pifo_map_dequeue(map, flags); 4154 } 4155 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org