From patchwork Mon Jun 3 21:22:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13684385 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2064.outbound.protection.outlook.com [40.107.94.64]) (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 DAD3E13C3DD for ; Mon, 3 Jun 2024 21:23:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717449832; cv=fail; b=rfEYhVX8P18xz2tcuLy4lOnzJew1H89UY4SOyzKMkQRCtx/PH7HDAub478/0eThpyWZnI4vvUydnxIC2MFcNf1PBSdTOqLQgXbTE0Vx7UDO1uuE/40ZO6W4sKcBabghO2YqkCJmy37Dk/WWKA1I9sJTfsLyBUK40rNwjiiLawOo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717449832; c=relaxed/simple; bh=MrtkEoB4QcVfZPsdbr/M37ZSapsWMpsMa/8ED1H/pgs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YzVqLX539MpPxDSlFj6hL14LCeZ5CeGmWKkq+POFuDoF4U10apiCLFCc1y3SvFpTOSmU2FZbHpqMEjvIG0wGLbBwHMfa22un4b3R9gJWVHSAlUV8liMs9AJkJKJn5WK0byelwHSohpxG/eBrjn3ex27JLGi202GTMKZg2vBDwOs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=LVI8fxLd; arc=fail smtp.client-ip=40.107.94.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="LVI8fxLd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZD8n0GvAZSKQyeCGOMRuKWFnVvL106L43YG6ZqafqE64rwgkG58Gf025tFOTki4o+ytIT+gyv48XvugL87tZSU/KHN+8lBET5P0WuO4PfbtCnsmwlYfXOuym+36LZeW/WoueyM6llwqUW+p7vtSdiKIGu18/dfLs7V7sDF/vtEWF9L/J8RUOUJm4fNAeiQPPIUIxw9+0iyfyqR3NkSPg7lAM2Jz9ExPAvYaCPFAv8sXCM2ureFg4CQIQzBNIIljVcqwiHC0ONND5I7eKd0N0RNlB4xaY6MLKu8DMDQlLvsJjidMkhVZMsbvYG/usLc1JUoizrViSyfjF1IUOsHHprQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=0jrWLwFwKqJRia/JAlXF/3a625sOfAOKo8KuRkIhxFA=; b=kRiZioXKcVw7JkO1UKOX2zgt8RAsXmLzR5exXoNgqXBRFAUCrSYL+Fa/J9StfzVkxX7BRLTS4JNEOFJo78wJK/UIdEr+qA5VYaz8PFDI1ZRSltaoqhVHkLo59jNnuupiDdvxRIbWf5GLq5eNMhgbBAVWWLPST0DYSNVTJL387yv21Kuz4o5NljEWor7Qz47nlmiECkM6xob8z2YrVRNBHdl9AZ/qvOmIZm2bCbWtabt6AaakDjRKqnkz2vPAdZOY57e9mvhXE2BbFBxOh62Sw1ch3Ohm2yerVsMvJifhwB1+MvFteGq9zTCFFEzkpTAivvf3NHrhCQJYgfpW99Pt9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0jrWLwFwKqJRia/JAlXF/3a625sOfAOKo8KuRkIhxFA=; b=LVI8fxLdLwkhwGIuWwyVcam147dfBASKbFgZ0gFCJcN9zHJPVwvWHRFIK/5QcOu7Lu2sNpqjibOt+mywlJeNT4i7TReehMx0Cd6JVElTj5JtGzaIH6oHtjhTnXIwFCWctTzuyUAzVfHPlWBFMFPJLk1cvmDcocZQcuj7qos+P90qpX/PyzKz+6n+WHodMB24qmdXoTARJPTLtSLpahs/tmjf2BoW2D1WIT4r8GAoO+5NeFYQjnUrwM+9IxjpAX3sRqtVwt/2b9RwPa5oFV6lNpyGXZ+QrseqBub4bLEZF24CxgklRw3/SICGDOVoT2ysXxOmUb4XgYTKsvOdj9KS4g== Received: from SA0PR11CA0020.namprd11.prod.outlook.com (2603:10b6:806:d3::25) by CY8PR12MB7292.namprd12.prod.outlook.com (2603:10b6:930:53::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.22; Mon, 3 Jun 2024 21:23:48 +0000 Received: from SN1PEPF00036F40.namprd05.prod.outlook.com (2603:10b6:806:d3:cafe::a9) by SA0PR11CA0020.outlook.office365.com (2603:10b6:806:d3::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.29 via Frontend Transport; Mon, 3 Jun 2024 21:23:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SN1PEPF00036F40.mail.protection.outlook.com (10.167.248.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.15 via Frontend Transport; Mon, 3 Jun 2024 21:23:47 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 3 Jun 2024 14:23:38 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 3 Jun 2024 14:23:38 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 3 Jun 2024 14:23:35 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , Dragos Tatulea , Tariq Toukan Subject: [PATCH net-next V2 07/14] net/mlx5e: SHAMPO, Specialize mlx5e_fill_skb_data() Date: Tue, 4 Jun 2024 00:22:12 +0300 Message-ID: <20240603212219.1037656-8-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240603212219.1037656-1-tariqt@nvidia.com> References: <20240603212219.1037656-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00036F40:EE_|CY8PR12MB7292:EE_ X-MS-Office365-Filtering-Correlation-Id: ed2d7f1c-be47-4db7-af76-08dc841374cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|376005|36860700004|1800799015; X-Microsoft-Antispam-Message-Info: VdTVHLJ2V9+c70InoGYDTV2aUd04bmsYdW6sdklfBF680Xk/MbQoUszDUgjn9UOaP79qk3H6FKeeUlpfODS6HBDBxbM9tSjqFFnkerdoy/d5MencFg3INhYvvjshn3515aEFaB8GUyKuNbxAfBRd9WLTGBT55YnYCqcxJh5w347FAvejmXbZ+iEQB8+Usi8jFNy+kG+RCxNrPqp4ITTIi9n0Xqhj6UAVhQoV74TC30wb7sxpVtAfM/5uPVoHWYZf1Q9cEGUCBZP9ONOXmdxtFGuhUc3pq5WX2+3FjZYYcqv0Gv3njnOLIYHtMgH/QsFt9jinttXYsy1w+U80wLjzLU+OhyYg0qrL1EWa3OxiI48TXUGKPXTEGCGdaJDCEf3IHESUOkt8bszeOpkAWWVh7QC4kpDzr0xgV/7oXN3iLoHH7A9TmK4Bt928GzTnGA3h/W21UFn7PpnPu7gmzOMs962ukr0OzE/MXxjiL9k/0IOiBlWBIN9PH8JupeCTlMiYoOv/Q/4mcsotkmWwdqlwFG978iYjcIovSe1OYXAQOtpKDmzbzhYSH9OF+tTVrnrQna92y8HYejAZiCQOpgtANf+d9APKpWe5tVzWEWXerr/+hCqdEbitz10AoZHxZVXlsfxPLyG0HzVYd3EX28A9xxYntnwm5huIM1D1yEdzKtrzOXCTaROvrCocdprDsJElzcQig/9DzGvzK4WpZ1fT6F5A8cYgHV5YAMTtnXf0/mBY3pfitRDbknpqw/sOF/5hk34m4Wk0F8gj/ow6vF3b1k64Ngx3OKfG5BbqtjfeSFVLMPX6dHeQC1tPB3Tr97OMh6yNLOwF7IWzJxDjsoSqJXiBvqS5ROfZetyUF9h3sqGTO8epB9bj3Ag+SAaknZNkHv+Vu6ZNU8EDkWz95o0u/WyoWFsZBBdc5qMxJ5YIIblRKWdGTMghT4TO2SeaY+duYHw3cj2jhl3m6fpdwjpMj3rsiYPUM3u+wpZSrzy0pvcmJ/00dERSjAHpBSxoPg/aZvdwsllIWjCr5+v31XoZRhBda3BfeROt5DokzzH0IeuklLwJA4Aq76MK7NSp4gE6yGY295yaiIlNcHsITjuOg2/tRRp2STMDKseQLeTip9oHerb8o+pwAKFXdGBup+FQYLuPZSMbuDxAk3C0ZkS0aBgUDNMvfRVLayzUhWFijO4Lei5LMRtBq20ylk73WB7e6WH8+V9iCq1RkG3XexEmLUbCIERVpwQYfVL1txvj5hmMoKgeaWrMcVJfGCTXDhVsrgBdc2U22GW+Gxml0Jk2nRuHILuUFTDoe21NMnMM4GnLL/aSugoT/72V3yWkRjCoshi4IEnY7Cm3MWJQ+4OpmsCh3Ts4z3nxbwuXe+7pyZYSrtuki0CZqayjs5pbPRJz X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230031)(82310400017)(376005)(36860700004)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2024 21:23:47.7268 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed2d7f1c-be47-4db7-af76-08dc841374cb X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF00036F40.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7292 X-Patchwork-Delegate: kuba@kernel.org From: Dragos Tatulea mlx5e_fill_skb_data() used to have multiple callers. But after the XDP multibuf refactoring from commit 2cb0e27d43b4 ("net/mlx5e: RX, Prepare non-linear striding RQ for XDP multi-buffer support") the SHAMPO code path is the only caller. Take advantage of this and specialize the function: - Drop the redundant check. - Assume that data_bcnt is > 0. This is needed in a downstream patch. Rename the function as well to make things clear. Signed-off-by: Dragos Tatulea Suggested-by: Tariq Toukan Signed-off-by: Tariq Toukan --- .../net/ethernet/mellanox/mlx5/core/en_rx.c | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index bb59ee0b1567..1e3a5b2afeae 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -1948,21 +1948,16 @@ const struct mlx5e_rx_handlers mlx5e_rx_handlers_rep = { #endif static void -mlx5e_fill_skb_data(struct sk_buff *skb, struct mlx5e_rq *rq, - struct mlx5e_frag_page *frag_page, - u32 data_bcnt, u32 data_offset) +mlx5e_shampo_fill_skb_data(struct sk_buff *skb, struct mlx5e_rq *rq, + struct mlx5e_frag_page *frag_page, + u32 data_bcnt, u32 data_offset) { net_prefetchw(skb->data); - while (data_bcnt) { + do { /* Non-linear mode, hence non-XSK, which always uses PAGE_SIZE. */ u32 pg_consumed_bytes = min_t(u32, PAGE_SIZE - data_offset, data_bcnt); - unsigned int truesize; - - if (test_bit(MLX5E_RQ_STATE_SHAMPO, &rq->state)) - truesize = pg_consumed_bytes; - else - truesize = ALIGN(pg_consumed_bytes, BIT(rq->mpwqe.log_stride_sz)); + unsigned int truesize = pg_consumed_bytes; frag_page->frags++; mlx5e_add_skb_frag(rq, skb, frag_page->page, data_offset, @@ -1971,7 +1966,7 @@ mlx5e_fill_skb_data(struct sk_buff *skb, struct mlx5e_rq *rq, data_bcnt -= pg_consumed_bytes; data_offset = 0; frag_page++; - } + } while (data_bcnt); } static struct sk_buff * @@ -2330,10 +2325,12 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq } if (likely(head_size)) { - struct mlx5e_frag_page *frag_page; + if (data_bcnt) { + struct mlx5e_frag_page *frag_page; - frag_page = &wi->alloc_units.frag_pages[page_idx]; - mlx5e_fill_skb_data(*skb, rq, frag_page, data_bcnt, data_offset); + frag_page = &wi->alloc_units.frag_pages[page_idx]; + mlx5e_shampo_fill_skb_data(*skb, rq, frag_page, data_bcnt, data_offset); + } } mlx5e_shampo_complete_rx_cqe(rq, cqe, cqe_bcnt, *skb);