Subject: Re: [PATCH net-next v3 4/4] net: ocelot: add FDMA support

From: kernel test robot <[email-masked]>
Date: Sat, 27 Nov 2021 04:04:11 +0800

Hi "Clément,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on net/master linus/master v5.16-rc2 next-20211126]
[cannot apply to net-next/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Cl-ment-L-ger/Add-FDMA-support-on-ocelot-switch-driver/20211127-013140
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20211127/[email-masked]/config)
compiler: m68k-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://github.com/0day-ci/linux/commit/07c95fe9105be293d2b7edf193e5fd139c70c194
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Cl-ment-L-ger/Add-FDMA-support-on-ocelot-switch-driver/20211127-013140
        git checkout 07c95fe9105be293d2b7edf193e5fd139c70c194
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=m68k SHELL=/bin/bash drivers/net/ethernet/mscc/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email-masked]>

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/mscc/ocelot_fdma.c: In function 'ocelot_fdma_tx_cleanup':
>> drivers/net/ethernet/mscc/ocelot_fdma.c:306:22: warning: variable 'tmp_head' set but not used [-Wunused-but-set-variable]
     306 |         unsigned int tmp_head, new_null_llp_idx;
         |                      ^~~~~~~~

vim +/tmp_head +306 drivers/net/ethernet/mscc/ocelot_fdma.c

   302	
   303	static void ocelot_fdma_tx_cleanup(struct ocelot_fdma *fdma, int budget)
   304	{
   305		struct ocelot_fdma_ring *ring = &fdma->inj;
 > 306		unsigned int tmp_head, new_null_llp_idx;
   307		struct ocelot_fdma_dcb *dcb;
   308		bool end_of_list = false;
   309		int ret;
   310	
   311		spin_lock_bh(&fdma->xmit_lock);
   312	
   313		/* Purge the TX packets that have been sent up to the NULL llp or the
   314		 * end of done list.
   315		 */
   316		while (!ocelot_fdma_ring_empty(&fdma->inj)) {
   317			dcb = &ring->dcbs[ring->head];
   318			if (!(dcb->hw->stat & MSCC_FDMA_DCB_STAT_PD))
   319				break;
   320	
   321			tmp_head = ring->head;
   322			ring->head = ocelot_fdma_idx_incr(ring->head);
   323	
   324			dma_unmap_single(fdma->dev, dcb->mapping, dcb->mapped_size,
   325					 DMA_TO_DEVICE);
   326			napi_consume_skb(dcb->skb, budget);
   327	
   328			/* If we hit the NULL LLP, stop, we might need to reload FDMA */
   329			if (dcb->hw->llp == 0) {
   330				end_of_list = true;
   331				break;
   332			}
   333		}
   334	
   335		/* If there is still some DCBs to be processed by the FDMA or if the
   336		 * pending list is empty, there is no need to restart the FDMA.
   337		 */
   338		if (!end_of_list || ocelot_fdma_ring_empty(&fdma->inj))
   339			goto out_unlock;
   340	
   341		ret = ocelot_fdma_wait_chan_safe(fdma, MSCC_FDMA_INJ_CHAN);
   342		if (ret) {
   343			dev_warn(fdma->dev, "Failed to wait for TX channel to stop\n");
   344			goto out_unlock;
   345		}
   346	
   347		/* Set NULL LLP */
   348		new_null_llp_idx = ocelot_fdma_idx_decr(ring->tail);
   349		dcb = &ring->dcbs[new_null_llp_idx];
   350		dcb->hw->llp = 0;
   351	
   352		dcb = &ring->dcbs[ring->head];
   353		ocelot_fdma_activate_chan(fdma, dcb, MSCC_FDMA_INJ_CHAN);
   354	
   355	out_unlock:
   356		spin_unlock_bh(&fdma->xmit_lock);
   357	}
   358	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]