hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/scsi/fnic/fnic_main.c
....@@ -49,8 +49,8 @@
4949
5050 static struct kmem_cache *fnic_sgl_cache[FNIC_SGL_NUM_CACHES];
5151 static struct kmem_cache *fnic_io_req_cache;
52
-LIST_HEAD(fnic_list);
53
-DEFINE_SPINLOCK(fnic_list_lock);
52
+static LIST_HEAD(fnic_list);
53
+static DEFINE_SPINLOCK(fnic_list_lock);
5454
5555 /* Supported devices by fnic module */
5656 static struct pci_device_id fnic_id_table[] = {
....@@ -68,6 +68,11 @@
6868 unsigned int fnic_log_level;
6969 module_param(fnic_log_level, int, S_IRUGO|S_IWUSR);
7070 MODULE_PARM_DESC(fnic_log_level, "bit mask of fnic logging levels");
71
+
72
+
73
+unsigned int io_completions = FNIC_DFLT_IO_COMPLETIONS;
74
+module_param(io_completions, int, S_IRUGO|S_IWUSR);
75
+MODULE_PARM_DESC(io_completions, "Max CQ entries to process at a time");
7176
7277 unsigned int fnic_trace_max_pages = 16;
7378 module_param(fnic_trace_max_pages, uint, S_IRUGO|S_IWUSR);
....@@ -115,7 +120,6 @@
115120 .this_id = -1,
116121 .cmd_per_lun = 3,
117122 .can_queue = FNIC_DFLT_IO_REQ,
118
- .use_clustering = ENABLE_CLUSTERING,
119123 .sg_tablesize = FNIC_MAX_SG_DESC_CNT,
120124 .max_sectors = 0xffff,
121125 .shost_attrs = fnic_attrs,
....@@ -178,6 +182,9 @@
178182 switch (port_speed) {
179183 case DCEM_PORTSPEED_10G:
180184 fc_host_speed(shost) = FC_PORTSPEED_10GBIT;
185
+ break;
186
+ case DCEM_PORTSPEED_20G:
187
+ fc_host_speed(shost) = FC_PORTSPEED_20GBIT;
181188 break;
182189 case DCEM_PORTSPEED_25G:
183190 fc_host_speed(shost) = FC_PORTSPEED_25GBIT;
....@@ -436,7 +443,7 @@
436443 default:
437444 /* Using intr for notification for INTx/MSI-X */
438445 break;
439
- };
446
+ }
440447 }
441448
442449 static int fnic_dev_wait(struct vnic_dev *vdev,
....@@ -501,7 +508,7 @@
501508 }
502509
503510 /* Clean up completed IOs and FCS frames */
504
- fnic_wq_copy_cmpl_handler(fnic, -1);
511
+ fnic_wq_copy_cmpl_handler(fnic, io_completions);
505512 fnic_wq_cmpl_handler(fnic, -1);
506513 fnic_rq_cmpl_handler(fnic, -1);
507514
....@@ -545,8 +552,7 @@
545552
546553 static void fnic_set_vlan(struct fnic *fnic, u16 vlan_id)
547554 {
548
- u16 old_vlan;
549
- old_vlan = vnic_dev_set_default_vlan(fnic->vdev, vlan_id);
555
+ vnic_dev_set_default_vlan(fnic->vdev, vlan_id);
550556 }
551557
552558 static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
....@@ -579,12 +585,7 @@
579585
580586 host->transportt = fnic_fc_transport;
581587
582
- err = fnic_stats_debugfs_init(fnic);
583
- if (err) {
584
- shost_printk(KERN_ERR, fnic->lport->host,
585
- "Failed to initialize debugfs for stats\n");
586
- fnic_stats_debugfs_remove(fnic);
587
- }
588
+ fnic_stats_debugfs_init(fnic);
588589
589590 /* Setup PCI resources */
590591 pci_set_drvdata(pdev, fnic);
....@@ -611,28 +612,13 @@
611612 * limitation for the device. Try 64-bit first, and
612613 * fail to 32-bit.
613614 */
614
- err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
615
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
615616 if (err) {
616
- err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
617
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
617618 if (err) {
618619 shost_printk(KERN_ERR, fnic->lport->host,
619620 "No usable DMA configuration "
620621 "aborting\n");
621
- goto err_out_release_regions;
622
- }
623
- err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
624
- if (err) {
625
- shost_printk(KERN_ERR, fnic->lport->host,
626
- "Unable to obtain 32-bit DMA "
627
- "for consistent allocations, aborting.\n");
628
- goto err_out_release_regions;
629
- }
630
- } else {
631
- err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
632
- if (err) {
633
- shost_printk(KERN_ERR, fnic->lport->host,
634
- "Unable to obtain 64-bit DMA "
635
- "for consistent allocations, aborting.\n");
636622 goto err_out_release_regions;
637623 }
638624 }
....@@ -666,12 +652,20 @@
666652 goto err_out_iounmap;
667653 }
668654
655
+ err = vnic_dev_cmd_init(fnic->vdev);
656
+ if (err) {
657
+ shost_printk(KERN_ERR, fnic->lport->host,
658
+ "vnic_dev_cmd_init() returns %d, aborting\n",
659
+ err);
660
+ goto err_out_vnic_unregister;
661
+ }
662
+
669663 err = fnic_dev_wait(fnic->vdev, vnic_dev_open,
670
- vnic_dev_open_done, 0);
664
+ vnic_dev_open_done, CMD_OPENF_RQ_ENABLE_THEN_POST);
671665 if (err) {
672666 shost_printk(KERN_ERR, fnic->lport->host,
673667 "vNIC dev open failed, aborting.\n");
674
- goto err_out_vnic_unregister;
668
+ goto err_out_dev_cmd_deinit;
675669 }
676670
677671 err = vnic_dev_init(fnic->vdev, 0);
....@@ -813,6 +807,7 @@
813807
814808 /* allocate RQ buffers and post them to RQ*/
815809 for (i = 0; i < fnic->rq_count; i++) {
810
+ vnic_rq_enable(&fnic->rq[i]);
816811 err = vnic_rq_fill(&fnic->rq[i], fnic_alloc_rq_frame);
817812 if (err) {
818813 shost_printk(KERN_ERR, fnic->lport->host,
....@@ -887,14 +882,10 @@
887882 /* Enable all queues */
888883 for (i = 0; i < fnic->raw_wq_count; i++)
889884 vnic_wq_enable(&fnic->wq[i]);
890
- for (i = 0; i < fnic->rq_count; i++)
891
- vnic_rq_enable(&fnic->rq[i]);
892885 for (i = 0; i < fnic->wq_copy_count; i++)
893886 vnic_wq_copy_enable(&fnic->wq_copy[i]);
894887
895888 fc_fabric_login(lp);
896
-
897
- vnic_dev_enable(fnic->vdev);
898889
899890 err = fnic_request_intr(fnic);
900891 if (err) {
....@@ -902,6 +893,8 @@
902893 "Unable to request irq.\n");
903894 goto err_out_free_exch_mgr;
904895 }
896
+
897
+ vnic_dev_enable(fnic->vdev);
905898
906899 for (i = 0; i < fnic->intr_count; i++)
907900 vnic_intr_unmask(&fnic->intr[i]);
....@@ -931,6 +924,7 @@
931924 fnic_clear_intr_mode(fnic);
932925 err_out_dev_close:
933926 vnic_dev_close(fnic->vdev);
927
+err_out_dev_cmd_deinit:
934928 err_out_vnic_unregister:
935929 vnic_dev_unregister(fnic->vdev);
936930 err_out_iounmap: