aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/fc_encode.h
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2009-08-25 17:03:58 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-10 13:08:03 -0400
commit2ab7e1ecb81ce35ed8e8df512e3fc6338a4c55bb (patch)
treecc4fea4717a66e7d1428505bb409146d37e52668 /include/scsi/fc_encode.h
parent8abbe3a42324264c9d5cc4e7c3d265b5be6d82d6 (diff)
[SCSI] libfc: send GPN_ID in reaction to single-port RSCNs.
When an RSCN indicates changes to individual remote ports, don't blindly log them out and then back in. Instead, determine whether they're still in the directory, by doing GPN_ID. If that is successful, call login, which will send ADISC and reverify, otherwise, call logoff. Perhaps we should just delete the rport, not send LOGO, but it seems safer. Also, fix a possible issue where if a mix of records in the RSCN cause us to queue disc_ports for disc_single and then we decide to do full rediscovery, we leak memory for those disc_ports queued. So, go through the list of disc_ports even if doing full discovery. Free the disc_ports in any case. If any of the disc_single() calls return error, do a full discovery. The ability to fill in GPN_ID requests was added to fc_ct_fill(). For this, it needs the FC_ID to be passed in as an arg. The did parameter for fc_elsct_send() is used for that, since the actual D_DID will always be 0xfffffc for all CT requests so far. 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 'include/scsi/fc_encode.h')
-rw-r--r--include/scsi/fc_encode.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index c5ee6bb79e05..27dad703824f 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -32,6 +32,7 @@ struct fc_ct_req {
32 struct fc_ns_gid_ft gid; 32 struct fc_ns_gid_ft gid;
33 struct fc_ns_rn_id rn; 33 struct fc_ns_rn_id rn;
34 struct fc_ns_rft rft; 34 struct fc_ns_rft rft;
35 struct fc_ns_fid fid;
35 } payload; 36 } payload;
36}; 37};
37 38
@@ -94,10 +95,16 @@ static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp,
94} 95}
95 96
96/** 97/**
97 * fc_ct_fill - Fill in a name service request frame 98 * fc_ct_fill() - Fill in a name service request frame
99 * @lport: local port.
100 * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries.
101 * @fp: frame to contain payload.
102 * @op: CT opcode.
103 * @r_ctl: pointer to FC header R_CTL.
104 * @fh_type: pointer to FC-4 type.
98 */ 105 */
99static inline int fc_ct_fill(struct fc_lport *lport, 106static inline int fc_ct_fill(struct fc_lport *lport,
100 struct fc_frame *fp, 107 u32 fc_id, struct fc_frame *fp,
101 unsigned int op, enum fc_rctl *r_ctl, 108 unsigned int op, enum fc_rctl *r_ctl,
102 enum fc_fh_type *fh_type) 109 enum fc_fh_type *fh_type)
103{ 110{
@@ -109,6 +116,11 @@ static inline int fc_ct_fill(struct fc_lport *lport,
109 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP; 116 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP;
110 break; 117 break;
111 118
119 case FC_NS_GPN_ID:
120 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_fid));
121 hton24(ct->payload.fid.fp_fid, fc_id);
122 break;
123
112 case FC_NS_RFT_ID: 124 case FC_NS_RFT_ID:
113 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft)); 125 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft));
114 hton24(ct->payload.rft.fid.fp_fid, 126 hton24(ct->payload.rft.fid.fp_fid,