From nobody Sat Nov 23 15:32:43 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2079.outbound.protection.outlook.com [40.107.22.79]) (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 809A7198E6D; Tue, 19 Nov 2024 08:39:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732005595; cv=fail; b=KTbwChe/B1Wy5cN1Yq1kECc/lpYa3WEocGBdBf2NDFUPZ8b0qSuL6Sy/Y8TK5TJqTe3goPM/XAA3HIBg2Fc6rmQ/7dZkgkCqrgE7jrulr13lXg5XAGcpPyrEeECAXxpUPr2hnBRNuPvVvcPlpF0RXEHDiUk5bl3a6CLVRYfxGk8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732005595; c=relaxed/simple; bh=+9nf9QsDdjUPoFsHi5usdr7sn0DYItbRdpYnVFW785A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=bc7vmJICTM6GKWWr8VdalFQ8SpdKVTmqZpBkcrdXeDMFgZdG4EogzATbRds9PfLMeISeb3rUud7bszs1fMwlWGbaUBHePtKwAg/ude6V/fQ9oqml9AIuC5ri30oFJ1gOy/sTWM1k0uaejheTjytsPtgxxFwcnO7ZKL9G2PuzFoQ= 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=kjJ6OWVA; arc=fail smtp.client-ip=40.107.22.79 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="kjJ6OWVA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rOeli7GpILXiS90xllpurd5VukzmeVLlluBUF7L1HVcpw0QBzrU5qq9tWmLSq0UXlZfk6zN/TaxDiRibIUtBijbFDjjriKTfTa4z2xII2UUhsyXibIYd6+UzR1HyB1Pwa53L1D9HVkIp38LSFMIAI4BJUWIy/dxwuD4uwida9iqlY7Os3wx01Pnmes0dlMGnF8i7jUj751LqKzGqndGFcWbp9ZewwPeaD0jnihRYaLocKrKQ17LR/gGFsbON5MkdJ3OtBkfAnRqaAcO3c7xScjKlxTOaspNzybT5vWfBSgDS8KKrGkZSJIKXEkJ4rUlj24JBj7dIWLdR6VyG8VN/dw== 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=9LEPox4/t6eD1N0yRuIj+mhJvpNJdmnUnmNgwk7HOUM=; b=ZYDhSn36PvvYgTanU2xGNzZu6ddXhKzSpEZqqruYfNQdyc+NEqD4n6Y9X6GHGgVpT26BY36BZ+zFXaBxTX/DKunDM9v/UknnbzHEso/46dhXsNn5hcZREEGfWkBsFeUmrnZVywnVx1bwUxrf34lET1T169cmxUwf0fWFi6R4JMfI4D4aB7v9LJNFWo+ci8jUr7WOI56SJy2tZM3e9oc0FvBVXTgVnz69wSkBB6xCD6XTWl3Gdf1SBZ56WEaag9k/77UMGag2M4gx8c6UnQdBPUG458dYoNN1xMzmxjzK2tRoB0oH3PZdAcoGryej6TwH8200hlaswQMNhqQa2vrYiA== 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=9LEPox4/t6eD1N0yRuIj+mhJvpNJdmnUnmNgwk7HOUM=; b=kjJ6OWVANsV07aD3uIOwHYBZD47r2rrBoD5Op3RAydxKTOVjCKK1QYK6GAdmCw2MtUig5oTKjXy9JS/IybLVoL75quRo+Psgh00fw/PCoz1bzHFmfGXt7LjfGsQNkRcM772ubTqNSa5r8kQnY0ADytACHRgneQSO6iRyQhkvzaPCCZ5hW3lH6UQOglNMEqSeDnsuB/Lk7c/+n7fVMKL9Mc+Oj9m0+0i8rpJXAPELutYXZQ+yLCocwmNoVpJZivHYU5cWGn1A6PkLo6EWBMuPqOuU5jjMkB9KwW4o/rEfqyqwk0YY9g0ufHT8+YNQFkDQNkpasb+1udTIT51QmTma7g== 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 AM7PR04MB7160.eurprd04.prod.outlook.com (2603:10a6:20b:119::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.23; Tue, 19 Nov 2024 08:39:50 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8158.023; Tue, 19 Nov 2024 08:39:50 +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, frank.li@nxp.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH v6 net-next 3/5] net: enetc: update max chained Tx BD number for i.MX95 ENETC Date: Tue, 19 Nov 2024 16:23:42 +0800 Message-Id: <20241119082344.2022830-4-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241119082344.2022830-1-wei.fang@nxp.com> References: <20241119082344.2022830-1-wei.fang@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2P153CA0019.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AM7PR04MB7160:EE_ X-MS-Office365-Filtering-Correlation-Id: 7bfba995-1a00-47bd-8852-08dd0875babd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?xmyXbhZ6mzILYdXyBTuBusBQm8XuGA21w8ACaBZ+oDk17p2PJ9XzOoaVmSNK?= =?us-ascii?Q?Nq8GObhFbSNyry9d5rY6sVeKgZHQP/0JiyAnfbUFvQ6xIfKXICNR9KsfBA2x?= =?us-ascii?Q?3c8NEvVQ861TlKa3X37kSBXDb6LgYiiLdzpWaORXcpFjs8xZwy8aIRPJriYS?= =?us-ascii?Q?hENVMHXbeOR3xEI/8B0mkSZzNOMBkJ2XPlemJWcaGoWm6nH8WtWC423OdcCX?= =?us-ascii?Q?ms9XepbkYDiyxf96CghWyVkdS/oPUYer5gMueoa6D4prGRJ4/w+qKztViqI4?= =?us-ascii?Q?lu07XARbRww5D5OTEUWPGj6hy+IcsisYNKQJSKkyBDQKf0NsYUylQ+CABiRv?= =?us-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U7MvojoMDvYseBc1?= =?us-ascii?Q?BVn1sYaryuuYF9E8BYTOA1zcN11lpw8thWnEyJepcwNVA9KRYGq+z5kN7a2J?= =?us-ascii?Q?7RDs/E4gXNbmJGACxx/CfbeZaEAmkqEngWYbonzwzo4ZU2hgrR58mTn7NdL1?= =?us-ascii?Q?4ccLRjY=3D?= 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)(1800799024)(52116014)(376014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?9/MNaLTLUNPQxzG63m2vK8q8FGOfu/YRM4HxXTA7GwhXzsuKOwLMTitoAA5H?= =?us-ascii?Q?IhSZfvV9MZzxBsnPiV+fp+DCCvs5KcoGC2yo6G76fsIYtZMKplcoXcqQMFn3?= =?us-ascii?Q?XxoP5g3Litq9PSBiWjkC6q1QQTYPrJ74dkA3t/gHuE9Fc6h5o9B3cMd7tdaw?= =?us-ascii?Q?v9bZDXB4Rca71PG/XmyxnY7yAoatDlZMnqBE5FdXzB7kQlXAb8ok8VCedIxG?= =?us-ascii?Q?IFVUaDssVvtK2Es8pNxr5dyseSm4E5DABR9jw08a7EZ59dKkcJFxKfS66QcJ?= =?us-ascii?Q?2QCrKOazzN4IRCCh47mOvd89wFuaMpgpJPS9kOaozt+G+qhxYzozflDB5QaL?= =?us-ascii?Q?0R/VJ1Hv5gyeRSNqYiwPfX+TjqKmzjvUMbVWSPW+3EHtbd2Nqj/uK4xe7/0a?= =?us-ascii?Q?nAU9WNGB17IBwnjtDcZrIgeazu0SywZ2yDyRQp+51ZVLIrhU0RbAR7p4EVFp?= =?us-ascii?Q?vM8tz4iC8XopXRyKMs7xnTtAoW8JHoJOJvhJciXS1cuEhsU2rt/fb2xz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dE+wWbrSgBfalPquOVGzJqc8swLS13krPZH?= =?us-ascii?Q?6VCPeO9G74l73dAAxyzdVqaSXmwIyefozGbODMkKtE6L1WsdY+HoRGTAYG2U?= =?us-ascii?Q?bH8KZGnxD/of4JxZIvTRgVco9j+Yr3Er5/6/Km9J2XJ6JJVJQyLolUL7NR6B?= =?us-ascii?Q?wpYVWgYs4+1oDsgsZC8VSpYaJS0/6mn1kHHC0jeM?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7bfba995-1a00-47bd-8852-08dd0875babd X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2024 08:39:50.7216 (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: YZYRAOU+veGQSY2Q/bU39fkcIB/C0yYNwFptLmrpKMLVTAv9WrdTFWdTuhoU/j91Rel/jbGd9C3JiFfokVh4OQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7160 Content-Type: text/plain; charset="utf-8" The max chained Tx BDs of latest ENETC (i.MX95 ENETC, rev 4.1) has been increased to 63, but since the range of MAX_SKB_FRAGS is 17~45, so for i.MX95 ENETC and later revision, it is better to set ENETC4_MAX_SKB_FRAGS to MAX_SKB_FRAGS. In addition, add max_frags in struct enetc_drvdata to indicate the max chained BDs supported by device. Because the max number of chained BDs supported by LS1028A and i.MX95 ENETC is different. Signed-off-by: Wei Fang Reviewed-by: Frank Li Reviewed-by: Claudiu Manoil --- v2: 1. Refine the commit message 2. Add Reviewed-by tag v3: no changes v4: no changes v5: no changes v6: no changes --- drivers/net/ethernet/freescale/enetc/enetc.c | 13 +++++++++---- drivers/net/ethernet/freescale/enetc/enetc.h | 13 +++++++++++-- .../net/ethernet/freescale/enetc/enetc_pf_common.c | 1 + drivers/net/ethernet/freescale/enetc/enetc_vf.c | 1 + 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/eth= ernet/freescale/enetc/enetc.c index 94a78dca86e1..dafe7aeac26b 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -525,6 +525,7 @@ static void enetc_tso_complete_csum(struct enetc_bdr *t= x_ring, struct tso_t *tso =20 static int enetc_map_tx_tso_buffs(struct enetc_bdr *tx_ring, struct sk_buf= f *skb) { + struct enetc_ndev_priv *priv =3D netdev_priv(tx_ring->ndev); int hdr_len, total_len, data_len; struct enetc_tx_swbd *tx_swbd; union enetc_tx_bd *txbd; @@ -590,7 +591,7 @@ static int enetc_map_tx_tso_buffs(struct enetc_bdr *tx_= ring, struct sk_buff *skb bd_data_num++; tso_build_data(skb, &tso, size); =20 - if (unlikely(bd_data_num >=3D ENETC_MAX_SKB_FRAGS && data_len)) + if (unlikely(bd_data_num >=3D priv->max_frags && data_len)) goto err_chained_bd; } =20 @@ -651,7 +652,7 @@ static netdev_tx_t enetc_start_xmit(struct sk_buff *skb, count =3D enetc_map_tx_tso_buffs(tx_ring, skb); enetc_unlock_mdio(); } else { - if (unlikely(skb_shinfo(skb)->nr_frags > ENETC_MAX_SKB_FRAGS)) + if (unlikely(skb_shinfo(skb)->nr_frags > priv->max_frags)) if (unlikely(skb_linearize(skb))) goto drop_packet_err; =20 @@ -669,7 +670,7 @@ static netdev_tx_t enetc_start_xmit(struct sk_buff *skb, if (unlikely(!count)) goto drop_packet_err; =20 - if (enetc_bd_unused(tx_ring) < ENETC_TXBDS_MAX_NEEDED) + if (enetc_bd_unused(tx_ring) < ENETC_TXBDS_MAX_NEEDED(priv->max_frags)) netif_stop_subqueue(ndev, tx_ring->index); =20 return NETDEV_TX_OK; @@ -937,7 +938,8 @@ static bool enetc_clean_tx_ring(struct enetc_bdr *tx_ri= ng, int napi_budget) if (unlikely(tx_frm_cnt && netif_carrier_ok(ndev) && __netif_subqueue_stopped(ndev, tx_ring->index) && !test_bit(ENETC_TX_DOWN, &priv->flags) && - (enetc_bd_unused(tx_ring) >=3D ENETC_TXBDS_MAX_NEEDED))) { + (enetc_bd_unused(tx_ring) >=3D + ENETC_TXBDS_MAX_NEEDED(priv->max_frags)))) { netif_wake_subqueue(ndev, tx_ring->index); } =20 @@ -3312,6 +3314,7 @@ EXPORT_SYMBOL_GPL(enetc_pci_remove); static const struct enetc_drvdata enetc_pf_data =3D { .sysclk_freq =3D ENETC_CLK_400M, .pmac_offset =3D ENETC_PMAC_OFFSET, + .max_frags =3D ENETC_MAX_SKB_FRAGS, .eth_ops =3D &enetc_pf_ethtool_ops, }; =20 @@ -3320,11 +3323,13 @@ static const struct enetc_drvdata enetc4_pf_data = =3D { .pmac_offset =3D ENETC4_PMAC_OFFSET, .rx_csum =3D 1, .tx_csum =3D 1, + .max_frags =3D ENETC4_MAX_SKB_FRAGS, .eth_ops =3D &enetc4_pf_ethtool_ops, }; =20 static const struct enetc_drvdata enetc_vf_data =3D { .sysclk_freq =3D ENETC_CLK_400M, + .max_frags =3D ENETC_MAX_SKB_FRAGS, .eth_ops =3D &enetc_vf_ethtool_ops, }; =20 diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/eth= ernet/freescale/enetc/enetc.h index ee11ff97e9ed..a78af4f624e0 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -59,9 +59,16 @@ struct enetc_rx_swbd { =20 /* ENETC overhead: optional extension BD + 1 BD gap */ #define ENETC_TXBDS_NEEDED(val) ((val) + 2) -/* max # of chained Tx BDs is 15, including head and extension BD */ +/* For LS1028A, max # of chained Tx BDs is 15, including head and + * extension BD. + */ #define ENETC_MAX_SKB_FRAGS 13 -#define ENETC_TXBDS_MAX_NEEDED ENETC_TXBDS_NEEDED(ENETC_MAX_SKB_FRAGS + 1) +/* For ENETC v4 and later versions, max # of chained Tx BDs is 63, + * including head and extension BD, but the range of MAX_SKB_FRAGS + * is 17 ~ 45, so set ENETC4_MAX_SKB_FRAGS to MAX_SKB_FRAGS. + */ +#define ENETC4_MAX_SKB_FRAGS MAX_SKB_FRAGS +#define ENETC_TXBDS_MAX_NEEDED(x) ENETC_TXBDS_NEEDED((x) + 1) =20 struct enetc_ring_stats { unsigned int packets; @@ -236,6 +243,7 @@ struct enetc_drvdata { u32 pmac_offset; /* Only valid for PSI which supports 802.1Qbu */ u8 rx_csum:1; u8 tx_csum:1; + u8 max_frags; u64 sysclk_freq; const struct ethtool_ops *eth_ops; }; @@ -379,6 +387,7 @@ struct enetc_ndev_priv { u16 msg_enable; =20 u8 preemptible_tcs; + u8 max_frags; /* The maximum number of BDs for fragments */ =20 enum enetc_active_offloads active_offloads; =20 diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drive= rs/net/ethernet/freescale/enetc/enetc_pf_common.c index 3a8a5b6d8c26..2c4c6af672e7 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -101,6 +101,7 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct = net_device *ndev, =20 priv->msg_enable =3D (NETIF_MSG_WOL << 1) - 1; priv->sysclk_freq =3D si->drvdata->sysclk_freq; + priv->max_frags =3D si->drvdata->max_frags; ndev->netdev_ops =3D ndev_ops; enetc_set_ethtool_ops(ndev); ndev->watchdog_timeo =3D 5 * HZ; diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/= ethernet/freescale/enetc/enetc_vf.c index 31e630638090..052833acd220 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c @@ -129,6 +129,7 @@ static void enetc_vf_netdev_setup(struct enetc_si *si, = struct net_device *ndev, =20 priv->msg_enable =3D (NETIF_MSG_IFUP << 1) - 1; priv->sysclk_freq =3D si->drvdata->sysclk_freq; + priv->max_frags =3D si->drvdata->max_frags; ndev->netdev_ops =3D ndev_ops; enetc_set_ethtool_ops(ndev); ndev->watchdog_timeo =3D 5 * HZ; --=20 2.34.1