drivers/net/veth.c:848:12: warning: stack frame size (2096) exceeds limit (2048) in 'veth_xdp_rcv'

From: kernel test robot
Date: Wed Jul 19 2023 - 19:13:56 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: bfa3037d828050896ae52f6467b6ca2489ae6fb1
commit: 03f61041c17914355dde7261be9ccdc821ddd454 skbuff: Switch structure bounds to struct_group()
date: 1 year, 8 months ago
config: riscv-randconfig-r042-20230720 (https://download.01.org/0day-ci/archive/20230720/202307200753.sG6BpxE4-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20230720/202307200753.sG6BpxE4-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307200753.sG6BpxE4-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/net/veth.c:848:12: warning: stack frame size (2096) exceeds limit (2048) in 'veth_xdp_rcv' [-Wframe-larger-than]
848 | static int veth_xdp_rcv(struct veth_rq *rq, int budget,
| ^
1 warning generated.


vim +/veth_xdp_rcv +848 drivers/net/veth.c

948d4f214fde43 Toshiaki Makita 2018-08-03 847
1c5b82e55f1529 Lorenzo Bianconi 2020-03-19 @848 static int veth_xdp_rcv(struct veth_rq *rq, int budget,
1c5b82e55f1529 Lorenzo Bianconi 2020-03-19 849 struct veth_xdp_tx_bq *bq,
1c5b82e55f1529 Lorenzo Bianconi 2020-03-19 850 struct veth_stats *stats)
948d4f214fde43 Toshiaki Makita 2018-08-03 851 {
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 852 int i, done = 0, n_xdpf = 0;
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 853 void *xdpf[VETH_XDP_BATCH];
948d4f214fde43 Toshiaki Makita 2018-08-03 854
948d4f214fde43 Toshiaki Makita 2018-08-03 855 for (i = 0; i < budget; i++) {
638264dc90227c Toshiaki Makita 2018-08-03 856 void *ptr = __ptr_ring_consume(&rq->xdp_ring);
948d4f214fde43 Toshiaki Makita 2018-08-03 857
9fc8d518d9d590 Toshiaki Makita 2018-08-03 858 if (!ptr)
948d4f214fde43 Toshiaki Makita 2018-08-03 859 break;
948d4f214fde43 Toshiaki Makita 2018-08-03 860
d1396004dd8686 Toshiaki Makita 2018-08-03 861 if (veth_is_xdp_frame(ptr)) {
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 862 /* ndo_xdp_xmit */
4195e54aaf1c8d Toshiaki Makita 2018-10-11 863 struct xdp_frame *frame = veth_ptr_to_xdp(ptr);
4195e54aaf1c8d Toshiaki Makita 2018-10-11 864
1c5b82e55f1529 Lorenzo Bianconi 2020-03-19 865 stats->xdp_bytes += frame->len;
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 866 frame = veth_xdp_rcv_one(rq, frame, bq, stats);
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 867 if (frame) {
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 868 /* XDP_PASS */
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 869 xdpf[n_xdpf++] = frame;
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 870 if (n_xdpf == VETH_XDP_BATCH) {
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 871 veth_xdp_rcv_bulk_skb(rq, xdpf, n_xdpf,
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 872 bq, stats);
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 873 n_xdpf = 0;
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 874 }
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 875 }
d1396004dd8686 Toshiaki Makita 2018-08-03 876 } else {
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 877 /* ndo_start_xmit */
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 878 struct sk_buff *skb = ptr;
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 879
1c5b82e55f1529 Lorenzo Bianconi 2020-03-19 880 stats->xdp_bytes += skb->len;
1c5b82e55f1529 Lorenzo Bianconi 2020-03-19 881 skb = veth_xdp_rcv_skb(rq, skb, bq, stats);
948d4f214fde43 Toshiaki Makita 2018-08-03 882 if (skb)
638264dc90227c Toshiaki Makita 2018-08-03 883 napi_gro_receive(&rq->xdp_napi, skb);
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 884 }
948d4f214fde43 Toshiaki Makita 2018-08-03 885 done++;
948d4f214fde43 Toshiaki Makita 2018-08-03 886 }
948d4f214fde43 Toshiaki Makita 2018-08-03 887
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 888 if (n_xdpf)
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 889 veth_xdp_rcv_bulk_skb(rq, xdpf, n_xdpf, bq, stats);
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 890
4195e54aaf1c8d Toshiaki Makita 2018-10-11 891 u64_stats_update_begin(&rq->stats.syncp);
9152cff0dd3df6 Lorenzo Bianconi 2020-03-19 892 rq->stats.vs.xdp_redirect += stats->xdp_redirect;
1c5b82e55f1529 Lorenzo Bianconi 2020-03-19 893 rq->stats.vs.xdp_bytes += stats->xdp_bytes;
66fe4a078879d1 Lorenzo Bianconi 2020-03-19 894 rq->stats.vs.xdp_drops += stats->xdp_drops;
66fe4a078879d1 Lorenzo Bianconi 2020-03-19 895 rq->stats.vs.rx_drops += stats->rx_drops;
65780c5627a26d Lorenzo Bianconi 2020-03-19 896 rq->stats.vs.xdp_packets += done;
4195e54aaf1c8d Toshiaki Makita 2018-10-11 897 u64_stats_update_end(&rq->stats.syncp);
4195e54aaf1c8d Toshiaki Makita 2018-10-11 898
948d4f214fde43 Toshiaki Makita 2018-08-03 899 return done;
948d4f214fde43 Toshiaki Makita 2018-08-03 900 }
948d4f214fde43 Toshiaki Makita 2018-08-03 901

:::::: The code at line 848 was first introduced by commit
:::::: 1c5b82e55f152988778bebeea52fae7f6cea9a60 veth: introduce more specialized counters in veth_stats

:::::: TO: Lorenzo Bianconi <lorenzo@xxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

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