Skip to content

Commit ab28f1f

Browse files
Joe EykholtJames Bottomley
authored andcommitted
[SCSI] libfc: prepare to split off struct fc_rport_priv from fc_rport_libfc_priv
While the I/O and LLD interfaces use fc_rport_libfc_priv, the disc and rport interfaces will use fc_rport_priv, which will be separately allocated. Change the disc and rport usage of fc_rport_libfc_priv to fc_rport_priv. Use #define temporarily to make both names equivalent until a subsequent patch splits them. 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 090eb6c commit ab28f1f

4 files changed

Lines changed: 49 additions & 41 deletions

File tree

‎drivers/scsi/libfc/fc_disc.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct fc_rport *fc_disc_lookup_rport(const struct fc_lport *lport,
6565
{
6666
const struct fc_disc *disc = &lport->disc;
6767
struct fc_rport *rport, *found = NULL;
68-
struct fc_rport_libfc_priv *rdata;
68+
struct fc_rport_priv *rdata;
6969
int disc_found = 0;
7070

7171
list_for_each_entry(rdata, &disc->rports, peers) {
@@ -94,7 +94,7 @@ void fc_disc_stop_rports(struct fc_disc *disc)
9494
{
9595
struct fc_lport *lport;
9696
struct fc_rport *rport;
97-
struct fc_rport_libfc_priv *rdata, *next;
97+
struct fc_rport_priv *rdata, *next;
9898

9999
lport = disc->lport;
100100

@@ -126,7 +126,7 @@ static void fc_disc_rport_callback(struct fc_lport *lport,
126126
struct fc_rport *rport,
127127
enum fc_rport_event event)
128128
{
129-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
129+
struct fc_rport_priv *rdata = rport->dd_data;
130130
struct fc_disc *disc = &lport->disc;
131131

132132
FC_DISC_DBG(disc, "Received a %d event for port (%6x)\n", event,
@@ -170,7 +170,7 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp,
170170
{
171171
struct fc_lport *lport;
172172
struct fc_rport *rport;
173-
struct fc_rport_libfc_priv *rdata;
173+
struct fc_rport_priv *rdata;
174174
struct fc_els_rscn *rp;
175175
struct fc_els_rscn_page *pp;
176176
struct fc_seq_els_data rjt_data;
@@ -309,7 +309,7 @@ static void fc_disc_recv_req(struct fc_seq *sp, struct fc_frame *fp,
309309
static void fc_disc_restart(struct fc_disc *disc)
310310
{
311311
struct fc_rport *rport;
312-
struct fc_rport_libfc_priv *rdata, *next;
312+
struct fc_rport_priv *rdata, *next;
313313
struct fc_lport *lport = disc->lport;
314314

315315
FC_DISC_DBG(disc, "Restarting discovery\n");
@@ -400,7 +400,7 @@ static int fc_disc_new_target(struct fc_disc *disc,
400400
struct fc_rport_identifiers *ids)
401401
{
402402
struct fc_lport *lport = disc->lport;
403-
struct fc_rport_libfc_priv *rdata;
403+
struct fc_rport_priv *rdata;
404404
int error = 0;
405405

406406
if (rport && ids->port_name) {
@@ -458,7 +458,7 @@ static int fc_disc_new_target(struct fc_disc *disc,
458458
static void fc_disc_del_target(struct fc_disc *disc, struct fc_rport *rport)
459459
{
460460
struct fc_lport *lport = disc->lport;
461-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
461+
struct fc_rport_priv *rdata = rport->dd_data;
462462
list_del(&rdata->peers);
463463
lport->tt.rport_logoff(rport);
464464
}
@@ -580,7 +580,7 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
580580
int error = 0;
581581
struct fc_disc_port dp;
582582
struct fc_rport *rport;
583-
struct fc_rport_libfc_priv *rdata;
583+
struct fc_rport_priv *rdata;
584584

585585
lport = disc->lport;
586586

@@ -774,7 +774,7 @@ static void fc_disc_single(struct fc_disc *disc, struct fc_disc_port *dp)
774774
{
775775
struct fc_lport *lport;
776776
struct fc_rport *new_rport;
777-
struct fc_rport_libfc_priv *rdata;
777+
struct fc_rport_priv *rdata;
778778

779779
lport = disc->lport;
780780

‎drivers/scsi/libfc/fc_lport.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ static struct fc_rport_operations fc_lport_rport_ops = {
13061306
static void fc_lport_enter_dns(struct fc_lport *lport)
13071307
{
13081308
struct fc_rport *rport;
1309-
struct fc_rport_libfc_priv *rdata;
1309+
struct fc_rport_priv *rdata;
13101310
struct fc_disc_port dp;
13111311

13121312
dp.ids.port_id = FC_FID_DIR_SERV;

‎drivers/scsi/libfc/fc_rport.c‎

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static void fc_rport_rogue_destroy(struct device *dev)
9696
struct fc_rport *fc_rport_rogue_create(struct fc_disc_port *dp)
9797
{
9898
struct fc_rport *rport;
99-
struct fc_rport_libfc_priv *rdata;
99+
struct fc_rport_priv *rdata;
100100
rport = kzalloc(sizeof(*rport) + sizeof(*rdata), GFP_KERNEL);
101101

102102
if (!rport)
@@ -144,7 +144,7 @@ struct fc_rport *fc_rport_rogue_create(struct fc_disc_port *dp)
144144
static const char *fc_rport_state(struct fc_rport *rport)
145145
{
146146
const char *cp;
147-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
147+
struct fc_rport_priv *rdata = rport->dd_data;
148148

149149
cp = fc_rport_state_names[rdata->rp_state];
150150
if (!cp)
@@ -199,7 +199,7 @@ static unsigned int fc_plogi_get_maxframe(struct fc_els_flogi *flp,
199199
static void fc_rport_state_enter(struct fc_rport *rport,
200200
enum fc_rport_state new)
201201
{
202-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
202+
struct fc_rport_priv *rdata = rport->dd_data;
203203
if (rdata->rp_state != new)
204204
rdata->retries = 0;
205205
rdata->rp_state = new;
@@ -208,8 +208,8 @@ static void fc_rport_state_enter(struct fc_rport *rport,
208208
static void fc_rport_work(struct work_struct *work)
209209
{
210210
u32 port_id;
211-
struct fc_rport_libfc_priv *rdata =
212-
container_of(work, struct fc_rport_libfc_priv, event_work);
211+
struct fc_rport_priv *rdata =
212+
container_of(work, struct fc_rport_priv, event_work);
213213
enum fc_rport_event event;
214214
enum fc_rport_trans_state trans_state;
215215
struct fc_lport *lport = rdata->local_port;
@@ -222,7 +222,7 @@ static void fc_rport_work(struct work_struct *work)
222222

223223
if (event == RPORT_EV_CREATED) {
224224
struct fc_rport *new_rport;
225-
struct fc_rport_libfc_priv *new_rdata;
225+
struct fc_rport_priv *new_rdata;
226226
struct fc_rport_identifiers ids;
227227

228228
ids.port_id = rport->port_id;
@@ -299,7 +299,7 @@ static void fc_rport_work(struct work_struct *work)
299299
*/
300300
int fc_rport_login(struct fc_rport *rport)
301301
{
302-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
302+
struct fc_rport_priv *rdata = rport->dd_data;
303303

304304
mutex_lock(&rdata->rp_mutex);
305305

@@ -329,7 +329,7 @@ int fc_rport_login(struct fc_rport *rport)
329329
static void fc_rport_enter_delete(struct fc_rport *rport,
330330
enum fc_rport_event event)
331331
{
332-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
332+
struct fc_rport_priv *rdata = rport->dd_data;
333333

334334
if (rdata->rp_state == RPORT_ST_DELETE)
335335
return;
@@ -353,7 +353,7 @@ static void fc_rport_enter_delete(struct fc_rport *rport,
353353
*/
354354
int fc_rport_logoff(struct fc_rport *rport)
355355
{
356-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
356+
struct fc_rport_priv *rdata = rport->dd_data;
357357

358358
mutex_lock(&rdata->rp_mutex);
359359

@@ -387,7 +387,7 @@ int fc_rport_logoff(struct fc_rport *rport)
387387
*/
388388
static void fc_rport_enter_ready(struct fc_rport *rport)
389389
{
390-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
390+
struct fc_rport_priv *rdata = rport->dd_data;
391391

392392
fc_rport_state_enter(rport, RPORT_ST_READY);
393393

@@ -400,16 +400,16 @@ static void fc_rport_enter_ready(struct fc_rport *rport)
400400

401401
/**
402402
* fc_rport_timeout() - Handler for the retry_work timer.
403-
* @work: The work struct of the fc_rport_libfc_priv
403+
* @work: The work struct of the fc_rport_priv
404404
*
405405
* Locking Note: Called without the rport lock held. This
406406
* function will hold the rport lock, call an _enter_*
407407
* function and then unlock the rport.
408408
*/
409409
static void fc_rport_timeout(struct work_struct *work)
410410
{
411-
struct fc_rport_libfc_priv *rdata =
412-
container_of(work, struct fc_rport_libfc_priv, retry_work.work);
411+
struct fc_rport_priv *rdata =
412+
container_of(work, struct fc_rport_priv, retry_work.work);
413413
struct fc_rport *rport = PRIV_TO_RPORT(rdata);
414414

415415
mutex_lock(&rdata->rp_mutex);
@@ -446,7 +446,7 @@ static void fc_rport_timeout(struct work_struct *work)
446446
*/
447447
static void fc_rport_error(struct fc_rport *rport, struct fc_frame *fp)
448448
{
449-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
449+
struct fc_rport_priv *rdata = rport->dd_data;
450450

451451
FC_RPORT_DBG(rport, "Error %ld in state %s, retries %d\n",
452452
PTR_ERR(fp), fc_rport_state(rport), rdata->retries);
@@ -480,7 +480,7 @@ static void fc_rport_error(struct fc_rport *rport, struct fc_frame *fp)
480480
*/
481481
static void fc_rport_error_retry(struct fc_rport *rport, struct fc_frame *fp)
482482
{
483-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
483+
struct fc_rport_priv *rdata = rport->dd_data;
484484
unsigned long delay = FC_DEF_E_D_TOV;
485485

486486
/* make sure this isn't an FC_EX_CLOSED error, never retry those */
@@ -515,7 +515,7 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp,
515515
void *rp_arg)
516516
{
517517
struct fc_rport *rport = rp_arg;
518-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
518+
struct fc_rport_priv *rdata = rport->dd_data;
519519
struct fc_lport *lport = rdata->local_port;
520520
struct fc_els_flogi *plp = NULL;
521521
unsigned int tov;
@@ -586,7 +586,7 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp,
586586
*/
587587
static void fc_rport_enter_plogi(struct fc_rport *rport)
588588
{
589-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
589+
struct fc_rport_priv *rdata = rport->dd_data;
590590
struct fc_lport *lport = rdata->local_port;
591591
struct fc_frame *fp;
592592

@@ -624,7 +624,7 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp,
624624
void *rp_arg)
625625
{
626626
struct fc_rport *rport = rp_arg;
627-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
627+
struct fc_rport_priv *rdata = rport->dd_data;
628628
struct {
629629
struct fc_els_prli prli;
630630
struct fc_els_spp spp;
@@ -694,7 +694,7 @@ static void fc_rport_logo_resp(struct fc_seq *sp, struct fc_frame *fp,
694694
void *rp_arg)
695695
{
696696
struct fc_rport *rport = rp_arg;
697-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
697+
struct fc_rport_priv *rdata = rport->dd_data;
698698
u8 op;
699699

700700
mutex_lock(&rdata->rp_mutex);
@@ -738,7 +738,7 @@ static void fc_rport_logo_resp(struct fc_seq *sp, struct fc_frame *fp,
738738
*/
739739
static void fc_rport_enter_prli(struct fc_rport *rport)
740740
{
741-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
741+
struct fc_rport_priv *rdata = rport->dd_data;
742742
struct fc_lport *lport = rdata->local_port;
743743
struct {
744744
struct fc_els_prli prli;
@@ -780,7 +780,7 @@ static void fc_rport_rtv_resp(struct fc_seq *sp, struct fc_frame *fp,
780780
void *rp_arg)
781781
{
782782
struct fc_rport *rport = rp_arg;
783-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
783+
struct fc_rport_priv *rdata = rport->dd_data;
784784
u8 op;
785785

786786
mutex_lock(&rdata->rp_mutex);
@@ -841,7 +841,7 @@ static void fc_rport_rtv_resp(struct fc_seq *sp, struct fc_frame *fp,
841841
static void fc_rport_enter_rtv(struct fc_rport *rport)
842842
{
843843
struct fc_frame *fp;
844-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
844+
struct fc_rport_priv *rdata = rport->dd_data;
845845
struct fc_lport *lport = rdata->local_port;
846846

847847
FC_RPORT_DBG(rport, "Port entered RTV state from %s state\n",
@@ -871,7 +871,7 @@ static void fc_rport_enter_rtv(struct fc_rport *rport)
871871
*/
872872
static void fc_rport_enter_logo(struct fc_rport *rport)
873873
{
874-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
874+
struct fc_rport_priv *rdata = rport->dd_data;
875875
struct fc_lport *lport = rdata->local_port;
876876
struct fc_frame *fp;
877877

@@ -907,7 +907,7 @@ static void fc_rport_enter_logo(struct fc_rport *rport)
907907
void fc_rport_recv_req(struct fc_seq *sp, struct fc_frame *fp,
908908
struct fc_rport *rport)
909909
{
910-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
910+
struct fc_rport_priv *rdata = rport->dd_data;
911911
struct fc_lport *lport = rdata->local_port;
912912

913913
struct fc_frame_header *fh;
@@ -967,7 +967,7 @@ void fc_rport_recv_req(struct fc_seq *sp, struct fc_frame *fp,
967967
static void fc_rport_recv_plogi_req(struct fc_rport *rport,
968968
struct fc_seq *sp, struct fc_frame *rx_fp)
969969
{
970-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
970+
struct fc_rport_priv *rdata = rport->dd_data;
971971
struct fc_lport *lport = rdata->local_port;
972972
struct fc_frame *fp = rx_fp;
973973
struct fc_exch *ep;
@@ -1090,7 +1090,7 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
10901090
static void fc_rport_recv_prli_req(struct fc_rport *rport,
10911091
struct fc_seq *sp, struct fc_frame *rx_fp)
10921092
{
1093-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
1093+
struct fc_rport_priv *rdata = rport->dd_data;
10941094
struct fc_lport *lport = rdata->local_port;
10951095
struct fc_exch *ep;
10961096
struct fc_frame *fp;
@@ -1242,7 +1242,7 @@ static void fc_rport_recv_prli_req(struct fc_rport *rport,
12421242
static void fc_rport_recv_prlo_req(struct fc_rport *rport, struct fc_seq *sp,
12431243
struct fc_frame *fp)
12441244
{
1245-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
1245+
struct fc_rport_priv *rdata = rport->dd_data;
12461246
struct fc_lport *lport = rdata->local_port;
12471247

12481248
struct fc_frame_header *fh;
@@ -1278,7 +1278,7 @@ static void fc_rport_recv_logo_req(struct fc_rport *rport, struct fc_seq *sp,
12781278
struct fc_frame *fp)
12791279
{
12801280
struct fc_frame_header *fh;
1281-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
1281+
struct fc_rport_priv *rdata = rport->dd_data;
12821282
struct fc_lport *lport = rdata->local_port;
12831283

12841284
fh = fc_frame_header_get(fp);
@@ -1342,8 +1342,8 @@ EXPORT_SYMBOL(fc_destroy_rport);
13421342

13431343
void fc_rport_terminate_io(struct fc_rport *rport)
13441344
{
1345-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
1346-
struct fc_lport *lport = rdata->local_port;
1345+
struct fc_rport_libfc_priv *rp = rport->dd_data;
1346+
struct fc_lport *lport = rp->local_port;
13471347

13481348
lport->tt.exch_mgr_reset(lport, 0, rport->port_id);
13491349
lport->tt.exch_mgr_reset(lport, rport->port_id, 0);

‎include/scsi/libfc.h‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ do { \
7777

7878
#define FC_RPORT_DBG(rport, fmt, args...) \
7979
do { \
80-
struct fc_rport_libfc_priv *rdata = rport->dd_data; \
80+
struct fc_rport_priv *rdata = rport->dd_data; \
8181
struct fc_lport *lport = rdata->local_port; \
8282
FC_RPORT_ID_DBG(lport, rport->port_id, fmt, ##args); \
8383
} while (0)
@@ -177,6 +177,14 @@ enum fc_rport_event {
177177
RPORT_EV_LOGO
178178
};
179179

180+
/*
181+
* Temporary definition to prepare for split off from fc_rport_libfc_priv
182+
* of a separately-allocated structure called fc_rport_priv. This will
183+
* be the primary object for the discovery and rport state machines.
184+
* This definition is just to make this patch series easier to review.
185+
*/
186+
#define fc_rport_priv fc_rport_libfc_priv
187+
180188
struct fc_rport_operations {
181189
void (*event_callback)(struct fc_lport *, struct fc_rport *,
182190
enum fc_rport_event);

0 commit comments

Comments
 (0)