Skip to content

Commit c71b9b6

Browse files
Mike ChristieJames Bottomley
authored andcommitted
[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>
1 parent 289324b commit c71b9b6

File tree

5 files changed

+22
-28
lines changed

5 files changed

+22
-28
lines changed

drivers/scsi/cxgbi/cxgb3i/cxgb3i.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static struct iscsi_transport cxgb3i_iscsi_transport = {
137137
.destroy_conn= iscsi_tcp_conn_teardown,
138138
.start_conn= iscsi_conn_start,
139139
.stop_conn= iscsi_conn_stop,
140-
.get_conn_param= cxgbi_get_conn_param,
140+
.get_conn_param= iscsi_conn_get_param,
141141
.set_param= cxgbi_set_conn_param,
142142
.get_stats= cxgbi_get_conn_stats,
143143
/* pdu xmit req from user space */
@@ -152,6 +152,7 @@ static struct iscsi_transport cxgb3i_iscsi_transport = {
152152
.xmit_pdu= cxgbi_conn_xmit_pdu,
153153
.parse_pdu_itt= cxgbi_parse_pdu_itt,
154154
/* TCP connect/disconnect */
155+
.get_ep_param= cxgbi_get_ep_param,
155156
.ep_connect= cxgbi_ep_connect,
156157
.ep_poll= cxgbi_ep_poll,
157158
.ep_disconnect= cxgbi_ep_disconnect,

drivers/scsi/cxgbi/cxgb4i/cxgb4i.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static struct iscsi_transport cxgb4i_iscsi_transport = {
138138
.destroy_conn= iscsi_tcp_conn_teardown,
139139
.start_conn= iscsi_conn_start,
140140
.stop_conn= iscsi_conn_stop,
141-
.get_conn_param= cxgbi_get_conn_param,
141+
.get_conn_param= iscsi_conn_get_param,
142142
.set_param= cxgbi_set_conn_param,
143143
.get_stats= cxgbi_get_conn_stats,
144144
/* pdu xmit req from user space */
@@ -153,6 +153,7 @@ static struct iscsi_transport cxgb4i_iscsi_transport = {
153153
.xmit_pdu= cxgbi_conn_xmit_pdu,
154154
.parse_pdu_itt= cxgbi_parse_pdu_itt,
155155
/* TCP connect/disconnect */
156+
.get_ep_param= cxgbi_get_ep_param,
156157
.ep_connect= cxgbi_ep_connect,
157158
.ep_poll= cxgbi_ep_poll,
158159
.ep_disconnect= cxgbi_ep_disconnect,

drivers/scsi/cxgbi/libcxgbi.c

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
543543
csk->dst = dst;
544544
csk->daddr.sin_addr.s_addr = daddr->sin_addr.s_addr;
545545
csk->daddr.sin_port = daddr->sin_port;
546+
csk->daddr.sin_family = daddr->sin_family;
546547
csk->saddr.sin_addr.s_addr = rt->rt_src;
547548

548549
return csk;
@@ -2200,32 +2201,34 @@ int cxgbi_set_conn_param(struct iscsi_cls_conn *cls_conn,
22002201
}
22012202
EXPORT_SYMBOL_GPL(cxgbi_set_conn_param);
22022203

2203-
int cxgbi_get_conn_param(struct iscsi_cls_conn *cls_conn,
2204-
enum iscsi_param param, char *buf)
2204+
int cxgbi_get_ep_param(struct iscsi_endpoint *ep, enum iscsi_param param,
2205+
char *buf)
22052206
{
2206-
struct iscsi_conn *iconn = cls_conn->dd_data;
2207+
struct cxgbi_endpoint *cep = ep->dd_data;
2208+
struct cxgbi_sock *csk;
22072209
int len;
22082210

22092211
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);
22112213

22122214
switch (param) {
22132215
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;
22182216
case ISCSI_PARAM_CONN_ADDRESS:
2219-
spin_lock_bh(&iconn->session->lock);
2220-
len = sprintf(buf, "%s\n", iconn->portal_address);
2221-
spin_unlock_bh(&iconn->session->lock);
2222-
break;
2217+
if (!cep)
2218+
return -ENOTCONN;
2219+
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);
22232226
default:
2224-
return iscsi_conn_get_param(cls_conn, param, buf);
2227+
return -ENOSYS;
22252228
}
22262229
return len;
22272230
}
2228-
EXPORT_SYMBOL_GPL(cxgbi_get_conn_param);
2231+
EXPORT_SYMBOL_GPL(cxgbi_get_ep_param);
22292232

22302233
struct iscsi_cls_conn *
22312234
cxgbi_create_conn(struct iscsi_cls_session *cls_session, u32 cid)
@@ -2292,11 +2295,6 @@ int cxgbi_bind_conn(struct iscsi_cls_session *cls_session,
22922295
cxgbi_conn_max_xmit_dlength(conn);
22932296
cxgbi_conn_max_recv_dlength(conn);
22942297

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-
23002298
log_debug(1 << CXGBI_DBG_ISCSI,
23012299
"cls 0x%p,0x%p, ep 0x%p, cconn 0x%p, csk 0x%p.\n",
23022300
cls_session, cls_conn, ep, cconn, csk);

drivers/scsi/cxgbi/libcxgbi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ void cxgbi_cleanup_task(struct iscsi_task *task);
712712
void cxgbi_get_conn_stats(struct iscsi_cls_conn *, struct iscsi_stats *);
713713
int cxgbi_set_conn_param(struct iscsi_cls_conn *,
714714
enum iscsi_param, char *, int);
715-
int cxgbi_get_conn_param(struct iscsi_cls_conn *, enum iscsi_param, char *);
715+
int cxgbi_get_ep_param(struct iscsi_endpoint *ep, enum iscsi_param, char *);
716716
struct iscsi_cls_conn *cxgbi_create_conn(struct iscsi_cls_session *, u32);
717717
int cxgbi_bind_conn(struct iscsi_cls_session *,
718718
struct iscsi_cls_conn *, u64, int);

include/scsi/libiscsi.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,6 @@ struct iscsi_conn {
212212
/* values userspace uses to id a conn */
213213
intpersistent_port;
214214
char*persistent_address;
215-
/* remote portal currently connected to */
216-
intportal_port;
217-
charportal_address[ISCSI_ADDRESS_BUF_LEN];
218215

219216
/* MIB-statistics */
220217
uint64_ttxdata_octets;
@@ -319,9 +316,6 @@ struct iscsi_host {
319316
/* hw address or netdev iscsi connection is bound to */
320317
char*hwaddress;
321318
char*netdev;
322-
/* local address */
323-
intlocal_port;
324-
charlocal_address[ISCSI_ADDRESS_BUF_LEN];
325319

326320
wait_queue_head_tsession_removal_wq;
327321
/* protects sessions and state */

0 commit comments

Comments
 (0)