[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] Add version number to API between netback and accel plugin.
# HG changeset patch # User Keir Fraser <keir@xxxxxxxxxxxxx> # Date 1191420042 -3600 # Node ID df158d6b9e579730ac3868e291ccbb6570980442 # Parent 9c9881c9037b04957dfbb93c9c2556f0c824049c Add version number to API between netback and accel plugin. Signed-off-by: Kieran Mansley <kmansley@xxxxxxxxxxxxxx> --- drivers/xen/netback/accel.c | 37 ++++++++++++++++++++++++++++--------- drivers/xen/netback/common.h | 13 ++++++++++--- 2 files changed, 38 insertions(+), 12 deletions(-) diff -r 9c9881c9037b -r df158d6b9e57 drivers/xen/netback/accel.c --- a/drivers/xen/netback/accel.c Wed Oct 03 14:58:45 2007 +0100 +++ b/drivers/xen/netback/accel.c Wed Oct 03 15:00:42 2007 +0100 @@ -103,18 +103,35 @@ static int netback_accelerator_tell_back * Entry point for an netback accelerator plugin module. Called to * advertise its presence, and connect to any suitable backends. */ -void netback_connect_accelerator(int id, const char *eth_name, - struct netback_accel_hooks *hooks) -{ - struct netback_accelerator *new_accelerator = +int netback_connect_accelerator(unsigned version, int id, const char *eth_name, + struct netback_accel_hooks *hooks) +{ + struct netback_accelerator *new_accelerator; + unsigned eth_name_len, flags; + + if (version != NETBACK_ACCEL_VERSION) { + if (version > NETBACK_ACCEL_VERSION) { + /* Caller has higher version number, leave it + up to them to decide whether to continue. + They can recall with a lower number if + they're happy to be compatible with us */ + return NETBACK_ACCEL_VERSION; + } else { + /* We have a more recent version than caller. + Currently reject, but may in future be able + to be backwardly compatible */ + return -EPROTO; + } + } + + new_accelerator = kmalloc(sizeof(struct netback_accelerator), GFP_KERNEL); - unsigned eth_name_len, flags; - if (!new_accelerator) { DPRINTK("%s: failed to allocate memory for accelerator\n", __FUNCTION__); - return; - } + return -ENOMEM; + } + new_accelerator->id = id; @@ -124,7 +141,7 @@ void netback_connect_accelerator(int id, DPRINTK("%s: failed to allocate memory for eth_name string\n", __FUNCTION__); kfree(new_accelerator); - return; + return -ENOMEM; } strlcpy(new_accelerator->eth_name, eth_name, eth_name_len); @@ -139,6 +156,8 @@ void netback_connect_accelerator(int id, /* tell existing backends about new plugin */ xenbus_for_each_backend(new_accelerator, netback_accelerator_tell_backend); + + return 0; } EXPORT_SYMBOL_GPL(netback_connect_accelerator); diff -r 9c9881c9037b -r df158d6b9e57 drivers/xen/netback/common.h --- a/drivers/xen/netback/common.h Wed Oct 03 14:58:45 2007 +0100 +++ b/drivers/xen/netback/common.h Wed Oct 03 15:00:42 2007 +0100 @@ -149,9 +149,16 @@ struct backend_info { struct netback_accelerator *accelerator; }; -/* Connect an accelerator plugin module to netback */ -extern void netback_connect_accelerator(int id, const char *eth_name, - struct netback_accel_hooks *hooks); +#define NETBACK_ACCEL_VERSION 0x00010000 + +/* + * Connect an accelerator plugin module to netback. Returns zero on + * success, < 0 on error, > 0 (with highest version number supported) + * if version mismatch. + */ +extern int netback_connect_accelerator(unsigned version, + int id, const char *eth_name, + struct netback_accel_hooks *hooks); /* Disconnect a previously connected accelerator plugin module */ extern void netback_disconnect_accelerator(int id, const char *eth_name); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |