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: <faf9e431-c5e4-7fcc-0341-6fc46e3561fb@egil-hjelmeland.no>
Date:   Tue, 1 Aug 2017 15:50:14 +0200
From:   Egil Hjelmeland <privat@...l-hjelmeland.no>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     vivien.didelot@...oirfairelinux.com, f.fainelli@...il.com,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel@...gutronix.de
Subject: Re: [PATCH v2 net-next 1/3] net: dsa: lan9303: Refactor
 lan9303_xxx_packet_processing()

On 01. aug. 2017 15:39, Andrew Lunn wrote:
>> @@ -704,7 +710,7 @@ static void lan9303_get_ethtool_stats(struct dsa_switch *ds, int port,
>>   	unsigned int u, poff;
>>   	int ret;
>>   
>> -	poff = port * 0x400;
>> +	poff = LAN9303_SWITCH_PORT_REG(port, 0);
>>   
>>   	for (u = 0; u < ARRAY_SIZE(lan9303_mib); u++) {
>>   		ret = lan9303_read_switch_reg(chip,
> 
> So the actual code is:
> 
> 	for (u = 0; u < ARRAY_SIZE(lan9303_mib); u++) {
>         		ret = lan9303_read_switch_reg(chip,
> 			      		      lan9303_mib[u].offset + poff,
> 					      &reg);
> 
> Could this be written as
> 
> 	for (u = 0; u < ARRAY_SIZE(lan9303_mib); u++) {
> 		ret = lan9303_read_switch_port(chip, port, lan9303_mib[u].offset, &reg);
> 
> It is then clear you are reading the statistics from a port register.
> 
>     Andrew
> 

Yes it can. Since it is (insignificantly) less efficient, I
chose not to touch it. But I can do it if you like.

Egil

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ