aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_fc.c
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2009-11-24 10:54:11 -0500
committerJames Bottomley <James.Bottomley@suse.de>2009-12-04 13:02:14 -0500
commitbd0072ecc449fb2ea8f6a2c9f6ff308f3ae0b078 (patch)
treed58dc3bbac4a7e5c7fa44c009c4946b091eb9a88 /drivers/s390/scsi/zfcp_fc.c
parentdbf5dfe9dbcecf159139eec25ad256738cbc3715 (diff)
[SCSI] zfcp: Move WKA port to zfcp FC code
The well-known-address (WKA) port handling code is part of the FC code in zfcp. Move everything WKA related to the zfcp_fc files and use the common zfcp_fc prefix for structs and functions. Drop the unused key management service while renaming the struct, no request could ever reach this service in zfcp and it is obsolete anyway. Reviewed-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi/zfcp_fc.c')
-rw-r--r--drivers/s390/scsi/zfcp_fc.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index 7c306a5ef4dd..d6d1e78ba0f9 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -28,25 +28,25 @@ struct zfcp_fc_ns_handler_data {
28 unsigned long handler_data; 28 unsigned long handler_data;
29}; 29};
30 30
31static int zfcp_fc_wka_port_get(struct zfcp_wka_port *wka_port) 31static int zfcp_fc_wka_port_get(struct zfcp_fc_wka_port *wka_port)
32{ 32{
33 if (mutex_lock_interruptible(&wka_port->mutex)) 33 if (mutex_lock_interruptible(&wka_port->mutex))
34 return -ERESTARTSYS; 34 return -ERESTARTSYS;
35 35
36 if (wka_port->status == ZFCP_WKA_PORT_OFFLINE || 36 if (wka_port->status == ZFCP_FC_WKA_PORT_OFFLINE ||
37 wka_port->status == ZFCP_WKA_PORT_CLOSING) { 37 wka_port->status == ZFCP_FC_WKA_PORT_CLOSING) {
38 wka_port->status = ZFCP_WKA_PORT_OPENING; 38 wka_port->status = ZFCP_FC_WKA_PORT_OPENING;
39 if (zfcp_fsf_open_wka_port(wka_port)) 39 if (zfcp_fsf_open_wka_port(wka_port))
40 wka_port->status = ZFCP_WKA_PORT_OFFLINE; 40 wka_port->status = ZFCP_FC_WKA_PORT_OFFLINE;
41 } 41 }
42 42
43 mutex_unlock(&wka_port->mutex); 43 mutex_unlock(&wka_port->mutex);
44 44
45 wait_event(wka_port->completion_wq, 45 wait_event(wka_port->completion_wq,
46 wka_port->status == ZFCP_WKA_PORT_ONLINE || 46 wka_port->status == ZFCP_FC_WKA_PORT_ONLINE ||
47 wka_port->status == ZFCP_WKA_PORT_OFFLINE); 47 wka_port->status == ZFCP_FC_WKA_PORT_OFFLINE);
48 48
49 if (wka_port->status == ZFCP_WKA_PORT_ONLINE) { 49 if (wka_port->status == ZFCP_FC_WKA_PORT_ONLINE) {
50 atomic_inc(&wka_port->refcount); 50 atomic_inc(&wka_port->refcount);
51 return 0; 51 return 0;
52 } 52 }
@@ -56,24 +56,24 @@ static int zfcp_fc_wka_port_get(struct zfcp_wka_port *wka_port)
56static void zfcp_fc_wka_port_offline(struct work_struct *work) 56static void zfcp_fc_wka_port_offline(struct work_struct *work)
57{ 57{
58 struct delayed_work *dw = to_delayed_work(work); 58 struct delayed_work *dw = to_delayed_work(work);
59 struct zfcp_wka_port *wka_port = 59 struct zfcp_fc_wka_port *wka_port =
60 container_of(dw, struct zfcp_wka_port, work); 60 container_of(dw, struct zfcp_fc_wka_port, work);
61 61
62 mutex_lock(&wka_port->mutex); 62 mutex_lock(&wka_port->mutex);
63 if ((atomic_read(&wka_port->refcount) != 0) || 63 if ((atomic_read(&wka_port->refcount) != 0) ||
64 (wka_port->status != ZFCP_WKA_PORT_ONLINE)) 64 (wka_port->status != ZFCP_FC_WKA_PORT_ONLINE))
65 goto out; 65 goto out;
66 66
67 wka_port->status = ZFCP_WKA_PORT_CLOSING; 67 wka_port->status = ZFCP_FC_WKA_PORT_CLOSING;
68 if (zfcp_fsf_close_wka_port(wka_port)) { 68 if (zfcp_fsf_close_wka_port(wka_port)) {
69 wka_port->status = ZFCP_WKA_PORT_OFFLINE; 69 wka_port->status = ZFCP_FC_WKA_PORT_OFFLINE;
70 wake_up(&wka_port->completion_wq); 70 wake_up(&wka_port->completion_wq);
71 } 71 }
72out: 72out:
73 mutex_unlock(&wka_port->mutex); 73 mutex_unlock(&wka_port->mutex);
74} 74}
75 75
76static void zfcp_fc_wka_port_put(struct zfcp_wka_port *wka_port) 76static void zfcp_fc_wka_port_put(struct zfcp_fc_wka_port *wka_port)
77{ 77{
78 if (atomic_dec_return(&wka_port->refcount) != 0) 78 if (atomic_dec_return(&wka_port->refcount) != 0)
79 return; 79 return;
@@ -81,7 +81,7 @@ static void zfcp_fc_wka_port_put(struct zfcp_wka_port *wka_port)
81 schedule_delayed_work(&wka_port->work, HZ / 100); 81 schedule_delayed_work(&wka_port->work, HZ / 100);
82} 82}
83 83
84static void zfcp_fc_wka_port_init(struct zfcp_wka_port *wka_port, u32 d_id, 84static void zfcp_fc_wka_port_init(struct zfcp_fc_wka_port *wka_port, u32 d_id,
85 struct zfcp_adapter *adapter) 85 struct zfcp_adapter *adapter)
86{ 86{
87 init_waitqueue_head(&wka_port->completion_wq); 87 init_waitqueue_head(&wka_port->completion_wq);
@@ -89,21 +89,21 @@ static void zfcp_fc_wka_port_init(struct zfcp_wka_port *wka_port, u32 d_id,
89 wka_port->adapter = adapter; 89 wka_port->adapter = adapter;
90 wka_port->d_id = d_id; 90 wka_port->d_id = d_id;
91 91
92 wka_port->status = ZFCP_WKA_PORT_OFFLINE; 92 wka_port->status = ZFCP_FC_WKA_PORT_OFFLINE;
93 atomic_set(&wka_port->refcount, 0); 93 atomic_set(&wka_port->refcount, 0);
94 mutex_init(&wka_port->mutex); 94 mutex_init(&wka_port->mutex);
95 INIT_DELAYED_WORK(&wka_port->work, zfcp_fc_wka_port_offline); 95 INIT_DELAYED_WORK(&wka_port->work, zfcp_fc_wka_port_offline);
96} 96}
97 97
98static void zfcp_fc_wka_port_force_offline(struct zfcp_wka_port *wka) 98static void zfcp_fc_wka_port_force_offline(struct zfcp_fc_wka_port *wka)
99{ 99{
100 cancel_delayed_work_sync(&wka->work); 100 cancel_delayed_work_sync(&wka->work);
101 mutex_lock(&wka->mutex); 101 mutex_lock(&wka->mutex);
102 wka->status = ZFCP_WKA_PORT_OFFLINE; 102 wka->status = ZFCP_FC_WKA_PORT_OFFLINE;
103 mutex_unlock(&wka->mutex); 103 mutex_unlock(&wka->mutex);
104} 104}
105 105
106void zfcp_fc_wka_ports_force_offline(struct zfcp_wka_ports *gs) 106void zfcp_fc_wka_ports_force_offline(struct zfcp_fc_wka_ports *gs)
107{ 107{
108 if (!gs) 108 if (!gs)
109 return; 109 return;
@@ -111,7 +111,6 @@ void zfcp_fc_wka_ports_force_offline(struct zfcp_wka_ports *gs)
111 zfcp_fc_wka_port_force_offline(&gs->ts); 111 zfcp_fc_wka_port_force_offline(&gs->ts);
112 zfcp_fc_wka_port_force_offline(&gs->ds); 112 zfcp_fc_wka_port_force_offline(&gs->ds);
113 zfcp_fc_wka_port_force_offline(&gs->as); 113 zfcp_fc_wka_port_force_offline(&gs->as);
114 zfcp_fc_wka_port_force_offline(&gs->ks);
115} 114}
116 115
117static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range, 116static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range,
@@ -834,9 +833,9 @@ int zfcp_fc_execute_ct_fc_job(struct fc_bsg_job *job)
834 833
835int zfcp_fc_gs_setup(struct zfcp_adapter *adapter) 834int zfcp_fc_gs_setup(struct zfcp_adapter *adapter)
836{ 835{
837 struct zfcp_wka_ports *wka_ports; 836 struct zfcp_fc_wka_ports *wka_ports;
838 837
839 wka_ports = kzalloc(sizeof(struct zfcp_wka_ports), GFP_KERNEL); 838 wka_ports = kzalloc(sizeof(struct zfcp_fc_wka_ports), GFP_KERNEL);
840 if (!wka_ports) 839 if (!wka_ports)
841 return -ENOMEM; 840 return -ENOMEM;
842 841
@@ -845,7 +844,6 @@ int zfcp_fc_gs_setup(struct zfcp_adapter *adapter)
845 zfcp_fc_wka_port_init(&wka_ports->ts, FC_FID_TIME_SERV, adapter); 844 zfcp_fc_wka_port_init(&wka_ports->ts, FC_FID_TIME_SERV, adapter);
846 zfcp_fc_wka_port_init(&wka_ports->ds, FC_FID_DIR_SERV, adapter); 845 zfcp_fc_wka_port_init(&wka_ports->ds, FC_FID_DIR_SERV, adapter);
847 zfcp_fc_wka_port_init(&wka_ports->as, FC_FID_ALIASES, adapter); 846 zfcp_fc_wka_port_init(&wka_ports->as, FC_FID_ALIASES, adapter);
848 zfcp_fc_wka_port_init(&wka_ports->ks, FC_FID_SEC_KEY, adapter);
849 847
850 return 0; 848 return 0;
851} 849}