diff options
author | Steve Wise <swise@opengridcomputing.com> | 2008-02-12 17:09:29 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-02-13 10:47:42 -0500 |
commit | 8704e9a8790cc9e394198663c1c9150c899fb9a2 (patch) | |
tree | 68f6ba71227f445d2fb81d5385f22d36fc1ba895 /drivers/infiniband | |
parent | 7c7a9bccd2ba9f17e4b588461f140578a0a7b073 (diff) |
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 <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/cxgb3/iwch_cm.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index e9a08fa3dffe..320f2b6ddee6 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/skbuff.h> | 35 | #include <linux/skbuff.h> |
36 | #include <linux/timer.h> | 36 | #include <linux/timer.h> |
37 | #include <linux/notifier.h> | 37 | #include <linux/notifier.h> |
38 | #include <linux/inetdevice.h> | ||
38 | 39 | ||
39 | #include <net/neighbour.h> | 40 | #include <net/neighbour.h> |
40 | #include <net/netevent.h> | 41 | #include <net/netevent.h> |
@@ -1784,6 +1785,17 @@ err: | |||
1784 | return err; | 1785 | return err; |
1785 | } | 1786 | } |
1786 | 1787 | ||
1788 | static int is_loopback_dst(struct iw_cm_id *cm_id) | ||
1789 | { | ||
1790 | struct net_device *dev; | ||
1791 | |||
1792 | dev = ip_dev_find(&init_net, cm_id->remote_addr.sin_addr.s_addr); | ||
1793 | if (!dev) | ||
1794 | return 0; | ||
1795 | dev_put(dev); | ||
1796 | return 1; | ||
1797 | } | ||
1798 | |||
1787 | int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | 1799 | int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) |
1788 | { | 1800 | { |
1789 | int err = 0; | 1801 | int err = 0; |
@@ -1791,6 +1803,11 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
1791 | struct iwch_ep *ep; | 1803 | struct iwch_ep *ep; |
1792 | struct rtable *rt; | 1804 | struct rtable *rt; |
1793 | 1805 | ||
1806 | if (is_loopback_dst(cm_id)) { | ||
1807 | err = -ENOSYS; | ||
1808 | goto out; | ||
1809 | } | ||
1810 | |||
1794 | ep = alloc_ep(sizeof(*ep), GFP_KERNEL); | 1811 | ep = alloc_ep(sizeof(*ep), GFP_KERNEL); |
1795 | if (!ep) { | 1812 | if (!ep) { |
1796 | printk(KERN_ERR MOD "%s - cannot alloc ep.\n", __FUNCTION__); | 1813 | printk(KERN_ERR MOD "%s - cannot alloc ep.\n", __FUNCTION__); |