[ofw] [IPOIB_NDIS6_CM] IPOIB_INLINE_RECV readability patch
Smith, Stan
stan.smith at intel.com
Wed Aug 4 09:59:24 PDT 2010
Hello,
This patch simplifies the IPOIB_INLINE_RECV conditionals by separating out only the different items; enhances readability/understanding of the code.
No Functionality changes!
--- A/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp Wed Aug 04 09:41:43 2010
+++ B/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp Wed Aug 04 09:41:37 2010
@@ -198,7 +198,7 @@
__recv_dtor(
IN const cl_pool_item_t* const p_pool_item,
IN void *context );
-#endif /* IPOIB_INLINE_RECV */
+#endif
static inline ipoib_send_desc_t*
__buf_mgr_get_send(
@@ -1410,11 +1410,17 @@
/* Allocate the receive descriptor pool */
cl_status = cl_qpool_init( &p_port->buf_mgr.recv_pool,
p_params->rq_depth * p_params->recv_pool_ratio,
+ 0,
+ 0,
+ sizeof(ipoib_recv_desc_t),
+ __recv_ctor,
#if IPOIB_INLINE_RECV
- 0, 0, sizeof(ipoib_recv_desc_t), __recv_ctor, NULL, p_port );
-#else /* IPOIB_INLINE_RECV */
- 0, 0, sizeof(ipoib_recv_desc_t), __recv_ctor, __recv_dtor, p_port );
-#endif /* IPOIB_INLINE_RECV */
+ NULL,
+#else
+ __recv_dtor,
+#endif
+ p_port );
+
if( cl_status != CL_SUCCESS )
{
NdisWriteErrorLogEntry( p_port->p_adapter->h_adapter,
@@ -2214,12 +2220,14 @@
{
/* Lookup the source endpoints based on GID. */
cl_perf_start( GetEndptByGid );
- *pp_src =
+ *pp_src = __endpt_mgr_get_by_gid( p_port,
#if IPOIB_INLINE_RECV
- __endpt_mgr_get_by_gid( p_port, &p_desc->buf.ib.grh.src_gid );
-#else /* IPOIB_INLINE_RECV */
- __endpt_mgr_get_by_gid( p_port, &p_desc->p_buf->ib.grh.src_gid );
-#endif /* IPOIB_INLINE_RECV */
+ &p_desc->buf.ib.grh.src_gid
+#else
+ &p_desc->p_buf->ib.grh.src_gid
+#endif
+ );
+
cl_perf_stop( &p_port->p_adapter->perf, GetEndptByGid );
/*
@@ -2228,12 +2236,15 @@
* whether to report this to NDIS.
*/
cl_perf_start( GetEndptByGid );
- *pp_dst =
+
+ *pp_dst = __endpt_mgr_get_by_gid( p_port,
#if IPOIB_INLINE_RECV
- __endpt_mgr_get_by_gid( p_port, &p_desc->buf.ib.grh.dest_gid );
-#else /* IPOIB_INLINE_RECV */
- __endpt_mgr_get_by_gid( p_port, &p_desc->p_buf->ib.grh.dest_gid );
-#endif /* IPOIB_INLINE_RECV */
+ &p_desc->buf.ib.grh.dest_gid
+#else
+ &p_desc->p_buf->ib.grh.dest_gid
+#endif
+ );
+
cl_perf_stop( &p_port->p_adapter->perf, GetEndptByGid );
/*
@@ -2245,10 +2256,13 @@
{
status = ipoib_mac_from_guid(
#if IPOIB_INLINE_RECV
- p_desc->buf.ib.grh.src_gid.unicast.interface_id, p_port->p_adapter->params.guid_mask, &mac );
-#else /* IPOIB_INLINE_RECV */
- p_desc->p_buf->ib.grh.src_gid.unicast.interface_id, p_port->p_adapter->params.guid_mask, &mac );
-#endif /* IPOIB_INLINE_RECV */
+ p_desc->buf.ib.grh.src_gid.unicast.interface_id,
+#else
+ p_desc->p_buf->ib.grh.src_gid.unicast.interface_id,
+#endif
+ p_port->p_adapter->params.guid_mask,
+ &mac );
+
if( status != IB_SUCCESS )
{
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
@@ -2258,12 +2272,14 @@
}
/* Create the endpoint. */
+ *pp_src = ipoib_endpt_create(
#if IPOIB_INLINE_RECV
- *pp_src = ipoib_endpt_create( &p_desc->buf.ib.grh.src_gid,
-#else /* IPOIB_INLINE_RECV */
- *pp_src = ipoib_endpt_create( &p_desc->p_buf->ib.grh.src_gid,
-#endif /* IPOIB_INLINE_RECV */
- p_wc->recv.ud.remote_lid, p_wc->recv.ud.remote_qp );
+ &p_desc->buf.ib.grh.src_gid,
+#else
+ &p_desc->p_buf->ib.grh.src_gid,
+#endif
+ p_wc->recv.ud.remote_lid,
+ p_wc->recv.ud.remote_qp );
if( !*pp_src )
{
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
@@ -2416,10 +2432,10 @@
#if IPOIB_INLINE_RECV
p_ipoib = &p_desc->buf.ib.pkt;
p_eth = &p_desc->buf.eth.pkt;
-#else /* IPOIB_INLINE_RECV */
+#else
p_ipoib = &p_desc->p_buf->ib.pkt;
p_eth = &p_desc->p_buf->eth.pkt;
-#endif /*IPOIB_INLINE_RECV */
+#endif
if( p_src )
{
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipoib_port.cpp.patch
Type: application/octet-stream
Size: 3992 bytes
Desc: ipoib_port.cpp.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100804/eaa9a4aa/attachment.obj>
More information about the ofw
mailing list