aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_disc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libfc/fc_disc.c')
-rw-r--r--drivers/scsi/libfc/fc_disc.c63
1 files changed, 32 insertions, 31 deletions
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index dd1564c9e04a..e57556ea5b48 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -64,7 +64,7 @@ static void fc_disc_single(struct fc_disc *, struct fc_disc_port *);
64static void fc_disc_restart(struct fc_disc *); 64static void fc_disc_restart(struct fc_disc *);
65 65
66/** 66/**
67 * fc_disc_lookup_rport - lookup a remote port by port_id 67 * fc_disc_lookup_rport() - lookup a remote port by port_id
68 * @lport: Fibre Channel host port instance 68 * @lport: Fibre Channel host port instance
69 * @port_id: remote port port_id to match 69 * @port_id: remote port port_id to match
70 */ 70 */
@@ -92,7 +92,7 @@ struct fc_rport *fc_disc_lookup_rport(const struct fc_lport *lport,
92} 92}
93 93
94/** 94/**
95 * fc_disc_stop_rports - delete all the remote ports associated with the lport 95 * fc_disc_stop_rports() - delete all the remote ports associated with the lport
96 * @disc: The discovery job to stop rports on 96 * @disc: The discovery job to stop rports on
97 * 97 *
98 * Locking Note: This function expects that the lport mutex is locked before 98 * Locking Note: This function expects that the lport mutex is locked before
@@ -117,7 +117,7 @@ void fc_disc_stop_rports(struct fc_disc *disc)
117} 117}
118 118
119/** 119/**
120 * fc_disc_rport_callback - Event handler for rport events 120 * fc_disc_rport_callback() - Event handler for rport events
121 * @lport: The lport which is receiving the event 121 * @lport: The lport which is receiving the event
122 * @rport: The rport which the event has occured on 122 * @rport: The rport which the event has occured on
123 * @event: The event that occured 123 * @event: The event that occured
@@ -151,7 +151,7 @@ static void fc_disc_rport_callback(struct fc_lport *lport,
151} 151}
152 152
153/** 153/**
154 * fc_disc_recv_rscn_req - Handle Registered State Change Notification (RSCN) 154 * fc_disc_recv_rscn_req() - Handle Registered State Change Notification (RSCN)
155 * @sp: Current sequence of the RSCN exchange 155 * @sp: Current sequence of the RSCN exchange
156 * @fp: RSCN Frame 156 * @fp: RSCN Frame
157 * @lport: Fibre Channel host port instance 157 * @lport: Fibre Channel host port instance
@@ -246,7 +246,7 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp,
246 list_del(&dp->peers); 246 list_del(&dp->peers);
247 rport = lport->tt.rport_lookup(lport, dp->ids.port_id); 247 rport = lport->tt.rport_lookup(lport, dp->ids.port_id);
248 if (rport) { 248 if (rport) {
249 rdata = RPORT_TO_PRIV(rport); 249 rdata = rport->dd_data;
250 list_del(&rdata->peers); 250 list_del(&rdata->peers);
251 lport->tt.rport_logoff(rport); 251 lport->tt.rport_logoff(rport);
252 } 252 }
@@ -265,7 +265,7 @@ reject:
265} 265}
266 266
267/** 267/**
268 * fc_disc_recv_req - Handle incoming requests 268 * fc_disc_recv_req() - Handle incoming requests
269 * @sp: Current sequence of the request exchange 269 * @sp: Current sequence of the request exchange
270 * @fp: The frame 270 * @fp: The frame
271 * @lport: The FC local port 271 * @lport: The FC local port
@@ -294,7 +294,7 @@ static void fc_disc_recv_req(struct fc_seq *sp, struct fc_frame *fp,
294} 294}
295 295
296/** 296/**
297 * fc_disc_restart - Restart discovery 297 * fc_disc_restart() - Restart discovery
298 * @lport: FC discovery context 298 * @lport: FC discovery context
299 * 299 *
300 * Locking Note: This function expects that the disc mutex 300 * Locking Note: This function expects that the disc mutex
@@ -322,7 +322,7 @@ static void fc_disc_restart(struct fc_disc *disc)
322} 322}
323 323
324/** 324/**
325 * fc_disc_start - Fibre Channel Target discovery 325 * fc_disc_start() - Fibre Channel Target discovery
326 * @lport: FC local port 326 * @lport: FC local port
327 * 327 *
328 * Returns non-zero if discovery cannot be started. 328 * Returns non-zero if discovery cannot be started.
@@ -383,7 +383,7 @@ static struct fc_rport_operations fc_disc_rport_ops = {
383}; 383};
384 384
385/** 385/**
386 * fc_disc_new_target - Handle new target found by discovery 386 * fc_disc_new_target() - Handle new target found by discovery
387 * @lport: FC local port 387 * @lport: FC local port
388 * @rport: The previous FC remote port (NULL if new remote port) 388 * @rport: The previous FC remote port (NULL if new remote port)
389 * @ids: Identifiers for the new FC remote port 389 * @ids: Identifiers for the new FC remote port
@@ -396,7 +396,7 @@ static int fc_disc_new_target(struct fc_disc *disc,
396 struct fc_rport_identifiers *ids) 396 struct fc_rport_identifiers *ids)
397{ 397{
398 struct fc_lport *lport = disc->lport; 398 struct fc_lport *lport = disc->lport;
399 struct fc_rport_libfc_priv *rp; 399 struct fc_rport_libfc_priv *rdata;
400 int error = 0; 400 int error = 0;
401 401
402 if (rport && ids->port_name) { 402 if (rport && ids->port_name) {
@@ -430,15 +430,15 @@ static int fc_disc_new_target(struct fc_disc *disc,
430 dp.ids.port_name = ids->port_name; 430 dp.ids.port_name = ids->port_name;
431 dp.ids.node_name = ids->node_name; 431 dp.ids.node_name = ids->node_name;
432 dp.ids.roles = ids->roles; 432 dp.ids.roles = ids->roles;
433 rport = fc_rport_rogue_create(&dp); 433 rport = lport->tt.rport_create(&dp);
434 } 434 }
435 if (!rport) 435 if (!rport)
436 error = -ENOMEM; 436 error = -ENOMEM;
437 } 437 }
438 if (rport) { 438 if (rport) {
439 rp = rport->dd_data; 439 rdata = rport->dd_data;
440 rp->ops = &fc_disc_rport_ops; 440 rdata->ops = &fc_disc_rport_ops;
441 rp->rp_state = RPORT_ST_INIT; 441 rdata->rp_state = RPORT_ST_INIT;
442 lport->tt.rport_login(rport); 442 lport->tt.rport_login(rport);
443 } 443 }
444 } 444 }
@@ -446,20 +446,20 @@ static int fc_disc_new_target(struct fc_disc *disc,
446} 446}
447 447
448/** 448/**
449 * fc_disc_del_target - Delete a target 449 * fc_disc_del_target() - Delete a target
450 * @disc: FC discovery context 450 * @disc: FC discovery context
451 * @rport: The remote port to be removed 451 * @rport: The remote port to be removed
452 */ 452 */
453static void fc_disc_del_target(struct fc_disc *disc, struct fc_rport *rport) 453static void fc_disc_del_target(struct fc_disc *disc, struct fc_rport *rport)
454{ 454{
455 struct fc_lport *lport = disc->lport; 455 struct fc_lport *lport = disc->lport;
456 struct fc_rport_libfc_priv *rdata = RPORT_TO_PRIV(rport); 456 struct fc_rport_libfc_priv *rdata = rport->dd_data;
457 list_del(&rdata->peers); 457 list_del(&rdata->peers);
458 lport->tt.rport_logoff(rport); 458 lport->tt.rport_logoff(rport);
459} 459}
460 460
461/** 461/**
462 * fc_disc_done - Discovery has been completed 462 * fc_disc_done() - Discovery has been completed
463 * @disc: FC discovery context 463 * @disc: FC discovery context
464 */ 464 */
465static void fc_disc_done(struct fc_disc *disc) 465static void fc_disc_done(struct fc_disc *disc)
@@ -479,7 +479,7 @@ static void fc_disc_done(struct fc_disc *disc)
479} 479}
480 480
481/** 481/**
482 * fc_disc_error - Handle error on dNS request 482 * fc_disc_error() - Handle error on dNS request
483 * @disc: FC discovery context 483 * @disc: FC discovery context
484 * @fp: The frame pointer 484 * @fp: The frame pointer
485 */ 485 */
@@ -519,7 +519,7 @@ static void fc_disc_error(struct fc_disc *disc, struct fc_frame *fp)
519} 519}
520 520
521/** 521/**
522 * fc_disc_gpn_ft_req - Send Get Port Names by FC-4 type (GPN_FT) request 522 * fc_disc_gpn_ft_req() - Send Get Port Names by FC-4 type (GPN_FT) request
523 * @lport: FC discovery context 523 * @lport: FC discovery context
524 * 524 *
525 * Locking Note: This function expects that the disc_mutex is locked 525 * Locking Note: This function expects that the disc_mutex is locked
@@ -553,7 +553,7 @@ err:
553} 553}
554 554
555/** 555/**
556 * fc_disc_gpn_ft_parse - Parse the list of IDs and names resulting from a request 556 * fc_disc_gpn_ft_parse() - Parse the list of IDs and names resulting from a request
557 * @lport: Fibre Channel host port instance 557 * @lport: Fibre Channel host port instance
558 * @buf: GPN_FT response buffer 558 * @buf: GPN_FT response buffer
559 * @len: size of response buffer 559 * @len: size of response buffer
@@ -617,7 +617,7 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
617 617
618 if ((dp.ids.port_id != fc_host_port_id(lport->host)) && 618 if ((dp.ids.port_id != fc_host_port_id(lport->host)) &&
619 (dp.ids.port_name != lport->wwpn)) { 619 (dp.ids.port_name != lport->wwpn)) {
620 rport = fc_rport_rogue_create(&dp); 620 rport = lport->tt.rport_create(&dp);
621 if (rport) { 621 if (rport) {
622 rdata = rport->dd_data; 622 rdata = rport->dd_data;
623 rdata->ops = &fc_disc_rport_ops; 623 rdata->ops = &fc_disc_rport_ops;
@@ -658,7 +658,10 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
658 return error; 658 return error;
659} 659}
660 660
661/* 661/**
662 * fc_disc_timeout() - Retry handler for the disc component
663 * @work: Structure holding disc obj that needs retry discovery
664 *
662 * Handle retry of memory allocation for remote ports. 665 * Handle retry of memory allocation for remote ports.
663 */ 666 */
664static void fc_disc_timeout(struct work_struct *work) 667static void fc_disc_timeout(struct work_struct *work)
@@ -673,7 +676,7 @@ static void fc_disc_timeout(struct work_struct *work)
673} 676}
674 677
675/** 678/**
676 * fc_disc_gpn_ft_resp - Handle a response frame from Get Port Names (GPN_FT) 679 * fc_disc_gpn_ft_resp() - Handle a response frame from Get Port Names (GPN_FT)
677 * @sp: Current sequence of GPN_FT exchange 680 * @sp: Current sequence of GPN_FT exchange
678 * @fp: response frame 681 * @fp: response frame
679 * @lp_arg: Fibre Channel host port instance 682 * @lp_arg: Fibre Channel host port instance
@@ -712,9 +715,7 @@ static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
712 fr_len(fp)); 715 fr_len(fp));
713 } else if (ntohs(cp->ct_cmd) == FC_FS_ACC) { 716 } else if (ntohs(cp->ct_cmd) == FC_FS_ACC) {
714 717
715 /* 718 /* Accepted, parse the response. */
716 * Accepted. Parse response.
717 */
718 buf = cp + 1; 719 buf = cp + 1;
719 len -= sizeof(*cp); 720 len -= sizeof(*cp);
720 } else if (ntohs(cp->ct_cmd) == FC_FS_RJT) { 721 } else if (ntohs(cp->ct_cmd) == FC_FS_RJT) {
@@ -746,7 +747,7 @@ static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
746} 747}
747 748
748/** 749/**
749 * fc_disc_single - Discover the directory information for a single target 750 * fc_disc_single() - Discover the directory information for a single target
750 * @lport: FC local port 751 * @lport: FC local port
751 * @dp: The port to rediscover 752 * @dp: The port to rediscover
752 * 753 *
@@ -769,7 +770,7 @@ static void fc_disc_single(struct fc_disc *disc, struct fc_disc_port *dp)
769 if (rport) 770 if (rport)
770 fc_disc_del_target(disc, rport); 771 fc_disc_del_target(disc, rport);
771 772
772 new_rport = fc_rport_rogue_create(dp); 773 new_rport = lport->tt.rport_create(dp);
773 if (new_rport) { 774 if (new_rport) {
774 rdata = new_rport->dd_data; 775 rdata = new_rport->dd_data;
775 rdata->ops = &fc_disc_rport_ops; 776 rdata->ops = &fc_disc_rport_ops;
@@ -782,7 +783,7 @@ out:
782} 783}
783 784
784/** 785/**
785 * fc_disc_stop - Stop discovery for a given lport 786 * fc_disc_stop() - Stop discovery for a given lport
786 * @lport: The lport that discovery should stop for 787 * @lport: The lport that discovery should stop for
787 */ 788 */
788void fc_disc_stop(struct fc_lport *lport) 789void fc_disc_stop(struct fc_lport *lport)
@@ -796,7 +797,7 @@ void fc_disc_stop(struct fc_lport *lport)
796} 797}
797 798
798/** 799/**
799 * fc_disc_stop_final - Stop discovery for a given lport 800 * fc_disc_stop_final() - Stop discovery for a given lport
800 * @lport: The lport that discovery should stop for 801 * @lport: The lport that discovery should stop for
801 * 802 *
802 * This function will block until discovery has been 803 * This function will block until discovery has been
@@ -809,7 +810,7 @@ void fc_disc_stop_final(struct fc_lport *lport)
809} 810}
810 811
811/** 812/**
812 * fc_disc_init - Initialize the discovery block 813 * fc_disc_init() - Initialize the discovery block
813 * @lport: FC local port 814 * @lport: FC local port
814 */ 815 */
815int fc_disc_init(struct fc_lport *lport) 816int fc_disc_init(struct fc_lport *lport)