Re: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopback connections.

2008-02-12 Thread Steve Wise

Roland Dreier wrote:

applied, although:

  +static void is_loopback_dst(struct iw_cm_id *cm_id)
  +{
  + struct net_device *dev;
  + 
  + dev = ip_dev_find(init_net, cm_id-remote_addr.sin_addr.s_addr);
  + if (!dev)
  + return 0;
  + dev_put(dev);
  + return 1;
  +}

is there any way this could trigger when it should, like if I'm trying
to make a connection from one local device to a different local device
(which should work fine)?



As far as I can tell, if the app does a rdma_resolve_addr() on the dst 
addr (which is a local address), then the routing lookup will find the 
local interface with that dst addr, and that device will be used for the 
connect.  IE src and dst devices are the same.


Maybe if the app does an explicit bind to the addr on one device, then 
connects to the addr on the other device.  But that's not gonna work 
either, I think.  I still think it will resolve to one device and that 
device cannot do loopback...



Steve.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopback connections.

2008-02-12 Thread Roland Dreier
applied, although:

  +static void is_loopback_dst(struct iw_cm_id *cm_id)
  +{
  +struct net_device *dev;
  +
  +dev = ip_dev_find(init_net, cm_id-remote_addr.sin_addr.s_addr);
  +if (!dev)
  +return 0;
  +dev_put(dev);
  +return 1;
  +}

is there any way this could trigger when it should, like if I'm trying
to make a connection from one local device to a different local device
(which should work fine)?

 - R.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.25] RDMA/cxgb3: Fail loopback connections.

2008-02-12 Thread Steve Wise

RDMA/cxgb3: Fail loopback connections.

The cxgb3 HW and driver don't support loopback RDMA connections.  So fail
any connection attempt where the destination address is local.

Signed-off-by: Steve Wise [EMAIL PROTECTED]
---

 drivers/infiniband/hw/cxgb3/iwch_cm.c |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c 
b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index e9a08fa..5d82723 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -1784,6 +1784,17 @@ err:
return err;
 }
 
+static void is_loopback_dst(struct iw_cm_id *cm_id)
+{
+   struct net_device *dev;
+   
+   dev = ip_dev_find(init_net, cm_id-remote_addr.sin_addr.s_addr);
+   if (!dev)
+   return 0;
+   dev_put(dev);
+   return 1;
+}
+
 int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 {
int err = 0;
@@ -1791,6 +1802,11 @@ int iwch_connect(struct iw_cm_id *cm_id, struct 
iw_cm_conn_param *conn_param)
struct iwch_ep *ep;
struct rtable *rt;
 
+   if (is_loopback_dst(cm_id)) {
+   err = -ENOSYS;
+   goto out;
+   }
+
ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
if (!ep) {
printk(KERN_ERR MOD %s - cannot alloc ep.\n, __FUNCTION__);
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html