[PATCH net v3 1/1] net: stmmac: Prevent DSA tags from breaking C
Romain Gantois
romain.gantois at bootlin.com
Mon Jan 8 06:23:38 PST 2024
On Mon, 8 Jan 2024, Vladimir Oltean wrote:
...
> Nitpick: you could render this in kernel-doc format.
> https://docs.kernel.org/doc-guide/kernel-doc.html
>
> > +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
>
> Nitpick: in netdev it is preferred not to use the "inline" keyword at
> all in C files, only "static inline" in headers, and to let the compiler
> decide by itself when it is appropriate to inline the code (which it
> does by itself even without the "inline" keyword). For a bit more
> background why, you can view Documentation/process/4.Coding.rst, section
> "Inline functions".
I see, the kernel docs were indeed enlightening on this point. As a side note,
I've just benchmarked both the "with-inline" and "without-inline" versions.
First of all, objdump seems to confirm that GCC does indeed follow this pragma
in this particular case. Also, RX perfs are better with stmmac_has_ip_ethertype
inlined, but TX perfs are actually consistently worse with this function
inlined, which could very well be caused by cache effects.
In any case, I think it is better to remove the "inline" pragma as you said.
I'll do that in v4.
Best Regards,
--
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
More information about the linux-arm-kernel
mailing list