[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e6bd1a85-0bcf-457c-8fa8-33e68d818547@broadcom.com>
Date: Thu, 26 Oct 2023 10:55:10 -0700
From: Florian Fainelli <florian.fainelli@...adcom.com>
To: Vincent MAILHOL <mailhol.vincent@...adoo.fr>
Cc: netdev@...r.kernel.org, Doug Berger <opendmb@...il.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@...adcom.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
Vladimir Oltean <vladimir.oltean@....com>,
Tariq Toukan <tariqt@...dia.com>,
Gal Pressman <gal@...dia.com>,
Willem de Bruijn <willemb@...gle.com>,
Daniil Tatianin <d-tatianin@...dex-team.ru>,
Simon Horman <horms@...nel.org>,
Justin Chen <justin.chen@...adcom.com>,
Ratheesh Kannoth <rkannoth@...vell.com>,
Joe Damato <jdamato@...tly.com>, Jiri Pirko <jiri@...nulli.us>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next 4/5] net: phy: broadcom: Add support for
WAKE_FILTER
Hi Vincent,
On 10/25/23 19:13, Vincent MAILHOL wrote:
[snip]
>>
>> This looks like an endianness conversion (I can not tell if this is
>> big to little or the opposite)...
>
> Oopsy! On second look, this is an open coded cpu to big endian
> conversion. So the question I should have asked is:
>
> why not use the put_unaligned_be16() helper here?
Because this is consistent with the existing code, though I will keep
that suggestion in mind as a subsequent patch. I personally find it
clearer expressed that way, but can update.
>
> Below comments still remain.
>
>>> + }
>>> + ether_addr_copy(nfc->fs.h_u.ether_spec.h_dest, da);
>>> +
>>> + for (i = 0; i < sizeof(da) / 2; i++) {
>>> + ret = bcm_phy_read_exp(phydev,
>>> + BCM54XX_WOL_MASK(2 - i));
>>> + if (ret < 0)
>>> + return ret;
>>> +
>>> + da[i * 2] = ~(ret >> 8);
>>> + da[i * 2 + 1] = ~(ret & 0xff);
>>> + }
>>> + ether_addr_copy(nfc->fs.m_u.ether_spec.h_dest, da);
>>> +
>>> + ret = bcm_phy_read_exp(phydev, BCM54XX_WOL_INNER_PROTO);
>>> + if (ret < 0)
>>> + return ret;
>>> +
>>> + nfc->fs.h_u.ether_spec.h_proto = be16_to_cpu(ret);
>>
>> ... but here it is big endian to cpu endian? It does not look coherent.
You are right, it was not consistent.
>>
>> Also, did you run parse to check your endianness conversions?
I did, though nothing came out with C=1 or C=2, I might have to check
that separately.
>>
>> https://www.kernel.org/doc/html/latest/dev-tools/sparse.html
>>
>> For example, I would have expected htons() (a.k.a. cpu_to_be16())
>> instead of be16_to_cpu().
Thanks for having taken a look.
--
Florian
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4221 bytes)
Powered by blists - more mailing lists