Re: [PATCH net-next 2/3] net: use skb_for_each_frag() helper where possible

From: kernel test robot
Date: Fri Apr 09 2021 - 17:22:16 EST


Hi Matteo,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url: https://github.com/0day-ci/linux/commits/Matteo-Croce/introduce-skb_for_each_frag/20210410-020828
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 4438669eb703d1a7416c2b19a8a15b0400b36738
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.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://github.com/0day-ci/linux/commit/9a46b324d3f1ca289db31c0011a6bbfd5ae06918
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Matteo-Croce/introduce-skb_for_each_frag/20210410-020828
git checkout 9a46b324d3f1ca289db31c0011a6bbfd5ae06918
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa

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

All warnings (new ones prefixed by >>):

drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c: In function 'netxen_map_tx_skb':
>> drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c:1975:9: warning: variable 'nr_frags' set but not used [-Wunused-but-set-variable]
1975 | int i, nr_frags;
| ^~~~~~~~
--
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c: In function 'qlcnic_map_tx_skb':
>> drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c:584:9: warning: variable 'nr_frags' set but not used [-Wunused-but-set-variable]
584 | int i, nr_frags;
| ^~~~~~~~


vim +/nr_frags +1975 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c

cd1f8160e015cd drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2008-07-21 1968
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1969 static int
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1970 netxen_map_tx_skb(struct pci_dev *pdev,
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1971 struct sk_buff *skb, struct netxen_cmd_buffer *pbuf)
6f70340698333f drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-01-14 1972 {
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1973 struct netxen_skb_frag *nf;
d7840976e39156 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c Matthew Wilcox (Oracle 2019-07-22 1974) skb_frag_t *frag;
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 @1975 int i, nr_frags;
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1976 dma_addr_t map;
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1977
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1978 nr_frags = skb_shinfo(skb)->nr_frags;
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1979 nf = &pbuf->frag_array[0];
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1980
297af515d75f5c drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c Christophe JAILLET 2021-01-13 1981 map = dma_map_single(&pdev->dev, skb->data, skb_headlen(skb),
297af515d75f5c drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c Christophe JAILLET 2021-01-13 1982 DMA_TO_DEVICE);
297af515d75f5c drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c Christophe JAILLET 2021-01-13 1983 if (dma_mapping_error(&pdev->dev, map))
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1984 goto out_err;
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1985
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1986 nf->dma = map;
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1987 nf->length = skb_headlen(skb);
6f70340698333f drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-01-14 1988
9a46b324d3f1ca drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c Matteo Croce 2021-04-09 1989 skb_for_each_frag(skb, i) {
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1990 frag = &skb_shinfo(skb)->frags[i];
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1991 nf = &pbuf->frag_array[i+1];
6f70340698333f drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-01-14 1992
9e903e085262ff drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c Eric Dumazet 2011-10-18 1993 map = skb_frag_dma_map(&pdev->dev, frag, 0, skb_frag_size(frag),
5d6bcdfe38ce88 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c Ian Campbell 2011-10-06 1994 DMA_TO_DEVICE);
5d6bcdfe38ce88 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c Ian Campbell 2011-10-06 1995 if (dma_mapping_error(&pdev->dev, map))
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1996 goto unwind;
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1997
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 1998 nf->dma = map;
9e903e085262ff drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c Eric Dumazet 2011-10-18 1999 nf->length = skb_frag_size(frag);
6f70340698333f drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-01-14 2000 }
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 2001
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 2002 return 0;
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 2003
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 2004 unwind:
cf503e8f458cec drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-09-03 2005 while (--i >= 0) {
cf503e8f458cec drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-09-03 2006 nf = &pbuf->frag_array[i+1];
297af515d75f5c drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c Christophe JAILLET 2021-01-13 2007 dma_unmap_page(&pdev->dev, nf->dma, nf->length, DMA_TO_DEVICE);
a05948f296ce10 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c Eric Dumazet 2013-01-22 2008 nf->dma = 0ULL;
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 2009 }
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 2010
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 2011 nf = &pbuf->frag_array[0];
297af515d75f5c drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c Christophe JAILLET 2021-01-13 2012 dma_unmap_single(&pdev->dev, nf->dma, skb_headlen(skb), DMA_TO_DEVICE);
a05948f296ce10 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c Eric Dumazet 2013-01-22 2013 nf->dma = 0ULL;
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 2014
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 2015 out_err:
ce644ed4db3ee1 drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-08-23 2016 return -ENOMEM;
6f70340698333f drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-01-14 2017 }
6f70340698333f drivers/net/netxen/netxen_nic_main.c Dhananjay Phadke 2009-01-14 2018

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

Attachment: .config.gz
Description: application/gzip