lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20130701.134000.477493946784788761.davem@davemloft.net>
Date:	Mon, 01 Jul 2013 13:40:00 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	B38611@...escale.com
Cc:	jim_baxter@...tor.com, r49496@...escale.com, B20596@...escale.com,
	shawn.guo@...aro.org, netdev@...r.kernel.org
Subject: Re: [PATCH net v1 1/1] net: fec: Fix Transmitted bytes counter

From: Duan Fugang-B38611 <B38611@...escale.com>
Date: Fri, 28 Jun 2013 02:11:30 +0000

> On 06/28/13 02:25, Jim Baxter wrote:
> 
>> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
>> index ed6180e..05a5f76 100644
>> --- a/drivers/net/ethernet/freescale/fec_main.c
>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>> @@ -738,6 +738,7 @@ fec_enet_tx(struct net_device *ndev)
>>  				ndev->stats.tx_carrier_errors++;
>>  		} else {
>>  			ndev->stats.tx_packets++;
>> +			ndev->stats.tx_bytes += bdp->cbd_datlen;
>>  		}
>>  
>>  		if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS) &&
>> --
> You cannot stat. tx_bytes in here, since stat.tx_bytes indicate that all bytes sent by MAC regardless whether there have error packets or not.
> You must add the stat. at xmit function as below:

I completely disagree.

tx_bytes indicates what actually made it to the wires, so Jim's original
patch is the correct one.

Every single driver I have ever written, always increments tx_bytes in
the transmit completion handler, not when the device layer gives the
packet to the driver.
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ