[ofw] [IPOIB_NDIS6_CM] enhance wc linking loop performance by removing array index calculations
Hefty, Sean
sean.hefty at intel.com
Mon Aug 9 11:59:44 PDT 2010
> > --- A/ulp/ipoib_NDIS6_CM/kernel/ipoib_endpoint.cpp Wed Aug 04
> > 10:30:43 2010
> > +++ B/ulp/ipoib_NDIS6_CM/kernel/ipoib_endpoint.cpp Wed Aug 04
> > 10:28:59 2010
> > @@ -888,9 +888,10 @@
> > p_port->p_adapter->p_ifc->modify_qp( p_endpt-
> > >conn.h_send_qp, &mod_attr );
> > p_port->p_adapter->p_ifc->modify_qp( p_endpt-
> > >conn.h_recv_qp, &mod_attr );
> >
> > - for( i = 0; i < MAX_RECV_WC; i++ )
> > - wc[i].p_next = &wc[i + 1];
> > - wc[MAX_RECV_WC - 1].p_next = NULL;
> > + for( p_free_wc=wc; p_free_wc < &wc[MAX_RECV_WC]; p_free_wc++ )
> > + p_free_wc->p_next = p_free_wc + 1;
> > +
> > + (--p_free_wc)->p_next = NULL;
Personally, I don't like the use of (--p_free_wc) here. This results in updating (extra memory write) p_free_wc outside of the loop, plus a second write to wc[MAX_RECV_WC - 1].p_next, because the first write was incorrect. I realize that the original code had this update as well, but can't we just end the loop one iteration earlier?
- Sean
More information about the ofw
mailing list