WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH 3/4] [Net] Support Xen accelerated network plugin

To: Kieran Mansley <kmansley@xxxxxxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 3/4] [Net] Support Xen accelerated network plugin modules
From: Stephen Hemminger <shemminger@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 May 2007 10:54:45 -0700
Cc: muli@xxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, herbert@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 23 May 2007 02:11:24 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1179494208.14376.10.camel@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Linux Foundation
References: <1179494208.14376.10.camel@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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 <shemminger@xxxxxxxxxxxxxxxxxxxx>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel