aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
diff options
context:
space:
mode:
authorAriel Elior <ariele@broadcom.com>2013-01-01 00:22:31 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-02 04:45:06 -0500
commit290ca2bb456d4214f00ba0b83fcb9793963fe007 (patch)
treefe4412f38b50e1a5db4749fe6cf1f34c5431889d /drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
parentdc1ba591463ca0f7ba2ac9af6ee4a5305f27ca1f (diff)
bnx2x: Allocate VF database in PF when VFs are present
When A PF determines that it may have to manage SRIOV VFs it allocates a database for this purpose. The database is intended to keep track of the VF state, the resources allocated for each VF (queues, interrupt vectors, etc), the state of the VF's queues. When the VF loads the database is updated accordingly. When A VF closes the database is consulted to determine which resources need to be released (close queues against device, reclaim interrupt vectors, etc). Signed-off-by: Ariel Elior <ariele@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.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index aafcaf610c15..6188ec68b45d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -7270,12 +7270,21 @@ static int bnx2x_init_hw_func(struct bnx2x *bp)
7270 ilt = BP_ILT(bp); 7270 ilt = BP_ILT(bp);
7271 cdu_ilt_start = ilt->clients[ILT_CLIENT_CDU].start; 7271 cdu_ilt_start = ilt->clients[ILT_CLIENT_CDU].start;
7272 7272
7273 if (IS_SRIOV(bp))
7274 cdu_ilt_start += BNX2X_FIRST_VF_CID/ILT_PAGE_CIDS;
7275 cdu_ilt_start = bnx2x_iov_init_ilt(bp, cdu_ilt_start);
7276
7277 /* since BNX2X_FIRST_VF_CID > 0 the PF L2 cids precedes
7278 * those of the VFs, so start line should be reset
7279 */
7280 cdu_ilt_start = ilt->clients[ILT_CLIENT_CDU].start;
7273 for (i = 0; i < L2_ILT_LINES(bp); i++) { 7281 for (i = 0; i < L2_ILT_LINES(bp); i++) {
7274 ilt->lines[cdu_ilt_start + i].page = bp->context[i].vcxt; 7282 ilt->lines[cdu_ilt_start + i].page = bp->context[i].vcxt;
7275 ilt->lines[cdu_ilt_start + i].page_mapping = 7283 ilt->lines[cdu_ilt_start + i].page_mapping =
7276 bp->context[i].cxt_mapping; 7284 bp->context[i].cxt_mapping;
7277 ilt->lines[cdu_ilt_start + i].size = bp->context[i].size; 7285 ilt->lines[cdu_ilt_start + i].size = bp->context[i].size;
7278 } 7286 }
7287
7279 bnx2x_ilt_init_op(bp, INITOP_SET); 7288 bnx2x_ilt_init_op(bp, INITOP_SET);
7280 7289
7281 if (!CONFIGURE_NIC_MODE(bp)) { 7290 if (!CONFIGURE_NIC_MODE(bp)) {
@@ -7881,6 +7890,8 @@ int bnx2x_set_int_mode(struct bnx2x *bp)
7881/* must be called prior to any HW initializations */ 7890/* must be called prior to any HW initializations */
7882static inline u16 bnx2x_cid_ilt_lines(struct bnx2x *bp) 7891static inline u16 bnx2x_cid_ilt_lines(struct bnx2x *bp)
7883{ 7892{
7893 if (IS_SRIOV(bp))
7894 return (BNX2X_FIRST_VF_CID + BNX2X_VF_CIDS)/ILT_PAGE_CIDS;
7884 return L2_ILT_LINES(bp); 7895 return L2_ILT_LINES(bp);
7885} 7896}
7886 7897
@@ -12106,8 +12117,12 @@ static int bnx2x_set_qm_cid_count(struct bnx2x *bp)
12106{ 12117{
12107 int cid_count = BNX2X_L2_MAX_CID(bp); 12118 int cid_count = BNX2X_L2_MAX_CID(bp);
12108 12119
12120 if (IS_SRIOV(bp))
12121 cid_count += BNX2X_VF_CIDS;
12122
12109 if (CNIC_SUPPORT(bp)) 12123 if (CNIC_SUPPORT(bp))
12110 cid_count += CNIC_CID_MAX; 12124 cid_count += CNIC_CID_MAX;
12125
12111 return roundup(cid_count, QM_CID_ROUND); 12126 return roundup(cid_count, QM_CID_ROUND);
12112} 12127}
12113 12128
@@ -12312,6 +12327,16 @@ static int bnx2x_init_one(struct pci_dev *pdev,
12312 goto init_one_exit; 12327 goto init_one_exit;
12313 } 12328 }
12314 12329
12330 /* Enable SRIOV if capability found in configuration space.
12331 * Once the generic SR-IOV framework makes it in from the
12332 * pci tree this will be revised, to allow dynamic control
12333 * over the number of VFs. Right now, change the num of vfs
12334 * param below to enable SR-IOV.
12335 */
12336 rc = bnx2x_iov_init_one(bp, int_mode, 0/*num vfs*/);
12337 if (rc)
12338 goto init_one_exit;
12339
12315 /* calc qm_cid_count */ 12340 /* calc qm_cid_count */
12316 bp->qm_cid_count = bnx2x_set_qm_cid_count(bp); 12341 bp->qm_cid_count = bnx2x_set_qm_cid_count(bp);
12317 BNX2X_DEV_INFO("qm_cid_count %d\n", bp->qm_cid_count); 12342 BNX2X_DEV_INFO("qm_cid_count %d\n", bp->qm_cid_count);
@@ -12435,6 +12460,9 @@ static void bnx2x_remove_one(struct pci_dev *pdev)
12435 12460
12436 /* Make sure RESET task is not scheduled before continuing */ 12461 /* Make sure RESET task is not scheduled before continuing */
12437 cancel_delayed_work_sync(&bp->sp_rtnl_task); 12462 cancel_delayed_work_sync(&bp->sp_rtnl_task);
12463
12464 bnx2x_iov_remove_one(bp);
12465
12438 /* send message via vfpf channel to release the resources of this vf */ 12466 /* send message via vfpf channel to release the resources of this vf */
12439 if (IS_VF(bp)) 12467 if (IS_VF(bp))
12440 bnx2x_vfpf_release(bp); 12468 bnx2x_vfpf_release(bp);