aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_transport_fc.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-11-03 14:30:39 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-11 19:22:40 -0500
commiteb44820c28bc9a042e1157b41c677018a8fdfc74 (patch)
treede027b3cd40533488805ef7ee8156f077cd2b7e5 /drivers/scsi/scsi_transport_fc.c
parent3f48985823001c89c9bd5c5e57cc07530578dfcc (diff)
[SCSI] Add Documentation and integrate into docbook build
Add Documentation/DocBook/scsi_midlayer.tmpl, add to Makefile, and update lots of kerneldoc comments in drivers/scsi/*. Updated with comments from Stefan Richter, Stephen M. Cameron, James Bottomley and Randy Dunlap. Signed-off-by: Rob Landley <rob@landley.net> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_fc.c')
-rw-r--r--drivers/scsi/scsi_transport_fc.c102
1 files changed, 46 insertions, 56 deletions
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 7a7cfe583b2a..b1119da6e88c 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -481,9 +481,9 @@ MODULE_PARM_DESC(dev_loss_tmo,
481 " exceeded, the scsi target is removed. Value should be" 481 " exceeded, the scsi target is removed. Value should be"
482 " between 1 and SCSI_DEVICE_BLOCK_MAX_TIMEOUT."); 482 " between 1 and SCSI_DEVICE_BLOCK_MAX_TIMEOUT.");
483 483
484/** 484/*
485 * Netlink Infrastructure 485 * Netlink Infrastructure
486 **/ 486 */
487 487
488static atomic_t fc_event_seq; 488static atomic_t fc_event_seq;
489 489
@@ -491,10 +491,10 @@ static atomic_t fc_event_seq;
491 * fc_get_event_number - Obtain the next sequential FC event number 491 * fc_get_event_number - Obtain the next sequential FC event number
492 * 492 *
493 * Notes: 493 * Notes:
494 * We could have inline'd this, but it would have required fc_event_seq to 494 * We could have inlined this, but it would have required fc_event_seq to
495 * be exposed. For now, live with the subroutine call. 495 * be exposed. For now, live with the subroutine call.
496 * Atomic used to avoid lock/unlock... 496 * Atomic used to avoid lock/unlock...
497 **/ 497 */
498u32 498u32
499fc_get_event_number(void) 499fc_get_event_number(void)
500{ 500{
@@ -505,7 +505,6 @@ EXPORT_SYMBOL(fc_get_event_number);
505 505
506/** 506/**
507 * fc_host_post_event - called to post an even on an fc_host. 507 * fc_host_post_event - called to post an even on an fc_host.
508 *
509 * @shost: host the event occurred on 508 * @shost: host the event occurred on
510 * @event_number: fc event number obtained from get_fc_event_number() 509 * @event_number: fc event number obtained from get_fc_event_number()
511 * @event_code: fc_host event being posted 510 * @event_code: fc_host event being posted
@@ -513,7 +512,7 @@ EXPORT_SYMBOL(fc_get_event_number);
513 * 512 *
514 * Notes: 513 * Notes:
515 * This routine assumes no locks are held on entry. 514 * This routine assumes no locks are held on entry.
516 **/ 515 */
517void 516void
518fc_host_post_event(struct Scsi_Host *shost, u32 event_number, 517fc_host_post_event(struct Scsi_Host *shost, u32 event_number,
519 enum fc_host_event_code event_code, u32 event_data) 518 enum fc_host_event_code event_code, u32 event_data)
@@ -579,17 +578,16 @@ EXPORT_SYMBOL(fc_host_post_event);
579 578
580 579
581/** 580/**
582 * fc_host_post_vendor_event - called to post a vendor unique event on 581 * fc_host_post_vendor_event - called to post a vendor unique event on an fc_host
583 * a fc_host
584 *
585 * @shost: host the event occurred on 582 * @shost: host the event occurred on
586 * @event_number: fc event number obtained from get_fc_event_number() 583 * @event_number: fc event number obtained from get_fc_event_number()
587 * @data_len: amount, in bytes, of vendor unique data 584 * @data_len: amount, in bytes, of vendor unique data
588 * @data_buf: pointer to vendor unique data 585 * @data_buf: pointer to vendor unique data
586 * @vendor_id: Vendor id
589 * 587 *
590 * Notes: 588 * Notes:
591 * This routine assumes no locks are held on entry. 589 * This routine assumes no locks are held on entry.
592 **/ 590 */
593void 591void
594fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number, 592fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
595 u32 data_len, char * data_buf, u64 vendor_id) 593 u32 data_len, char * data_buf, u64 vendor_id)
@@ -1900,7 +1898,6 @@ static int fc_vport_match(struct attribute_container *cont,
1900 1898
1901/** 1899/**
1902 * fc_timed_out - FC Transport I/O timeout intercept handler 1900 * fc_timed_out - FC Transport I/O timeout intercept handler
1903 *
1904 * @scmd: The SCSI command which timed out 1901 * @scmd: The SCSI command which timed out
1905 * 1902 *
1906 * This routine protects against error handlers getting invoked while a 1903 * This routine protects against error handlers getting invoked while a
@@ -1920,7 +1917,7 @@ static int fc_vport_match(struct attribute_container *cont,
1920 * 1917 *
1921 * Notes: 1918 * Notes:
1922 * This routine assumes no locks are held on entry. 1919 * This routine assumes no locks are held on entry.
1923 **/ 1920 */
1924static enum scsi_eh_timer_return 1921static enum scsi_eh_timer_return
1925fc_timed_out(struct scsi_cmnd *scmd) 1922fc_timed_out(struct scsi_cmnd *scmd)
1926{ 1923{
@@ -2133,7 +2130,7 @@ EXPORT_SYMBOL(fc_release_transport);
2133 * 1 - work queued for execution 2130 * 1 - work queued for execution
2134 * 0 - work is already queued 2131 * 0 - work is already queued
2135 * -EINVAL - work queue doesn't exist 2132 * -EINVAL - work queue doesn't exist
2136 **/ 2133 */
2137static int 2134static int
2138fc_queue_work(struct Scsi_Host *shost, struct work_struct *work) 2135fc_queue_work(struct Scsi_Host *shost, struct work_struct *work)
2139{ 2136{
@@ -2152,7 +2149,7 @@ fc_queue_work(struct Scsi_Host *shost, struct work_struct *work)
2152/** 2149/**
2153 * fc_flush_work - Flush a fc_host's workqueue. 2150 * fc_flush_work - Flush a fc_host's workqueue.
2154 * @shost: Pointer to Scsi_Host bound to fc_host. 2151 * @shost: Pointer to Scsi_Host bound to fc_host.
2155 **/ 2152 */
2156static void 2153static void
2157fc_flush_work(struct Scsi_Host *shost) 2154fc_flush_work(struct Scsi_Host *shost)
2158{ 2155{
@@ -2175,7 +2172,7 @@ fc_flush_work(struct Scsi_Host *shost)
2175 * 2172 *
2176 * Return value: 2173 * Return value:
2177 * 1 on success / 0 already queued / < 0 for error 2174 * 1 on success / 0 already queued / < 0 for error
2178 **/ 2175 */
2179static int 2176static int
2180fc_queue_devloss_work(struct Scsi_Host *shost, struct delayed_work *work, 2177fc_queue_devloss_work(struct Scsi_Host *shost, struct delayed_work *work,
2181 unsigned long delay) 2178 unsigned long delay)
@@ -2195,7 +2192,7 @@ fc_queue_devloss_work(struct Scsi_Host *shost, struct delayed_work *work,
2195/** 2192/**
2196 * fc_flush_devloss - Flush a fc_host's devloss workqueue. 2193 * fc_flush_devloss - Flush a fc_host's devloss workqueue.
2197 * @shost: Pointer to Scsi_Host bound to fc_host. 2194 * @shost: Pointer to Scsi_Host bound to fc_host.
2198 **/ 2195 */
2199static void 2196static void
2200fc_flush_devloss(struct Scsi_Host *shost) 2197fc_flush_devloss(struct Scsi_Host *shost)
2201{ 2198{
@@ -2212,21 +2209,20 @@ fc_flush_devloss(struct Scsi_Host *shost)
2212 2209
2213 2210
2214/** 2211/**
2215 * fc_remove_host - called to terminate any fc_transport-related elements 2212 * fc_remove_host - called to terminate any fc_transport-related elements for a scsi host.
2216 * for a scsi host. 2213 * @shost: Which &Scsi_Host
2217 * @rport: remote port to be unblocked.
2218 * 2214 *
2219 * This routine is expected to be called immediately preceeding the 2215 * This routine is expected to be called immediately preceeding the
2220 * a driver's call to scsi_remove_host(). 2216 * a driver's call to scsi_remove_host().
2221 * 2217 *
2222 * WARNING: A driver utilizing the fc_transport, which fails to call 2218 * WARNING: A driver utilizing the fc_transport, which fails to call
2223 * this routine prior to scsi_remote_host(), will leave dangling 2219 * this routine prior to scsi_remove_host(), will leave dangling
2224 * objects in /sys/class/fc_remote_ports. Access to any of these 2220 * objects in /sys/class/fc_remote_ports. Access to any of these
2225 * objects can result in a system crash !!! 2221 * objects can result in a system crash !!!
2226 * 2222 *
2227 * Notes: 2223 * Notes:
2228 * This routine assumes no locks are held on entry. 2224 * This routine assumes no locks are held on entry.
2229 **/ 2225 */
2230void 2226void
2231fc_remove_host(struct Scsi_Host *shost) 2227fc_remove_host(struct Scsi_Host *shost)
2232{ 2228{
@@ -2281,10 +2277,10 @@ EXPORT_SYMBOL(fc_remove_host);
2281 2277
2282/** 2278/**
2283 * fc_starget_delete - called to delete the scsi decendents of an rport 2279 * fc_starget_delete - called to delete the scsi decendents of an rport
2284 * (target and all sdevs)
2285 *
2286 * @work: remote port to be operated on. 2280 * @work: remote port to be operated on.
2287 **/ 2281 *
2282 * Deletes target and all sdevs.
2283 */
2288static void 2284static void
2289fc_starget_delete(struct work_struct *work) 2285fc_starget_delete(struct work_struct *work)
2290{ 2286{
@@ -2303,9 +2299,8 @@ fc_starget_delete(struct work_struct *work)
2303 2299
2304/** 2300/**
2305 * fc_rport_final_delete - finish rport termination and delete it. 2301 * fc_rport_final_delete - finish rport termination and delete it.
2306 *
2307 * @work: remote port to be deleted. 2302 * @work: remote port to be deleted.
2308 **/ 2303 */
2309static void 2304static void
2310fc_rport_final_delete(struct work_struct *work) 2305fc_rport_final_delete(struct work_struct *work)
2311{ 2306{
@@ -2375,7 +2370,7 @@ fc_rport_final_delete(struct work_struct *work)
2375 * 2370 *
2376 * Notes: 2371 * Notes:
2377 * This routine assumes no locks are held on entry. 2372 * This routine assumes no locks are held on entry.
2378 **/ 2373 */
2379static struct fc_rport * 2374static struct fc_rport *
2380fc_rport_create(struct Scsi_Host *shost, int channel, 2375fc_rport_create(struct Scsi_Host *shost, int channel,
2381 struct fc_rport_identifiers *ids) 2376 struct fc_rport_identifiers *ids)
@@ -2462,8 +2457,7 @@ delete_rport:
2462} 2457}
2463 2458
2464/** 2459/**
2465 * fc_remote_port_add - notifies the fc transport of the existence 2460 * fc_remote_port_add - notify fc transport of the existence of a remote FC port.
2466 * of a remote FC port.
2467 * @shost: scsi host the remote port is connected to. 2461 * @shost: scsi host the remote port is connected to.
2468 * @channel: Channel on shost port connected to. 2462 * @channel: Channel on shost port connected to.
2469 * @ids: The world wide names, fc address, and FC4 port 2463 * @ids: The world wide names, fc address, and FC4 port
@@ -2499,7 +2493,7 @@ delete_rport:
2499 * 2493 *
2500 * Notes: 2494 * Notes:
2501 * This routine assumes no locks are held on entry. 2495 * This routine assumes no locks are held on entry.
2502 **/ 2496 */
2503struct fc_rport * 2497struct fc_rport *
2504fc_remote_port_add(struct Scsi_Host *shost, int channel, 2498fc_remote_port_add(struct Scsi_Host *shost, int channel,
2505 struct fc_rport_identifiers *ids) 2499 struct fc_rport_identifiers *ids)
@@ -2683,19 +2677,18 @@ EXPORT_SYMBOL(fc_remote_port_add);
2683 2677
2684 2678
2685/** 2679/**
2686 * fc_remote_port_delete - notifies the fc transport that a remote 2680 * fc_remote_port_delete - notifies the fc transport that a remote port is no longer in existence.
2687 * port is no longer in existence.
2688 * @rport: The remote port that no longer exists 2681 * @rport: The remote port that no longer exists
2689 * 2682 *
2690 * The LLDD calls this routine to notify the transport that a remote 2683 * The LLDD calls this routine to notify the transport that a remote
2691 * port is no longer part of the topology. Note: Although a port 2684 * port is no longer part of the topology. Note: Although a port
2692 * may no longer be part of the topology, it may persist in the remote 2685 * may no longer be part of the topology, it may persist in the remote
2693 * ports displayed by the fc_host. We do this under 2 conditions: 2686 * ports displayed by the fc_host. We do this under 2 conditions:
2694 * - If the port was a scsi target, we delay its deletion by "blocking" it. 2687 * 1) If the port was a scsi target, we delay its deletion by "blocking" it.
2695 * This allows the port to temporarily disappear, then reappear without 2688 * This allows the port to temporarily disappear, then reappear without
2696 * disrupting the SCSI device tree attached to it. During the "blocked" 2689 * disrupting the SCSI device tree attached to it. During the "blocked"
2697 * period the port will still exist. 2690 * period the port will still exist.
2698 * - If the port was a scsi target and disappears for longer than we 2691 * 2) If the port was a scsi target and disappears for longer than we
2699 * expect, we'll delete the port and the tear down the SCSI device tree 2692 * expect, we'll delete the port and the tear down the SCSI device tree
2700 * attached to it. However, we want to semi-persist the target id assigned 2693 * attached to it. However, we want to semi-persist the target id assigned
2701 * to that port if it eventually does exist. The port structure will 2694 * to that port if it eventually does exist. The port structure will
@@ -2709,7 +2702,8 @@ EXPORT_SYMBOL(fc_remote_port_add);
2709 * temporary blocked state. From the LLDD's perspective, the rport no 2702 * temporary blocked state. From the LLDD's perspective, the rport no
2710 * longer exists. From the SCSI midlayer's perspective, the SCSI target 2703 * longer exists. From the SCSI midlayer's perspective, the SCSI target
2711 * exists, but all sdevs on it are blocked from further I/O. The following 2704 * exists, but all sdevs on it are blocked from further I/O. The following
2712 * is then expected: 2705 * is then expected.
2706 *
2713 * If the remote port does not return (signaled by a LLDD call to 2707 * If the remote port does not return (signaled by a LLDD call to
2714 * fc_remote_port_add()) within the dev_loss_tmo timeout, then the 2708 * fc_remote_port_add()) within the dev_loss_tmo timeout, then the
2715 * scsi target is removed - killing all outstanding i/o and removing the 2709 * scsi target is removed - killing all outstanding i/o and removing the
@@ -2731,7 +2725,7 @@ EXPORT_SYMBOL(fc_remote_port_add);
2731 * 2725 *
2732 * Notes: 2726 * Notes:
2733 * This routine assumes no locks are held on entry. 2727 * This routine assumes no locks are held on entry.
2734 **/ 2728 */
2735void 2729void
2736fc_remote_port_delete(struct fc_rport *rport) 2730fc_remote_port_delete(struct fc_rport *rport)
2737{ 2731{
@@ -2792,12 +2786,12 @@ fc_remote_port_delete(struct fc_rport *rport)
2792EXPORT_SYMBOL(fc_remote_port_delete); 2786EXPORT_SYMBOL(fc_remote_port_delete);
2793 2787
2794/** 2788/**
2795 * fc_remote_port_rolechg - notifies the fc transport that the roles 2789 * fc_remote_port_rolechg - notifies the fc transport that the roles on a remote may have changed.
2796 * on a remote may have changed.
2797 * @rport: The remote port that changed. 2790 * @rport: The remote port that changed.
2791 * @roles: New roles for this port.
2798 * 2792 *
2799 * The LLDD calls this routine to notify the transport that the roles 2793 * Description: The LLDD calls this routine to notify the transport that the
2800 * on a remote port may have changed. The largest effect of this is 2794 * roles on a remote port may have changed. The largest effect of this is
2801 * if a port now becomes a FCP Target, it must be allocated a 2795 * if a port now becomes a FCP Target, it must be allocated a
2802 * scsi target id. If the port is no longer a FCP target, any 2796 * scsi target id. If the port is no longer a FCP target, any
2803 * scsi target id value assigned to it will persist in case the 2797 * scsi target id value assigned to it will persist in case the
@@ -2810,7 +2804,7 @@ EXPORT_SYMBOL(fc_remote_port_delete);
2810 * 2804 *
2811 * Notes: 2805 * Notes:
2812 * This routine assumes no locks are held on entry. 2806 * This routine assumes no locks are held on entry.
2813 **/ 2807 */
2814void 2808void
2815fc_remote_port_rolechg(struct fc_rport *rport, u32 roles) 2809fc_remote_port_rolechg(struct fc_rport *rport, u32 roles)
2816{ 2810{
@@ -2875,12 +2869,12 @@ fc_remote_port_rolechg(struct fc_rport *rport, u32 roles)
2875EXPORT_SYMBOL(fc_remote_port_rolechg); 2869EXPORT_SYMBOL(fc_remote_port_rolechg);
2876 2870
2877/** 2871/**
2878 * fc_timeout_deleted_rport - Timeout handler for a deleted remote port, 2872 * fc_timeout_deleted_rport - Timeout handler for a deleted remote port.
2879 * which we blocked, and has now failed to return
2880 * in the allotted time.
2881 *
2882 * @work: rport target that failed to reappear in the allotted time. 2873 * @work: rport target that failed to reappear in the allotted time.
2883 **/ 2874 *
2875 * Description: An attempt to delete a remote port blocks, and if it fails
2876 * to return in the allotted time this gets called.
2877 */
2884static void 2878static void
2885fc_timeout_deleted_rport(struct work_struct *work) 2879fc_timeout_deleted_rport(struct work_struct *work)
2886{ 2880{
@@ -2984,14 +2978,12 @@ fc_timeout_deleted_rport(struct work_struct *work)
2984} 2978}
2985 2979
2986/** 2980/**
2987 * fc_timeout_fail_rport_io - Timeout handler for a fast io failing on a 2981 * fc_timeout_fail_rport_io - Timeout handler for a fast io failing on a disconnected SCSI target.
2988 * disconnected SCSI target.
2989 *
2990 * @work: rport to terminate io on. 2982 * @work: rport to terminate io on.
2991 * 2983 *
2992 * Notes: Only requests the failure of the io, not that all are flushed 2984 * Notes: Only requests the failure of the io, not that all are flushed
2993 * prior to returning. 2985 * prior to returning.
2994 **/ 2986 */
2995static void 2987static void
2996fc_timeout_fail_rport_io(struct work_struct *work) 2988fc_timeout_fail_rport_io(struct work_struct *work)
2997{ 2989{
@@ -3008,9 +3000,8 @@ fc_timeout_fail_rport_io(struct work_struct *work)
3008 3000
3009/** 3001/**
3010 * fc_scsi_scan_rport - called to perform a scsi scan on a remote port. 3002 * fc_scsi_scan_rport - called to perform a scsi scan on a remote port.
3011 *
3012 * @work: remote port to be scanned. 3003 * @work: remote port to be scanned.
3013 **/ 3004 */
3014static void 3005static void
3015fc_scsi_scan_rport(struct work_struct *work) 3006fc_scsi_scan_rport(struct work_struct *work)
3016{ 3007{
@@ -3047,7 +3038,7 @@ fc_scsi_scan_rport(struct work_struct *work)
3047 * 3038 *
3048 * Notes: 3039 * Notes:
3049 * This routine assumes no locks are held on entry. 3040 * This routine assumes no locks are held on entry.
3050 **/ 3041 */
3051static int 3042static int
3052fc_vport_create(struct Scsi_Host *shost, int channel, struct device *pdev, 3043fc_vport_create(struct Scsi_Host *shost, int channel, struct device *pdev,
3053 struct fc_vport_identifiers *ids, struct fc_vport **ret_vport) 3044 struct fc_vport_identifiers *ids, struct fc_vport **ret_vport)
@@ -3172,7 +3163,7 @@ delete_vport:
3172 * 3163 *
3173 * Notes: 3164 * Notes:
3174 * This routine assumes no locks are held on entry. 3165 * This routine assumes no locks are held on entry.
3175 **/ 3166 */
3176int 3167int
3177fc_vport_terminate(struct fc_vport *vport) 3168fc_vport_terminate(struct fc_vport *vport)
3178{ 3169{
@@ -3232,9 +3223,8 @@ EXPORT_SYMBOL(fc_vport_terminate);
3232 3223
3233/** 3224/**
3234 * fc_vport_sched_delete - workq-based delete request for a vport 3225 * fc_vport_sched_delete - workq-based delete request for a vport
3235 *
3236 * @work: vport to be deleted. 3226 * @work: vport to be deleted.
3237 **/ 3227 */
3238static void 3228static void
3239fc_vport_sched_delete(struct work_struct *work) 3229fc_vport_sched_delete(struct work_struct *work)
3240{ 3230{