[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1317060132.2796.4.camel@edumazet-laptop>
Date: Mon, 26 Sep 2011 20:02:12 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: brenohl@...ibm.com
Cc: davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH] ehea: Remove sleep at .ndo_get_stats
Le lundi 26 septembre 2011 à 14:15 -0300, brenohl@...ibm.com a écrit :
> Currently ehea ndo_get_stats can sleep in two places, in a hcall
> and in a GFP_KERNEL alloc, which is not correct.
> This patch creates a delayed workqueue that grabs the information each 1
> sec from the hardware, and place it into the device structure, so that,
> .ndo_get_stats quickly returns the device structure statistics block.
>
> Signed-off-by: Breno Leitao <brenohl@...ibm.com>
> ---
> drivers/net/ethernet/ibm/ehea/ehea.h | 1 +
> drivers/net/ethernet/ibm/ehea/ehea_main.c | 26 ++++++++++++++++++++------
> 2 files changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/ibm/ehea/ehea.h b/drivers/net/ethernet/ibm/ehea/ehea.h
> index 7dd5e6a..0b8e6a9 100644
> --- a/drivers/net/ethernet/ibm/ehea/ehea.h
> +++ b/drivers/net/ethernet/ibm/ehea/ehea.h
> @@ -459,6 +459,7 @@ struct ehea_port {
> struct ehea_mc_list *mc_list; /* Multicast MAC addresses */
> struct ehea_eq *qp_eq;
> struct work_struct reset_task;
> + struct delayed_work stats_work;
> struct mutex port_lock;
> char int_aff_name[EHEA_IRQ_NAME_SIZE];
> int allmulti; /* Indicates IFF_ALLMULTI state */
> diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
> index 583bcd3..a10f6b3 100644
> --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
> +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
> @@ -330,17 +330,24 @@ out:
> static struct net_device_stats *ehea_get_stats(struct net_device *dev)
> {
> struct ehea_port *port = netdev_priv(dev);
> +
> + return &port->stats;
> +}
Hmm...
You should move in ehea_get_stats() all software-computed stats.
Only the hardware assisted stats should be gathered/changed from your
ehea_update_stats() helper.
This way, SNMP readers get accurate stats for all fields but the
stats->multicast and stats->rx_errors that are updated once per second.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists