diff options
Diffstat (limited to 'drivers/scsi/cxgbi/libcxgbi.c')
-rw-r--r-- | drivers/scsi/cxgbi/libcxgbi.c | 36 |
1 files changed, 17 insertions, 19 deletions
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 | } |
2201 | EXPORT_SYMBOL_GPL(cxgbi_set_conn_param); | 2202 | EXPORT_SYMBOL_GPL(cxgbi_set_conn_param); |
2202 | 2203 | ||
2203 | int cxgbi_get_conn_param(struct iscsi_cls_conn *cls_conn, | 2204 | int 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 | } |
2228 | EXPORT_SYMBOL_GPL(cxgbi_get_conn_param); | 2231 | EXPORT_SYMBOL_GPL(cxgbi_get_ep_param); |
2229 | 2232 | ||
2230 | struct iscsi_cls_conn * | 2233 | struct iscsi_cls_conn * |
2231 | cxgbi_create_conn(struct iscsi_cls_session *cls_session, u32 cid) | 2234 | 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, | |||
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); |