Skip to content

Commit a46f327

Browse files
Joe EykholtJames Bottomley
authored andcommitted
[SCSI] libfc: change elsct to use FC_ID instead of rdata
tt.elsct_send is used by both FCP and by the rport state machine. After further patches, these two modules will use different structures for the remote port. So, change elsct_send to use the FC_ID instead of the fc_rport_priv as its argument. It currently only uses the FC_ID anyway. For CT requests the destination FC_ID is still implicitly 0xfffffc. After further patches the did arg on CT requests will be used to specify the FC_ID being inquired about for GPN_ID or other queries. 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 9fb9d32 commit a46f327

7 files changed

Lines changed: 24 additions & 39 deletions

File tree

‎drivers/scsi/libfc/fc_disc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ static void fc_disc_gpn_ft_req(struct fc_disc *disc)
526526
if (!fp)
527527
goto err;
528528

529-
if (lport->tt.elsct_send(lport, NULL, fp,
529+
if (lport->tt.elsct_send(lport, 0, fp,
530530
FC_NS_GPN_FT,
531531
fc_disc_gpn_ft_resp,
532532
disc, lport->e_d_tov))

‎drivers/scsi/libfc/fc_elsct.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* fc_elsct_send - sends ELS/CT frame
3333
*/
3434
static struct fc_seq *fc_elsct_send(struct fc_lport *lport,
35-
struct fc_rport_priv *rdata,
35+
u32 did,
3636
struct fc_frame *fp,
3737
unsigned int op,
3838
void (*resp)(struct fc_seq *,
@@ -41,16 +41,17 @@ static struct fc_seq *fc_elsct_send(struct fc_lport *lport,
4141
void *arg, u32 timer_msec)
4242
{
4343
enum fc_rctl r_ctl;
44-
u32 did = FC_FID_NONE;
4544
enum fc_fh_type fh_type;
4645
int rc;
4746

4847
/* ELS requests */
4948
if ((op >= ELS_LS_RJT) && (op <= ELS_AUTH_ELS))
50-
rc = fc_els_fill(lport, rdata, fp, op, &r_ctl, &did, &fh_type);
51-
else
49+
rc = fc_els_fill(lport, did, fp, op, &r_ctl, &fh_type);
50+
else {
5251
/* CT requests */
53-
rc = fc_ct_fill(lport, fp, op, &r_ctl, &did, &fh_type);
52+
rc = fc_ct_fill(lport, fp, op, &r_ctl, &fh_type);
53+
did = FC_FID_DIR_SERV;
54+
}
5455

5556
if (rc)
5657
return NULL;

‎drivers/scsi/libfc/fc_fcp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ static void fc_fcp_rec(struct fc_fcp_pkt *fsp)
13081308
fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, rport->port_id,
13091309
fc_host_port_id(rp->local_port->host), FC_TYPE_ELS,
13101310
FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);
1311-
if (lp->tt.elsct_send(lp, rport->dd_data, fp, ELS_REC, fc_fcp_rec_resp,
1311+
if (lp->tt.elsct_send(lp, rport->port_id, fp, ELS_REC, fc_fcp_rec_resp,
13121312
fsp, jiffies_to_msecs(FC_SCSI_REC_TOV))) {
13131313
fc_fcp_pkt_hold(fsp); /* hold while REC outstanding */
13141314
return;

‎drivers/scsi/libfc/fc_lport.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ static void fc_lport_enter_scr(struct fc_lport *lport)
12171217
return;
12181218
}
12191219

1220-
if (!lport->tt.elsct_send(lport, NULL, fp, ELS_SCR,
1220+
if (!lport->tt.elsct_send(lport, FC_FID_FCTRL, fp, ELS_SCR,
12211221
fc_lport_scr_resp, lport, lport->e_d_tov))
12221222
fc_lport_error(lport, fp);
12231223
}
@@ -1258,7 +1258,7 @@ static void fc_lport_enter_rft_id(struct fc_lport *lport)
12581258
return;
12591259
}
12601260

1261-
if (!lport->tt.elsct_send(lport, NULL, fp, FC_NS_RFT_ID,
1261+
if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RFT_ID,
12621262
fc_lport_rft_id_resp,
12631263
lport, lport->e_d_tov))
12641264
fc_lport_error(lport, fp);
@@ -1287,7 +1287,7 @@ static void fc_lport_enter_rpn_id(struct fc_lport *lport)
12871287
return;
12881288
}
12891289

1290-
if (!lport->tt.elsct_send(lport, NULL, fp, FC_NS_RPN_ID,
1290+
if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RPN_ID,
12911291
fc_lport_rpn_id_resp,
12921292
lport, lport->e_d_tov))
12931293
fc_lport_error(lport, fp);
@@ -1443,8 +1443,8 @@ static void fc_lport_enter_logo(struct fc_lport *lport)
14431443
return;
14441444
}
14451445

1446-
if (!lport->tt.elsct_send(lport, NULL, fp, ELS_LOGO, fc_lport_logo_resp,
1447-
lport, lport->e_d_tov))
1446+
if (!lport->tt.elsct_send(lport, FC_FID_FLOGI, fp, ELS_LOGO,
1447+
fc_lport_logo_resp, lport, lport->e_d_tov))
14481448
fc_lport_error(lport, fp);
14491449
}
14501450

@@ -1567,7 +1567,7 @@ void fc_lport_enter_flogi(struct fc_lport *lport)
15671567
if (!fp)
15681568
return fc_lport_error(lport, fp);
15691569

1570-
if (!lport->tt.elsct_send(lport, NULL, fp, ELS_FLOGI,
1570+
if (!lport->tt.elsct_send(lport, FC_FID_FLOGI, fp, ELS_FLOGI,
15711571
fc_lport_flogi_resp, lport, lport->e_d_tov))
15721572
fc_lport_error(lport, fp);
15731573
}

‎drivers/scsi/libfc/fc_rport.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ static void fc_rport_enter_plogi(struct fc_rport_priv *rdata)
593593
}
594594
rdata->e_d_tov = lport->e_d_tov;
595595

596-
if (!lport->tt.elsct_send(lport, rdata, fp, ELS_PLOGI,
596+
if (!lport->tt.elsct_send(lport, rport->port_id, fp, ELS_PLOGI,
597597
fc_rport_plogi_resp, rdata, lport->e_d_tov))
598598
fc_rport_error_retry(rdata, fp);
599599
else
@@ -747,7 +747,7 @@ static void fc_rport_enter_prli(struct fc_rport_priv *rdata)
747747
return;
748748
}
749749

750-
if (!lport->tt.elsct_send(lport, rdata, fp, ELS_PRLI,
750+
if (!lport->tt.elsct_send(lport, rport->port_id, fp, ELS_PRLI,
751751
fc_rport_prli_resp, rdata, lport->e_d_tov))
752752
fc_rport_error_retry(rdata, fp);
753753
else
@@ -845,7 +845,7 @@ static void fc_rport_enter_rtv(struct fc_rport_priv *rdata)
845845
return;
846846
}
847847

848-
if (!lport->tt.elsct_send(lport, rdata, fp, ELS_RTV,
848+
if (!lport->tt.elsct_send(lport, rport->port_id, fp, ELS_RTV,
849849
fc_rport_rtv_resp, rdata, lport->e_d_tov))
850850
fc_rport_error_retry(rdata, fp);
851851
else
@@ -876,7 +876,7 @@ static void fc_rport_enter_logo(struct fc_rport_priv *rdata)
876876
return;
877877
}
878878

879-
if (!lport->tt.elsct_send(lport, rdata, fp, ELS_LOGO,
879+
if (!lport->tt.elsct_send(lport, rport->port_id, fp, ELS_LOGO,
880880
fc_rport_logo_resp, rdata, lport->e_d_tov))
881881
fc_rport_error_retry(rdata, fp);
882882
else

‎include/scsi/fc_encode.h‎

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp,
7979
/**
8080
* fc_ct_fill - Fill in a name service request frame
8181
*/
82-
static inline int fc_ct_fill(struct fc_lport *lport, struct fc_frame *fp,
83-
unsigned int op, enum fc_rctl *r_ctl, u32 *did,
82+
static inline int fc_ct_fill(struct fc_lport *lport,
83+
struct fc_frame *fp,
84+
unsigned int op, enum fc_rctl *r_ctl,
8485
enum fc_fh_type *fh_type)
8586
{
8687
struct fc_ct_req *ct;
@@ -110,7 +111,6 @@ static inline int fc_ct_fill(struct fc_lport *lport, struct fc_frame *fp,
110111
return -EINVAL;
111112
}
112113
*r_ctl = FC_RCTL_DD_UNSOL_CTL;
113-
*did = FC_FID_DIR_SERV;
114114
*fh_type = FC_TYPE_CT;
115115
return 0;
116116
}
@@ -250,53 +250,37 @@ static inline void fc_scr_fill(struct fc_lport *lport, struct fc_frame *fp)
250250
* fc_els_fill - Fill in an ELS request frame
251251
*/
252252
static inline int fc_els_fill(struct fc_lport *lport,
253-
struct fc_rport_priv *rdata,
253+
u32 did,
254254
struct fc_frame *fp, unsigned int op,
255-
enum fc_rctl *r_ctl, u32 *did, enum fc_fh_type *fh_type)
255+
enum fc_rctl *r_ctl, enum fc_fh_type *fh_type)
256256
{
257-
struct fc_rport *rport = PRIV_TO_RPORT(rdata);
258-
259257
switch (op) {
260258
case ELS_PLOGI:
261259
fc_plogi_fill(lport, fp, ELS_PLOGI);
262-
*did = rport->port_id;
263260
break;
264261

265262
case ELS_FLOGI:
266263
fc_flogi_fill(lport, fp);
267-
*did = FC_FID_FLOGI;
268264
break;
269265

270266
case ELS_LOGO:
271267
fc_logo_fill(lport, fp);
272-
*did = FC_FID_FLOGI;
273-
/*
274-
* if rport is valid then it
275-
* is port logo, therefore
276-
* set did to rport id.
277-
*/
278-
if (rdata)
279-
*did = rport->port_id;
280268
break;
281269

282270
case ELS_RTV:
283271
fc_rtv_fill(lport, fp);
284-
*did = rport->port_id;
285272
break;
286273

287274
case ELS_REC:
288275
fc_rec_fill(lport, fp);
289-
*did = rport->port_id;
290276
break;
291277

292278
case ELS_PRLI:
293279
fc_prli_fill(lport, fp);
294-
*did = rport->port_id;
295280
break;
296281

297282
case ELS_SCR:
298283
fc_scr_fill(lport, fp);
299-
*did = FC_FID_FCTRL;
300284
break;
301285

302286
default:

‎include/scsi/libfc.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ struct libfc_function_template {
424424
* STATUS: OPTIONAL
425425
*/
426426
struct fc_seq *(*elsct_send)(struct fc_lport *lport,
427-
struct fc_rport_priv *,
427+
u32 did,
428428
struct fc_frame *fp,
429429
unsigned int op,
430430
void (*resp)(struct fc_seq *,

0 commit comments

Comments
 (0)