aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2009-11-03 14:49:05 -0500
committerJames Bottomley <James.Bottomley@suse.de>2009-12-04 13:01:17 -0500
commit093bb6a2d378ee83fc6ab886c772b6be86abb5a8 (patch)
tree30fea295440a3c4d5242902fbf3a7b3543d9aa9d /drivers/scsi/libfc
parent52a6690d3f0cb7414c34b1e26c569b32d4987662 (diff)
[SCSI] libfc: add set_fid function to libfc template
This is to notify the LLD when an FC_ID is assigned to the local port. The fnic driver needs to push the assigned FC_ID to firmware. It currently does this by intercepting the FLOGI responses, and in order to make that code more common with FIP and NPIV, it makes more sense to wait until the local port has completely handled the FLOGI or FDISC response. Also, when we fix point-to-point FC_ID assignment, we'll need this callback as well. Add a call to the libfc template, which is called whenever the local port FC_ID is being assigned. It defaults to fc_lport_set_fid(), supplied by libfc. As additional benefit of this function, the LLD may determine the MAC address that caused the change by looking at the received frame. We also print the assigned port ID as long as it isn't 0. Setting port ID to 0 happens often in reset while retrying FLOGI, and would be uninteresting. This replaces the previous message which didn't identify the host adapter instance. patch v2 note: changed one word in a comment. "intercepted" -> "provided". 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.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 90930c435455..653b52dd2ff7 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -733,6 +733,27 @@ static void fc_lport_enter_ready(struct fc_lport *lport)
733} 733}
734 734
735/** 735/**
736 * fc_lport_set_port_id() - set the local port Port ID
737 * @lport: The local port which will have its Port ID set.
738 * @port_id: The new port ID.
739 * @fp: The frame containing the incoming request, or NULL.
740 *
741 * Locking Note: The lport lock is expected to be held before calling
742 * this function.
743 */
744static void fc_lport_set_port_id(struct fc_lport *lport, u32 port_id,
745 struct fc_frame *fp)
746{
747 if (port_id)
748 printk(KERN_INFO "host%d: Assigned Port ID %6x\n",
749 lport->host->host_no, port_id);
750
751 fc_host_port_id(lport->host) = port_id;
752 if (lport->tt.lport_set_port_id)
753 lport->tt.lport_set_port_id(lport, port_id, fp);
754}
755
756/**
736 * fc_lport_recv_flogi_req() - Receive a FLOGI request 757 * fc_lport_recv_flogi_req() - Receive a FLOGI request
737 * @sp_in: The sequence the FLOGI is on 758 * @sp_in: The sequence the FLOGI is on
738 * @rx_fp: The FLOGI frame 759 * @rx_fp: The FLOGI frame
@@ -790,7 +811,7 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in,
790 remote_fid = FC_LOCAL_PTP_FID_HI; 811 remote_fid = FC_LOCAL_PTP_FID_HI;
791 } 812 }
792 813
793 fc_host_port_id(lport->host) = local_fid; 814 fc_lport_set_port_id(lport, local_fid, rx_fp);
794 815
795 fp = fc_frame_alloc(lport, sizeof(*flp)); 816 fp = fc_frame_alloc(lport, sizeof(*flp));
796 if (fp) { 817 if (fp) {
@@ -926,7 +947,9 @@ static void fc_lport_reset_locked(struct fc_lport *lport)
926 947
927 lport->tt.exch_mgr_reset(lport, 0, 0); 948 lport->tt.exch_mgr_reset(lport, 0, 0);
928 fc_host_fabric_name(lport->host) = 0; 949 fc_host_fabric_name(lport->host) = 0;
929 fc_host_port_id(lport->host) = 0; 950
951 if (fc_host_port_id(lport->host))
952 fc_lport_set_port_id(lport, 0, NULL);
930} 953}
931 954
932/** 955/**
@@ -1428,11 +1451,6 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
1428 fh = fc_frame_header_get(fp); 1451 fh = fc_frame_header_get(fp);
1429 did = ntoh24(fh->fh_d_id); 1452 did = ntoh24(fh->fh_d_id);
1430 if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) { 1453 if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) {
1431
1432 printk(KERN_INFO "libfc: Assigned FID (%6x) in FLOGI response\n",
1433 did);
1434 fc_host_port_id(lport->host) = did;
1435
1436 flp = fc_frame_payload_get(fp, sizeof(*flp)); 1454 flp = fc_frame_payload_get(fp, sizeof(*flp));
1437 if (flp) { 1455 if (flp) {
1438 mfs = ntohs(flp->fl_csp.sp_bb_data) & 1456 mfs = ntohs(flp->fl_csp.sp_bb_data) &
@@ -1452,6 +1470,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
1452 if (e_d_tov > lport->e_d_tov) 1470 if (e_d_tov > lport->e_d_tov)
1453 lport->e_d_tov = e_d_tov; 1471 lport->e_d_tov = e_d_tov;
1454 lport->r_a_tov = 2 * e_d_tov; 1472 lport->r_a_tov = 2 * e_d_tov;
1473 fc_lport_set_port_id(lport, did, fp);
1455 printk(KERN_INFO "libfc: Port (%6x) entered " 1474 printk(KERN_INFO "libfc: Port (%6x) entered "
1456 "point to point mode\n", did); 1475 "point to point mode\n", did);
1457 fc_lport_ptp_setup(lport, ntoh24(fh->fh_s_id), 1476 fc_lport_ptp_setup(lport, ntoh24(fh->fh_s_id),
@@ -1464,6 +1483,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
1464 lport->r_a_tov = r_a_tov; 1483 lport->r_a_tov = r_a_tov;
1465 fc_host_fabric_name(lport->host) = 1484 fc_host_fabric_name(lport->host) =
1466 get_unaligned_be64(&flp->fl_wwnn); 1485 get_unaligned_be64(&flp->fl_wwnn);
1486 fc_lport_set_port_id(lport, did, fp);
1467 fc_lport_enter_dns(lport); 1487 fc_lport_enter_dns(lport);
1468 } 1488 }
1469 } 1489 }