diff options
author | Ariel Elior <ariele@broadcom.com> | 2013-03-11 01:17:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-12 07:54:23 -0400 |
commit | 3c76feff68559bf9ec08d4d86abe57bc56a9847a (patch) | |
tree | af826ebde6b7f036fc916739cf87a47b5518446d /drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |
parent | 3ec9f9ca79757c54b12f87e51a6664ba1e597b17 (diff) |
bnx2x: Control number of vfs dynamically
1. Support sysfs interface for getting the maximal number of virtual functions
of a given physical function.
2. Support sysfs interface for getting and setting the current number of
virtual functions.
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 9be9b0373ca9..f685d2e77fcb 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -9546,8 +9546,10 @@ sp_rtnl_not_reset: | |||
9546 | 9546 | ||
9547 | /* enable SR-IOV if applicable */ | 9547 | /* enable SR-IOV if applicable */ |
9548 | if (IS_SRIOV(bp) && test_and_clear_bit(BNX2X_SP_RTNL_ENABLE_SRIOV, | 9548 | if (IS_SRIOV(bp) && test_and_clear_bit(BNX2X_SP_RTNL_ENABLE_SRIOV, |
9549 | &bp->sp_rtnl_state)) | 9549 | &bp->sp_rtnl_state)) { |
9550 | bnx2x_disable_sriov(bp); | ||
9550 | bnx2x_enable_sriov(bp); | 9551 | bnx2x_enable_sriov(bp); |
9552 | } | ||
9551 | } | 9553 | } |
9552 | 9554 | ||
9553 | static void bnx2x_period_task(struct work_struct *work) | 9555 | static void bnx2x_period_task(struct work_struct *work) |
@@ -11423,26 +11425,6 @@ static int bnx2x_init_bp(struct bnx2x *bp) | |||
11423 | * net_device service functions | 11425 | * net_device service functions |
11424 | */ | 11426 | */ |
11425 | 11427 | ||
11426 | static int bnx2x_open_epilog(struct bnx2x *bp) | ||
11427 | { | ||
11428 | /* Enable sriov via delayed work. This must be done via delayed work | ||
11429 | * because it causes the probe of the vf devices to be run, which invoke | ||
11430 | * register_netdevice which must have rtnl lock taken. As we are holding | ||
11431 | * the lock right now, that could only work if the probe would not take | ||
11432 | * the lock. However, as the probe of the vf may be called from other | ||
11433 | * contexts as well (such as passthrough to vm failes) it can't assume | ||
11434 | * the lock is being held for it. Using delayed work here allows the | ||
11435 | * probe code to simply take the lock (i.e. wait for it to be released | ||
11436 | * if it is being held). | ||
11437 | */ | ||
11438 | smp_mb__before_clear_bit(); | ||
11439 | set_bit(BNX2X_SP_RTNL_ENABLE_SRIOV, &bp->sp_rtnl_state); | ||
11440 | smp_mb__after_clear_bit(); | ||
11441 | schedule_delayed_work(&bp->sp_rtnl_task, 0); | ||
11442 | |||
11443 | return 0; | ||
11444 | } | ||
11445 | |||
11446 | /* called with rtnl_lock */ | 11428 | /* called with rtnl_lock */ |
11447 | static int bnx2x_open(struct net_device *dev) | 11429 | static int bnx2x_open(struct net_device *dev) |
11448 | { | 11430 | { |
@@ -12498,13 +12480,8 @@ static int bnx2x_init_one(struct pci_dev *pdev, | |||
12498 | goto init_one_exit; | 12480 | goto init_one_exit; |
12499 | } | 12481 | } |
12500 | 12482 | ||
12501 | /* Enable SRIOV if capability found in configuration space. | 12483 | /* Enable SRIOV if capability found in configuration space */ |
12502 | * Once the generic SR-IOV framework makes it in from the | 12484 | rc = bnx2x_iov_init_one(bp, int_mode, BNX2X_MAX_NUM_OF_VFS); |
12503 | * pci tree this will be revised, to allow dynamic control | ||
12504 | * over the number of VFs. Right now, change the num of vfs | ||
12505 | * param below to enable SR-IOV. | ||
12506 | */ | ||
12507 | rc = bnx2x_iov_init_one(bp, int_mode, 0/*num vfs*/); | ||
12508 | if (rc) | 12485 | if (rc) |
12509 | goto init_one_exit; | 12486 | goto init_one_exit; |
12510 | 12487 | ||
@@ -12820,6 +12797,9 @@ static struct pci_driver bnx2x_pci_driver = { | |||
12820 | .suspend = bnx2x_suspend, | 12797 | .suspend = bnx2x_suspend, |
12821 | .resume = bnx2x_resume, | 12798 | .resume = bnx2x_resume, |
12822 | .err_handler = &bnx2x_err_handler, | 12799 | .err_handler = &bnx2x_err_handler, |
12800 | #ifdef CONFIG_BNX2X_SRIOV | ||
12801 | .sriov_configure = bnx2x_sriov_configure, | ||
12802 | #endif | ||
12823 | }; | 12803 | }; |
12824 | 12804 | ||
12825 | static int __init bnx2x_init(void) | 12805 | static int __init bnx2x_init(void) |