Re: [PATCH net-next v20 06/10] net: dsa: tag_mtk: add Airoha variant usage of this TAG

[email protected]
Newsgroups dev.linux.lists.mfd,org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Adding a new tag protocol enum for Airoha without updating the strict protocol checks in MediaTek/Airoha ethernet master drivers silently breaks hardware offloads and special tag functionality.
--

--- Patch [6]: [PATCH net-next v20 06/10] net: dsa: tag_mtk: add Airoha variant usage of this TAG ---
commit 9a6d2b41d720a4ec342b1d91531294b7baced74f
Author: Christian Marangi <[email protected]>

net: dsa: tag_mtk: add Airoha variant usage of this TAG

This commit adds a variant of the MTK DSA tag for Airoha switches,
documenting differences and introducing the new DSA_TAG_PROTO_AIROHA
enum to report the Airoha name to external tools.

> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index 6f7f5c17b5320..396c1e5208523 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -74,6 +75,7 @@ enum dsa_tag_protocol {
>  	DSA_TAG_PROTO_KSZ9893		= DSA_TAG_PROTO_KSZ9893_VALUE,
>  	DSA_TAG_PROTO_LAN9303		= DSA_TAG_PROTO_LAN9303_VALUE,
>  	DSA_TAG_PROTO_MTK		= DSA_TAG_PROTO_MTK_VALUE,
> +	DSA_TAG_PROTO_AIROHA		= DSA_TAG_PROTO_AIROHA_VALUE,

[Severity: High]
Does adding this new protocol enum break hardware offloads and tag
processing in the ethernet master drivers?

Looking at the Mediatek and Airoha ethernet drivers, they appear to use strict
protocol checks for DSA_TAG_PROTO_MTK. For example, in
drivers/net/ethernet/airoha/airoha_eth.c:airoha_get_dsa_tag():

    if (dev->dsa_ptr->tag_ops->proto != DSA_TAG_PROTO_MTK)
        return 0;

This check would fail to extract the DSA tag for the new Airoha protocol,
causing untagged packets to retain the tag in the payload which breaks
the hardware PPE module.

Similar strict checks exist in other master drivers that might bypass PPE
hardware routing logic and L2/L3 flow offloading:

drivers/net/ethernet/mediatek/mtk_eth_soc.c:mtk_uses_dsa()
    dev->dsa_ptr->tag_ops->proto == DSA_TAG_PROTO_MTK;

drivers/net/ethernet/mediatek/mtk_ppe.c:__mtk_ppe_check_skb()
    if (skb->dev->dsa_ptr->tag_ops->proto != DSA_TAG_PROTO_MTK)

drivers/net/ethernet/mediatek/mtk_ppe_offload.c:mtk_flow_get_dsa_port()
    if (dp->cpu_dp->tag_ops->proto != DSA_TAG_PROTO_MTK)
        return -ENODEV;

Should these master drivers be updated to also accept DSA_TAG_PROTO_AIROHA
so that hardware capabilities are not disabled?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.