aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2010-12-23 02:43:03 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-23 14:44:33 -0500
commite21ba414eed8a233eadb79bb6b158ac7ceb35025 (patch)
treefedf2c866d5a396081b4d01daae800ea914d3a75 /drivers/net/cnic.c
parent42ecbb8426aa229167d7f9d4b4e20f24bf42cb24 (diff)
cnic: Add kcq2 support on 57712
The kcq2 (2nd kernel work queue) is used by FCoE on 57712 devices. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r--drivers/net/cnic.c76
1 files changed, 55 insertions, 21 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 36c1578a1b1e..6ce739859ac3 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -843,6 +843,7 @@ static void cnic_free_resc(struct cnic_dev *dev)
843 cnic_free_dma(dev, &cp->conn_buf_info); 843 cnic_free_dma(dev, &cp->conn_buf_info);
844 cnic_free_dma(dev, &cp->kwq_info); 844 cnic_free_dma(dev, &cp->kwq_info);
845 cnic_free_dma(dev, &cp->kwq_16_data_info); 845 cnic_free_dma(dev, &cp->kwq_16_data_info);
846 cnic_free_dma(dev, &cp->kcq2.dma);
846 cnic_free_dma(dev, &cp->kcq1.dma); 847 cnic_free_dma(dev, &cp->kcq1.dma);
847 kfree(cp->iscsi_tbl); 848 kfree(cp->iscsi_tbl);
848 cp->iscsi_tbl = NULL; 849 cp->iscsi_tbl = NULL;
@@ -1183,6 +1184,12 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev)
1183 if (ret) 1184 if (ret)
1184 goto error; 1185 goto error;
1185 1186
1187 if (BNX2X_CHIP_IS_E2(cp->chip_id)) {
1188 ret = cnic_alloc_kcq(dev, &cp->kcq2);
1189 if (ret)
1190 goto error;
1191 }
1192
1186 pages = PAGE_ALIGN(BNX2X_ISCSI_NUM_CONNECTIONS * 1193 pages = PAGE_ALIGN(BNX2X_ISCSI_NUM_CONNECTIONS *
1187 BNX2X_ISCSI_CONN_BUF_SIZE) / PAGE_SIZE; 1194 BNX2X_ISCSI_CONN_BUF_SIZE) / PAGE_SIZE;
1188 ret = cnic_alloc_dma(dev, &cp->conn_buf_info, pages, 1); 1195 ret = cnic_alloc_dma(dev, &cp->conn_buf_info, pages, 1);
@@ -2493,12 +2500,19 @@ static void cnic_service_bnx2x_bh(unsigned long data)
2493 status_idx = cnic_service_bnx2x_kcq(dev, &cp->kcq1); 2500 status_idx = cnic_service_bnx2x_kcq(dev, &cp->kcq1);
2494 2501
2495 CNIC_WR16(dev, cp->kcq1.io_addr, cp->kcq1.sw_prod_idx + MAX_KCQ_IDX); 2502 CNIC_WR16(dev, cp->kcq1.io_addr, cp->kcq1.sw_prod_idx + MAX_KCQ_IDX);
2496 if (BNX2X_CHIP_IS_E2(cp->chip_id)) 2503
2504 if (BNX2X_CHIP_IS_E2(cp->chip_id)) {
2505 status_idx = cnic_service_bnx2x_kcq(dev, &cp->kcq2);
2506
2507 CNIC_WR16(dev, cp->kcq2.io_addr, cp->kcq2.sw_prod_idx +
2508 MAX_KCQ_IDX);
2509
2497 cnic_ack_igu_sb(dev, cp->bnx2x_igu_sb_id, IGU_SEG_ACCESS_DEF, 2510 cnic_ack_igu_sb(dev, cp->bnx2x_igu_sb_id, IGU_SEG_ACCESS_DEF,
2498 status_idx, IGU_INT_ENABLE, 1); 2511 status_idx, IGU_INT_ENABLE, 1);
2499 else 2512 } else {
2500 cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, USTORM_ID, 2513 cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, USTORM_ID,
2501 status_idx, IGU_INT_ENABLE, 1); 2514 status_idx, IGU_INT_ENABLE, 1);
2515 }
2502} 2516}
2503 2517
2504static int cnic_service_bnx2x(void *data, void *status_blk) 2518static int cnic_service_bnx2x(void *data, void *status_blk)
@@ -4381,6 +4395,44 @@ static void cnic_get_bnx2x_iscsi_info(struct cnic_dev *dev)
4381 dev->max_iscsi_conn = 0; 4395 dev->max_iscsi_conn = 0;
4382} 4396}
4383 4397
4398static void cnic_init_bnx2x_kcq(struct cnic_dev *dev)
4399{
4400 struct cnic_local *cp = dev->cnic_priv;
4401 u32 pfid = cp->pfid;
4402
4403 cp->kcq1.io_addr = BAR_CSTRORM_INTMEM +
4404 CSTORM_ISCSI_EQ_PROD_OFFSET(pfid, 0);
4405 cp->kcq1.sw_prod_idx = 0;
4406
4407 if (BNX2X_CHIP_IS_E2(cp->chip_id)) {
4408 struct host_hc_status_block_e2 *sb = cp->status_blk.gen;
4409
4410 cp->kcq1.hw_prod_idx_ptr =
4411 &sb->sb.index_values[HC_INDEX_ISCSI_EQ_CONS];
4412 cp->kcq1.status_idx_ptr =
4413 &sb->sb.running_index[SM_RX_ID];
4414 } else {
4415 struct host_hc_status_block_e1x *sb = cp->status_blk.gen;
4416
4417 cp->kcq1.hw_prod_idx_ptr =
4418 &sb->sb.index_values[HC_INDEX_ISCSI_EQ_CONS];
4419 cp->kcq1.status_idx_ptr =
4420 &sb->sb.running_index[SM_RX_ID];
4421 }
4422
4423 if (BNX2X_CHIP_IS_E2(cp->chip_id)) {
4424 struct host_hc_status_block_e2 *sb = cp->status_blk.gen;
4425
4426 cp->kcq2.io_addr = BAR_USTRORM_INTMEM +
4427 USTORM_FCOE_EQ_PROD_OFFSET(pfid);
4428 cp->kcq2.sw_prod_idx = 0;
4429 cp->kcq2.hw_prod_idx_ptr =
4430 &sb->sb.index_values[HC_INDEX_FCOE_EQ_CONS];
4431 cp->kcq2.status_idx_ptr =
4432 &sb->sb.running_index[SM_RX_ID];
4433 }
4434}
4435
4384static int cnic_start_bnx2x_hw(struct cnic_dev *dev) 4436static int cnic_start_bnx2x_hw(struct cnic_dev *dev)
4385{ 4437{
4386 struct cnic_local *cp = dev->cnic_priv; 4438 struct cnic_local *cp = dev->cnic_priv;
@@ -4413,25 +4465,7 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev)
4413 4465
4414 cp->bnx2x_igu_sb_id = ethdev->irq_arr[0].status_blk_num2; 4466 cp->bnx2x_igu_sb_id = ethdev->irq_arr[0].status_blk_num2;
4415 4467
4416 cp->kcq1.io_addr = BAR_CSTRORM_INTMEM + 4468 cnic_init_bnx2x_kcq(dev);
4417 CSTORM_ISCSI_EQ_PROD_OFFSET(pfid, 0);
4418 cp->kcq1.sw_prod_idx = 0;
4419
4420 if (BNX2X_CHIP_IS_E2(cp->chip_id)) {
4421 struct host_hc_status_block_e2 *sb = cp->status_blk.gen;
4422
4423 cp->kcq1.hw_prod_idx_ptr =
4424 &sb->sb.index_values[HC_INDEX_ISCSI_EQ_CONS];
4425 cp->kcq1.status_idx_ptr =
4426 &sb->sb.running_index[SM_RX_ID];
4427 } else {
4428 struct host_hc_status_block_e1x *sb = cp->status_blk.gen;
4429
4430 cp->kcq1.hw_prod_idx_ptr =
4431 &sb->sb.index_values[HC_INDEX_ISCSI_EQ_CONS];
4432 cp->kcq1.status_idx_ptr =
4433 &sb->sb.running_index[SM_RX_ID];
4434 }
4435 4469
4436 cnic_get_bnx2x_iscsi_info(dev); 4470 cnic_get_bnx2x_iscsi_info(dev);
4437 4471