[openib-general] Re: ipoib: question

Michael S. Tsirkin mst at mellanox.co.il
Thu Dec 15 14:02:14 PST 2005


Quoting Roland Dreier <rdreier at cisco.com>:
> Subject: Re: ipoib: question
> 
>  > Is this better?
>  > 
>  > -        return (struct ipoib_neigh **) (neigh->ha + 24 -
>  > -                                        (offsetof(struct neighbour, ha) & 4));
>  > +        return (void*)neigh +
>  > 		 ALIGN(offsetof(struct neighbour, ha) + INFINIBAND_ALEN, x)
> 
> I guess so, with "x" replaced by "sizeof (void *)".
> 
>  - R.
> 

Right, there's also a ; missing - I hope you figured out it wasnt a real
patch. The below does compile.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: linux-2.6.14/drivers/infiniband/ulp/ipoib/ipoib.h
===================================================================
--- linux-2.6.14.orig/drivers/infiniband/ulp/ipoib/ipoib.h	2005-12-16 02:15:55.000000000 +0200
+++ linux-2.6.14/drivers/infiniband/ulp/ipoib/ipoib.h	2005-12-16 02:39:42.000000000 +0200
@@ -219,8 +219,8 @@ struct ipoib_neigh {
 
 static inline struct ipoib_neigh **to_ipoib_neigh(struct neighbour *neigh)
 {
-	return (struct ipoib_neigh **) (neigh->ha + 24 -
-					(offsetof(struct neighbour, ha) & 4));
+	return (void*)neigh + ALIGN(offsetof(struct neighbour, ha) +
+				    INFINIBAND_ALEN, sizeof(void *));
 }
 
 extern struct workqueue_struct *ipoib_workqueue;

-- 
MST



More information about the general mailing list