From: Ben Dooks <ben.dooks@codethink.co.uk>
To: Simon Horman <simon.horman@corigine.com>
Cc: netdev@vger.kernel.org, pabeni@redhat.com, kuba@kernel.org,
edumazet@google.com, davem@davemloft.net,
linux-kernel@vger.kernel.org, claudiu.beznea@microchip.com,
nicolas.ferre@microchip.com
Subject: Re: [PATCH 1/3] net: macb: check constant to define and fix __be32 warnings
Date: Fri, 23 Jun 2023 10:40:52 +0100 [thread overview]
Message-ID: <f13928be3aa5b14908104993979df6f7@codethink.co.uk> (raw)
In-Reply-To: <ZJRtinvcu2PAf+Cc@corigine.com>
On 2023-06-22 16:49, Simon Horman wrote:
> On Thu, Jun 22, 2023 at 02:05:05PM +0100, Ben Dooks wrote:
>> The checks on ipv4 addresses in the filtering code check against
>> a constant of 0xFFFFFFFF, so replace it with MACB_IPV4_MASK and
>> then make sure it is of __be32 type to avoid the following
>> sparse warnigns:
>>
>> drivers/net/ethernet/cadence/macb_main.c:3448:39: warning: restricted
>> __be32 degrades to integer
>> drivers/net/ethernet/cadence/macb_main.c:3453:39: warning: restricted
>> __be32 degrades to integer
>> drivers/net/ethernet/cadence/macb_main.c:3483:20: warning: restricted
>> __be32 degrades to integer
>> drivers/net/ethernet/cadence/macb_main.c:3497:20: warning: restricted
>> __be32 degrades to integer
>>
>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>> ---
>> drivers/net/ethernet/cadence/macb_main.c | 10 ++++++----
>> 1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/cadence/macb_main.c
>> b/drivers/net/ethernet/cadence/macb_main.c
>> index f20ec0d5260b..538d4c7e023b 100644
>> --- a/drivers/net/ethernet/cadence/macb_main.c
>> +++ b/drivers/net/ethernet/cadence/macb_main.c
>> @@ -3418,6 +3418,8 @@ static int macb_get_ts_info(struct net_device
>> *netdev,
>> return ethtool_op_get_ts_info(netdev, info);
>> }
>>
>> +#define MACB_IPV4_MASK htonl(0xFFFFFFFF)
>> +
>
> Hi Ben,
>
> according to a recent thread, it seems that the preferred approach
> might be
> ~(__le32)0.
>
> https://lore.kernel.org/netdev/20230522153615.247577-1-minhuadotchen@gmail.com/
Out of interest, should we keep the define then or simply go through
changing
all the places where change is needed?
--
Ben
next prev parent reply other threads:[~2023-06-23 9:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-22 13:05 net: macb: sparse warning fixes Ben Dooks
2023-06-22 13:05 ` [PATCH 1/3] net: macb: check constant to define and fix __be32 warnings Ben Dooks
2023-06-22 15:49 ` Simon Horman
2023-06-23 9:40 ` Ben Dooks [this message]
2023-06-23 11:02 ` Simon Horman
2023-06-22 13:05 ` [PATCH 2/3] net: macb: add port constant to fix __be16 warnings Ben Dooks
2023-06-22 13:05 ` [PATCH 3/3] net: macb: fix __be32 warnings in debug code Ben Dooks
2023-06-22 15:44 ` Simon Horman
2023-06-23 9:43 ` Ben Dooks
2023-06-23 11:01 ` Simon Horman
2023-06-23 13:16 ` net: macb: sparse warning fixes Nicolas Ferre
2023-06-23 15:38 ` Andrew Lunn
2023-06-23 15:42 ` Nicolas Ferre
2023-07-03 8:10 ` Ben Dooks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f13928be3aa5b14908104993979df6f7@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=claudiu.beznea@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pabeni@redhat.com \
--cc=simon.horman@corigine.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox