Skip to content

Commit ab593b1

Browse files
Joe EykholtJames Bottomley
authored andcommitted
[SCSI] libfc: register FC4 features with the FC switch
Customers and certification tests have pointed out that we don't show up on the switch management software as an initiator. On some MDS switches 'show fcns database' command shows libfc initiators as 'fcp' not 'fcp:init' like other initiators. On others switches, I think the switch gets the features by doing a PRLI, but it may be only certain models or under certain configurations. Fix this by registering our FC4 features with the RFF_ID CT request after local port login and after the RFT_ID. 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>
1 parent 78112e5 commit ab593b1

5 files changed

Lines changed: 43 additions & 2 deletions

File tree

‎drivers/scsi/libfc/fc_lport.c‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ static const char *fc_lport_state_names[] = {
122122
[LPORT_ST_RSNN_NN] = "RSNN_NN",
123123
[LPORT_ST_RSPN_ID] = "RSPN_ID",
124124
[LPORT_ST_RFT_ID] = "RFT_ID",
125+
[LPORT_ST_RFF_ID] = "RFF_ID",
125126
[LPORT_ST_SCR] = "SCR",
126127
[LPORT_ST_READY] = "Ready",
127128
[LPORT_ST_LOGO] = "LOGO",
@@ -1034,6 +1035,7 @@ static void fc_lport_error(struct fc_lport *lport, struct fc_frame *fp)
10341035
case LPORT_ST_RSNN_NN:
10351036
case LPORT_ST_RSPN_ID:
10361037
case LPORT_ST_RFT_ID:
1038+
case LPORT_ST_RFF_ID:
10371039
case LPORT_ST_SCR:
10381040
case LPORT_ST_DNS:
10391041
case LPORT_ST_FLOGI:
@@ -1070,7 +1072,7 @@ static void fc_lport_ns_resp(struct fc_seq *sp, struct fc_frame *fp,
10701072

10711073
mutex_lock(&lport->lp_mutex);
10721074

1073-
if (lport->state < LPORT_ST_RNN_ID || lport->state > LPORT_ST_RFT_ID) {
1075+
if (lport->state < LPORT_ST_RNN_ID || lport->state > LPORT_ST_RFF_ID) {
10741076
FC_LPORT_DBG(lport, "Received a name server response, "
10751077
"but in state %s\n", fc_lport_state(lport));
10761078
if (IS_ERR(fp))
@@ -1101,6 +1103,9 @@ static void fc_lport_ns_resp(struct fc_seq *sp, struct fc_frame *fp,
11011103
fc_lport_enter_ns(lport, LPORT_ST_RFT_ID);
11021104
break;
11031105
case LPORT_ST_RFT_ID:
1106+
fc_lport_enter_ns(lport, LPORT_ST_RFF_ID);
1107+
break;
1108+
case LPORT_ST_RFF_ID:
11041109
fc_lport_enter_scr(lport);
11051110
break;
11061111
default:
@@ -1235,6 +1240,10 @@ static void fc_lport_enter_ns(struct fc_lport *lport, enum fc_lport_state state)
12351240
cmd = FC_NS_RFT_ID;
12361241
size += sizeof(struct fc_ns_rft);
12371242
break;
1243+
case LPORT_ST_RFF_ID:
1244+
cmd = FC_NS_RFF_ID;
1245+
size += sizeof(struct fc_ns_rff_id);
1246+
break;
12381247
default:
12391248
fc_lport_error(lport, NULL);
12401249
return;
@@ -1317,6 +1326,7 @@ static void fc_lport_timeout(struct work_struct *work)
13171326
case LPORT_ST_RSNN_NN:
13181327
case LPORT_ST_RSPN_ID:
13191328
case LPORT_ST_RFT_ID:
1329+
case LPORT_ST_RFF_ID:
13201330
fc_lport_enter_ns(lport, lport->state);
13211331
break;
13221332
case LPORT_ST_SCR:

‎include/scsi/fc/fc_fcp.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,10 @@ struct fcp_srr {
196196
__u8 srr_resvd2[3]; /* reserved */
197197
};
198198

199+
/*
200+
* Feature bits in name server FC-4 Features object.
201+
*/
202+
#define FCP_FEAT_TARG (1 << 0) /* target function supported */
203+
#define FCP_FEAT_INIT (1 << 1) /* initiator function supported */
204+
199205
#endif /* _FC_FCP_H_ */

‎include/scsi/fc/fc_ns.h‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ enum fc_ns_req {
4646
FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */
4747
FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */
4848
FC_NS_GID_PT = 0x01a1, /* get IDs by port type */
49-
FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */
5049
FC_NS_RPN_ID = 0x0212, /* reg port name for ID */
5150
FC_NS_RNN_ID = 0x0213, /* reg node name for ID */
51+
FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */
5252
FC_NS_RSPN_ID = 0x0218, /* reg symbolic port name */
53+
FC_NS_RFF_ID = 0x021f, /* reg FC4 Features for ID */
5354
FC_NS_RSNN_NN = 0x0239, /* reg symbolic node name */
5455
};
5556

@@ -178,4 +179,14 @@ struct fc_ns_rspn {
178179
char fr_name[];
179180
} __attribute__((__packed__));
180181

182+
/*
183+
* RFF_ID request - register FC-4 Features for ID.
184+
*/
185+
struct fc_ns_rff_id {
186+
struct fc_ns_fid fr_fid; /* port ID object */
187+
__u8 fr_resvd[2];
188+
__u8 fr_feat; /* FC-4 Feature bits */
189+
__u8 fr_type; /* FC-4 type */
190+
} __attribute__((__packed__));
191+
181192
#endif /* _FC_NS_H_ */

‎include/scsi/fc_encode.h‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct fc_ct_req {
3232
struct fc_ns_gid_ft gid;
3333
struct fc_ns_rn_id rn;
3434
struct fc_ns_rft rft;
35+
struct fc_ns_rff_id rff;
3536
struct fc_ns_fid fid;
3637
struct fc_ns_rsnn snn;
3738
struct fc_ns_rspn spn;
@@ -131,6 +132,17 @@ static inline int fc_ct_fill(struct fc_lport *lport,
131132
ct->payload.rft.fts = lport->fcts;
132133
break;
133134

135+
case FC_NS_RFF_ID:
136+
ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id));
137+
hton24(ct->payload.rff.fr_fid.fp_fid,
138+
fc_host_port_id(lport->host));
139+
ct->payload.rff.fr_type = FC_TYPE_FCP;
140+
if (lport->service_params & FCP_SPPF_INIT_FCN)
141+
ct->payload.rff.fr_feat = FCP_FEAT_INIT;
142+
if (lport->service_params & FCP_SPPF_TARG_FCN)
143+
ct->payload.rff.fr_feat |= FCP_FEAT_TARG;
144+
break;
145+
134146
case FC_NS_RNN_ID:
135147
ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id));
136148
hton24(ct->payload.rn.fr_fid.fp_fid,

‎include/scsi/libfc.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
* @LPORT_ST_DNS: Waiting for name server remote port to become ready
6363
* @LPORT_ST_RPN_ID: Register port name by ID (RPN_ID) sent
6464
* @LPORT_ST_RFT_ID: Register Fibre Channel types by ID (RFT_ID) sent
65+
* @LPORT_ST_RFF_ID: Register FC-4 Features by ID (RFF_ID) sent
6566
* @LPORT_ST_SCR: State Change Register (SCR) sent
6667
* @LPORT_ST_READY: Ready for use
6768
* @LPORT_ST_LOGO: Local port logout (LOGO) sent
@@ -75,6 +76,7 @@ enum fc_lport_state {
7576
LPORT_ST_RSNN_NN,
7677
LPORT_ST_RSPN_ID,
7778
LPORT_ST_RFT_ID,
79+
LPORT_ST_RFF_ID,
7880
LPORT_ST_SCR,
7981
LPORT_ST_READY,
8082
LPORT_ST_LOGO,

0 commit comments

Comments
 (0)