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]

 



Hi Romain,

overall this patch makes sense.

On Tue, Jan 2, 2024 at 5:27 PM Romain Gantois
<romain.gantois@xxxxxxxxxxx> wrote:

> Some DSA tagging protocols change the EtherType field in the MAC header
> e.g.  DSA_TAG_PROTO_(DSA/EDSA/BRCM/MTK/RTL4C_A/SJA1105). On TX these tagged
> frames are ignored by the checksum offload engine and IP header checker of
> some stmmac cores.
>
> On RX, the stmmac driver wrongly assumes that checksums have been computed
> for these tagged packets, and sets CHECKSUM_UNNECESSARY.
>
> Add an additional check in the stmmac tx and rx hotpaths so that COE is
> deactivated for packets with ethertypes that will not trigger the COE and
> ip header checks.
>
> Fixes: 6b2c6e4a938f ("net: stmmac: propagate feature flags to vlan")
> Cc: stable@xxxxxxxxxxxxxxx
> Reported-by: Richard Tresidder <rtresidd@xxxxxxxxxxxxxxxxx>
> Closes: https://lore.kernel.org/netdev/e5c6c75f-2dfa-4e50-a1fb-6bf4cdb617c2@xxxxxxxxxxxxxxxxx/
> Reported-by: Romain Gantois <romain.gantois@xxxxxxxxxxx>
> Closes: https://lore.kernel.org/netdev/c57283ed-6b9b-b0e6-ee12-5655c1c54495@xxxxxxxxxxx/
> Signed-off-by: Romain Gantois <romain.gantois@xxxxxxxxxxx>
(...)

> +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> +{
> +       __be16 proto = eth_header_parse_protocol(skb);

I made a new function for this in my patch
https://lore.kernel.org/netdev/20231222-new-gemini-ethernet-regression-v4-2-a36e71b0f32b@xxxxxxxxxx/

I was careful to add if (!pskb_may_pull(skb, ETH_HLEN)) because Eric
was very specific about this, I suppose you could get fragment frames that
are smaller than an ethernet header.

I should use eth_header_parse_protocol() instead of reimplementing it
though. :/

Should we add an if (!pskb_may_pull(skb, ETH_HLEN)) to
eth_header_parse_protocol()?

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