Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932836AbcDTH7H (ORCPT ); Wed, 20 Apr 2016 03:59:07 -0400 Received: from smtprelay0111.hostedemail.com ([216.40.44.111]:40892 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754532AbcDTH7F (ORCPT ); Wed, 20 Apr 2016 03:59:05 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::,RULES_HIT:41:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:4321:5007:6119:7903:10004:10400:10848:11026:11232:11473:11657:11658:11783:11914:12043:12296:12438:12517:12519:12740:13069:13161:13229:13311:13357:13439:13894:14659:14721:21080:30034:30054:30064:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: coat04_1403baa96b351 X-Filterd-Recvd-Size: 2764 Message-ID: <1461139122.1917.52.camel@perches.com> Subject: Re: [PATCH v1] IB/ipoib: Add readout of statistics using ethtool From: Joe Perches To: Hans Westgaard Ry Cc: Doug Ledford , Sean Hefty , Hal Rosenstock , Or Gerlitz , Santosh Shilimkar , Yuval Shaia , "open list:INFINIBAND SUBSYSTEM" , open list Date: Wed, 20 Apr 2016 00:58:42 -0700 In-Reply-To: <1461138630-15158-1-git-send-email-hans.westgaard.ry@oracle.com> References: <1460715468-16235-1-git-send-email-hans.westgaard.ry@oracle.com> <1461138630-15158-1-git-send-email-hans.westgaard.ry@oracle.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1537 Lines: 56 On Wed, 2016-04-20 at 09:50 +0200, Hans Westgaard Ry wrote: > IPoIB collects statistics of traffic including number of packets > sent/received, number of bytes transferred, and certain errors. This > patch makes these statistics available to be queried by ethtool. trivial notes: > diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c b/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c [] > @@ -36,6 +36,31 @@ > ? > ?#include "ipoib.h" > ? > +struct ipoib_stats { > + char stat_string[ETH_GSTRING_LEN]; > + int stat_offset; > +}; > + > + > +#define IPOIB_NETDEV_STAT(str, m) { \ > + .stat_string = str, \ > + .stat_offset = offsetof(struct rtnl_link_stats64, m) } > + > + > + A few unnecessary extra blank lines > +static const struct ipoib_stats ipoib_gstrings_stats[] = { > + IPOIB_NETDEV_STAT("rx_packets", rx_packets), > + IPOIB_NETDEV_STAT("tx_packets", tx_packets), > + IPOIB_NETDEV_STAT("rx_bytes",???rx_bytes), > + IPOIB_NETDEV_STAT("tx_bytes",???tx_bytes), > + IPOIB_NETDEV_STAT("tx_errors",??tx_errors), > + IPOIB_NETDEV_STAT("rx_dropped", rx_dropped), > + IPOIB_NETDEV_STAT("tx_dropped", tx_dropped) > +}; Couldn't the macro could be simplified by using # and a single argument? > +static int ipoib_get_sset_count(struct net_device __always_unused *dev, > + ?int sset) > +{ > + switch (sset) { > + case ETH_SS_STATS: > + return IPOIB_GLOBAL_STATS_LEN; > + case ETH_SS_TEST: > + default: > + return -EOPNOTSUPP; > + } > +} Didn't some old versions of gcc complain about reaching the end of a non-void function?