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:   Tue, 25 Jul 2017 10:28:11 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Michael Chan <michael.chan@...adcom.com>
Cc:     kbuild-all@...org, davem@...emloft.net, netdev@...r.kernel.org,
        Sathya Perla <sathya.perla@...adcom.com>
Subject: Re: [PATCH net-next 08/10] bnxt_en: add support to enable
 VF-representors

Hi Sathya,

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

url:    https://github.com/0day-ci/linux/commits/Michael-Chan/bnxt_en-Update-firmware-interface-spec-to-1-8-0/20170725-094835
config: x86_64-randconfig-x016-201730 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from include/linux/kernfs.h:13:0,
                    from include/linux/sysfs.h:15,
                    from include/linux/kobject.h:21,
                    from include/linux/pci.h:28,
                    from drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c:9:
   drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c: In function 'bnxt_dl_eswitch_mode_set':
>> drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c:165:16: error: 'struct bnxt' has no member named 'sriov_lock'
     mutex_lock(&bp->sriov_lock);
                   ^
   include/linux/mutex.h:164:44: note: in definition of macro 'mutex_lock'
    #define mutex_lock(lock) mutex_lock_nested(lock, 0)
                                               ^~~~
   drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c:194:18: error: 'struct bnxt' has no member named 'sriov_lock'
     mutex_unlock(&bp->sriov_lock);
                     ^~

vim +165 drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c

   > 9	#include <linux/pci.h>
    10	#include <linux/netdevice.h>
    11	#include <linux/etherdevice.h>
    12	#include <linux/rtnetlink.h>
    13	#include <linux/jhash.h>
    14	
    15	#include "bnxt_hsi.h"
    16	#include "bnxt.h"
    17	#include "bnxt_vfr.h"
    18	
    19	#define CFA_HANDLE_INVALID		0xffff
    20	
    21	static void __bnxt_vf_reps_destroy(struct bnxt *bp)
    22	{
    23		u16 num_vfs = pci_num_vf(bp->pdev);
    24		struct bnxt_vf_rep *vf_rep;
    25		int i;
    26	
    27		for (i = 0; i < num_vfs; i++) {
    28			vf_rep = bp->vf_reps[i];
    29			if (vf_rep) {
    30				if (vf_rep->dev) {
    31					/* if register_netdev failed, then netdev_ops
    32					 * would have been set to NULL
    33					 */
    34					if (vf_rep->dev->netdev_ops)
    35						unregister_netdev(vf_rep->dev);
    36					free_netdev(vf_rep->dev);
    37				}
    38			}
    39		}
    40	
    41		kfree(bp->vf_reps);
    42		bp->vf_reps = NULL;
    43	}
    44	
    45	void bnxt_vf_reps_destroy(struct bnxt *bp)
    46	{
    47		bool closed = false;
    48	
    49		if (bp->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV)
    50			return;
    51	
    52		if (!bp->vf_reps)
    53			return;
    54	
    55		/* Ensure that parent PF's and VF-reps' RX/TX has been quiesced
    56		 * before proceeding with VF-rep cleanup.
    57		 */
    58		rtnl_lock();
    59		if (netif_running(bp->dev)) {
    60			bnxt_close_nic(bp, false, false);
    61			closed = true;
    62		}
    63		bp->eswitch_mode = DEVLINK_ESWITCH_MODE_LEGACY;
    64	
    65		if (closed)
    66			bnxt_open_nic(bp, false, false);
    67		rtnl_unlock();
    68	
    69		/* Need to call vf_reps_destroy() outside of rntl_lock
    70		 * as unregister_netdev takes rtnl_lock
    71		 */
    72		__bnxt_vf_reps_destroy(bp);
    73	}
    74	
    75	/* Use the OUI of the PF's perm addr and report the same mac addr
    76	 * for the same VF-rep each time
    77	 */
    78	static void bnxt_vf_rep_eth_addr_gen(u8 *src_mac, u16 vf_idx, u8 *mac)
    79	{
    80		u32 addr;
    81	
    82		ether_addr_copy(mac, src_mac);
    83	
    84		addr = jhash(src_mac, ETH_ALEN, 0) + vf_idx;
    85		mac[3] = (u8)(addr & 0xFF);
    86		mac[4] = (u8)((addr >> 8) & 0xFF);
    87		mac[5] = (u8)((addr >> 16) & 0xFF);
    88	}
    89	
    90	static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep,
    91					    struct net_device *dev)
    92	{
    93		struct net_device *pf_dev = bp->dev;
    94	
    95		/* Just inherit all the featues of the parent PF as the VF-R
    96		 * uses the RX/TX rings of the parent PF
    97		 */
    98		dev->hw_features = pf_dev->hw_features;
    99		dev->gso_partial_features = pf_dev->gso_partial_features;
   100		dev->vlan_features = pf_dev->vlan_features;
   101		dev->hw_enc_features = pf_dev->hw_enc_features;
   102		dev->features |= pf_dev->features;
   103		bnxt_vf_rep_eth_addr_gen(bp->pf.mac_addr, vf_rep->vf_idx,
   104					 dev->perm_addr);
   105		ether_addr_copy(dev->dev_addr, dev->perm_addr);
   106	}
   107	
   108	static int bnxt_vf_reps_create(struct bnxt *bp)
   109	{
   110		u16 num_vfs = pci_num_vf(bp->pdev);
   111		struct bnxt_vf_rep *vf_rep;
   112		struct net_device *dev;
   113		int rc, i;
   114	
   115		bp->vf_reps = kcalloc(num_vfs, sizeof(vf_rep), GFP_KERNEL);
   116		if (!bp->vf_reps)
   117			return -ENOMEM;
   118	
   119		for (i = 0; i < num_vfs; i++) {
   120			dev = alloc_etherdev(sizeof(*vf_rep));
   121			if (!dev) {
   122				rc = -ENOMEM;
   123				goto err;
   124			}
   125	
   126			vf_rep = netdev_priv(dev);
   127			bp->vf_reps[i] = vf_rep;
   128			vf_rep->dev = dev;
   129			vf_rep->bp = bp;
   130			vf_rep->vf_idx = i;
   131			vf_rep->tx_cfa_action = CFA_HANDLE_INVALID;
   132	
   133			bnxt_vf_rep_netdev_init(bp, vf_rep, dev);
   134			rc = register_netdev(dev);
   135			if (rc) {
   136				/* no need for unregister_netdev in cleanup */
   137				dev->netdev_ops = NULL;
   138				goto err;
   139			}
   140		}
   141	
   142		bp->eswitch_mode = DEVLINK_ESWITCH_MODE_SWITCHDEV;
   143		return 0;
   144	
   145	err:
   146		netdev_info(bp->dev, "%s error=%d", __func__, rc);
   147		__bnxt_vf_reps_destroy(bp);
   148		return rc;
   149	}
   150	
   151	/* Devlink related routines */
   152	static int bnxt_dl_eswitch_mode_get(struct devlink *devlink, u16 *mode)
   153	{
   154		struct bnxt *bp = bnxt_get_bp_from_dl(devlink);
   155	
   156		*mode = bp->eswitch_mode;
   157		return 0;
   158	}
   159	
   160	static int bnxt_dl_eswitch_mode_set(struct devlink *devlink, u16 mode)
   161	{
   162		struct bnxt *bp = bnxt_get_bp_from_dl(devlink);
   163		int rc = 0;
   164	
 > 165		mutex_lock(&bp->sriov_lock);
   166		if (bp->eswitch_mode == mode) {
   167			netdev_info(bp->dev, "already in %s eswitch mode",
   168				    mode == DEVLINK_ESWITCH_MODE_LEGACY ?
   169				    "legacy" : "switchdev");
   170			rc = -EINVAL;
   171			goto done;
   172		}
   173	
   174		switch (mode) {
   175		case DEVLINK_ESWITCH_MODE_LEGACY:
   176			bnxt_vf_reps_destroy(bp);
   177			break;
   178	
   179		case DEVLINK_ESWITCH_MODE_SWITCHDEV:
   180			if (pci_num_vf(bp->pdev) == 0) {
   181				netdev_info(bp->dev,
   182					    "Enable VFs before setting swtichdev mode");
   183				rc = -EPERM;
   184				goto done;
   185			}
   186			rc = bnxt_vf_reps_create(bp);
   187			break;
   188	
   189		default:
   190			rc = -EINVAL;
   191			goto done;
   192		}
   193	done:
   194		mutex_unlock(&bp->sriov_lock);
   195		return rc;
   196	}
   197	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ