]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: enetc: enable RSS feature by default
authorWei Fang <wei.fang@nxp.com>
Tue, 6 May 2025 08:07:31 +0000 (16:07 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 9 May 2025 02:43:52 +0000 (19:43 -0700)
Receive side scaling (RSS) is a network driver technology that enables
the efficient distribution of network receive processing across multiple
CPUs in multiprocessor systems. Therefore, it is better to enable RSS by
default so that the CPU load can be balanced and network performance can
be improved when then network is enabled.

Signed-off-by: Wei Fang <wei.fang@nxp.com>
Acked-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://patch.msgid.link/20250506080735.3444381-11-wei.fang@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/enetc/enetc.c
drivers/net/ethernet/freescale/enetc/enetc_pf_common.c
drivers/net/ethernet/freescale/enetc/enetc_vf.c

index daea85cbf043534a82f1698c665693c65c686c00..7e92dc0a9a4974906c471f1dd6d677a7d6a83cd8 100644 (file)
@@ -2430,6 +2430,20 @@ static void enetc_set_lso_flags_mask(struct enetc_hw *hw)
        enetc_wr(hw, ENETC4_SILSOSFMR1, 0);
 }
 
+static void enetc_set_rss(struct net_device *ndev, int en)
+{
+       struct enetc_ndev_priv *priv = netdev_priv(ndev);
+       struct enetc_hw *hw = &priv->si->hw;
+       u32 reg;
+
+       enetc_wr(hw, ENETC_SIRBGCR, priv->num_rx_rings);
+
+       reg = enetc_rd(hw, ENETC_SIMR);
+       reg &= ~ENETC_SIMR_RSSE;
+       reg |= (en) ? ENETC_SIMR_RSSE : 0;
+       enetc_wr(hw, ENETC_SIMR, reg);
+}
+
 int enetc_configure_si(struct enetc_ndev_priv *priv)
 {
        struct enetc_si *si = priv->si;
@@ -2450,6 +2464,9 @@ int enetc_configure_si(struct enetc_ndev_priv *priv)
                err = enetc_setup_default_rss_table(si, priv->num_rx_rings);
                if (err)
                        return err;
+
+               if (priv->ndev->features & NETIF_F_RXHASH)
+                       enetc_set_rss(priv->ndev, true);
        }
 
        return 0;
@@ -3242,20 +3259,6 @@ struct net_device_stats *enetc_get_stats(struct net_device *ndev)
 }
 EXPORT_SYMBOL_GPL(enetc_get_stats);
 
-static void enetc_set_rss(struct net_device *ndev, int en)
-{
-       struct enetc_ndev_priv *priv = netdev_priv(ndev);
-       struct enetc_hw *hw = &priv->si->hw;
-       u32 reg;
-
-       enetc_wr(hw, ENETC_SIRBGCR, priv->num_rx_rings);
-
-       reg = enetc_rd(hw, ENETC_SIMR);
-       reg &= ~ENETC_SIMR_RSSE;
-       reg |= (en) ? ENETC_SIMR_RSSE : 0;
-       enetc_wr(hw, ENETC_SIMR, reg);
-}
-
 static void enetc_enable_rxvlan(struct net_device *ndev, bool en)
 {
        struct enetc_ndev_priv *priv = netdev_priv(ndev);
index a302477c4de49945de038533be90cfc0cd935ab8..a751862a70b1c16ed9c6a43a0463e9c2d7ee537e 100644 (file)
@@ -128,8 +128,10 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
        if (si->hw_features & ENETC_SI_F_LSO)
                priv->active_offloads |= ENETC_F_LSO;
 
-       if (si->num_rss)
+       if (si->num_rss) {
                ndev->hw_features |= NETIF_F_RXHASH;
+               ndev->features |= NETIF_F_RXHASH;
+       }
 
        /* TODO: currently, i.MX95 ENETC driver does not support advanced features */
        if (!is_enetc_rev1(si)) {
index 4fafe4e18a37d026af9a61ca92be5d66daf0279e..f6aed0a1ad1e24fe1665d14556734c2b0cac419a 100644 (file)
@@ -155,8 +155,10 @@ static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
        ndev->vlan_features = NETIF_F_SG | NETIF_F_HW_CSUM |
                              NETIF_F_TSO | NETIF_F_TSO6;
 
-       if (si->num_rss)
+       if (si->num_rss) {
                ndev->hw_features |= NETIF_F_RXHASH;
+               ndev->features |= NETIF_F_RXHASH;
+       }
 
        /* pick up primary MAC address from SI */
        enetc_load_primary_mac_addr(&si->hw, ndev);