* [PATCH] net/ena: Fix build warning in ena_xdp_set()
@ 2020-04-24 0:01 Gavin Shan
2020-04-24 23:53 ` David Miller
2020-04-27 16:27 ` kbuild test robot
0 siblings, 2 replies; 3+ messages in thread
From: Gavin Shan @ 2020-04-24 0:01 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, netanel, akiyano, gtzalik, saeedb, zorik, davem
This fixes the following build warning in ena_xdp_set()
In file included from ./include/net/inet_sock.h:19,
from ./include/net/ip.h:27,
from drivers/net/ethernet/amazon/ena/ena_netdev.c:46:
drivers/net/ethernet/amazon/ena/ena_netdev.c: In function \
‘ena_xdp_set’: \
drivers/net/ethernet/amazon/ena/ena_netdev.c:557:6: warning: \
format ‘%lu’ \
expects argument of type ‘long unsigned int’, but argument 4 \
has type ‘int’ \
[-Wformat=] "Failed to set xdp program, the current MTU (%d) is \
larger than the maximum allowed MTU (%lu) while xdp is on",
Signed-off-by: Gavin Shan <gshan@redhat.com>
---
drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 2cc765df8da3..6ff648423867 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -554,7 +554,7 @@ static int ena_xdp_set(struct net_device *netdev, struct netdev_bpf *bpf)
} else if (rc == ENA_XDP_CURRENT_MTU_TOO_LARGE) {
netif_err(adapter, drv, adapter->netdev,
- "Failed to set xdp program, the current MTU (%d) is larger than the maximum allowed MTU (%lu) while xdp is on",
+ "Failed to set xdp program, the current MTU (%d) is larger than the maximum allowed MTU (%d) while xdp is on",
netdev->mtu, ENA_XDP_MAX_MTU);
NL_SET_ERR_MSG_MOD(bpf->extack,
"Failed to set xdp program, the current MTU is larger than the maximum allowed MTU. Check the dmesg for more info");
--
2.23.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net/ena: Fix build warning in ena_xdp_set()
2020-04-24 0:01 [PATCH] net/ena: Fix build warning in ena_xdp_set() Gavin Shan
@ 2020-04-24 23:53 ` David Miller
2020-04-27 16:27 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-04-24 23:53 UTC (permalink / raw)
To: gshan; +Cc: netdev, linux-kernel, netanel, akiyano, gtzalik, saeedb, zorik
From: Gavin Shan <gshan@redhat.com>
Date: Fri, 24 Apr 2020 10:01:46 +1000
> This fixes the following build warning in ena_xdp_set()
>
> In file included from ./include/net/inet_sock.h:19,
> from ./include/net/ip.h:27,
> from drivers/net/ethernet/amazon/ena/ena_netdev.c:46:
> drivers/net/ethernet/amazon/ena/ena_netdev.c: In function \
> ‘ena_xdp_set’: \
> drivers/net/ethernet/amazon/ena/ena_netdev.c:557:6: warning: \
> format ‘%lu’ \
> expects argument of type ‘long unsigned int’, but argument 4 \
> has type ‘int’ \
> [-Wformat=] "Failed to set xdp program, the current MTU (%d) is \
> larger than the maximum allowed MTU (%lu) while xdp is on",
>
> Signed-off-by: Gavin Shan <gshan@redhat.com>
The type of the argument is configuration dependent, this is because
sometimes one of the terms to define ENA_XDP_MAX_MTU is PAGE_SIZE and
sometimes it is SZ_16K. And this determines whether it evaluates to
a long or not.
So your patch will just cause warnings in other configurations.
A better fix is therefore necessary.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net/ena: Fix build warning in ena_xdp_set()
2020-04-24 0:01 [PATCH] net/ena: Fix build warning in ena_xdp_set() Gavin Shan
2020-04-24 23:53 ` David Miller
@ 2020-04-27 16:27 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-04-27 16:27 UTC (permalink / raw)
To: Gavin Shan, netdev, linux-kernel, netanel, akiyano, gtzalik,
saeedb, zorik, davem
Cc: kbuild-all, linux-kernel, netanel, akiyano, gtzalik, saeedb, zorik
[-- Attachment #1: Type: text/plain, Size: 6354 bytes --]
Hi Gavin,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on v5.7-rc2]
[also build test WARNING on next-20200423]
[cannot apply to ipvs/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Gavin-Shan/net-ena-Fix-build-warning-in-ena_xdp_set/20200427-011237
base: ae83d0b416db002fe95601e7f97f64b59514d936
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=xtensa
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from arch/xtensa/include/asm/atomic.h:19,
from include/linux/atomic.h:7,
from include/asm-generic/bitops/atomic.h:5,
from arch/xtensa/include/asm/bitops.h:192,
from include/linux/bitops.h:29,
from include/linux/bitmap.h:8,
from include/linux/ethtool.h:16,
from drivers/net/ethernet/amazon/ena/ena_netdev.c:38:
drivers/net/ethernet/amazon/ena/ena_netdev.c: In function 'ena_xdp_exchange_program_rx_in_range':
arch/xtensa/include/asm/cmpxchg.h:173:3: warning: value computed is not used [-Wunused-value]
173 | ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/amazon/ena/ena_netdev.c:469:3: note: in expansion of macro 'xchg'
469 | xchg(&rx_ring->xdp_bpf_prog, prog);
| ^~~~
In file included from include/net/inet_sock.h:19,
from include/net/ip.h:27,
from drivers/net/ethernet/amazon/ena/ena_netdev.c:46:
drivers/net/ethernet/amazon/ena/ena_netdev.c: In function 'ena_xdp_set':
>> drivers/net/ethernet/amazon/ena/ena_netdev.c:557:6: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
557 | "Failed to set xdp program, the current MTU (%d) is larger than the maximum allowed MTU (%d) while xdp is on",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/netdevice.h:4923:23: note: in definition of macro 'netif_level'
4923 | netdev_##level(dev, fmt, ##args); \
| ^~~
>> drivers/net/ethernet/amazon/ena/ena_netdev.c:556:3: note: in expansion of macro 'netif_err'
556 | netif_err(adapter, drv, adapter->netdev,
| ^~~~~~~~~
drivers/net/ethernet/amazon/ena/ena_netdev.c:557:96: note: format string is defined here
557 | "Failed to set xdp program, the current MTU (%d) is larger than the maximum allowed MTU (%d) while xdp is on",
| ~^
| |
| int
| %ld
vim +557 drivers/net/ethernet/amazon/ena/ena_netdev.c
514
515 static int ena_xdp_set(struct net_device *netdev, struct netdev_bpf *bpf)
516 {
517 struct ena_adapter *adapter = netdev_priv(netdev);
518 struct bpf_prog *prog = bpf->prog;
519 struct bpf_prog *old_bpf_prog;
520 int rc, prev_mtu;
521 bool is_up;
522
523 is_up = test_bit(ENA_FLAG_DEV_UP, &adapter->flags);
524 rc = ena_xdp_allowed(adapter);
525 if (rc == ENA_XDP_ALLOWED) {
526 old_bpf_prog = adapter->xdp_bpf_prog;
527 if (prog) {
528 if (!is_up) {
529 ena_init_all_xdp_queues(adapter);
530 } else if (!old_bpf_prog) {
531 ena_down(adapter);
532 ena_init_all_xdp_queues(adapter);
533 }
534 ena_xdp_exchange_program(adapter, prog);
535
536 if (is_up && !old_bpf_prog) {
537 rc = ena_up(adapter);
538 if (rc)
539 return rc;
540 }
541 } else if (old_bpf_prog) {
542 rc = ena_destroy_and_free_all_xdp_queues(adapter);
543 if (rc)
544 return rc;
545 }
546
547 prev_mtu = netdev->max_mtu;
548 netdev->max_mtu = prog ? ENA_XDP_MAX_MTU : adapter->max_mtu;
549
550 if (!old_bpf_prog)
551 netif_info(adapter, drv, adapter->netdev,
552 "xdp program set, changing the max_mtu from %d to %d",
553 prev_mtu, netdev->max_mtu);
554
555 } else if (rc == ENA_XDP_CURRENT_MTU_TOO_LARGE) {
> 556 netif_err(adapter, drv, adapter->netdev,
> 557 "Failed to set xdp program, the current MTU (%d) is larger than the maximum allowed MTU (%d) while xdp is on",
558 netdev->mtu, ENA_XDP_MAX_MTU);
559 NL_SET_ERR_MSG_MOD(bpf->extack,
560 "Failed to set xdp program, the current MTU is larger than the maximum allowed MTU. Check the dmesg for more info");
561 return -EINVAL;
562 } else if (rc == ENA_XDP_NO_ENOUGH_QUEUES) {
563 netif_err(adapter, drv, adapter->netdev,
564 "Failed to set xdp program, the Rx/Tx channel count should be at most half of the maximum allowed channel count. The current queue count (%d), the maximal queue count (%d)\n",
565 adapter->num_io_queues, adapter->max_num_io_queues);
566 NL_SET_ERR_MSG_MOD(bpf->extack,
567 "Failed to set xdp program, there is no enough space for allocating XDP queues, Check the dmesg for more info");
568 return -EINVAL;
569 }
570
571 return 0;
572 }
573
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 62842 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-27 16:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 0:01 [PATCH] net/ena: Fix build warning in ena_xdp_set() Gavin Shan
2020-04-24 23:53 ` David Miller
2020-04-27 16:27 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).