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: 13925241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6F30DE77188 for ; Fri, 3 Jan 2025 06:34:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SKmbdyjlUOnASRV1UUrBtrrn//m7/BQBjZhIlweh76w=; b=jN3VOIuZisQWIiNxU/eIal+Dyo Orqlye3BhbmZ4mzLwgwBP6WmIw+VTFcQbq3xSwz+LrlTr/gFd22MYAGmrcI9CegCWd2+ACORd1nEl A5yLDa+jrFa1TPNW8mBZ8PaylIJ66EV9Z+fBRCOjBG/md+6iK0876KMC6uShS+KcPOg5mG064Z0zr XNQUv4FK2XKv4tmEx15QAMziENk6zUhVrXl8DECMgj3yPRssBnKJxcPVKqbBrmP49RFRgMI5WeZwS 9RshE5TTTWN2aRNhd+Bx4rUr7fk+XHN4Y3BK/whBQNO3XuFfxWgdNkYIbQnh2dBO2TBpWW8Zal45n K2FZRlng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tTbGF-0000000CEMz-2p8s; Fri, 03 Jan 2025 06:34:19 +0000 Received: from mail-am7eur03on20614.outbound.protection.outlook.com ([2a01:111:f403:260e::614] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tTb5x-0000000CCQr-1zcl for linux-arm-kernel@lists.infradead.org; Fri, 03 Jan 2025 06:23:42 +0000 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) 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/zHh9t8aR1FCPU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asQ9VGJ7jojndQVjwSoXaz1mTXBpZNQp 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250102_222341_555848_E9442E0D X-CRM114-Status: GOOD ( 14.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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);