[PATCH net v3 1/1] net: stmmac: Prevent DSA tags from breaking COE

Miquel Raynal miquel.raynal at bootlin.com
Mon Jan 8 05:29:41 PST 2024


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



More information about the linux-arm-kernel mailing list