Skip to content

Commit

Permalink
RDMA/cxgb3: Fail loopback connections
Browse files Browse the repository at this point in the history
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 <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Steve Wise authored and Roland Dreier committed Feb 13, 2008
1 parent 7c7a9bc commit 8704e9a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions drivers/infiniband/hw/cxgb3/iwch_cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <linux/skbuff.h>
#include <linux/timer.h>
#include <linux/notifier.h>
#include <linux/inetdevice.h>

#include <net/neighbour.h>
#include <net/netevent.h>
Expand Down Expand Up @@ -1784,13 +1785,29 @@ int iwch_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
return err;
}

static int 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;
struct iwch_dev *h = to_iwch_dev(cm_id->device);
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__);
Expand Down

0 comments on commit 8704e9a

Please sign in to comment.