O
> +
> +/* 
> + * Macro to call one of the accelerator's function hooks.  The use
> + * count for the accelerator's hooks is incremented for the duration
> + * of the call to prevent the accelerator being able to modify the
> + * hooks in the middle (by, for example, unloading)
> + */ 
> +#define netfront_call_accelerator_hook(_np, _hook, _args...)
> \
> +        do {
> \
> +                if ( (_np)->accel_vif_state.hooks ) {
> \
> +                        unsigned flags;
> \
> +                        spin_lock_irqsave(&accelerators_lock, flags);
> \
> +                        ++(_np)->accelerator->hooks_usecount;
> \
> +                        spin_unlock_irqrestore(&accelerators_lock,
> flags); \
> +                        if ( (_np)->accel_vif_state.hooks )
> \
> +                                (_np)->accel_vif_state.hooks->_hook
> (_args); \
> +                        spin_lock_irqsave(&accelerators_lock, flags);
> \
> +                        if ( (--(_np)->accelerator->hooks_usecount) ==
> 0 ) \
> +                                accelerator_remove_hooks((_np)-
> >accelerator); \
> +                        spin_unlock_irqrestore(&accelerators_lock,
> flags); \
> +                }
> \
> +        } while(0)


Gag, why a macro... See earlier comments about suing RCU and eliminating
the refcount and locking overhead.

-- 
Stephen Hemminger <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to