RDMA/cxgb3: Program hardware IRD with correct value
[sfrench/cifs-2.6.git] / drivers / infiniband / hw / cxgb3 / iwch_cm.c
index e9a08fa3dffeb99ba718b1a1af343f030915603d..99f2f2a46bf79244270be761d4f9637aad540694 100644 (file)
@@ -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>
@@ -1744,7 +1745,7 @@ int iwch_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 
        /* bind QP to EP and move to RTS */
        attrs.mpa_attr = ep->mpa_attr;
-       attrs.max_ird = ep->ord;
+       attrs.max_ird = ep->ird;
        attrs.max_ord = ep->ord;
        attrs.llp_stream_handle = ep;
        attrs.next_state = IWCH_QP_STATE_RTS;
@@ -1784,6 +1785,17 @@ err:
        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;
@@ -1791,6 +1803,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__);