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]
Date:   Wed, 6 Oct 2021 19:41:00 +0300
From:   Sergey Shtylyov <s.shtylyov@....ru>
To:     Biju Das <biju.das.jz@...renesas.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>
CC:     Sergei Shtylyov <sergei.shtylyov@...il.com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Sergey Shtylyov <s.shtylyov@...russia.ru>,
        "Adam Ford" <aford173@...il.com>, Andrew Lunn <andrew@...n.ch>,
        Yuusuke Ashizuka <ashiduka@...itsu.com>,
        Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
        <netdev@...r.kernel.org>, <linux-renesas-soc@...r.kernel.org>,
        Chris Paterson <Chris.Paterson2@...esas.com>,
        Biju Das <biju.das@...renesas.com>,
        "Prabhakar Mahadev Lad" <prabhakar.mahadev-lad.rj@...renesas.com>
Subject: Re: [RFC 08/12] ravb: Add carrier_counters to struct ravb_hw_info

On 10/5/21 2:06 PM, Biju Das wrote:

> RZ/G2L E-MAC supports carrier counters.
> Add a carrier_counter hw feature bit to struct ravb_hw_info
> to add this feature only for RZ/G2L.
> 
> Signed-off-by: Biju Das <biju.das.jz@...renesas.com>
> Reviewed-by: Sergey Shtylyov <s.shtylyov@....ru>

[...]

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 8c7b2569c7dd..899e16c5eb1a 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
[...]
@@ -1061,6 +1065,7 @@ struct ravb_hw_info {
 	unsigned nc_queue:1;		/* AVB-DMAC has NC queue */
 	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
 	unsigned half_duplex:1;		/* E-MAC supports half duplex mode */
+	unsigned carrier_counters:1;	/* E-MAC has carrier counters */



[...]
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 42573eac82b9..c057de81ec58 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -2075,6 +2075,18 @@ static struct net_device_stats *ravb_get_stats(struct net_device *ndev)
>  		ravb_write(ndev, 0, TROCR);	/* (write clear) */
>  	}
>  
> +	if (info->carrier_counters) {
> +		nstats->collisions += ravb_read(ndev, CXR41);
> +		ravb_write(ndev, 0, CXR41);	/* (write clear) */
> +		nstats->tx_carrier_errors += ravb_read(ndev, CXR42);
> +		ravb_write(ndev, 0, CXR42);	/* (write clear) */
> +
> +		nstats->tx_carrier_errors += ravb_read(ndev, CXR55);

   According to the manual, CXR55 counts RX events (carrier extension lost.

> +		ravb_write(ndev, 0, CXR55);	/* (write clear) */
> +		nstats->tx_carrier_errors += ravb_read(ndev, CXR56);

   And CXR56 counts receive events too...

> +		ravb_write(ndev, 0, CXR56);	/* (write clear) */
> +	}
> +
>  	nstats->rx_packets = stats0->rx_packets;
>  	nstats->tx_packets = stats0->tx_packets;
>  	nstats->rx_bytes = stats0->rx_bytes;
> @@ -2486,6 +2498,7 @@ static const struct ravb_hw_info gbeth_hw_info = {
>  	.aligned_tx = 1,
>  	.tx_counters = 1,
>  	.half_duplex = 1,
> +	.carrier_counters = 1,

   At least init it next to 'tx_counters'. :-)

[...]

MBR, Sergey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ