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>] [day] [month] [year] [list]
Message-ID: <202108300417.UBoKwFkM-lkp@intel.com>
Date:   Mon, 30 Aug 2021 04:32:30 +0800
From:   kernel test robot <lkp@...el.com>
To:     Andi Kleen <ak@...ux.intel.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Kuppuswamy Sathyanarayanan 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>
Subject: [intel-tdx:guest 94/113] drivers/net/vmxnet3/vmxnet3_drv.c:3413:29:
 warning: shift count >= width of type

tree:   https://github.com/intel/tdx.git guest
head:   44e41606b85b08fad5378c876547f8557f835cf6
commit: eb26b8afd9b6c065a6cd81ca1fa48b3d6e11c5a5 [94/113] x86/tdx: Make RDRAND/RDSEED loop forever
config: i386-randconfig-a004-20210829 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 510e106fa8635e7f9c51c896180b971de6309b2f)
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/tdx/commit/eb26b8afd9b6c065a6cd81ca1fa48b3d6e11c5a5
        git remote add intel-tdx https://github.com/intel/tdx.git
        git fetch --no-tags intel-tdx guest
        git checkout eb26b8afd9b6c065a6cd81ca1fa48b3d6e11c5a5
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 

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

All warnings (new ones prefixed by >>):

   In file included from drivers/net/vmxnet3/vmxnet3_drv.c:28:
   In file included from include/net/ip6_checksum.h:27:
   In file included from include/net/ip.h:22:
   In file included from include/linux/ip.h:16:
   In file included from include/linux/skbuff.h:26:
   In file included from include/linux/net.h:18:
   In file included from include/linux/random.h:121:
   In file included from arch/x86/include/asm/archrandom.h:13:
   include/linux/protected_guest.h:57:12: error: incomplete definition of type 'struct device'
           return dev->authorized;
                  ~~~^
   include/linux/dynamic_debug.h:70:8: note: forward declaration of 'struct device'
   struct device;
          ^
>> drivers/net/vmxnet3/vmxnet3_drv.c:3413:29: warning: shift count >= width of type [-Wshift-count-overflow]
           if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) == 0) {
                                      ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   drivers/net/vmxnet3/vmxnet3_drv.c:3414:41: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) {
                                                         ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   2 warnings and 1 error generated.
--
   In file included from drivers/net/ethernet/marvell/sky2.c:18:
   In file included from include/linux/netdevice.h:37:
   In file included from include/net/net_namespace.h:39:
   In file included from include/linux/skbuff.h:26:
   In file included from include/linux/net.h:18:
   In file included from include/linux/random.h:121:
   In file included from arch/x86/include/asm/archrandom.h:13:
   include/linux/protected_guest.h:57:12: error: incomplete definition of type 'struct device'
           return dev->authorized;
                  ~~~^
   include/linux/dynamic_debug.h:70:8: note: forward declaration of 'struct device'
   struct device;
          ^
>> drivers/net/ethernet/marvell/sky2.c:4988:39: warning: shift count >= width of type [-Wshift-count-overflow]
               !(err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)))) {
                                                ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   drivers/net/ethernet/marvell/sky2.c:4990:43: warning: shift count >= width of type [-Wshift-count-overflow]
                   err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
                                                           ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   2 warnings and 1 error generated.
--
   In file included from drivers/net/ethernet/realtek/8139cp.c:60:
   In file included from include/linux/netdevice.h:37:
   In file included from include/net/net_namespace.h:39:
   In file included from include/linux/skbuff.h:26:
   In file included from include/linux/net.h:18:
   In file included from include/linux/random.h:121:
   In file included from arch/x86/include/asm/archrandom.h:13:
   include/linux/protected_guest.h:57:12: error: incomplete definition of type 'struct device'
           return dev->authorized;
                  ~~~^
   include/linux/dynamic_debug.h:70:8: note: forward declaration of 'struct device'
   struct device;
          ^
>> drivers/net/ethernet/realtek/8139cp.c:1948:41: warning: shift count >= width of type [-Wshift-count-overflow]
               !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) &&
                                                  ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   drivers/net/ethernet/realtek/8139cp.c:1949:30: warning: shift count >= width of type [-Wshift-count-overflow]
               !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
                                       ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   2 warnings and 1 error generated.
--
   In file included from drivers/net/ethernet/intel/fm10k/fm10k_main.c:6:
   In file included from include/net/ipv6.h:12:
   In file included from include/linux/ipv6.h:88:
   In file included from include/linux/tcp.h:17:
   In file included from include/linux/skbuff.h:26:
   In file included from include/linux/net.h:18:
   In file included from include/linux/random.h:121:
   In file included from arch/x86/include/asm/archrandom.h:13:
   include/linux/protected_guest.h:57:12: error: incomplete definition of type 'struct device'
           return dev->authorized;
                  ~~~^
   include/linux/dynamic_debug.h:70:8: note: forward declaration of 'struct device'
   struct device;
          ^
>> drivers/net/ethernet/intel/fm10k/fm10k_main.c:878:16: warning: division by zero is undefined [-Wdivision-by-zero]
           desc_flags |= FM10K_SET_FLAG(tx_flags, FM10K_TX_FLAGS_CSUM,
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/fm10k/fm10k_main.c:870:26: note: expanded from macro 'FM10K_SET_FLAG'
            ((u32)(_input & _flag) / (_flag / _result)))
                                   ^ ~~~~~~~~~~~~~~~~~
   1 warning and 1 error generated.
--
   In file included from drivers/net/ethernet/intel/igb/igb_main.c:12:
   In file included from include/linux/netdevice.h:37:
   In file included from include/net/net_namespace.h:39:
   In file included from include/linux/skbuff.h:26:
   In file included from include/linux/net.h:18:
   In file included from include/linux/random.h:121:
   In file included from arch/x86/include/asm/archrandom.h:13:
   include/linux/protected_guest.h:57:12: error: incomplete definition of type 'struct device'
           return dev->authorized;
                  ~~~^
   include/linux/dynamic_debug.h:70:8: note: forward declaration of 'struct device'
   struct device;
          ^
>> drivers/net/ethernet/intel/igb/igb_main.c:3177:46: warning: shift count >= width of type [-Wshift-count-overflow]
           err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
                                                       ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
>> drivers/net/ethernet/intel/igb/igb_main.c:6028:14: warning: division by zero is undefined [-Wdivision-by-zero]
           cmd_type |= IGB_SET_FLAG(tx_flags, IGB_TX_FLAGS_VLAN,
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igb/igb_main.c:6018:26: note: expanded from macro 'IGB_SET_FLAG'
            ((u32)(_input & _flag) / (_flag / _result)))
                                   ^ ~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igb/igb_main.c:6032:14: warning: division by zero is undefined [-Wdivision-by-zero]
           cmd_type |= IGB_SET_FLAG(tx_flags, IGB_TX_FLAGS_TSO,
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igb/igb_main.c:6018:26: note: expanded from macro 'IGB_SET_FLAG'
            ((u32)(_input & _flag) / (_flag / _result)))
                                   ^ ~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igb/igb_main.c:6036:14: warning: division by zero is undefined [-Wdivision-by-zero]
           cmd_type |= IGB_SET_FLAG(tx_flags, IGB_TX_FLAGS_TSTAMP,
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igb/igb_main.c:6018:26: note: expanded from macro 'IGB_SET_FLAG'
            ((u32)(_input & _flag) / (_flag / _result)))
                                   ^ ~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igb/igb_main.c:6040:14: warning: division by zero is undefined [-Wdivision-by-zero]
           cmd_type ^= IGB_SET_FLAG(skb->no_fcs, 1, E1000_ADVTXD_DCMD_IFCS);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igb/igb_main.c:6018:26: note: expanded from macro 'IGB_SET_FLAG'
            ((u32)(_input & _flag) / (_flag / _result)))
                                   ^ ~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igb/igb_main.c:6056:19: warning: division by zero is undefined [-Wdivision-by-zero]
           olinfo_status |= IGB_SET_FLAG(tx_flags,
                            ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igb/igb_main.c:6018:26: note: expanded from macro 'IGB_SET_FLAG'
            ((u32)(_input & _flag) / (_flag / _result)))
                                   ^ ~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igb/igb_main.c:6061:19: warning: division by zero is undefined [-Wdivision-by-zero]
           olinfo_status |= IGB_SET_FLAG(tx_flags,
                            ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igb/igb_main.c:6018:26: note: expanded from macro 'IGB_SET_FLAG'
            ((u32)(_input & _flag) / (_flag / _result)))
                                   ^ ~~~~~~~~~~~~~~~~~
   7 warnings and 1 error generated.
--
   In file included from drivers/net/ethernet/intel/igc/igc_main.c:6:
   In file included from include/linux/if_vlan.h:10:
   In file included from include/linux/netdevice.h:37:
   In file included from include/net/net_namespace.h:39:
   In file included from include/linux/skbuff.h:26:
   In file included from include/linux/net.h:18:
   In file included from include/linux/random.h:121:
   In file included from arch/x86/include/asm/archrandom.h:13:
   include/linux/protected_guest.h:57:12: error: incomplete definition of type 'struct device'
           return dev->authorized;
                  ~~~^
   include/linux/dynamic_debug.h:70:8: note: forward declaration of 'struct device'
   struct device;
          ^
>> drivers/net/ethernet/intel/igc/igc_main.c:1138:14: warning: division by zero is undefined [-Wdivision-by-zero]
           cmd_type |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_VLAN,
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igc/igc_main.c:1128:30: note: expanded from macro 'IGC_SET_FLAG'
            ((u32)((_input) & (_flag)) / ((_flag) / (_result))))
                                       ^ ~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igc/igc_main.c:1142:14: warning: division by zero is undefined [-Wdivision-by-zero]
           cmd_type |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_TSO,
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igc/igc_main.c:1128:30: note: expanded from macro 'IGC_SET_FLAG'
            ((u32)((_input) & (_flag)) / ((_flag) / (_result))))
                                       ^ ~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igc/igc_main.c:1146:14: warning: division by zero is undefined [-Wdivision-by-zero]
           cmd_type |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_TSTAMP,
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igc/igc_main.c:1128:30: note: expanded from macro 'IGC_SET_FLAG'
            ((u32)((_input) & (_flag)) / ((_flag) / (_result))))
                                       ^ ~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igc/igc_main.c:1150:14: warning: division by zero is undefined [-Wdivision-by-zero]
           cmd_type ^= IGC_SET_FLAG(skb->no_fcs, 1, IGC_ADVTXD_DCMD_IFCS);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/igc/igc_main.c:1128:30: note: expanded from macro 'IGC_SET_FLAG'
            ((u32)((_input) & (_flag)) / ((_flag) / (_result))))
                                       ^ ~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/igc/igc_main.c:5844:46: warning: shift count >= width of type [-Wshift-count-overflow]
           err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
                                                       ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   5 warnings and 1 error generated.


vim +3413 drivers/net/vmxnet3/vmxnet3_drv.c

d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3342  
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3343  
3a4751a3bb2704 Bill Pemberton     2012-12-03  3344  static int
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3345  vmxnet3_probe_device(struct pci_dev *pdev,
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3346  		     const struct pci_device_id *id)
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3347  {
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3348  	static const struct net_device_ops vmxnet3_netdev_ops = {
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3349  		.ndo_open = vmxnet3_open,
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3350  		.ndo_stop = vmxnet3_close,
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3351  		.ndo_start_xmit = vmxnet3_xmit_frame,
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3352  		.ndo_set_mac_address = vmxnet3_set_mac_addr,
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3353  		.ndo_change_mtu = vmxnet3_change_mtu,
3dd7400b419409 Ronak Doshi        2019-06-03  3354  		.ndo_fix_features = vmxnet3_fix_features,
a0d2730c9571ae Michał Mirosław    2011-04-18  3355  		.ndo_set_features = vmxnet3_set_features,
1dac3b1bc66dc6 Ronak Doshi        2020-09-24  3356  		.ndo_features_check = vmxnet3_features_check,
95305f6c3b4e8c stephen hemminger  2011-06-08  3357  		.ndo_get_stats64 = vmxnet3_get_stats64,
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3358  		.ndo_tx_timeout = vmxnet3_tx_timeout,
afc4b13df14312 Jiri Pirko         2011-08-16  3359  		.ndo_set_rx_mode = vmxnet3_set_mc,
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3360  		.ndo_vlan_rx_add_vid = vmxnet3_vlan_rx_add_vid,
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3361  		.ndo_vlan_rx_kill_vid = vmxnet3_vlan_rx_kill_vid,
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3362  #ifdef CONFIG_NET_POLL_CONTROLLER
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3363  		.ndo_poll_controller = vmxnet3_netpoll,
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3364  #endif
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3365  	};
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3366  	int err;
61aeecea40afb2 hpreg@...are.com   2018-05-14  3367  	bool dma64;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3368  	u32 ver;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3369  	struct net_device *netdev;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3370  	struct vmxnet3_adapter *adapter;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3371  	u8 mac[ETH_ALEN];
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3372  	int size;
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3373  	int num_tx_queues;
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3374  	int num_rx_queues;
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3375  
e154b639bbe53d Shreyas Bhatewara  2011-05-10  3376  	if (!pci_msi_enabled())
e154b639bbe53d Shreyas Bhatewara  2011-05-10  3377  		enable_mq = 0;
e154b639bbe53d Shreyas Bhatewara  2011-05-10  3378  
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3379  #ifdef VMXNET3_RSS
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3380  	if (enable_mq)
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3381  		num_rx_queues = min(VMXNET3_DEVICE_MAX_RX_QUEUES,
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3382  				    (int)num_online_cpus());
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3383  	else
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3384  #endif
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3385  		num_rx_queues = 1;
eebb02b1f03b37 Shreyas Bhatewara  2011-07-07  3386  	num_rx_queues = rounddown_pow_of_two(num_rx_queues);
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3387  
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3388  	if (enable_mq)
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3389  		num_tx_queues = min(VMXNET3_DEVICE_MAX_TX_QUEUES,
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3390  				    (int)num_online_cpus());
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3391  	else
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3392  		num_tx_queues = 1;
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3393  
eebb02b1f03b37 Shreyas Bhatewara  2011-07-07  3394  	num_tx_queues = rounddown_pow_of_two(num_tx_queues);
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3395  	netdev = alloc_etherdev_mq(sizeof(struct vmxnet3_adapter),
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3396  				   max(num_tx_queues, num_rx_queues));
204a6e659439b7 Stephen Hemminger  2013-01-15  3397  	dev_info(&pdev->dev,
204a6e659439b7 Stephen Hemminger  2013-01-15  3398  		 "# of Tx queues : %d, # of Rx queues : %d\n",
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3399  		 num_tx_queues, num_rx_queues);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3400  
41de8d4cff21a2 Joe Perches        2012-01-29  3401  	if (!netdev)
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3402  		return -ENOMEM;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3403  
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3404  	pci_set_drvdata(pdev, netdev);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3405  	adapter = netdev_priv(netdev);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3406  	adapter->netdev = netdev;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3407  	adapter->pdev = pdev;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3408  
f00e2b0ac3ae25 Neil Horman        2014-06-13  3409  	adapter->tx_ring_size = VMXNET3_DEF_TX_RING_SIZE;
f00e2b0ac3ae25 Neil Horman        2014-06-13  3410  	adapter->rx_ring_size = VMXNET3_DEF_RX_RING_SIZE;
53831aa12538f8 Shrikrishna Khare  2015-01-06  3411  	adapter->rx_ring2_size = VMXNET3_DEF_RX_RING2_SIZE;
f00e2b0ac3ae25 Neil Horman        2014-06-13  3412  
61aeecea40afb2 hpreg@...are.com   2018-05-14 @3413  	if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) == 0) {
61aeecea40afb2 hpreg@...are.com   2018-05-14  3414  		if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) {
61aeecea40afb2 hpreg@...are.com   2018-05-14  3415  			dev_err(&pdev->dev,
61aeecea40afb2 hpreg@...are.com   2018-05-14  3416  				"pci_set_consistent_dma_mask failed\n");
61aeecea40afb2 hpreg@...are.com   2018-05-14  3417  			err = -EIO;
61aeecea40afb2 hpreg@...are.com   2018-05-14  3418  			goto err_set_mask;
61aeecea40afb2 hpreg@...are.com   2018-05-14  3419  		}
61aeecea40afb2 hpreg@...are.com   2018-05-14  3420  		dma64 = true;
61aeecea40afb2 hpreg@...are.com   2018-05-14  3421  	} else {
61aeecea40afb2 hpreg@...are.com   2018-05-14  3422  		if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) {
61aeecea40afb2 hpreg@...are.com   2018-05-14  3423  			dev_err(&pdev->dev,
61aeecea40afb2 hpreg@...are.com   2018-05-14  3424  				"pci_set_dma_mask failed\n");
61aeecea40afb2 hpreg@...are.com   2018-05-14  3425  			err = -EIO;
61aeecea40afb2 hpreg@...are.com   2018-05-14  3426  			goto err_set_mask;
61aeecea40afb2 hpreg@...are.com   2018-05-14  3427  		}
61aeecea40afb2 hpreg@...are.com   2018-05-14  3428  		dma64 = false;
61aeecea40afb2 hpreg@...are.com   2018-05-14  3429  	}
61aeecea40afb2 hpreg@...are.com   2018-05-14  3430  
83d0feffc5695d Shreyas Bhatewara  2011-01-14  3431  	spin_lock_init(&adapter->cmd_lock);
b0eb57cb97e783 Andy King          2013-08-23  3432  	adapter->adapter_pa = dma_map_single(&adapter->pdev->dev, adapter,
b0eb57cb97e783 Andy King          2013-08-23  3433  					     sizeof(struct vmxnet3_adapter),
b0eb57cb97e783 Andy King          2013-08-23  3434  					     PCI_DMA_TODEVICE);
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  3435  	if (dma_mapping_error(&adapter->pdev->dev, adapter->adapter_pa)) {
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  3436  		dev_err(&pdev->dev, "Failed to map dma\n");
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  3437  		err = -EFAULT;
61aeecea40afb2 hpreg@...are.com   2018-05-14  3438  		goto err_set_mask;
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  3439  	}
b0eb57cb97e783 Andy King          2013-08-23  3440  	adapter->shared = dma_alloc_coherent(
b0eb57cb97e783 Andy King          2013-08-23  3441  				&adapter->pdev->dev,
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3442  				sizeof(struct Vmxnet3_DriverShared),
b0eb57cb97e783 Andy King          2013-08-23  3443  				&adapter->shared_pa, GFP_KERNEL);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3444  	if (!adapter->shared) {
204a6e659439b7 Stephen Hemminger  2013-01-15  3445  		dev_err(&pdev->dev, "Failed to allocate memory\n");
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3446  		err = -ENOMEM;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3447  		goto err_alloc_shared;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3448  	}
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3449  
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3450  	adapter->num_rx_queues = num_rx_queues;
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3451  	adapter->num_tx_queues = num_tx_queues;
e4fabf2b6e6d75 Bhavesh Davda      2013-03-06  3452  	adapter->rx_buf_per_pkt = 1;
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3453  
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3454  	size = sizeof(struct Vmxnet3_TxQueueDesc) * adapter->num_tx_queues;
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3455  	size += sizeof(struct Vmxnet3_RxQueueDesc) * adapter->num_rx_queues;
b0eb57cb97e783 Andy King          2013-08-23  3456  	adapter->tqd_start = dma_alloc_coherent(&adapter->pdev->dev, size,
b0eb57cb97e783 Andy King          2013-08-23  3457  						&adapter->queue_desc_pa,
b0eb57cb97e783 Andy King          2013-08-23  3458  						GFP_KERNEL);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3459  
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3460  	if (!adapter->tqd_start) {
204a6e659439b7 Stephen Hemminger  2013-01-15  3461  		dev_err(&pdev->dev, "Failed to allocate memory\n");
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3462  		err = -ENOMEM;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3463  		goto err_alloc_queue_desc;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3464  	}
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3465  	adapter->rqd_start = (struct Vmxnet3_RxQueueDesc *)(adapter->tqd_start +
09c5088e5c5993 Shreyas Bhatewara  2010-11-19  3466  							    adapter->num_tx_queues);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3467  
b0eb57cb97e783 Andy King          2013-08-23  3468  	adapter->pm_conf = dma_alloc_coherent(&adapter->pdev->dev,
b0eb57cb97e783 Andy King          2013-08-23  3469  					      sizeof(struct Vmxnet3_PMConf),
b0eb57cb97e783 Andy King          2013-08-23  3470  					      &adapter->pm_conf_pa,
b0eb57cb97e783 Andy King          2013-08-23  3471  					      GFP_KERNEL);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3472  	if (adapter->pm_conf == NULL) {
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3473  		err = -ENOMEM;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3474  		goto err_alloc_pm;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3475  	}
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  3476  

:::::: The code at line 3413 was first introduced by commit
:::::: 61aeecea40afb2b89933e27cd4adb10fc2e75cfd vmxnet3: set the DMA mask before the first DMA map operation

:::::: TO: hpreg@...are.com <hpreg@...are.com>
:::::: CC: David S. Miller <davem@...emloft.net>

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

Download attachment ".config.gz" of type "application/gzip" (38030 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ