Netfront accelerator bug fixes
PATCH 1/8 Netfront accelerator bug fixes
Get network stats from accelerator plugin
Signed-off-by <[email protected]>
drivers/xen/netfront/accel.c +48 -1
@@ -529,6 +529,7 @@ static void accelerator_remove_hooks(strstatic void accelerator_remove_hooks (struct netfront_accelerator *accelerator,int remove_master) { +struct netfront_accel_hooks *hooks;struct netfront_accel_vif_state *vif_state, *tmp;unsigned flags;
@@ -537,6 +538,7 @@ static void accelerator_remove_hooks(strlist_for_each_entry_safe (vif_state, tmp, &accelerator->vif_states, link) { + hooks = vif_state->hooks;accelerator_remove_single_hook (accelerator, vif_state);/*
@@ -544,7 +546,12 @@ static void accelerator_remove_hooks(str* were set, must be called without lock held */ spin_unlock_irqrestore (&accelerator->vif_states_lock, flags); + +/* Last chance to get statistics from the accelerator */ + hooks->get_stats (vif_state->np->netdev, &vif_state->np->stats); +kref_put (&vif_state->vif_kref, vif_kref_release); +spin_lock_irqsave (&accelerator->vif_states_lock, flags); }
@@ -663,7 +670,8 @@ int netfront_accelerator_call_remove(strkref_get (&np->accel_vif_state.vif_kref);spin_unlock_irqrestore (&np->accelerator->vif_states_lock, flags); - +/* Last chance to get statistics from the accelerator */ + vif_state->hooks->get_stats (np->netdev, &np->stats); rc = np->accel_vif_state.hooks->remove (dev); kref_put(&np->accel_vif_state.vif_kref,
@@ -720,6 +728,9 @@ int netfront_accelerator_call_suspend(stspin_unlock_irqrestore (&np->accelerator->vif_states_lock, flags); +/* Last chance to get stats from the accelerator */ + np->accel_vif_state.hooks->get_stats (dev, &np->stats); + rc = np->accel_vif_state.hooks->suspend (dev); kref_put(&np->accel_vif_state.vif_kref,
@@ -869,6 +880,42 @@ void netfront_accelerator_call_stop_napi (&np->accelerator->vif_states_lock, flags); } } +} + + +int netfront_accelerator_call_get_stats (struct netfront_info *np, +struct net_device *dev) +{ +struct netfront_accel_hooks *hooks; +unsigned flags; +int rc =0 ; + +/* +* Call the get_stats accelerator hook. 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) +*/ + +if (np->accel_vif_state.hooks) { +spin_lock_irqsave (&np->accelerator->vif_states_lock, flags); + hooks = np->accel_vif_state.hooks; +if (hooks) { +kref_get (&np->accel_vif_state.vif_kref); +spin_unlock_irqrestore + (&np->accelerator->vif_states_lock, flags); + + rc = np->accel_vif_state.hooks->get_stats (dev, + &np->stats); + +kref_put (&np->accel_vif_state.vif_kref, + vif_kref_release); + }else { +spin_unlock_irqrestore + (&np->accelerator->vif_states_lock, flags); + } + } +return rc; }
drivers/xen/netfront/netfront.c +2 -0
@@ -1674,6 +1674,8 @@ static struct net_device_stats *network_static struct net_device_stats *network_get_stats (struct net_device *dev) {struct netfront_info *np =netdev_priv (dev); + +netfront_accelerator_call_get_stats (np, dev);return &np->stats; }
drivers/xen/netfront/netfront.h +9 -2
@@ -96,12 +96,17 @@ struct netfront_accel_hooks {* path has slots too */ int (*check_busy)(struct net_device *dev); +/* +* Get the fastpath network statistics +*/ +int (*get_stats)(struct net_device *dev, +struct net_device_stats *stats); };/* Version of API/protocol for communication between netfront and acceleration plugin supported */ -#define NETFRONT_ACCEL_VERSION 0x00010000 +#define NETFRONT_ACCEL_VERSION 0x00010001/* * Per-netfront device state for the accelerator. This is used to
@@ -295,7 +300,9 @@ externextern void netfront_accelerator_call_stop_napi_irq (struct netfront_info *np,struct net_device *dev); - +extern +int netfront_accelerator_call_get_stats (struct netfront_info *np, +struct net_device *dev); extern int netfront_load_accelerator(struct netfront_info *np, struct xenbus_device *dev,
Get network stats from accelerator plugin
drivers/xen/netfront/accel.c +48 -1
86 lines not on this page · raw message
drivers/xen/netfront/netfront.c +2 -0
@@ -1674,6 +1674,8 @@ static struct net_device_stats *network_static struct net_device_stats *network_get_stats (struct net_device *dev) {struct netfront_info *np =netdev_priv (dev); + +netfront_accelerator_call_get_stats (np, dev);return &np->stats; }
drivers/xen/netfront/netfront.h +9 -2
@@ -96,12 +96,17 @@ struct netfront_accel_hooks {* path has slots too */ int (*check_busy)(struct net_device *dev); +/* +* Get the fastpath network statistics +*/ +int (*get_stats)(struct net_device *dev, +struct net_device_stats *stats); };/* Version of API/protocol for communication between netfront and acceleration plugin supported */ -#define NETFRONT_ACCEL_VERSION 0x00010000 +#define NETFRONT_ACCEL_VERSION 0x00010001/* * Per-netfront device state for the accelerator. This is used to
@@ -295,7 +300,9 @@ externextern void netfront_accelerator_call_stop_napi_irq (struct netfront_info *np,struct net_device *dev); - +extern +int netfront_accelerator_call_get_stats (struct netfront_info *np, +struct net_device *dev); extern int netfront_load_accelerator(struct netfront_info *np, struct xenbus_device *dev,
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel