[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240108142941.2b14f90e@xps-13>
Date: Mon, 8 Jan 2024 14:29:41 +0100
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Vladimir Oltean <vladimir.oltean@....com>
Cc: Romain Gantois <romain.gantois@...tlin.com>, Alexandre Torgue
<alexandre.torgue@...s.st.com>, Jose Abreu <joabreu@...opsys.com>, "David
S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub
Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Maxime
Coquelin <mcoquelin.stm32@...il.com>, Maxime Chevallier
<maxime.chevallier@...tlin.com>, Sylvain Girard <sylvain.girard@...com>,
Pascal EBERHARD <pascal.eberhard@...com>, Richard Tresidder
<rtresidd@...ctromag.com.au>, Linus Walleij <linus.walleij@...aro.org>,
Florian Fainelli <f.fainelli@...il.com>, Andrew Lunn <andrew@...n.ch>,
netdev@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, stable@...r.kernel.org
Subject: Re: [PATCH net v3 1/1] net: stmmac: Prevent DSA tags from breaking
COE
Hi Romain,
> > +/* Check if ethertype will trigger IP
> > + * header checks/COE in hardware
> > + */
>
> 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".
>
> > +{
> > + int depth = 0;
> > + __be16 proto;
> > +
> > + proto = __vlan_get_protocol(skb, eth_header_parse_protocol(skb), &depth);
> > +
> > + return depth <= ETH_HLEN && (proto == htons(ETH_P_IP) || proto == htons(ETH_P_IPV6));
I also want to nitpick a bit :) If you are to send a v4, maybe you can
enclose the first condition within parenthesis to further clarify the
return logic.
Cheers,
Miquèl
Powered by blists - more mailing lists