[ofw][IPoIB][patch] fix ref counter indexes enumeration.

Alex Estrin alex.estrin at qlogic.com
Mon Sep 15 15:00:54 PDT 2008


Hi Stan,

For operations '+' and '|' results could be different. 
If reference counter specified as ('mask' | 'basket index'),
'mask' = 100(dec) and basket equal 7, so we will have:
 100 | 7 = 103 (!!!)

Targeting basket index for dereferencing calculated as (reference
counter % mask ) therefore
in our example case result index will be (103 % 100) eq 3 instead of
expected 7.

Another possibility to fix this, would be specify mask as 0x100 (hex),
then usage of operation '|' would be correct.
Patch would require more changes though.

Thanks,
Alex.


> -----Original Message-----
> From: Smith, Stan [mailto:stan.smith at intel.com] 
> Sent: Monday, September 15, 2008 5:02 PM
> To: Alex Estrin
> Cc: ofw at lists.openfabrics.org
> Subject: RE: [ofw][IPoIB][patch] fix ref counter indexes enumeration.
> 
> Alex Estrin wrote:
> > Proposed patch fixes incorrect ref array indexes enumeration.
> > Not a high priority patch since 'ref' array was designed for debug
> > purposes only.
> > Still if not fixed could be confusing for anyone who relies on it's
> > values.
> > Please review.
> 
> Hello,
>   Not to pick nits, curious as to why '+' is superior to '|' 
> in this case?
> 
> Thanks,
> 
> Stan.
> 
> >
> > Thanks,
> > Alex.
> >
> >
> > Index: ipoib/kernel/ipoib_debug.h
> > ===================================================================
> > --- ipoib/kernel/ipoib_debug.h  (revision 1601)
> > +++ ipoib/kernel/ipoib_debug.h  (working copy)
> > @@ -271,28 +271,28 @@
> >         ref_array_size, /* Used to size the array of ref buckets. */
> >         ref_mask = 100, /* Used to differentiate derefs. */
> >
> > -       ref_failed_recv_wc = 100 | ref_get_recv,
> > -       ref_recv_inv_len = 200 | ref_get_recv,
> > -       ref_recv_loopback = 300 | ref_get_recv,
> > -       ref_recv_filter = 400 | ref_get_recv,
> > +       ref_failed_recv_wc = 100 + ref_get_recv,
> > +       ref_recv_inv_len = 200 + ref_get_recv,
> > +       ref_recv_loopback = 300 + ref_get_recv,
> > +       ref_recv_filter = 400 + ref_get_recv,
> >
> > -       ref_bcast_get_cb = 100 | ref_get_bcast,
> > +       ref_bcast_get_cb = 100 + ref_get_bcast,
> >
> > -       ref_join_bcast = 100 | ref_bcast,
> > -       ref_create_bcast = 200 | ref_bcast,
> > -       ref_bcast_inv_state = 300 | ref_bcast,
> > -       ref_bcast_req_failed = 400 | ref_bcast,
> > -       ref_bcast_error = 500 | ref_bcast,
> > -       ref_bcast_join_failed = 600 | ref_bcast,
> > -       ref_bcast_create_failed = 700 | ref_bcast,
> > +       ref_join_bcast = 100 + ref_bcast,
> > +       ref_create_bcast = 200 + ref_bcast,
> > +       ref_bcast_inv_state = 300 + ref_bcast,
> > +       ref_bcast_req_failed = 400 + ref_bcast,
> > +       ref_bcast_error = 500 + ref_bcast,
> > +       ref_bcast_join_failed = 600 + ref_bcast,
> > +       ref_bcast_create_failed = 700 + ref_bcast,
> >
> > -       ref_mcast_inv_state = 100 | ref_join_mcast,
> > -       ref_mcast_req_failed = 200 | ref_join_mcast,
> > -       ref_mcast_no_endpt = 300 | ref_join_mcast,
> > -       ref_mcast_av_failed = 400 | ref_join_mcast,
> > -       ref_mcast_join_failed = 500 | ref_join_mcast,
> > +       ref_mcast_inv_state = 100 + ref_join_mcast,
> > +       ref_mcast_req_failed = 200 + ref_join_mcast,
> > +       ref_mcast_no_endpt = 300 + ref_join_mcast,
> > +       ref_mcast_av_failed = 400 + ref_join_mcast,
> > +       ref_mcast_join_failed = 500 + ref_join_mcast,
> >
> > -       ref_port_info_cb = 100 | ref_port_up
> > +       ref_port_info_cb = 100 + ref_port_up
> >
> >  };
> 
> 



More information about the ofw mailing list