From owner-svn-src-head@FreeBSD.ORG Thu Sep 18 20:09:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 88AC9D4B; Thu, 18 Sep 2014 20:09:10 +0000 (UTC) Received: from mail-pa0-x22c.google.com (mail-pa0-x22c.google.com [IPv6:2607:f8b0:400e:c03::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C432CB6; Thu, 18 Sep 2014 20:09:10 +0000 (UTC) Received: by mail-pa0-f44.google.com with SMTP id bj1so2281822pad.3 for ; Thu, 18 Sep 2014 13:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=kPU8ohhZKahZSrwAR/ZJ10Y9e9F1OLPM9bbPvaDLnQA=; b=k/Cn+vNyDiiMuR/ferNPwYw//oiKT0hE5loih45Gl7jZrFzVer5LygHE8Wi0ae+2S6 4JpmmxPGLR4NCYaCjNYZoNgDcAP6g+za3XA0ImNNEqfzWqEVHSWVsZWKAMZwYek/yPtp jkNb6pHM9/gPjf6tPQBlIviYSlKyCvFybmYBnk3H+hVW8qts7HCFof8VlX3VSpH4gFw4 0/K1Webr/UDqLdbclkjL8pFd4KROWoyFQWtYNBCFZRDJpnrZREuydGGq2nW2HhQU2M5M vQlSgka6L8fEzQB9U0QyhVZ8a0qhZvgc1WoMVKmp+PHdh6Np6fxJ/rCcjQcR9ZyMyEwH rRqw== X-Received: by 10.70.96.200 with SMTP id du8mr10032453pdb.117.1411070949303; Thu, 18 Sep 2014 13:09:09 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id d3sm20524775pbu.18.2014.09.18.13.09.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Sep 2014 13:09:08 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <541B3BE1.7080005@FreeBSD.org> Date: Thu, 18 Sep 2014 13:09:05 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r271803 - head/sys/dev/tl References: <201409182003.s8IK3kr8033068@svn.freebsd.org> In-Reply-To: <201409182003.s8IK3kr8033068@svn.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Sep 2014 20:09:10 -0000 Consider changing if_inc_counter to be inline and have it take const ints for the counter and increment. The compiler will optimize away all the unneeded code in if_inc_counter. Regards, Navdeep On 09/18/14 13:03, Gleb Smirnoff wrote: > Author: glebius > Date: Thu Sep 18 20:03:45 2014 > New Revision: 271803 > URL: http://svnweb.freebsd.org/changeset/base/271803 > > Log: > Mechanically convert to if_inc_counter(). > > Modified: > head/sys/dev/tl/if_tl.c > > Modified: head/sys/dev/tl/if_tl.c > ============================================================================== > --- head/sys/dev/tl/if_tl.c Thu Sep 18 20:00:36 2014 (r271802) > +++ head/sys/dev/tl/if_tl.c Thu Sep 18 20:03:45 2014 (r271803) > @@ -1430,7 +1430,7 @@ tl_intvec_rxeof(xsc, type) > total_len = cur_rx->tl_ptr->tlist_frsize; > > if (tl_newbuf(sc, cur_rx) == ENOBUFS) { > - ifp->if_ierrors++; > + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); > cur_rx->tl_ptr->tlist_frsize = MCLBYTES; > cur_rx->tl_ptr->tlist_cstat = TL_CSTAT_READY; > cur_rx->tl_ptr->tl_frag.tlist_dcnt = MCLBYTES; > @@ -1726,13 +1726,13 @@ tl_stats_update(xsc) > *p++ = CSR_READ_4(sc, TL_DIO_DATA); > *p++ = CSR_READ_4(sc, TL_DIO_DATA); > > - ifp->if_opackets += tl_tx_goodframes(tl_stats); > - ifp->if_collisions += tl_stats.tl_tx_single_collision + > - tl_stats.tl_tx_multi_collision; > - ifp->if_ipackets += tl_rx_goodframes(tl_stats); > - ifp->if_ierrors += tl_stats.tl_crc_errors + tl_stats.tl_code_errors + > - tl_rx_overrun(tl_stats); > - ifp->if_oerrors += tl_tx_underrun(tl_stats); > + if_inc_counter(ifp, IFCOUNTER_OPACKETS, tl_tx_goodframes(tl_stats)); > + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, > + tl_stats.tl_tx_single_collision + tl_stats.tl_tx_multi_collision); > + if_inc_counter(ifp, IFCOUNTER_IPACKETS, tl_rx_goodframes(tl_stats)); > + if_inc_counter(ifp, IFCOUNTER_IERRORS, tl_stats.tl_crc_errors + > + tl_stats.tl_code_errors + tl_rx_overrun(tl_stats)); > + if_inc_counter(ifp, IFCOUNTER_OERRORS, tl_tx_underrun(tl_stats)); > > if (tl_tx_underrun(tl_stats)) { > u_int8_t tx_thresh; > @@ -2186,7 +2186,7 @@ tl_watchdog(sc) > > if_printf(ifp, "device timeout\n"); > > - ifp->if_oerrors++; > + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); > > tl_softreset(sc, 1); > tl_init_locked(sc); >