[openib-general] [PATCH] IPOIB: Use a GRH when appropriate for unicast packets

Jason Gunthorpe jgunthorpe at obsidianresearch.com
Thu Jan 25 16:03:19 PST 2007


ib_init_ah_from_path contains the logic to decide when to use a GRH
so call ib_init_ah_from_path instead of the hand coded version in IPOIB.

This change along with recent opensm changes allows unicast IPOIB traffic
to traverse a router.

Signed-off-by: Jason Gunthorpe <jgunthorpe at obsidianresearch.com>
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 705eb1d..cb54da1 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -385,14 +385,18 @@ static void path_rec_completion(int status,
 	skb_queue_head_init(&skqueue);
 
 	if (!status) {
-		struct ib_ah_attr av = {
-			.dlid 	       = be16_to_cpu(pathrec->dlid),
-			.sl 	       = pathrec->sl,
-			.port_num      = priv->port,
-			.static_rate   = pathrec->rate
-		};
-
-		ah = ipoib_create_ah(dev, priv->pd, &av);
+		int ret;
+		struct ib_ah_attr av;
+		if ((ret = ib_init_ah_from_path(priv->ca,priv->port,pathrec,&av)))
+			ipoib_dbg(priv, "PathRec init_ah failed %d for GID "
+				  IPOIB_GID_FMT "\n", ret,
+				  IPOIB_GID_ARG(path->pathrec.dgid));
+		else {
+			// FIXME: Should this be in ib_init_ah_from_path?
+			av.static_rate = pathrec->rate;
+
+			ah = ipoib_create_ah(dev, priv->pd, &av);
+		}
 	}
 
 	spin_lock_irqsave(&priv->lock, flags);
-- 
1.4.4.3





More information about the general mailing list