aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2010-07-20 18:20:03 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-28 10:05:53 -0400
commit3726f3584e113697b68d3d4ff1ecf1042a06f800 (patch)
tree2e452d689739c4c2516f50d018f8587bf7d58e41 /drivers/scsi/libfc
parent3d902ac09a2812b359edf633425d1327a18399e9 (diff)
[SCSI] libfc: Add local port point-to-multipoint flag
For VN_port to VN_port mode, the transport sets the port_id and there's no lport FLOGI. This is similar to FC loop mode. Add a point_to_multipoint flag that indicates the local port is in point-to-multipoint mode. This skips FLOGI and discovery. It also skips resetting the port_id on resets other than link down. Add function fc_lport_set_local_id() that sets the local port_id. This is called by libfcoe on behalf of the low-level driver to set the port_id when the link comes up. Signed-off-by: Joe Eykholt <jeykholt@cisco.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/libfc')
-rw-r--r--drivers/scsi/libfc/fc_lport.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 79c9e3ccd341..f7bff2cad4ee 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -755,6 +755,34 @@ static void fc_lport_set_port_id(struct fc_lport *lport, u32 port_id,
755} 755}
756 756
757/** 757/**
758 * fc_lport_set_port_id() - set the local port Port ID for point-to-multipoint
759 * @lport: The local port which will have its Port ID set.
760 * @port_id: The new port ID.
761 *
762 * Called by the lower-level driver when transport sets the local port_id.
763 * This is used in VN_port to VN_port mode for FCoE, and causes FLOGI and
764 * discovery to be skipped.
765 */
766void fc_lport_set_local_id(struct fc_lport *lport, u32 port_id)
767{
768 mutex_lock(&lport->lp_mutex);
769
770 fc_lport_set_port_id(lport, port_id, NULL);
771
772 switch (lport->state) {
773 case LPORT_ST_RESET:
774 case LPORT_ST_FLOGI:
775 if (port_id)
776 fc_lport_enter_ready(lport);
777 break;
778 default:
779 break;
780 }
781 mutex_unlock(&lport->lp_mutex);
782}
783EXPORT_SYMBOL(fc_lport_set_local_id);
784
785/**
758 * fc_lport_recv_flogi_req() - Receive a FLOGI request 786 * fc_lport_recv_flogi_req() - Receive a FLOGI request
759 * @sp_in: The sequence the FLOGI is on 787 * @sp_in: The sequence the FLOGI is on
760 * @rx_fp: The FLOGI frame 788 * @rx_fp: The FLOGI frame
@@ -954,7 +982,7 @@ static void fc_lport_reset_locked(struct fc_lport *lport)
954 lport->tt.exch_mgr_reset(lport, 0, 0); 982 lport->tt.exch_mgr_reset(lport, 0, 0);
955 fc_host_fabric_name(lport->host) = 0; 983 fc_host_fabric_name(lport->host) = 0;
956 984
957 if (lport->port_id) 985 if (lport->port_id && (!lport->point_to_multipoint || !lport->link_up))
958 fc_lport_set_port_id(lport, 0, NULL); 986 fc_lport_set_port_id(lport, 0, NULL);
959} 987}
960 988
@@ -1536,6 +1564,12 @@ void fc_lport_enter_flogi(struct fc_lport *lport)
1536 1564
1537 fc_lport_state_enter(lport, LPORT_ST_FLOGI); 1565 fc_lport_state_enter(lport, LPORT_ST_FLOGI);
1538 1566
1567 if (lport->point_to_multipoint) {
1568 if (lport->port_id)
1569 fc_lport_enter_ready(lport);
1570 return;
1571 }
1572
1539 fp = fc_frame_alloc(lport, sizeof(struct fc_els_flogi)); 1573 fp = fc_frame_alloc(lport, sizeof(struct fc_els_flogi));
1540 if (!fp) 1574 if (!fp)
1541 return fc_lport_error(lport, fp); 1575 return fc_lport_error(lport, fp);