From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0BA5946002; Mon, 6 Jan 2025 15:25:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A77AA40691; Mon, 6 Jan 2025 15:25:51 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mails.dpdk.org (Postfix) with ESMTP id 7EED640687 for ; Mon, 6 Jan 2025 15:25:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736173548; x=1767709548; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=sVaFczA74mqvXHLNuhrHhBsQUFa4MqjZmRi0UVZhOu0=; b=l7/CuzOP4pC2O2hnDffaMZhySXVZT9GkDHH6ZJPrnh+fw3DzXlIU4wKU y6e1qRxUWFoERJlkoynubKbosUTI48yrQO1SMsXFgfAZ8hpRqVseX5C8J Gdhy7PHawUMPVJEJ5m1RBL20QI/CxJjgEUbubgDSj+ZTBSNZta5cYFi0a TEbHcbWpjQAUe4YPrRmR2DnikrYfBDYvVvNg/iHhMvCeDAN4lSkPNK65T 0Puc54qRpGbmo4cTGXlMkFBs+7NBxXQqcjWHD+yQS5AGbcW1P1YbOrmY7 1Eg39LWoZvpqkIrcDzKn/+XkfzcWAx3rMiPHQz0Ej2jsIVmc0l5qFryXm w==; X-CSE-ConnectionGUID: TCu+VzrdSVSfOtI1V/OBLg== X-CSE-MsgGUID: sIzKGOjfRwqR6IAkHvwI+A== X-IronPort-AV: E=McAfee;i="6700,10204,11307"; a="58781793" X-IronPort-AV: E=Sophos;i="6.12,292,1728975600"; d="scan'208";a="58781793" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2025 06:25:46 -0800 X-CSE-ConnectionGUID: QLg2uHMoQCysr1lf/9UwTA== X-CSE-MsgGUID: T2v+g7bsSB6ZAsi3yqTw2A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="102953512" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orviesa007.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 06 Jan 2025 06:25:45 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44; Mon, 6 Jan 2025 06:25:44 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44 via Frontend Transport; Mon, 6 Jan 2025 06:25:44 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.40) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.44; Mon, 6 Jan 2025 06:25:44 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gkhcQgl60sZs3y7xCpAn6TQeaLIJWAaa8WzsyCoh9Jo4lbqLW1KTcJ47mP0oOuLYKtVeFgYUyTVgLq+r4xit59LFZJEtLNjxhnJZNU39V4qQ0tIxA5XsUisMKN3QcgloY/MWli9W+Ofs4jbdt0KQjxyua8BvR7og56JtO36xRCnA2buEJ5zrcC33bG/v3CHibYh8KzzOQ9AFB2smb7cGcO1RTehSzttY5iOnTfB382kwd/9bZXRSvQ83NZkcq16H6YdL3ZPIIaxtbXzaqXLBtoyI8qrVAZzGVInlzJJO9MZPNt4zbaOmUXCwp42jcBWB5kroabxdH+mW1/bYFEtuBg== 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=dHSuARLVWEgXca1bP0R9riiKK2c5OZ56mq16fUybfWM=; b=a8uMi9E/pocbNGNByJ5+JYT/UepYK5q90ojTL0tB6jl1kWRO6uK6P+ke0Dj5DkDYqgP+6k+JvLUxeAOLAFOEe5ZsrbV3wjk4uwb0HvW38SNAM39UPFJnDz1OmBq36oRvwMGWvq1jlvCQRyb7zS5GOZhgOV7VXSq9knZE9iRA6pRM/AXL+flhnj1++5dPARuc1/dwZlpn4ChYGXhMBFP4n7EzUcGSDabNiDu52fh0TRi4VnAdMxk0hR0do97h9DDlAzv6BdVbyn/GYLM5TvW94sn/Mfqi7U/Eu1f9m38X+ML3gKMJqhalpJfw2etZfKmrZizlpwkub2UTdCx177O5cg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by SN7PR11MB6677.namprd11.prod.outlook.com (2603:10b6:806:26b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.12; Mon, 6 Jan 2025 14:25:11 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b%5]) with mapi id 15.20.8314.015; Mon, 6 Jan 2025 14:25:11 +0000 Date: Mon, 6 Jan 2025 14:25:05 +0000 From: Bruce Richardson To: Stephen Hemminger CC: , David Christensen , Ian Stokes , Konstantin Ananyev , Wathsala Vithanage , Vladimir Medvedkin , Anatoly Burakov Subject: Re: [PATCH v4 01/24] net/_common_intel: add pkt reassembly fn for intel drivers Message-ID: References: <20241122125418.2857301-1-bruce.richardson@intel.com> <20241220143925.609044-1-bruce.richardson@intel.com> <20241220143925.609044-2-bruce.richardson@intel.com> <20241220081540.1a6a3da5@hermes.local> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20241220081540.1a6a3da5@hermes.local> X-ClientProxiedBy: DUZPR01CA0032.eurprd01.prod.exchangelabs.com (2603:10a6:10:468::11) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|SN7PR11MB6677:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f7eba43-fc60-49bc-9fdb-08dd2e5ded85 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?3eUDI1K5DuHBQ8vvRCGDoaiVCr8ngHkqps9E/MPLx0MRxpDetDg5PRhw6Xsc?= =?us-ascii?Q?/NGYKzBs5FUqYq9sWMA1UWWtgLBVtTWij+PYL5sNaqZlsnipwPy6z6xQvTYl?= =?us-ascii?Q?K+p5JULLFi5qf6hrXINHqoG+Odf+du766e2eiBqfzBfpBPo5ii2Tw7cX5ZT6?= =?us-ascii?Q?Qhwo/+y2AGynzUcmQNKuA9FtwtPhodmn1zhdAFLRLj9BeJZW83eWEy8RNmgy?= =?us-ascii?Q?B49k6YjzCPWfmjFF1U9o2TA1/pt+xMa2If/JunhrnYfMjulHPEqpGS7QP3Fy?= =?us-ascii?Q?9HBcbEoStoyv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ShqxXMHs?= =?us-ascii?Q?p5fUBN3hr5EyQPNBmtoSASxh9hFNidrMDYWqaZzQpFdDtpTi/QaXAsNkDmMU?= =?us-ascii?Q?2uuWV5Q86LEJQkhH09SKYonbLj6yYatGNzEJ+myaB++ev5yB09VgJQttvORo?= =?us-ascii?Q?lMsx1fzLlQilxlbXtZiT7LJ3W5herGf4tGf4DbewK4NFSzEKKpyT2/TCCSIe?= =?us-ascii?Q?R771NQfW6jgr0HlXSX1CfeZxfmOl?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?JSmGjWP5zOqvhKa3dSS0iKDF6sfvIuFWWWgLSsLlFKydnK7C0+p1eNng/upI?= =?us-ascii?Q?LsAKKcU27auKvafxuMdcBmNsEE1Us6gLHeq/koSpgJrTcCqVey0i7ktd6+Hp?= =?us-ascii?Q?ufBMO/DimuGLR9Qf1hF/0oOvEXjCJHEMrxU/BW1SuyRehnvtVCcYPOiy+nge?= =?us-ascii?Q?aOULRD2fjr2G7iemVQmQXV/4dZLTN34upRKQy8BPRVP6Bdo40t3NlRym2CBF?= =?us-ascii?Q?aPph+el3alrfZKIGjQ6fPXvUmSpU6U/CyB1jKygKh1m7pV1nNIjUJ3JrRTjk?= =?us-ascii?Q?nlulw/HXk/cizdaGhMzdirtsUyMAMysmG7oHoLbCAhvi8m53SU+afC0kncFN?= =?us-ascii?Q?nLbMnQa5yafzbmM38af63a/0kzMAjX7jzsonJq6kaZlLmwrDyJ798p3/F3dv?= =?us-ascii?Q?wKKBd7djz2BRByXrkIUcOHAIyEyFu8GZrd9bwUQK4xxKeCfMVqaSSHXRgytu?= =?us-ascii?Q?E/uTx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+Q?= =?us-ascii?Q?2T2ZlFm3KSJwZKrQta6tA18uHW+5oON2cupbbNCvitaoS2/b6j0UpOO8kGDC?= =?us-ascii?Q?27khnoZiKkFUz3/9MoMHXuEXUjkm2o1eb61KB5GM7illkhmvW92k1DdlmcDn?= =?us-ascii?Q?KrrAjTZRLfI/e/jpMvA77VQe9VTT3OfNXYRDzcIx2MuRrU7GBzXq4kWPU440?= =?us-ascii?Q?UV7vw0OcRxG8F6HnAgoQ+MiCil3gzkOY0gIjtQyCPXNk3hL3RIIe+1SBZJ6U?= =?us-ascii?Q?VQ=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 4f7eba43-fc60-49bc-9fdb-08dd2e5ded85 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2025 14:25:11.1769 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6icrS8/8UGOWn71BZvqBAcOsdf1eNFbhZvCxpXsfMcNeJQWZHDsjzbFGHjZX0uw72T8n92i4x7BSNyRttHqCKPRk4xc6HhjIt1+ErQ3tvGA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB6677 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Fri, Dec 20, 2024 at 08:15:40AM -0800, Stephen Hemminger wrote: > On Fri, 20 Dec 2024 14:38:58 +0000 > Bruce Richardson wrote: > > > + > > + if (!split_flags[buf_idx]) { > > + /* it's the last packet of the set */ > > + start->hash = end->hash; > > + start->vlan_tci = end->vlan_tci; > > + start->ol_flags = end->ol_flags; > > + /* we need to strip crc for the whole packet */ > > + start->pkt_len -= crc_len; > > + if (end->data_len > crc_len) { > > + end->data_len -= crc_len; > > + } else { > > + /* free up last mbuf */ > > + struct rte_mbuf *secondlast = start; > > + > > + start->nb_segs--; > > + while (secondlast->next != end) > > + secondlast = secondlast->next; > > + secondlast->data_len -= (crc_len - end->data_len); > > + secondlast->next = NULL; > > + rte_pktmbuf_free_seg(end); > > + } > > The problem with freeing the last buffer is that the CRC will be garbage. > What if the CRC is sitting past the last mbuf? > > +-----------------------+ +-----+ > | Data +--->+ CRC | > +-----------------------+ +-----+ > > This part (from original code) will free the second mbuf which contains > the CRC. The whole "don't strip CRC and leave it past the mbuf data" model > of mbuf's is a danger trap. Can you explain more clearly what you see as the issue with the current code above? The "crc_len" variable contains the length of the CRC included in the packet, which should be removed from that before returning the mbuf from RX. It contains "0" if the CRC is HW stripped, and "4" if the CRC needs to be removed by software - something that is done just by subtracting the CRC length from the packet and buffer lengths. The freeing of the last segment occurs only in the case that the last segment contains the CRC only - or part of the CRC only, as otherwise we would have an extra empty buffer at the end of the chain. /Bruce