From patchwork Thu May 19 00:59:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stephen hemminger X-Patchwork-Id: 96278 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7FF10B6F70 for ; Thu, 19 May 2011 10:59:30 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754184Ab1ESA7O (ORCPT ); Wed, 18 May 2011 20:59:14 -0400 Received: from mail.vyatta.com ([76.74.103.46]:39724 "EHLO mail.vyatta.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753582Ab1ESA7N (ORCPT ); Wed, 18 May 2011 20:59:13 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.vyatta.com (Postfix) with ESMTP id 8CDBC1829902; Wed, 18 May 2011 17:59:13 -0700 (PDT) X-Virus-Scanned: amavisd-new at tahiti.vyatta.com Received: from mail.vyatta.com ([127.0.0.1]) by localhost (mail.vyatta.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i6EgF5jyzNDZ; Wed, 18 May 2011 17:59:12 -0700 (PDT) Received: from nehalam (static-50-53-80-93.bvtn.or.frontiernet.net [50.53.80.93]) by mail.vyatta.com (Postfix) with ESMTPSA id 52BD218298F0; Wed, 18 May 2011 17:59:12 -0700 (PDT) Date: Wed, 18 May 2011 17:59:10 -0700 From: Stephen Hemminger To: David Decotigny Cc: "David S. Miller" , Joe Perches , Szymon Janc , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-net-upstream@google.com, Sameer Nanda Subject: Re: [PATCH 2/6] forcedeth: new ethtool stat "tx_timeout" to account for tx_timeouts Message-ID: <20110518175910.355026a1@nehalam> In-Reply-To: <1305764080-24853-2-git-send-email-decot@google.com> References: <1305764080-24853-1-git-send-email-decot@google.com> <1305764080-24853-2-git-send-email-decot@google.com> Organization: Vyatta X-Mailer: Claws Mail 3.7.6 (GTK+ 2.22.0; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, 18 May 2011 17:14:36 -0700 David Decotigny wrote: > From: Sameer Nanda > > This change publishes a new ethtool stats: tx_timeout that counts the > number of times the tx_timeout callback was triggered. > > > Signed-off-by: David Decotigny Since this is generic, maybe should be done that way not through ethtool that way tools and administrators don't have to look for something special. Something like: --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/include/linux/netdevice.h 2011-05-18 17:40:15.901691265 -0700 +++ b/include/linux/netdevice.h 2011-05-18 17:56:11.731742792 -0700 @@ -571,6 +571,8 @@ struct netdev_queue { * please use this field instead of dev->trans_start */ unsigned long trans_start; + + unsigned long trans_timeout; } ____cacheline_aligned_in_smp; static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) --- a/net/core/net-sysfs.c 2011-05-18 17:50:54.540403456 -0700 +++ b/net/core/net-sysfs.c 2011-05-18 17:57:47.136747867 -0700 @@ -788,7 +788,6 @@ net_rx_queue_update_kobjects(struct net_ #endif } -#ifdef CONFIG_XPS /* * netdev_queue sysfs structures and functions. */ @@ -834,6 +833,17 @@ static const struct sysfs_ops netdev_que .store = netdev_queue_attr_store, }; +static ssize_t show_trans_timeout(struct netdev_queue *queue, + struct netdev_queue_attribute *attribute, + char *buf) +{ + return sprintf(buf, "%lu", queue->trans_timeout); +} + +static struct netdev_queue_attribute queue_trans_timeout = + __ATTR(tx_timeout, S_IRUGO, show_trans_timeout, NULL); + +#ifdef CONFIG_XPS static inline unsigned int get_netdev_queue_index(struct netdev_queue *queue) { struct net_device *dev = queue->dev; @@ -1043,9 +1053,13 @@ error: static struct netdev_queue_attribute xps_cpus_attribute = __ATTR(xps_cpus, S_IRUGO | S_IWUSR, show_xps_map, store_xps_map); +#endif /* CONFIG_XPS */ static struct attribute *netdev_queue_default_attrs[] = { + &queue_trans_timeout.attr, +#ifdef CONFIG_XPS &xps_cpus_attribute.attr, +#endif NULL }; @@ -1125,7 +1139,6 @@ static int netdev_queue_add_kobject(stru return error; } -#endif /* CONFIG_XPS */ int netdev_queue_update_kobjects(struct net_device *net, int old_num, int new_num) --- a/net/sched/sch_generic.c 2011-05-18 17:45:07.740756564 -0700 +++ b/net/sched/sch_generic.c 2011-05-18 17:48:18.474761735 -0700 @@ -245,6 +245,7 @@ static void dev_watchdog(unsigned long a if (netif_tx_queue_stopped(txq) && time_after(jiffies, (trans_start + dev->watchdog_timeo))) { + ++txq->trans_timeout; some_queue_timedout = 1; break; }