aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2009-05-13 18:57:38 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-05-23 16:44:09 -0400
commit10eb0f013c63c71c82ede77945a5f390c10cfda6 (patch)
tree6f4b738aa1dfc422087a0b05ebde4388cf84a3f0 /drivers/scsi/cxgb3i/cxgb3i_iscsi.c
parent5a2537959fa8781012e8c286fc1614e0f6991327 (diff)
[SCSI] iscsi: pass ep connect shost
When we create the tcp/ip connection by calling ep_connect, we currently just go by the routing table info. I think there are two problems with this. 1. Some drivers do not have access to a routing table. Some drivers like qla4xxx do not even know about other ports. 2. If you have two initiator ports on the same subnet, the user may have set things up so that session1 was supposed to be run through port1. and session2 was supposed to be run through port2. It looks like we could end with both sessions going through one of the ports. Fixes for cxgb3i from Karen Xie. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/cxgb3i/cxgb3i_iscsi.c')
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_iscsi.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index 9212400b9b13..04a43744aedf 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -178,7 +178,7 @@ void cxgb3i_adapter_close(struct t3cdev *t3dev)
178 * cxgb3i_hba_find_by_netdev - find the cxgb3i_hba structure via net_device 178 * cxgb3i_hba_find_by_netdev - find the cxgb3i_hba structure via net_device
179 * @t3dev: t3cdev adapter 179 * @t3dev: t3cdev adapter
180 */ 180 */
181struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct net_device *ndev) 181static struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct net_device *ndev)
182{ 182{
183 struct cxgb3i_adapter *snic; 183 struct cxgb3i_adapter *snic;
184 int i; 184 int i;
@@ -261,20 +261,27 @@ void cxgb3i_hba_host_remove(struct cxgb3i_hba *hba)
261 261
262/** 262/**
263 * cxgb3i_ep_connect - establish TCP connection to target portal 263 * cxgb3i_ep_connect - establish TCP connection to target portal
264 * @shost: scsi host to use
264 * @dst_addr: target IP address 265 * @dst_addr: target IP address
265 * @non_blocking: blocking or non-blocking call 266 * @non_blocking: blocking or non-blocking call
266 * 267 *
267 * Initiates a TCP/IP connection to the dst_addr 268 * Initiates a TCP/IP connection to the dst_addr
268 */ 269 */
269static struct iscsi_endpoint *cxgb3i_ep_connect(struct sockaddr *dst_addr, 270static struct iscsi_endpoint *cxgb3i_ep_connect(struct Scsi_Host *shost,
271 struct sockaddr *dst_addr,
270 int non_blocking) 272 int non_blocking)
271{ 273{
272 struct iscsi_endpoint *ep; 274 struct iscsi_endpoint *ep;
273 struct cxgb3i_endpoint *cep; 275 struct cxgb3i_endpoint *cep;
274 struct cxgb3i_hba *hba; 276 struct cxgb3i_hba *hba = NULL;
275 struct s3_conn *c3cn = NULL; 277 struct s3_conn *c3cn = NULL;
276 int err = 0; 278 int err = 0;
277 279
280 if (shost)
281 hba = iscsi_host_priv(shost);
282
283 cxgb3i_api_debug("shost 0x%p, hba 0x%p.\n", shost, hba);
284
278 c3cn = cxgb3i_c3cn_create(); 285 c3cn = cxgb3i_c3cn_create();
279 if (!c3cn) { 286 if (!c3cn) {
280 cxgb3i_log_info("ep connect OOM.\n"); 287 cxgb3i_log_info("ep connect OOM.\n");
@@ -282,17 +289,27 @@ static struct iscsi_endpoint *cxgb3i_ep_connect(struct sockaddr *dst_addr,
282 goto release_conn; 289 goto release_conn;
283 } 290 }
284 291
285 err = cxgb3i_c3cn_connect(c3cn, (struct sockaddr_in *)dst_addr); 292 err = cxgb3i_c3cn_connect(hba ? hba->ndev : NULL, c3cn,
293 (struct sockaddr_in *)dst_addr);
286 if (err < 0) { 294 if (err < 0) {
287 cxgb3i_log_info("ep connect failed.\n"); 295 cxgb3i_log_info("ep connect failed.\n");
288 goto release_conn; 296 goto release_conn;
289 } 297 }
298
290 hba = cxgb3i_hba_find_by_netdev(c3cn->dst_cache->dev); 299 hba = cxgb3i_hba_find_by_netdev(c3cn->dst_cache->dev);
291 if (!hba) { 300 if (!hba) {
292 err = -ENOSPC; 301 err = -ENOSPC;
293 cxgb3i_log_info("NOT going through cxgbi device.\n"); 302 cxgb3i_log_info("NOT going through cxgbi device.\n");
294 goto release_conn; 303 goto release_conn;
295 } 304 }
305
306 if (shost && hba != iscsi_host_priv(shost)) {
307 err = -ENOSPC;
308 cxgb3i_log_info("Could not connect through request host%u\n",
309 shost->host_no);
310 goto release_conn;
311 }
312
296 if (c3cn_is_closing(c3cn)) { 313 if (c3cn_is_closing(c3cn)) {
297 err = -ENOSPC; 314 err = -ENOSPC;
298 cxgb3i_log_info("ep connect unable to connect.\n"); 315 cxgb3i_log_info("ep connect unable to connect.\n");