hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/scsi/be2iscsi/be_main.c
....@@ -214,12 +214,6 @@
214214 "CXN_KILLED_IMM_DATA_RCVD"
215215 };
216216
217
-static int beiscsi_slave_configure(struct scsi_device *sdev)
218
-{
219
- blk_queue_max_segment_size(sdev->request_queue, 65536);
220
- return 0;
221
-}
222
-
223217 static int beiscsi_eh_abort(struct scsi_cmnd *sc)
224218 {
225219 struct iscsi_task *abrt_task = (struct iscsi_task *)sc->SCp.ptr;
....@@ -393,7 +387,6 @@
393387 .proc_name = DRV_NAME,
394388 .queuecommand = iscsi_queuecommand,
395389 .change_queue_depth = scsi_change_queue_depth,
396
- .slave_configure = beiscsi_slave_configure,
397390 .target_alloc = iscsi_target_alloc,
398391 .eh_timed_out = iscsi_eh_cmd_timed_out,
399392 .eh_abort_handler = beiscsi_eh_abort,
....@@ -404,8 +397,8 @@
404397 .can_queue = BE2_IO_DEPTH,
405398 .this_id = -1,
406399 .max_sectors = BEISCSI_MAX_SECTORS,
400
+ .max_segment_size = 65536,
407401 .cmd_per_lun = BEISCSI_CMD_PER_LUN,
408
- .use_clustering = ENABLE_CLUSTERING,
409402 .vendor_id = SCSI_NL_VID_TYPE_PCI | BE_VENDOR_ID,
410403 .track_queue_depth = 1,
411404 };
....@@ -460,14 +453,14 @@
460453 u8 __iomem *addr;
461454 int pcicfg_reg;
462455
463
- addr = ioremap_nocache(pci_resource_start(pcidev, 2),
456
+ addr = ioremap(pci_resource_start(pcidev, 2),
464457 pci_resource_len(pcidev, 2));
465458 if (addr == NULL)
466459 return -ENOMEM;
467460 phba->ctrl.csr = addr;
468461 phba->csr_va = addr;
469462
470
- addr = ioremap_nocache(pci_resource_start(pcidev, 4), 128 * 1024);
463
+ addr = ioremap(pci_resource_start(pcidev, 4), 128 * 1024);
471464 if (addr == NULL)
472465 goto pci_map_err;
473466 phba->ctrl.db = addr;
....@@ -478,7 +471,7 @@
478471 else
479472 pcicfg_reg = 0;
480473
481
- addr = ioremap_nocache(pci_resource_start(pcidev, pcicfg_reg),
474
+ addr = ioremap(pci_resource_start(pcidev, pcicfg_reg),
482475 pci_resource_len(pcidev, pcicfg_reg));
483476
484477 if (addr == NULL)
....@@ -511,18 +504,9 @@
511504 }
512505
513506 pci_set_master(pcidev);
514
- ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(64));
507
+ ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(64));
515508 if (ret) {
516
- ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(32));
517
- if (ret) {
518
- dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n");
519
- goto pci_region_release;
520
- } else {
521
- ret = pci_set_consistent_dma_mask(pcidev,
522
- DMA_BIT_MASK(32));
523
- }
524
- } else {
525
- ret = pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(64));
509
+ ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
526510 if (ret) {
527511 dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n");
528512 goto pci_region_release;
....@@ -550,9 +534,8 @@
550534 if (status)
551535 return status;
552536 mbox_mem_alloc->size = sizeof(struct be_mcc_mailbox) + 16;
553
- mbox_mem_alloc->va = pci_alloc_consistent(pdev,
554
- mbox_mem_alloc->size,
555
- &mbox_mem_alloc->dma);
537
+ mbox_mem_alloc->va = dma_alloc_coherent(&pdev->dev,
538
+ mbox_mem_alloc->size, &mbox_mem_alloc->dma, GFP_KERNEL);
556539 if (!mbox_mem_alloc->va) {
557540 beiscsi_unmap_pci_function(phba);
558541 return -ENOMEM;
....@@ -994,7 +977,7 @@
994977 * alloc_wrb_handle - To allocate a wrb handle
995978 * @phba: The hba pointer
996979 * @cid: The cid to use for allocation
997
- * @pwrb_context: ptr to ptr to wrb context
980
+ * @pcontext: ptr to ptr to wrb context
998981 *
999982 * This happens under session_lock until submission to chip
1000983 */
....@@ -1411,7 +1394,7 @@
14111394 spin_unlock_bh(&session->back_lock);
14121395 }
14131396
1414
-/**
1397
+/*
14151398 * ASYNC PDUs include
14161399 * a. Unsolicited NOP-In (target initiated NOP-In)
14171400 * b. ASYNC Messages
....@@ -1549,6 +1532,7 @@
15491532 break;
15501533 case UNSOL_DATA_DIGEST_ERROR_NOTIFY:
15511534 error = 1;
1535
+ fallthrough;
15521536 case UNSOL_DATA_NOTIFY:
15531537 pasync_handle = pasync_ctx->async_entry[ci].data;
15541538 break;
....@@ -1866,7 +1850,6 @@
18661850 {
18671851 struct be_queue_info *cq;
18681852 struct sol_cqe *sol;
1869
- struct dmsg_cqe *dmsg;
18701853 unsigned int total = 0;
18711854 unsigned int num_processed = 0;
18721855 unsigned short code = 0, cid = 0;
....@@ -1939,7 +1922,6 @@
19391922 "BM_%d : Received %s[%d] on CID : %d\n",
19401923 cqe_desc[code], code, cid);
19411924
1942
- dmsg = (struct dmsg_cqe *)sol;
19431925 hwi_complete_drvr_msgs(beiscsi_conn, phba, sol);
19441926 break;
19451927 case UNSOL_HDR_NOTIFY:
....@@ -2304,11 +2286,11 @@
23042286
23052287 /* Map addr only if there is data_count */
23062288 if (dsp_value) {
2307
- io_task->mtask_addr = pci_map_single(phba->pcidev,
2289
+ io_task->mtask_addr = dma_map_single(&phba->pcidev->dev,
23082290 task->data,
23092291 task->data_count,
2310
- PCI_DMA_TODEVICE);
2311
- if (pci_dma_mapping_error(phba->pcidev,
2292
+ DMA_TO_DEVICE);
2293
+ if (dma_mapping_error(&phba->pcidev->dev,
23122294 io_task->mtask_addr))
23132295 return -ENOMEM;
23142296 io_task->mtask_data_count = task->data_count;
....@@ -2519,10 +2501,9 @@
25192501 BEISCSI_MAX_FRAGS_INIT);
25202502 curr_alloc_size = min(be_max_phys_size * 1024, alloc_size);
25212503 do {
2522
- mem_arr->virtual_address = pci_alloc_consistent(
2523
- phba->pcidev,
2524
- curr_alloc_size,
2525
- &bus_add);
2504
+ mem_arr->virtual_address =
2505
+ dma_alloc_coherent(&phba->pcidev->dev,
2506
+ curr_alloc_size, &bus_add, GFP_KERNEL);
25262507 if (!mem_arr->virtual_address) {
25272508 if (curr_alloc_size <= BE_MIN_MEM_SIZE)
25282509 goto free_mem;
....@@ -2560,7 +2541,7 @@
25602541 mem_descr->num_elements = j;
25612542 while ((i) || (j)) {
25622543 for (j = mem_descr->num_elements; j > 0; j--) {
2563
- pci_free_consistent(phba->pcidev,
2544
+ dma_free_coherent(&phba->pcidev->dev,
25642545 mem_descr->mem_array[j - 1].size,
25652546 mem_descr->mem_array[j - 1].
25662547 virtual_address,
....@@ -3031,9 +3012,9 @@
30313012 eq = &phwi_context->be_eq[i].q;
30323013 mem = &eq->dma_mem;
30333014 phwi_context->be_eq[i].phba = phba;
3034
- eq_vaddress = pci_alloc_consistent(phba->pcidev,
3015
+ eq_vaddress = dma_alloc_coherent(&phba->pcidev->dev,
30353016 num_eq_pages * PAGE_SIZE,
3036
- &paddr);
3017
+ &paddr, GFP_KERNEL);
30373018 if (!eq_vaddress) {
30383019 ret = -ENOMEM;
30393020 goto create_eq_error;
....@@ -3069,7 +3050,7 @@
30693050 eq = &phwi_context->be_eq[i].q;
30703051 mem = &eq->dma_mem;
30713052 if (mem->va)
3072
- pci_free_consistent(phba->pcidev, num_eq_pages
3053
+ dma_free_coherent(&phba->pcidev->dev, num_eq_pages
30733054 * PAGE_SIZE,
30743055 mem->va, mem->dma);
30753056 }
....@@ -3097,9 +3078,9 @@
30973078 pbe_eq->cq = cq;
30983079 pbe_eq->phba = phba;
30993080 mem = &cq->dma_mem;
3100
- cq_vaddress = pci_alloc_consistent(phba->pcidev,
3081
+ cq_vaddress = dma_alloc_coherent(&phba->pcidev->dev,
31013082 num_cq_pages * PAGE_SIZE,
3102
- &paddr);
3083
+ &paddr, GFP_KERNEL);
31033084 if (!cq_vaddress) {
31043085 ret = -ENOMEM;
31053086 goto create_cq_error;
....@@ -3134,7 +3115,7 @@
31343115 cq = &phwi_context->be_cq[i];
31353116 mem = &cq->dma_mem;
31363117 if (mem->va)
3137
- pci_free_consistent(phba->pcidev, num_cq_pages
3118
+ dma_free_coherent(&phba->pcidev->dev, num_cq_pages
31383119 * PAGE_SIZE,
31393120 mem->va, mem->dma);
31403121 }
....@@ -3326,7 +3307,7 @@
33263307 {
33273308 struct be_dma_mem *mem = &q->dma_mem;
33283309 if (mem->va) {
3329
- pci_free_consistent(phba->pcidev, mem->size,
3310
+ dma_free_coherent(&phba->pcidev->dev, mem->size,
33303311 mem->va, mem->dma);
33313312 mem->va = NULL;
33323313 }
....@@ -3341,7 +3322,8 @@
33413322 q->len = len;
33423323 q->entry_size = entry_size;
33433324 mem->size = len * entry_size;
3344
- mem->va = pci_zalloc_consistent(phba->pcidev, mem->size, &mem->dma);
3325
+ mem->va = dma_alloc_coherent(&phba->pcidev->dev, mem->size, &mem->dma,
3326
+ GFP_KERNEL);
33453327 if (!mem->va)
33463328 return -ENOMEM;
33473329 return 0;
....@@ -3479,7 +3461,7 @@
34793461 &ctrl->ptag_state[tag].tag_state)) {
34803462 ptag_mem = &ctrl->ptag_state[tag].tag_mem_state;
34813463 if (ptag_mem->size) {
3482
- pci_free_consistent(ctrl->pdev,
3464
+ dma_free_coherent(&ctrl->pdev->dev,
34833465 ptag_mem->size,
34843466 ptag_mem->va,
34853467 ptag_mem->dma);
....@@ -3585,7 +3567,7 @@
35853567
35863568 /* if eqid_count == 1 fall back to INTX */
35873569 if (enable_msix && nvec > 1) {
3588
- const struct irq_affinity desc = { .post_vectors = 1 };
3570
+ struct irq_affinity desc = { .post_vectors = 1 };
35893571
35903572 if (pci_alloc_irq_vectors_affinity(phba->pcidev, 2, nvec,
35913573 PCI_IRQ_MSIX | PCI_IRQ_AFFINITY, &desc) < 0) {
....@@ -3880,7 +3862,7 @@
38803862 j = 0;
38813863 for (i = 0; i < SE_MEM_MAX; i++) {
38823864 for (j = mem_descr->num_elements; j > 0; j--) {
3883
- pci_free_consistent(phba->pcidev,
3865
+ dma_free_coherent(&phba->pcidev->dev,
38843866 mem_descr->mem_array[j - 1].size,
38853867 mem_descr->mem_array[j - 1].virtual_address,
38863868 (unsigned long)mem_descr->mem_array[j - 1].
....@@ -4255,10 +4237,10 @@
42554237 }
42564238
42574239 if (io_task->mtask_addr) {
4258
- pci_unmap_single(phba->pcidev,
4240
+ dma_unmap_single(&phba->pcidev->dev,
42594241 io_task->mtask_addr,
42604242 io_task->mtask_data_count,
4261
- PCI_DMA_TODEVICE);
4243
+ DMA_TO_DEVICE);
42624244 io_task->mtask_addr = 0;
42634245 }
42644246 }
....@@ -4852,9 +4834,9 @@
48524834
48534835 switch (bsg_req->msgcode) {
48544836 case ISCSI_BSG_HST_VENDOR:
4855
- nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev,
4837
+ nonemb_cmd.va = dma_alloc_coherent(&phba->ctrl.pdev->dev,
48564838 job->request_payload.payload_len,
4857
- &nonemb_cmd.dma);
4839
+ &nonemb_cmd.dma, GFP_KERNEL);
48584840 if (nonemb_cmd.va == NULL) {
48594841 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
48604842 "BM_%d : Failed to allocate memory for "
....@@ -4867,7 +4849,7 @@
48674849 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
48684850 "BM_%d : MBX Tag Allocation Failed\n");
48694851
4870
- pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
4852
+ dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
48714853 nonemb_cmd.va, nonemb_cmd.dma);
48724854 return -EAGAIN;
48734855 }
....@@ -4881,7 +4863,7 @@
48814863 if (!test_bit(BEISCSI_HBA_ONLINE, &phba->state)) {
48824864 clear_bit(MCC_TAG_STATE_RUNNING,
48834865 &phba->ctrl.ptag_state[tag].tag_state);
4884
- pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
4866
+ dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
48854867 nonemb_cmd.va, nonemb_cmd.dma);
48864868 return -EIO;
48874869 }
....@@ -4898,7 +4880,7 @@
48984880 bsg_reply->result = status;
48994881 bsg_job_done(job, bsg_reply->result,
49004882 bsg_reply->reply_payload_rcv_len);
4901
- pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
4883
+ dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
49024884 nonemb_cmd.va, nonemb_cmd.dma);
49034885 if (status || extd_status) {
49044886 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
....@@ -5529,7 +5511,6 @@
55295511 return PCI_ERS_RESULT_DISCONNECT;
55305512 }
55315513
5532
- pci_cleanup_aer_uncorrect_error_status(pdev);
55335514 return PCI_ERS_RESULT_RECOVERED;
55345515 }
55355516
....@@ -5755,7 +5736,7 @@
57555736 beiscsi_cleanup_port(phba);
57565737 beiscsi_free_mem(phba);
57575738 free_port:
5758
- pci_free_consistent(phba->pcidev,
5739
+ dma_free_coherent(&phba->pcidev->dev,
57595740 phba->ctrl.mbox_mem_alloced.size,
57605741 phba->ctrl.mbox_mem_alloced.va,
57615742 phba->ctrl.mbox_mem_alloced.dma);
....@@ -5800,7 +5781,7 @@
58005781
58015782 /* ctrl uninit */
58025783 beiscsi_unmap_pci_function(phba);
5803
- pci_free_consistent(phba->pcidev,
5784
+ dma_free_coherent(&phba->pcidev->dev,
58045785 phba->ctrl.mbox_mem_alloced.size,
58055786 phba->ctrl.mbox_mem_alloced.va,
58065787 phba->ctrl.mbox_mem_alloced.dma);
....@@ -5829,6 +5810,7 @@
58295810 .destroy_session = beiscsi_session_destroy,
58305811 .create_conn = beiscsi_conn_create,
58315812 .bind_conn = beiscsi_conn_bind,
5813
+ .unbind_conn = iscsi_conn_unbind,
58325814 .destroy_conn = iscsi_conn_teardown,
58335815 .attr_is_visible = beiscsi_attr_is_visible,
58345816 .set_iface_param = beiscsi_iface_set_param,