[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZJV7xkASubAENdOI@corigine.com>
Date: Fri, 23 Jun 2023 13:02:30 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Ben Dooks <ben.dooks@...ethink.co.uk>
Cc: netdev@...r.kernel.org, pabeni@...hat.com, kuba@...nel.org,
edumazet@...gle.com, davem@...emloft.net,
linux-kernel@...r.kernel.org, claudiu.beznea@...rochip.com,
nicolas.ferre@...rochip.com
Subject: Re: [PATCH 1/3] net: macb: check constant to define and fix __be32
warnings
On Fri, Jun 23, 2023 at 10:40:52AM +0100, Ben Dooks wrote:
>
>
> 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@...ethink.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?
My personal opinion is that a #define is a nice way to go here.
Powered by blists - more mailing lists