Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 2014 13:09:05 -0700
From:      Navdeep Parhar <np@FreeBSD.org>
To:        Gleb Smirnoff <glebius@FreeBSD.org>, src-committers@freebsd.org,  svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r271803 - head/sys/dev/tl
Message-ID:  <541B3BE1.7080005@FreeBSD.org>
In-Reply-To: <201409182003.s8IK3kr8033068@svn.freebsd.org>
References:  <201409182003.s8IK3kr8033068@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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);
>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?541B3BE1.7080005>