Re: [PATCH] bind offloaded connection to port

2009-04-16 Thread Anil Veerabhadrappa

On Tue, 2009-04-14 at 19:19 -0700, Mike Christie wrote:
 Hey offload guys,
 
 If we are using a offload card, then iface_set_param will match the 
 iface info to a scsi_host and pass that info down to setup the net 
 settings of the port (currently we just set the ip address). 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.
 
 Also how do you edit the routing table for the offload cards? You cannot 
 use normal net tools like route can you?
 
 3. If we set up hostA in the iface_set_param step, but then the routing 
 info leads us to hostB, we are stuck.
 
 
 I did the attached patches to fix this. Basically we just pass down the 
 scsi host we want to go through. Well, ok I began to fix this :) For 
 qla4xxx or serverengines I think this will work fine.
 
 For bnx2i and cxgb3i, I am not sure. See the TODO and note in cxgb3i in 
 kern-ep-connect-through-host.patch. bnx2i guys, you guys do somehting 
 similar so will this work? In ep_connect can I control which host/port 
 to use?

this will work for bnx2i


 
 The patches were made against my iscsi tress. The kernel one was made 
 over the iscsi brandh and that was just updated so you might want to 
 reclone.
 
 The userspace one was made over the open-iscsi git tree head.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH] bind offloaded connection to port

2009-04-14 Thread Mike Christie
Hey offload guys,

If we are using a offload card, then iface_set_param will match the 
iface info to a scsi_host and pass that info down to setup the net 
settings of the port (currently we just set the ip address). 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.

Also how do you edit the routing table for the offload cards? You cannot 
use normal net tools like route can you?

3. If we set up hostA in the iface_set_param step, but then the routing 
info leads us to hostB, we are stuck.


I did the attached patches to fix this. Basically we just pass down the 
scsi host we want to go through. Well, ok I began to fix this :) For 
qla4xxx or serverengines I think this will work fine.

For bnx2i and cxgb3i, I am not sure. See the TODO and note in cxgb3i in 
kern-ep-connect-through-host.patch. bnx2i guys, you guys do somehting 
similar so will this work? In ep_connect can I control which host/port 
to use?

The patches were made against my iscsi tress. The kernel one was made 
over the iscsi brandh and that was just updated so you might want to 
reclone.

The userspace one was made over the open-iscsi git tree head.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c 
b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 75223f5..ffbe0c7 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -517,7 +517,8 @@ iscsi_iser_conn_get_stats(struct iscsi_cls_conn *cls_conn, 
struct iscsi_stats *s
 }
 
 static struct iscsi_endpoint *
-iscsi_iser_ep_connect(struct sockaddr *dst_addr, int non_blocking)
+iscsi_iser_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
+ int non_blocking)
 {
int err;
struct iser_conn *ib_conn;
diff --git a/drivers/scsi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgb3i/cxgb3i.h
index 59b0958..e3133b5 100644
--- a/drivers/scsi/cxgb3i/cxgb3i.h
+++ b/drivers/scsi/cxgb3i/cxgb3i.h
@@ -144,7 +144,6 @@ struct cxgb3i_adapter *cxgb3i_adapter_find_by_tdev(struct 
t3cdev *);
 void cxgb3i_adapter_open(struct t3cdev *);
 void cxgb3i_adapter_close(struct t3cdev *);
 
-struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct net_device *);
 struct cxgb3i_hba *cxgb3i_hba_host_add(struct cxgb3i_adapter *,
   struct net_device *);
 void cxgb3i_hba_host_remove(struct cxgb3i_hba *);
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c 
b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index 9212400..f423c49 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)
  * cxgb3i_hba_find_by_netdev - find the cxgb3i_hba structure via net_device
  * @t3dev: t3cdev adapter
  */
-struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct net_device *ndev)
+static struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct net_device *ndev)
 {
struct cxgb3i_adapter *snic;
int i;
@@ -261,12 +261,14 @@ void cxgb3i_hba_host_remove(struct cxgb3i_hba *hba)
 
 /**
  * cxgb3i_ep_connect - establish TCP connection to target portal
+ * @shost: scsi host to use
  * @dst_addr:  target IP address
  * @non_blocking:  blocking or non-blocking call
  *
  * Initiates a TCP/IP connection to the dst_addr
  */
-static struct iscsi_endpoint *cxgb3i_ep_connect(struct sockaddr *dst_addr,
+static struct iscsi_endpoint *cxgb3i_ep_connect(struct Scsi_Host *shost,
+   struct sockaddr *dst_addr,
int non_blocking)
 {
struct iscsi_endpoint *ep;
@@ -275,6 +277,13 @@ static struct iscsi_endpoint *cxgb3i_ep_connect(struct 
sockaddr *dst_addr,
struct s3_conn *c3cn = NULL;
int err = 0;
 
+   if (!shost) {
+   cxgb3i_log_error(Cannot connect. Missing host. Check that 
+have the current iscsi tools.\n);
+   err = -EINVAL;
+   goto release_conn;
+   }
+
c3cn = cxgb3i_c3cn_create();
if (!c3cn) {