From patchwork Fri Jan 3 06:06:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13925206 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2088.outbound.protection.outlook.com [40.107.103.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3D1A1B2183; Fri, 3 Jan 2025 06:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735885424; cv=fail; b=GP4ygaWRBYsir20JQIN9w194sWW4Ox+O6jmCpOPMKLfK3I5MD3dgRSTCDn1NKrdCcAtmWu4tYBJKlh4OWp1qP0O0lHc5siMPqvT79l/EAsskJ/u3jE9hOV/NS6uaBVNopEtM4k9FtX1rlymXnQr7NYz14m1GfjadPmxHajrzl2o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735885424; c=relaxed/simple; bh=7rFRv+QFGSor6bou53ANciafI/s6SbREgrM8l7OQP8c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=qHwPiEG/hmMCaBfgtuHlYw+x3VyhA0ktXoI3AhTJc1j4urRLdbeHzNBwP/6ojQQFdepHpzhsskA800K2Jvuva1yFatU93O2VYflqyp5i/iPnSMFrGCP5uRX/9MZW04J3MpH3KnUvLOtCsbube/YiY93nyuuoH1pWiZAZ8uvRbEo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=LddhqLa7; arc=fail smtp.client-ip=40.107.103.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="LddhqLa7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VNPdM3U2cQt4wNzwBnvgUTn3v4zAB+3SdzgEkX+epFFXbSVO9+OvlW7LdBfWJWROYgyFAkQjdW2Khz0vIgRjCGjszCw9uzTpcDsHvEwByXCyJerQg1vT/Ov8fOe5qSXux1eBy4LT+RXl+EXxbTZL8rxQfVZ34WO3ycKahscxwBNPnBlm9hF5+cbiZHypOCnTLnZMwo1KT22tJrSmGhmC2v7LI0Hq+phMhsWcXws9wmiCZVUQprlZI9x483RjsySqbU3ZmtRio963GdXOA78SbjDmgy0AgKgOUEPQ/tvetyfxZ37zH7e+SEzdULFLeS5+96mgst0aDosycqrFN9yqkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SKmbdyjlUOnASRV1UUrBtrrn//m7/BQBjZhIlweh76w=; b=Uw86rrG+90qFt1lECsBBInVVPh3yIaDEgjIRT6Aypp6XAXRGJbBy5d20tsRoMj63Ckn//nLr30jgPxnr9O3p1Yqer86CMmmwpXU6dGi5kFLd/ngwl2X85bZBUEWgreJUPhSi2p6fU6ZiKEoJ4LmyzGBrS+o/viokHxchUDJjUtnvQ0tIFpTsd0Didehfywu05bmayg7ar6A8m0y7gUTSBGK7fDlhI+sK9GJEcSHSFORIUilNnI8hO4nEWL0GpGXJFziLikwMwwtNulYDenqzqaqVm1wQwSJtbKUONWIWqA9XJnZE/ep5h+G/uPCzHUKl1MNs/dcmstnGyz0IElDyWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SKmbdyjlUOnASRV1UUrBtrrn//m7/BQBjZhIlweh76w=; b=LddhqLa71Q1J/I5/UiyWMnIgQTBCNyACZ3VdXlihd5szeQ/D6ovZRYUOJgwzlkKrHNVQo9gCuKD+839eQTB2Q21s5vRDQBuQ5dzeIHAoYdTjha4j43j6wEixojx/98AxCV5O6nrDEq8sRonP5dcT/IUmyI+37CxxfIra4ArzW4AJ6Ps3bVe3BS+Cj9MVjUbIAhJxtwP2/XSpFUDOautJfiZsMp3g56HwxkEAFo0CFQyPx6NsRIlGvyzPr2CFbMUNExTkCBzPwiqIxIQ4P5ggSK6FtABNognhzP+WjD+uAHLRr9XUJJDmkbPXWwMofRwmQAdb/sEO8jGRYSSOwdo+QA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by DB9PR04MB9331.eurprd04.prod.outlook.com (2603:10a6:10:36d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.12; Fri, 3 Jan 2025 06:23:34 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%6]) with mapi id 15.20.8314.013; Fri, 3 Jan 2025 06:23:34 +0000 From: Wei Fang To: claudiu.manoil@nxp.com, vladimir.oltean@nxp.com, xiaoning.wang@nxp.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, christophe.leroy@csgroup.eu Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev Subject: [PATCH net-next 08/13] net: enetc: enable RSS feature by default Date: Fri, 3 Jan 2025 14:06:04 +0800 Message-Id: <20250103060610.2233908-9-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250103060610.2233908-1-wei.fang@nxp.com> References: <20250103060610.2233908-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR03CA0127.apcprd03.prod.outlook.com (2603:1096:4:91::31) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|DB9PR04MB9331:EE_ X-MS-Office365-Filtering-Correlation-Id: 2064172a-1899-47df-ed00-08dd2bbf26af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|7416014|366016|38350700014; X-Microsoft-Antispam-Message-Info: EKyXHaR0n0tSiZioKvjc1PGJ8UoDdwNncuFbw1yE0Q4vKkzQblzE2DcZGTjs5Y4s+SUtsIPeXW3d6DkVUWVQ241/AbjUwQ3cOD90GYQzIH4M7YD2wPpFjtDBWpeF8HdNGPD/PI1hEtAjiJdObJKqgF0lxbie2OTZvvFwj10tQ2rExizZURhR6MyRY0K2RtnDYNQY74Uzc4BFGtGPTDHunCJbx5xV5iVU+qRvESlLnbfULMLXIWn707q/hOE70TWU8Mkum+NWwqspIiBOJkgED+unxRuD/ecPNxsDVHSLgrQtg4aln6q7oAUpvnZSVH0IPjkprPP3XhhKmWQbI46JZp/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ZZfLK/hy7YzTfasQ9VGJ7jojndQVjwSoXaz1mTXBpZNQp X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(7416014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8OVgjBIta+AVFL7JE7GpRlp42pL3nqqVTZZxo4ZDr6Bjy8xblB57MWN1LzC61gDBIG/er+zTNAFdriy0s+JE0ciV0P7RYIU/aRIKmZxDuhxvPtlTLqvMtUorpvdQzOVZXBBzwtRY5d3sXVCZCLtvO1WzpC2EK3NyX7ae57ve152d662tiD/5bwvTD+Uoqk4lV0X0Z88Xx3/gaHoODlw0TtKeIZSr7ieINXOFuUKh0ZILpDw7VwSi4bgpwWksG8GSOWyavgds/wy/1WLPLxhRh+Ht/hphQpfWqXr5lzVGgjvajWS3KaNYzbKkufV4g7Cc7pPE12rlmxK/k5y/R2BgIe5S8f1i68ea+PszNk5s73giBgnt6XrhJRhWgFYE2FDWMKfUVKnRpKAI9Fw7e6+KqKvSawG6B6HFvxam2zOEiClxzj8duAD2e+HVDlnvARb5HxVBSSLhk5TgnT/sGlWl7qXRwZKyiyRR+JPVkFIaUf5HUCpoY1X5eHwm2oRbyPaY2DBtribNCq0dBIPQofac3YZldV5/aP4h6dNTNk3Gs7cQaQJAKXFr2BYOI1V64bM5n+WHcUNCwsJeRlfgGwT7CdQOBCWv3VUUaf3PvBhnm5o0E7UL37g92c8Z58z39ibHRwWqk1/nkDlvBKGoFM+rXRdbzVJ13rpeVn3D1QbUhomPO1ZmpuFaI6TRWsB06TZkzqF8awOqzwc6x5fqxJ+MepBcKqlGaIGdmlpZ4QQ5ZaG3lv3epEMYVq4rFHCVYWMrQMiA0BttXDlqy1mwK0PM+LguG1/CReh6qgdjZ0p/o7KuTVx2zbkg5RoFGNpTrP4yCeKZ2Euv4h+HOsl3G2C1BEqo9IwME8uR+CGODkVjCtrbxNvKkEp8d2eqzZva/b2FrFcVWtvpAlf5bqZKhW6H+9qeZ31nCBIdxEblXdI+xYn0aB9ok/HTJLszUBihKn6rEHinERH4X3RExuxuV5FtqLnwwtEiDapbCLPufs/WUTwj1C9qWJz2Xe++dA4tY0nwSwxkZzlCjoiHBRfZELbO2PuZEchohsffikGeGTvaicMm25yDnqSRQ3gXzKqfAAG9d3ZbFry94S2Vj4wvPWp85M8is4fLPilBEl5pj8QrbOtKlXZYDNI4uPjgELSkmv97CwUWRoyBay6pvLvZ4pApfvsgqL3YCdvAzivNrHlc4pbDaBYLJC0a7Xbzxo3Cg8atHFp6NqYCEjZoLtmSNpPqEb0kmp14uK6gNSm0yAHHy5QnYQ57m8AIJ5lOj8w1PskKaLOAGxVKtxh3G9IeESpaKCaqP/JS9FKFGc7XkUs+AU5PMSGYmO9XaS2Gj+iu0FBUImDEvl0zW18oSgqTLwDmaAQzUj5Og6DHyUkal7O5r74F8q8XD6//HLSkX3k6I4XuMY33yFWhKhoz5aTQnAFp60GD07jOOIuXEj16zffnoi3nPxelCK/zNo2N3n14sUSWbLzfuUPGI9N1dMeSeY/ysb34Iu97BMn/TPizk00vO+gk6TgtDlJhsLEik+644Mne1qH8OuhGI8Lx5tbhJ+1vcczLaPs8019lYS4yUeKGGsXY+MbNpjC2mH0psbFnzx0o X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2064172a-1899-47df-ed00-08dd2bbf26af X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2025 06:23:34.6351 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BiJzmxKRC97dk7hSnfa+pqNSuDocSVZqd5x6oU14NIAv+82/vpjwSHtzasLy7x5Z5S/u9RzQX5dLWbO0ByYl7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9331 X-Patchwork-Delegate: kuba@kernel.org 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 --- drivers/net/ethernet/freescale/enetc/enetc.c | 35 ++++++++++--------- .../freescale/enetc/enetc_pf_common.c | 4 ++- .../net/ethernet/freescale/enetc/enetc_vf.c | 4 ++- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 233f58e57a20..e27b031c4f46 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2378,6 +2378,22 @@ static void enetc_set_lso_flags_mask(struct enetc_hw *hw) enetc_wr(hw, ENETC4_SILSOSFMR1, 0); } +static int 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); + + return 0; +} + int enetc_configure_si(struct enetc_ndev_priv *priv) { struct enetc_si *si = priv->si; @@ -2398,6 +2414,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; @@ -3190,22 +3209,6 @@ struct net_device_stats *enetc_get_stats(struct net_device *ndev) } EXPORT_SYMBOL_GPL(enetc_get_stats); -static int 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); - - return 0; -} - static void enetc_enable_rxvlan(struct net_device *ndev, bool en) { struct enetc_ndev_priv *priv = netdev_priv(ndev); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c index c346e0e3ad37..a737a7f8c79e 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -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)) { diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/ethernet/freescale/enetc/enetc_vf.c index 072e5b40a199..3372a9a779a6 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c @@ -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);