]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: enetc: manage ENETC_F_QBV in priv->active_offloads only when enabled
authorVladimir Oltean <vladimir.oltean@nxp.com>
Tue, 10 May 2022 16:36:14 +0000 (19:36 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Dec 2022 16:40:02 +0000 (17:40 +0100)
[ Upstream commit 32bf8e1f6fb9f6dc334b2b98dffc2e5dcd51e513 ]

Future work in this driver would like to look at priv->active_offloads &
ENETC_F_QBV to determine whether a tc-taprio qdisc offload was
installed, but this does not produce the intended effect.

All the other flags in priv->active_offloads are managed dynamically,
except ENETC_F_QBV which is set statically based on the probed SI capability.

This change makes priv->active_offloads & ENETC_F_QBV really track the
presence of a tc-taprio schedule on the port.

Some existing users, like the enetc_sched_speed_set() call from
phylink_mac_link_up(), are best kept using the old logic: the tc-taprio
offload does not re-trigger another link mode resolve, so the scheduler
needs to be functional from the get go, as long as Qbv is supported at
all on the port. So to preserve functionality there, look at the static
station interface capability from pf->si->hw_features instead.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 290b5fe096e7 ("net: enetc: preserve TX ring priority across reconfiguration")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/freescale/enetc/enetc_pf.c
drivers/net/ethernet/freescale/enetc/enetc_qos.c

index 6904e10dd46b32076d4a4a14b3bcad27251961a1..515db7e6e6497fe64a00ee4d8a724ab8b59ba1ca 100644 (file)
@@ -748,9 +748,6 @@ static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
 
        ndev->priv_flags |= IFF_UNICAST_FLT;
 
-       if (si->hw_features & ENETC_SI_F_QBV)
-               priv->active_offloads |= ENETC_F_QBV;
-
        if (si->hw_features & ENETC_SI_F_PSFP && !enetc_psfp_enable(priv)) {
                priv->active_offloads |= ENETC_F_QCI;
                ndev->features |= NETIF_F_HW_TC;
@@ -996,7 +993,8 @@ static void enetc_pl_mac_link_up(struct phylink_config *config,
        struct enetc_ndev_priv *priv;
 
        priv = netdev_priv(pf->si->ndev);
-       if (priv->active_offloads & ENETC_F_QBV)
+
+       if (pf->si->hw_features & ENETC_SI_F_QBV)
                enetc_sched_speed_set(priv, speed);
 
        if (!phylink_autoneg_inband(mode) &&
index 62efe1aebf86a48c7c2f81cde4ad7288382dec99..b0e278e1f4adf3e0b9046c5a0cd4ad9437fd0808 100644 (file)
@@ -69,6 +69,9 @@ static int enetc_setup_taprio(struct net_device *ndev,
                enetc_wr(&priv->si->hw,
                         ENETC_QBV_PTGCR_OFFSET,
                         tge & (~ENETC_QBV_TGE));
+
+               priv->active_offloads &= ~ENETC_F_QBV;
+
                return 0;
        }
 
@@ -135,6 +138,9 @@ static int enetc_setup_taprio(struct net_device *ndev,
        dma_unmap_single(&priv->si->pdev->dev, dma, data_size, DMA_TO_DEVICE);
        kfree(gcl_data);
 
+       if (!err)
+               priv->active_offloads |= ENETC_F_QBV;
+
        return err;
 }