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 8266E45B61; Thu, 17 Oct 2024 21:03:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A7824064C; Thu, 17 Oct 2024 21:03:31 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by mails.dpdk.org (Postfix) with ESMTP id 7BBE74029C for ; Thu, 17 Oct 2024 21:03:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729191810; x=1760727810; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=igl2YEwhivlYogIzLCj1WYlj2bwbXIbc6q2MRUUnoJg=; b=UsUTVnXYlTy+tqr9f9/bx+qpsy5H05w8YyjmS6fy05Z0ezgho6wPyxEa HF2ZS7Uqx+DCbJgSkTtkYjkwiwe0TmBVEekNyVhfanYKW71jrqc9lVXI9 o2BoUVMHGCxwI4elWYEHMHU/fUDKqvES3QIF54Ux6ov0iEkCGq6o9GmYf 1JVzT/2erO/0nqrvNUh0zn65vfU1eNfdstu4Y6/rn6vKxNX4pnI4Gzkm5 N8wrKb4Q4Stlph0PqtM5I3h/s82HPkNUMZt2Wz/2Ng9kqXh6FhZjVlGLS VDxZylOu3zhbx/Lh5w2C9ZkfhgUxxv4U5bpAzWDB0eXpiY6yruQ0o7C+k Q==; X-CSE-ConnectionGUID: H9qlHWuFTgOMIH9CUDjuhA== X-CSE-MsgGUID: gQdozzKlTQSFlNvALAhf/A== X-IronPort-AV: E=McAfee;i="6700,10204,11228"; a="28138664" X-IronPort-AV: E=Sophos;i="6.11,211,1725346800"; d="scan'208";a="28138664" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2024 12:03:28 -0700 X-CSE-ConnectionGUID: aUoGZT9USOyeujOixD8DCQ== X-CSE-MsgGUID: BtsuBv+LRtGuKW26GIbpdQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,211,1725346800"; d="scan'208";a="78537709" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 17 Oct 2024 12:03:28 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 17 Oct 2024 12:03:27 -0700 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 17 Oct 2024 12:03:27 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Thu, 17 Oct 2024 12:03:27 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.41) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 17 Oct 2024 12:03:26 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mYbbOfOxXF28qAF9CoNACIhI2/gzGhkC2uit29mA4qb6Y5JSB5Pfus60hjMKRSaUdwvr60v9fg2EDtAmXEWpMF9YZbnddxwFA9wuBsQGjmTzb0qzRdABb4nwRyfohBWFc0K27f7sLy0W8hn8YRp86hGNt7gFX+WjQUNJsgjHhEgCQDg4WFsyIV6G7Vc2V/98DhofZ8FSYbQyGGV7Z3afS1+lgkde4G87k/wBF6ViVllCbjNpLWBIGrxflmGg/EgNjiay+cbT0u85JARzqO0zhsTyHuNLwipNGbhurG9aj4FQWMpPcbbNjA0Vh58odC/P8v/tQUtMMPSc+8lqUr3Olw== 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=bbqN7UhAsKTH8X90//WsokqbNUL3sBN0s37rGtprUyI=; b=luIkO7rWF/cL3/iIAHcECEGWoeKTmbsXc0HuBMtyoWhV7IPGCCffT0fz54P5boY3gKSvd77aWWwpv4dtcqo1sxApJvoYM2oYW+gzh/iBhdJfVtLSot7NQWvKL6xLpsV1FIXyZD1fuy8+lM22HwtDtsEtaMa7UcEKHRH4XFXNHOstx9VtqMH3WkGg4OazCj0q3rf53bLu7kgthxgmw2mYIkaxf9EDCvsjiFrU7wEBo7SbRdX7I8lrGNr4kQYjhekZ7KmHxVLS7Dgrn+bluQhg6kpD/2cgoSuRvUge/6YO7OjPf1W6Lw/mZhnwyDQdhPKZyFuvTcEQJtQb4+COeD593w== 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 CY8PR11MB7290.namprd11.prod.outlook.com (2603:10b6:930:9a::6) by MN6PR11MB8242.namprd11.prod.outlook.com (2603:10b6:208:474::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17; Thu, 17 Oct 2024 19:03:18 +0000 Received: from CY8PR11MB7290.namprd11.prod.outlook.com ([fe80::2fa:a105:f81e:5971]) by CY8PR11MB7290.namprd11.prod.outlook.com ([fe80::2fa:a105:f81e:5971%5]) with mapi id 15.20.8069.018; Thu, 17 Oct 2024 19:03:18 +0000 Date: Thu, 17 Oct 2024 20:03:13 +0100 From: Bruce Richardson To: Morten =?iso-8859-1?Q?Br=F8rup?= CC: , Jerin Jacob , Aman Singh , Konstantin Ananyev Subject: Re: [PATCH 5/6] net: add smaller IPv4 cksum function for simple cases Message-ID: References: <20241017142214.1669370-1-bruce.richardson@intel.com> <20241017142214.1669370-6-bruce.richardson@intel.com> <98CBD80474FA8B44BF855DF32C47DC35E9F7F3@smartserver.smartshare.dk> Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F7F3@smartserver.smartshare.dk> X-ClientProxiedBy: DB9PR06CA0006.eurprd06.prod.outlook.com (2603:10a6:10:1db::11) To CY8PR11MB7290.namprd11.prod.outlook.com (2603:10b6:930:9a::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR11MB7290:EE_|MN6PR11MB8242:EE_ X-MS-Office365-Filtering-Correlation-Id: fb92c8a2-7e3d-4cd8-a79f-08dceede5c58 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: =?iso-8859-1?Q?lGsjMT05Wnlx8dX8ZuuwWoqIWUDQeSuCmGeVnDBwbo9y3yBd9WhfHixVIG?= =?iso-8859-1?Q?cXK+UaRXypYtJL9Fb20olUEPAR4SLiO76B1jIycIaFsSNGIU/Du8808r37?= =?iso-8859-1?Q?r1yLqGSDzdDaRZGAmr5nu0VYv0YXwRprG0m4szGIwCwU9V6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DYzyn9wNGHtd9v59W51QCgsajv4K4/OvA/zNnZ+ep4hq?= =?iso-8859-1?Q?OOLkwFToX11ILdEU4fcplkiq+gfIFBKH30V8Dq8yeS8x9j8krV0Wjyyuqv?= =?iso-8859-1?Q?PLdnQ0cIh6Nr/WyzjLzaI6xd9RJPGg0acVG5ub/cbkfVBoijN/bgU0w7xX?= =?iso-8859-1?Q?FTs4Bm/VQRIDd+OKAvo++2zD2snwiCTQ7YRpJuVQXUFkjpoiCU0kzObxJ+?= =?iso-8859-1?Q?cWEoTMtz2ttFdfyZb+mft67Vj033uo4Is9Z3bVQHLqH8e+s/XYoQhGBf+p?= =?iso-8859-1?Q?1DHrT8+WKKhMBPvncBmyrFyUO281dvLiQlpP0PcMP2dwGhe2bNG8kUekLs?= =?iso-8859-1?Q?os9PjoAy8j?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR11MB7290.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?sM4YSHeshKENEywplyGjpF+SRQUGnBZ++l1IUGgNXWFA2oPHhXPPZANuwW?= =?iso-8859-1?Q?9N6kjS30kW1J//2oZGoh4RjluFVx8qkzvnhcXR7NirS1s/f5ucLBUVIJgx?= =?iso-8859-1?Q?fZleD9/I4qeVy7Eo6r0HVXSSPEQvVO2ukjzCIFIikkYYj4D3fMfjNwP3Jk?= =?iso-8859-1?Q?4SNgMVBRH8HfaUHFyCCAGb091pDitY7TNN7+n1JFb8Vn801oKlq1dZaSf0?= =?iso-8859-1?Q?gMPF9Kpjfpd6nTjvNOG8W3rccZt1C9wWlChXiBN0kLTj77RdeaJFg7sJVr?= =?iso-8859-1?Q?d0hmn3upTGuDvhI0gUYdpgYga+YvuzRBkjEiZx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whzrpgKq+iJEdfSok8/SDoEjWSw8GqVw+e40tPgG1xWLJZ?= =?iso-8859-1?Q?YxFeS67I9JasrmPD3axJXFMDAGMWHKgAKt9XS9Altgr79HvBiamDgd3Ckg?= =?iso-8859-1?Q?9rJ9s6HX+uGGrhSGVxJpn2tCgIfGOj1YVXyXWmsQCefLSemKf6XRjzh8Qv?= =?iso-8859-1?Q?eIvhW7gOTHUPN3YcyUbr9vowp6DStgIgCv8FBVvryJtk0ZCPfRd/lp15Fo?= =?iso-8859-1?Q?K20grpXLe/QNsh3j7gjaJuJfYzgPPoHUNA8D9nHFsXpX0HeRtevJwzJtoz?= =?iso-8859-1?Q?/x+TY9fa4EDG1YnLLQmktKBZjPiHcU0vg/tsTX8vIDyURmw4G+tP0Fz1rv?= =?iso-8859-1?Q?5pYKcJwnjPSmvVD/M2wJU9/sY+UOBD+xTaemBT9AVp2VPzaJDu/LQl24cr?= =?iso-8859-1?Q?Dma+uOpI01T0kdqKb+zk7aJ1DAOGSwPWQrrat3CRZoAvitGwtXDotLbA?= =?iso-8859-1?Q?=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: fb92c8a2-7e3d-4cd8-a79f-08dceede5c58 X-MS-Exchange-CrossTenant-AuthSource: CY8PR11MB7290.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 19:03:18.2073 (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: NGgxoBN9mYm+8KP5zScE4V679O3xwx72qJbzQkhuYL5IedBA/thN9MM4aq1MWf5LJ0YnaNF0f/aSB10AsGC/lOZTbPHUxilAz9YppMHORlE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR11MB8242 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 Thu, Oct 17, 2024 at 07:15:10PM +0200, Morten Brørup wrote: > > +/** > > + * Process the IPv4 checksum of an IPv4 header without any extensions. > > + * > > + * The checksum field does NOT have to be set by the caller, the field > > + * is skipped by the calculation. > > + * > > + * @param ipv4_hdr > > + * The pointer to the contiguous IPv4 header. > > + * @return > > + * The complemented checksum to set in the IP packet. > > + */ > > +__rte_experimental > > +static inline uint16_t > > +rte_ipv4_cksum_simple(const struct rte_ipv4_hdr *ipv4_hdr) > > +{ > > + const uint16_t *v16_h; > > + uint32_t ip_cksum; > > + > > + /* > > + * Compute the sum of successive 16-bit words of the IPv4 header, > > + * skipping the checksum field of the header. > > + */ > > + v16_h = (const unaligned_uint16_t *)&ipv4_hdr->version_ihl; > > + ip_cksum = v16_h[0] + v16_h[1] + v16_h[2] + v16_h[3] + > > + v16_h[4] + v16_h[6] + v16_h[7] + v16_h[8] + v16_h[9]; > > + > > + /* reduce 32 bit checksum to 16 bits and complement it */ > > + ip_cksum = (ip_cksum & 0xffff) + (ip_cksum >> 16); > > + ip_cksum = (ip_cksum & 0xffff) + (ip_cksum >> 16); > > + ip_cksum = (~ip_cksum) & 0x0000FFFF; > > + return (ip_cksum == 0) ? 0xFFFF : (uint16_t) ip_cksum; > > The zero exception does not apply to the checksum stored in the IP header, only to the checksum in the UDP header. > I was wondering about that, because I didn't see it mentioned anywhere in the RFCs I consulted, but on the other hand all the implementations in the code seemed to have the check for zero. > > +} > > Besides that, for the series, So, just to confirm, the zero check at the end of the new ip_cksum_simple function should be removed and we always return the computed value directly? > Acked-by: Morten Brørup >