Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 3, 2024 at 9:10 PM Vladimir Oltean <olteanv@xxxxxxxxx> wrote:
> On Tue, Jan 02, 2024 at 05:27:15PM +0100, Romain Gantois wrote:
> > +/* Check if ethertype will trigger IP
> > + * header checks/COE in hardware
> > + */
> > +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> > +{
> > +     __be16 proto = eth_header_parse_protocol(skb);
> > +
> > +     return (proto == htons(ETH_P_IP)) || (proto == htons(ETH_P_IPV6)) ||
> > +             (proto == htons(ETH_P_8021Q));
>
> proto == htons(ETH_P_8021Q) means that the skb has an IP EtherType?
> What if an IP header does not follow after the VLAN header?

It's probably best to do like I do here:
https://lore.kernel.org/netdev/20240102-new-gemini-ethernet-regression-v5-2-cf61ab3aa8cd@xxxxxxxxxx/

+ if (ethertype == ETH_P_8021Q)
+   ethertype = ntohs(__vlan_get_protocol(skb, htons(ethertype), NULL));

Yours,
Linus Walleij





[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux