[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y0czpmTJlIVXd78u@lunn.ch>
Date: Wed, 12 Oct 2022 23:37:42 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Sergei Antonov <saproj@...il.com>
Cc: David Laight <David.Laight@...lab.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>
Subject: Re: [PATCH v2 net] net: ftmac100: do not reject packets bigger than
1514
> > > + const unsigned int length = ftmac100_rxdes_frame_length(rxdes);
> >
> > Do you need to read this value this early in the function?
> > Looks like it is only used when overlong packets are reported.
>
> I decided to make a variable in order to use it twice:
> in the condition: "length > 1518"
> in logging: "netdev_info(netdev, "rx frame too long (%u)\n", length);"
> You are right saying it is not needed in most cases. Can we hope for
> the optimizer to postpone the initialization of 'length' till it is
> accessed?
Unlikely, since it is accessing a descriptor, and probably using
memory barriers. It is hard for the compiler to differ that until
needed.
But you could look at the .lst file, and it should be pretty obvious
if it has deferred it.
make driver/net/foo/bar.lst
should i think generate what you need.
Andrew
Powered by blists - more mailing lists