Discussion:
[ofw] [Patch 3/62] Reference implementation of NDv2
Fab Tillier
2013-02-20 23:33:56 UTC
Permalink
Don't redefine CONTAINING_RECORD.

Signed-off-by: Fab Tillier <***@microsoft.com>

diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\user\hca\mlx4.h .\hw\mlx4\user\hca\mlx4.h
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\user\hca\mlx4.h Thu Mar 29 00:15:30 2012
+++ .\hw\mlx4\user\hca\mlx4.h Thu May 31 12:35:11 2012
@@ -276,44 +276,40 @@ static inline unsigned long align(unsign
return (val + align - 1) & ~(align - 1);
}

-#define to_mxxx(xxx, type) \
- ((struct mlx4_##type *) \
- ((uint8_t *) ib##xxx - offsetof(struct mlx4_##type, ibv_##xxx)))
-
static inline struct mlx4_context *to_mctx(struct ibv_context *ibctx)
{
- return to_mxxx(ctx, context);
+ return CONTAINING_RECORD(ibctx, struct mlx4_context, ibv_ctx);
}

static inline struct mlx4_pd *to_mpd(struct ibv_pd *ibpd)
{
- return to_mxxx(pd, pd);
+ return CONTAINING_RECORD(ibpd, struct mlx4_pd, ibv_pd);
}

static inline struct mlx4_cq *to_mcq(struct ibv_cq *ibcq)
{
- return to_mxxx(cq, cq);
+ return CONTAINING_RECORD(ibcq, struct mlx4_cq, ibv_cq);
}

static inline struct mlx4_srq *to_msrq(struct ibv_srq *ibsrq)
{
- return to_mxxx(srq, srq);
+ return CONTAINING_RECORD(ibsrq, struct mlx4_srq, ibv_srq);
}

static inline struct mlx4_qp *to_mqp(struct ibv_qp *ibqp)
{
- return to_mxxx(qp, qp);
+ return CONTAINING_RECORD(ibqp, struct mlx4_qp, ibv_qp);
}

static inline struct mlx4_ah *to_mah(struct ibv_ah *ibah)
{
- return to_mxxx(ah, ah);
+ return CONTAINING_RECORD(ibah, struct mlx4_ah, ibv_ah);
}

#ifdef XRC_SUPPORT
static inline struct mlx4_xrc_domain *to_mxrcd(struct ibv_xrc_domain *ibxrcd)
{
- return to_mxxx(xrcd, xrc_domain);
+ return CONTAINING_RECORD(ibxrcd, struct mlx4_xrcd, ibv_xrcd);
}
#endif

Loading...