lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 22 Jan 2023 11:05:52 +0800
From:   kernel test robot <lkp@...el.com>
To:     Jiawen Wu <jiawenwu@...stnetic.com>, netdev@...r.kernel.org,
        mengyuanlou@...-swift.com
Cc:     oe-kbuild-all@...ts.linux.dev, Jiawen Wu <jiawenwu@...stnetic.com>
Subject: Re: [PATCH net-next 05/10] net: libwx: Allocate Rx and Tx resources

Hi Jiawen,

I love your patch! Yet something to improve:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Jiawen-Wu/net-libwx-Add-irq-flow-functions/20230118-154258
patch link:    https://lore.kernel.org/r/20230118065504.3075474-6-jiawenwu%40trustnetic.com
patch subject: [PATCH net-next 05/10] net: libwx: Allocate Rx and Tx resources
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20230122/202301221047.SBlK8xvt-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/583ee5bbec18cbfb2f88a647db0d8d15457d2b54
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Jiawen-Wu/net-libwx-Add-irq-flow-functions/20230118-154258
        git checkout 583ee5bbec18cbfb2f88a647db0d8d15457d2b54
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

   drivers/net/ethernet/wangxun/libwx/wx_lib.c: In function 'wx_free_rx_resources':
>> drivers/net/ethernet/wangxun/libwx/wx_lib.c:612:9: error: implicit declaration of function 'vfree'; did you mean 'kvfree'? [-Werror=implicit-function-declaration]
     612 |         vfree(rx_ring->rx_buffer_info);
         |         ^~~~~
         |         kvfree
   drivers/net/ethernet/wangxun/libwx/wx_lib.c: In function 'wx_setup_rx_resources':
>> drivers/net/ethernet/wangxun/libwx/wx_lib.c:728:35: error: implicit declaration of function 'vmalloc_node'; did you mean 'kvmalloc_node'? [-Werror=implicit-function-declaration]
     728 |         rx_ring->rx_buffer_info = vmalloc_node(size, numa_node);
         |                                   ^~~~~~~~~~~~
         |                                   kvmalloc_node
   drivers/net/ethernet/wangxun/libwx/wx_lib.c:728:33: warning: assignment to 'struct wx_rx_buffer *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     728 |         rx_ring->rx_buffer_info = vmalloc_node(size, numa_node);
         |                                 ^
>> drivers/net/ethernet/wangxun/libwx/wx_lib.c:730:43: error: implicit declaration of function 'vmalloc'; did you mean 'kvmalloc'? [-Werror=implicit-function-declaration]
     730 |                 rx_ring->rx_buffer_info = vmalloc(size);
         |                                           ^~~~~~~
         |                                           kvmalloc
   drivers/net/ethernet/wangxun/libwx/wx_lib.c:730:41: warning: assignment to 'struct wx_rx_buffer *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     730 |                 rx_ring->rx_buffer_info = vmalloc(size);
         |                                         ^
   drivers/net/ethernet/wangxun/libwx/wx_lib.c: In function 'wx_setup_tx_resources':
   drivers/net/ethernet/wangxun/libwx/wx_lib.c:810:33: warning: assignment to 'struct wx_tx_buffer *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     810 |         tx_ring->tx_buffer_info = vmalloc_node(size, numa_node);
         |                                 ^
   drivers/net/ethernet/wangxun/libwx/wx_lib.c:812:41: warning: assignment to 'struct wx_tx_buffer *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     812 |                 tx_ring->tx_buffer_info = vmalloc(size);
         |                                         ^
   cc1: some warnings being treated as errors


vim +612 drivers/net/ethernet/wangxun/libwx/wx_lib.c

   603	
   604	/**
   605	 * wx_free_rx_resources - Free Rx Resources
   606	 * @rx_ring: ring to clean the resources from
   607	 *
   608	 * Free all receive software resources
   609	 **/
   610	static void wx_free_rx_resources(struct wx_ring *rx_ring)
   611	{
 > 612		vfree(rx_ring->rx_buffer_info);
   613		rx_ring->rx_buffer_info = NULL;
   614	
   615		/* if not set, then don't free */
   616		if (!rx_ring->desc)
   617			return;
   618	
   619		dma_free_coherent(rx_ring->dev, rx_ring->size,
   620				  rx_ring->desc, rx_ring->dma);
   621	
   622		rx_ring->desc = NULL;
   623	
   624		if (rx_ring->page_pool) {
   625			page_pool_destroy(rx_ring->page_pool);
   626			rx_ring->page_pool = NULL;
   627		}
   628	}
   629	
   630	/**
   631	 * wx_free_all_rx_resources - Free Rx Resources for All Queues
   632	 * @wx: pointer to hardware structure
   633	 *
   634	 * Free all receive software resources
   635	 **/
   636	static void wx_free_all_rx_resources(struct wx *wx)
   637	{
   638		int i;
   639	
   640		for (i = 0; i < wx->num_rx_queues; i++)
   641			wx_free_rx_resources(wx->rx_ring[i]);
   642	}
   643	
   644	/**
   645	 * wx_free_tx_resources - Free Tx Resources per Queue
   646	 * @tx_ring: Tx descriptor ring for a specific queue
   647	 *
   648	 * Free all transmit software resources
   649	 **/
   650	static void wx_free_tx_resources(struct wx_ring *tx_ring)
   651	{
   652		vfree(tx_ring->tx_buffer_info);
   653		tx_ring->tx_buffer_info = NULL;
   654	
   655		/* if not set, then don't free */
   656		if (!tx_ring->desc)
   657			return;
   658	
   659		dma_free_coherent(tx_ring->dev, tx_ring->size,
   660				  tx_ring->desc, tx_ring->dma);
   661		tx_ring->desc = NULL;
   662	}
   663	
   664	/**
   665	 * wx_free_all_tx_resources - Free Tx Resources for All Queues
   666	 * @wx: pointer to hardware structure
   667	 *
   668	 * Free all transmit software resources
   669	 **/
   670	static void wx_free_all_tx_resources(struct wx *wx)
   671	{
   672		int i;
   673	
   674		for (i = 0; i < wx->num_tx_queues; i++)
   675			wx_free_tx_resources(wx->tx_ring[i]);
   676	}
   677	
   678	void wx_free_resources(struct wx *wx)
   679	{
   680		wx_free_isb_resources(wx);
   681		wx_free_all_rx_resources(wx);
   682		wx_free_all_tx_resources(wx);
   683	}
   684	EXPORT_SYMBOL(wx_free_resources);
   685	
   686	static int wx_alloc_page_pool(struct wx_ring *rx_ring)
   687	{
   688		int ret = 0;
   689	
   690		struct page_pool_params pp_params = {
   691			.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV,
   692			.order = 0,
   693			.pool_size = rx_ring->size,
   694			.nid = dev_to_node(rx_ring->dev),
   695			.dev = rx_ring->dev,
   696			.dma_dir = DMA_FROM_DEVICE,
   697			.offset = 0,
   698			.max_len = PAGE_SIZE,
   699		};
   700	
   701		rx_ring->page_pool = page_pool_create(&pp_params);
   702		if (IS_ERR(rx_ring->page_pool)) {
   703			rx_ring->page_pool = NULL;
   704			ret = PTR_ERR(rx_ring->page_pool);
   705		}
   706	
   707		return ret;
   708	}
   709	
   710	/**
   711	 * wx_setup_rx_resources - allocate Rx resources (Descriptors)
   712	 * @rx_ring: rx descriptor ring (for a specific queue) to setup
   713	 *
   714	 * Returns 0 on success, negative on failure
   715	 **/
   716	static int wx_setup_rx_resources(struct wx_ring *rx_ring)
   717	{
   718		struct device *dev = rx_ring->dev;
   719		int orig_node = dev_to_node(dev);
   720		int numa_node = -1;
   721		int size, ret;
   722	
   723		size = sizeof(struct wx_rx_buffer) * rx_ring->count;
   724	
   725		if (rx_ring->q_vector)
   726			numa_node = rx_ring->q_vector->numa_node;
   727	
 > 728		rx_ring->rx_buffer_info = vmalloc_node(size, numa_node);
   729		if (!rx_ring->rx_buffer_info)
 > 730			rx_ring->rx_buffer_info = vmalloc(size);
   731		if (!rx_ring->rx_buffer_info)
   732			goto err;
   733	
   734		/* Round up to nearest 4K */
   735		rx_ring->size = rx_ring->count * sizeof(union wx_rx_desc);
   736		rx_ring->size = ALIGN(rx_ring->size, 4096);
   737	
   738		set_dev_node(dev, numa_node);
   739		rx_ring->desc = dma_alloc_coherent(dev, rx_ring->size,
   740						   &rx_ring->dma, GFP_KERNEL);
   741		set_dev_node(dev, orig_node);
   742		rx_ring->desc = dma_alloc_coherent(dev, rx_ring->size,
   743						   &rx_ring->dma, GFP_KERNEL);
   744		if (!rx_ring->desc)
   745			goto err;
   746	
   747		ret = wx_alloc_page_pool(rx_ring);
   748		if (ret < 0) {
   749			dev_err(rx_ring->dev, "Page pool creation failed: %d\n", ret);
   750			goto err;
   751		}
   752	
   753		return 0;
   754	err:
   755		vfree(rx_ring->rx_buffer_info);
   756		rx_ring->rx_buffer_info = NULL;
   757		dev_err(dev, "Unable to allocate memory for the Rx descriptor ring\n");
   758		return -ENOMEM;
   759	}
   760	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ