aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/fnic/fnic_main.c
diff options
context:
space:
mode:
authorVasu Dev <vasu.dev@intel.com>2009-07-29 20:05:10 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-08-22 18:52:08 -0400
commit52ff878c912215210f53c0a080552dd6ba3055a2 (patch)
treeefaf0c6a6585aedc02af5faa3b47f4f4685fc783 /drivers/scsi/fnic/fnic_main.c
parentd459b7ea1b4c7aa3dacfeee174d02b2f7a95850d (diff)
[SCSI] fcoe, fnic, libfc: modifies current code paths to use EM anchor list
Modifies current code to use EM anchor list in EM allocation, EM free, EM reset, exch allocation and exch lookup code paths. 1. Modifies fc_exch_mgr_alloc to accept EM match function and then have allocated EM added to the lport using fc_exch_mgr_add API while also updating EM kref for newly added EM. 2. Updates fc_exch_mgr_free API to accept only lport pointer instead EM and then have this API free all EMs of the lport from EM anchor list. 3. Removes single lport pointer link from the EM, which was used in associating lport pointer in newly allocated exchange. Instead have lport pointer passed along new exchange allocation call path and then store passed lport pointer in newly allocated exchange, this will allow a single EM instance to be used across more than one lport and used in EM reset to reset only lport specific exchanges. 4. Modifies fc_exch_mgr_reset to reset all EMs from the EM anchor list of the lport, adds additional exch lport pointer (ep->lp) check for shared EM case to reset exchange specific to a lport requested reset. 5. Updates exch allocation API fc_exch_alloc to use EM anchor list and its anchor match func pointer. The fc_exch_alloc will walk the list of EMs until it finds a match, a match will be either null match func pointer or call to match function returning true value. 6. Updates fc_exch_recv to accept incoming frame on local port using only lport pointer and frame pointer without specifying EM instance of incoming frame. Instead modified fc_exch_recv to locate EM for the incoming frame by matching xid of incoming frame against a EM xid range. This change was required to use EM list in libfc Rx path and after this change the lport fc_exch_mgr pointer emp is not needed anymore, so removed emp pointer. 7. Updates fnic for removed lport emp pointer and above modified libfc APIs fc_exch_recv, fc_exch_mgr_alloc and fc_exch_mgr_free. 8. Removes exch_get and exch_put from libfc_function_template as these are no longer needed with EM anchor list and its match function use. Also removes its default function fc_exch_get. A defect this patch introduced regarding the libfc initialization order in the fnic driver was fixed by Joe Eykholt <jeykholt@cisco.com>. Signed-off-by: Vasu Dev <vasu.dev@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/fnic/fnic_main.c')
-rw-r--r--drivers/scsi/fnic/fnic_main.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 2c266c01dc5a..71c7bbe26d05 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -671,14 +671,6 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
671 lp->link_up = 0; 671 lp->link_up = 0;
672 lp->tt = fnic_transport_template; 672 lp->tt = fnic_transport_template;
673 673
674 lp->emp = fc_exch_mgr_alloc(lp, FC_CLASS_3,
675 FCPIO_HOST_EXCH_RANGE_START,
676 FCPIO_HOST_EXCH_RANGE_END);
677 if (!lp->emp) {
678 err = -ENOMEM;
679 goto err_out_remove_scsi_host;
680 }
681
682 lp->max_retry_count = fnic->config.flogi_retries; 674 lp->max_retry_count = fnic->config.flogi_retries;
683 lp->max_rport_retry_count = fnic->config.plogi_retries; 675 lp->max_rport_retry_count = fnic->config.plogi_retries;
684 lp->service_params = (FCP_SPPF_INIT_FCN | FCP_SPPF_RD_XRDY_DIS | 676 lp->service_params = (FCP_SPPF_INIT_FCN | FCP_SPPF_RD_XRDY_DIS |
@@ -693,12 +685,18 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
693 fc_set_wwnn(lp, fnic->config.node_wwn); 685 fc_set_wwnn(lp, fnic->config.node_wwn);
694 fc_set_wwpn(lp, fnic->config.port_wwn); 686 fc_set_wwpn(lp, fnic->config.port_wwn);
695 687
696 fc_exch_init(lp);
697 fc_lport_init(lp); 688 fc_lport_init(lp);
689 fc_exch_init(lp);
698 fc_elsct_init(lp); 690 fc_elsct_init(lp);
699 fc_rport_init(lp); 691 fc_rport_init(lp);
700 fc_disc_init(lp); 692 fc_disc_init(lp);
701 693
694 if (!fc_exch_mgr_alloc(lp, FC_CLASS_3, FCPIO_HOST_EXCH_RANGE_START,
695 FCPIO_HOST_EXCH_RANGE_END, NULL)) {
696 err = -ENOMEM;
697 goto err_out_remove_scsi_host;
698 }
699
702 fc_lport_config(lp); 700 fc_lport_config(lp);
703 701
704 if (fc_set_mfs(lp, fnic->config.maxdatafieldsize + 702 if (fc_set_mfs(lp, fnic->config.maxdatafieldsize +
@@ -738,7 +736,7 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
738 return 0; 736 return 0;
739 737
740err_out_free_exch_mgr: 738err_out_free_exch_mgr:
741 fc_exch_mgr_free(lp->emp); 739 fc_exch_mgr_free(lp);
742err_out_remove_scsi_host: 740err_out_remove_scsi_host:
743 fc_remove_host(fnic->lport->host); 741 fc_remove_host(fnic->lport->host);
744 scsi_remove_host(fnic->lport->host); 742 scsi_remove_host(fnic->lport->host);
@@ -827,7 +825,7 @@ static void __devexit fnic_remove(struct pci_dev *pdev)
827 825
828 fc_remove_host(fnic->lport->host); 826 fc_remove_host(fnic->lport->host);
829 scsi_remove_host(fnic->lport->host); 827 scsi_remove_host(fnic->lport->host);
830 fc_exch_mgr_free(fnic->lport->emp); 828 fc_exch_mgr_free(fnic->lport);
831 vnic_dev_notify_unset(fnic->vdev); 829 vnic_dev_notify_unset(fnic->vdev);
832 fnic_free_vnic_resources(fnic); 830 fnic_free_vnic_resources(fnic);
833 fnic_free_intr(fnic); 831 fnic_free_intr(fnic);