[ofw] RE: IBBUS - keep last HCA reference until IBAL is shutdown.

Sean Hefty sean.hefty at intel.com
Mon May 18 14:50:49 PDT 2009


>-       if ( ic > 0 && p_ext->hca_ifc_taken ) {
>+       if ( ic > 1 && p_ext->hca_ifc_taken ) {

I realize this is old code, but...  can someone explain the logic for this
(before or after the change)?  I would expect to see logic more like:

some_count--;
if (some_count == 0)
	InterfaceDereference();

The && hca_ifc_taken check is somewhat confusing, but only releasing the
interface reference if ic is positive (or greater than 1 with the change)
"feels" like the wrong approach.

We don't release the interface if ic = 0, or does ic = 0 imply something about
value for hca_ifc_taken?  If so, can we eliminate hca_ifc_taken?  If ic = 4, we
release the reference immediately, then decrement ic to 3.  So whatever bumped
ic to 1 or 2 or 3 in the first place no longer has access to the HCA interface?

(No, I didn't spend any time trying to figure this code out.  However, IMO,
reference counting should be as clear as possible wrt what's happening.)

- Sean




More information about the ofw mailing list