aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2011-02-16 16:04:38 -0500
committerJames Bottomley <James.Bottomley@suse.de>2011-02-24 12:41:15 -0500
commitc71b9b669e1243623f7ed4332877d3f2beafc6ab (patch)
treeeb288d3cd92fe124ec5263dd6f3b0aa49dd238b9
parent289324b0c6007171d67bf1ab0827355ae3374773 (diff)
[SCSI] cxgbi: convert to use iscsi_conn_get_addr_param
This has cxgbi use the iscsi_conn_get_addr_param helper and the get ep callback. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/scsi/cxgbi/cxgb3i/cxgb3i.c3
-rw-r--r--drivers/scsi/cxgbi/cxgb4i/cxgb4i.c3
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c36
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.h2
-rw-r--r--include/scsi/libiscsi.h6
5 files changed, 22 insertions, 28 deletions
diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index 69a6769c633e..fc2cdb62f53b 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -137,7 +137,7 @@ static struct iscsi_transport cxgb3i_iscsi_transport = {
137 .destroy_conn = iscsi_tcp_conn_teardown, 137 .destroy_conn = iscsi_tcp_conn_teardown,
138 .start_conn = iscsi_conn_start, 138 .start_conn = iscsi_conn_start,
139 .stop_conn = iscsi_conn_stop, 139 .stop_conn = iscsi_conn_stop,
140 .get_conn_param = cxgbi_get_conn_param, 140 .get_conn_param = iscsi_conn_get_param,
141 .set_param = cxgbi_set_conn_param, 141 .set_param = cxgbi_set_conn_param,
142 .get_stats = cxgbi_get_conn_stats, 142 .get_stats = cxgbi_get_conn_stats,
143 /* pdu xmit req from user space */ 143 /* pdu xmit req from user space */
@@ -152,6 +152,7 @@ static struct iscsi_transport cxgb3i_iscsi_transport = {
152 .xmit_pdu = cxgbi_conn_xmit_pdu, 152 .xmit_pdu = cxgbi_conn_xmit_pdu,
153 .parse_pdu_itt = cxgbi_parse_pdu_itt, 153 .parse_pdu_itt = cxgbi_parse_pdu_itt,
154 /* TCP connect/disconnect */ 154 /* TCP connect/disconnect */
155 .get_ep_param = cxgbi_get_ep_param,
155 .ep_connect = cxgbi_ep_connect, 156 .ep_connect = cxgbi_ep_connect,
156 .ep_poll = cxgbi_ep_poll, 157 .ep_poll = cxgbi_ep_poll,
157 .ep_disconnect = cxgbi_ep_disconnect, 158 .ep_disconnect = cxgbi_ep_disconnect,
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 719aa71f5b10..f3a4cd7cf782 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -138,7 +138,7 @@ static struct iscsi_transport cxgb4i_iscsi_transport = {
138 .destroy_conn = iscsi_tcp_conn_teardown, 138 .destroy_conn = iscsi_tcp_conn_teardown,
139 .start_conn = iscsi_conn_start, 139 .start_conn = iscsi_conn_start,
140 .stop_conn = iscsi_conn_stop, 140 .stop_conn = iscsi_conn_stop,
141 .get_conn_param = cxgbi_get_conn_param, 141 .get_conn_param = iscsi_conn_get_param,
142 .set_param = cxgbi_set_conn_param, 142 .set_param = cxgbi_set_conn_param,
143 .get_stats = cxgbi_get_conn_stats, 143 .get_stats = cxgbi_get_conn_stats,
144 /* pdu xmit req from user space */ 144 /* pdu xmit req from user space */
@@ -153,6 +153,7 @@ static struct iscsi_transport cxgb4i_iscsi_transport = {
153 .xmit_pdu = cxgbi_conn_xmit_pdu, 153 .xmit_pdu = cxgbi_conn_xmit_pdu,
154 .parse_pdu_itt = cxgbi_parse_pdu_itt, 154 .parse_pdu_itt = cxgbi_parse_pdu_itt,
155 /* TCP connect/disconnect */ 155 /* TCP connect/disconnect */
156 .get_ep_param = cxgbi_get_ep_param,
156 .ep_connect = cxgbi_ep_connect, 157 .ep_connect = cxgbi_ep_connect,
157 .ep_poll = cxgbi_ep_poll, 158 .ep_poll = cxgbi_ep_poll,
158 .ep_disconnect = cxgbi_ep_disconnect, 159 .ep_disconnect = cxgbi_ep_disconnect,
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index b2acdef3dcb7..fedf1be278ff 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -543,6 +543,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
543 csk->dst = dst; 543 csk->dst = dst;
544 csk->daddr.sin_addr.s_addr = daddr->sin_addr.s_addr; 544 csk->daddr.sin_addr.s_addr = daddr->sin_addr.s_addr;
545 csk->daddr.sin_port = daddr->sin_port; 545 csk->daddr.sin_port = daddr->sin_port;
546 csk->daddr.sin_family = daddr->sin_family;
546 csk->saddr.sin_addr.s_addr = rt->rt_src; 547 csk->saddr.sin_addr.s_addr = rt->rt_src;
547 548
548 return csk; 549 return csk;
@@ -2200,32 +2201,34 @@ int cxgbi_set_conn_param(struct iscsi_cls_conn *cls_conn,
2200} 2201}
2201EXPORT_SYMBOL_GPL(cxgbi_set_conn_param); 2202EXPORT_SYMBOL_GPL(cxgbi_set_conn_param);
2202 2203
2203int cxgbi_get_conn_param(struct iscsi_cls_conn *cls_conn, 2204int cxgbi_get_ep_param(struct iscsi_endpoint *ep, enum iscsi_param param,
2204 enum iscsi_param param, char *buf) 2205 char *buf)
2205{ 2206{
2206 struct iscsi_conn *iconn = cls_conn->dd_data; 2207 struct cxgbi_endpoint *cep = ep->dd_data;
2208 struct cxgbi_sock *csk;
2207 int len; 2209 int len;
2208 2210
2209 log_debug(1 << CXGBI_DBG_ISCSI, 2211 log_debug(1 << CXGBI_DBG_ISCSI,
2210 "cls_conn 0x%p, param %d.\n", cls_conn, param); 2212 "cls_conn 0x%p, param %d.\n", ep, param);
2211 2213
2212 switch (param) { 2214 switch (param) {
2213 case ISCSI_PARAM_CONN_PORT: 2215 case ISCSI_PARAM_CONN_PORT:
2214 spin_lock_bh(&iconn->session->lock);
2215 len = sprintf(buf, "%hu\n", iconn->portal_port);
2216 spin_unlock_bh(&iconn->session->lock);
2217 break;
2218 case ISCSI_PARAM_CONN_ADDRESS: 2216 case ISCSI_PARAM_CONN_ADDRESS:
2219 spin_lock_bh(&iconn->session->lock); 2217 if (!cep)
2220 len = sprintf(buf, "%s\n", iconn->portal_address); 2218 return -ENOTCONN;
2221 spin_unlock_bh(&iconn->session->lock); 2219
2222 break; 2220 csk = cep->csk;
2221 if (!csk)
2222 return -ENOTCONN;
2223
2224 return iscsi_conn_get_addr_param((struct sockaddr_storage *)
2225 &csk->daddr, param, buf);
2223 default: 2226 default:
2224 return iscsi_conn_get_param(cls_conn, param, buf); 2227 return -ENOSYS;
2225 } 2228 }
2226 return len; 2229 return len;
2227} 2230}
2228EXPORT_SYMBOL_GPL(cxgbi_get_conn_param); 2231EXPORT_SYMBOL_GPL(cxgbi_get_ep_param);
2229 2232
2230struct iscsi_cls_conn * 2233struct iscsi_cls_conn *
2231cxgbi_create_conn(struct iscsi_cls_session *cls_session, u32 cid) 2234cxgbi_create_conn(struct iscsi_cls_session *cls_session, u32 cid)
@@ -2292,11 +2295,6 @@ int cxgbi_bind_conn(struct iscsi_cls_session *cls_session,
2292 cxgbi_conn_max_xmit_dlength(conn); 2295 cxgbi_conn_max_xmit_dlength(conn);
2293 cxgbi_conn_max_recv_dlength(conn); 2296 cxgbi_conn_max_recv_dlength(conn);
2294 2297
2295 spin_lock_bh(&conn->session->lock);
2296 sprintf(conn->portal_address, "%pI4", &csk->daddr.sin_addr.s_addr);
2297 conn->portal_port = ntohs(csk->daddr.sin_port);
2298 spin_unlock_bh(&conn->session->lock);
2299
2300 log_debug(1 << CXGBI_DBG_ISCSI, 2298 log_debug(1 << CXGBI_DBG_ISCSI,
2301 "cls 0x%p,0x%p, ep 0x%p, cconn 0x%p, csk 0x%p.\n", 2299 "cls 0x%p,0x%p, ep 0x%p, cconn 0x%p, csk 0x%p.\n",
2302 cls_session, cls_conn, ep, cconn, csk); 2300 cls_session, cls_conn, ep, cconn, csk);
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h
index 23cbc5854503..0a20fd5f7102 100644
--- a/drivers/scsi/cxgbi/libcxgbi.h
+++ b/drivers/scsi/cxgbi/libcxgbi.h
@@ -712,7 +712,7 @@ void cxgbi_cleanup_task(struct iscsi_task *task);
712void cxgbi_get_conn_stats(struct iscsi_cls_conn *, struct iscsi_stats *); 712void cxgbi_get_conn_stats(struct iscsi_cls_conn *, struct iscsi_stats *);
713int cxgbi_set_conn_param(struct iscsi_cls_conn *, 713int cxgbi_set_conn_param(struct iscsi_cls_conn *,
714 enum iscsi_param, char *, int); 714 enum iscsi_param, char *, int);
715int cxgbi_get_conn_param(struct iscsi_cls_conn *, enum iscsi_param, char *); 715int cxgbi_get_ep_param(struct iscsi_endpoint *ep, enum iscsi_param, char *);
716struct iscsi_cls_conn *cxgbi_create_conn(struct iscsi_cls_session *, u32); 716struct iscsi_cls_conn *cxgbi_create_conn(struct iscsi_cls_session *, u32);
717int cxgbi_bind_conn(struct iscsi_cls_session *, 717int cxgbi_bind_conn(struct iscsi_cls_session *,
718 struct iscsi_cls_conn *, u64, int); 718 struct iscsi_cls_conn *, u64, int);
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 4bef19fb3a65..0f4367751b71 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -212,9 +212,6 @@ struct iscsi_conn {
212 /* values userspace uses to id a conn */ 212 /* values userspace uses to id a conn */
213 int persistent_port; 213 int persistent_port;
214 char *persistent_address; 214 char *persistent_address;
215 /* remote portal currently connected to */
216 int portal_port;
217 char portal_address[ISCSI_ADDRESS_BUF_LEN];
218 215
219 /* MIB-statistics */ 216 /* MIB-statistics */
220 uint64_t txdata_octets; 217 uint64_t txdata_octets;
@@ -319,9 +316,6 @@ struct iscsi_host {
319 /* hw address or netdev iscsi connection is bound to */ 316 /* hw address or netdev iscsi connection is bound to */
320 char *hwaddress; 317 char *hwaddress;
321 char *netdev; 318 char *netdev;
322 /* local address */
323 int local_port;
324 char local_address[ISCSI_ADDRESS_BUF_LEN];
325 319
326 wait_queue_head_t session_removal_wq; 320 wait_queue_head_t session_removal_wq;
327 /* protects sessions and state */ 321 /* protects sessions and state */