From: Valentine Fatiev <valentinef@nvidia.com>
Subject: [PATCH] BACKPORT: drivers/infiniband/ulp/ipoib/ipoib_cm.c

Change-Id: I96488dfbabe88fc624fe22455c6e017925878138
---
 drivers/infiniband/ulp/ipoib/ipoib_cm.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -465,7 +465,6 @@ static int ipoib_cm_req_handler(struct i
 		ret = PTR_ERR(p->qp);
 		goto err_qp;
 	}
-
 	psn = get_random_u32() & 0xffffff;
 	ret = ipoib_cm_modify_rx_qp(dev, cm_id, p->qp, psn);
 	if (ret)
@@ -1154,19 +1153,19 @@ static int ipoib_cm_tx_init(struct ipoib
 			    struct sa_path_rec *pathrec)
 {
 	struct ipoib_dev_priv *priv = ipoib_priv(p->dev);
-	unsigned int noio_flag;
-	int ret;
+       unsigned int noio_flag;
+       int ret;
 
-	noio_flag = memalloc_noio_save();
-	p->tx_ring = vzalloc(array_size(ipoib_sendq_size, sizeof(*p->tx_ring)));
+       noio_flag = memalloc_noio_save();
+       p->tx_ring = vzalloc(array_size(ipoib_sendq_size, sizeof(*p->tx_ring)));
 	if (!p->tx_ring) {
-		memalloc_noio_restore(noio_flag);
+	       	memalloc_noio_restore(noio_flag);
 		ret = -ENOMEM;
 		goto err_tx;
 	}
 
 	p->qp = ipoib_cm_create_tx_qp(p->dev, p);
-	memalloc_noio_restore(noio_flag);
+       memalloc_noio_restore(noio_flag);
 	if (IS_ERR(p->qp)) {
 		ret = PTR_ERR(p->qp);
 		ipoib_warn(priv, "failed to create tx qp: %d\n", ret);
@@ -1597,7 +1596,9 @@ int ipoib_cm_dev_init(struct net_device
 {
 	struct ipoib_dev_priv *priv = ipoib_priv(dev);
 	int max_srq_sge, i;
+#ifdef HAVE_DEV_ADDR_MOD
 	u8 addr;
+#endif
 
 	INIT_LIST_HEAD(&priv->cm.passive_ids);
 	INIT_LIST_HEAD(&priv->cm.reap_list);
@@ -1651,8 +1652,12 @@ int ipoib_cm_dev_init(struct net_device
 		}
 	}
 
+#ifdef HAVE_DEV_ADDR_MOD
 	addr = IPOIB_FLAGS_RC;
 	dev_addr_mod(dev, 0, &addr, 1);
+#else
+	priv->dev->dev_addr[0] = IPOIB_FLAGS_RC;
+#endif
 	return 0;
 }
 
