From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by mail.toke.dk (Postfix) with ESMTPS id 0B311A283A5 for ; Tue, 5 Sep 2023 19:04:20 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=AOfWDuhn DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693933462; x=1725469462; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=i+D5tDpRGqsNmGY2e6S+XlTOSbFE61zmfw+38ORD8YY=; b=AOfWDuhnUD1nyIRs9HygmadFH1zS8naYOr890+DV56JjN1Xoe8WZjTeo xClAECqo2uWYhod8e2VIz7ODq3xmhIz7oS5e3I//9AUH5tBZPx4ronLIB K8tYMT7L/NXvN0eUCj149QDa/vi7SiPhjgwe1Da5P4gloTXvNuwEp9Wb4 cg58Hzjd1T4McgOwj8d26M6x0MMBrHX4n99RfYhObnBvjc5YF1Jcf+VYK RgsLp8RAeALQlLEvcQPp27pB9NwIlllNH+5OkfxRtU67FGS4fSyIRf8Mp JB0etNu/fOEUG9Lg7VVxVL1f4A+I0sS77BpOneoKywBSAImVvBPf3j118 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="407841928" X-IronPort-AV: E=Sophos;i="6.02,229,1688454000"; d="scan'208";a="407841928" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2023 10:04:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="744330360" X-IronPort-AV: E=Sophos;i="6.02,229,1688454000"; d="scan'208";a="744330360" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga007.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 05 Sep 2023 10:03:58 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 5 Sep 2023 10:03:57 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Tue, 5 Sep 2023 10:03:57 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Tue, 5 Sep 2023 10:02:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nVnRffXbyk5vfZuObxllIa8rtJdYZFQYzGmpWQ2zPCDGGBJn/npfs2aDHHrZD762H7bABoAZQFh3EjWCiP7/KyVJEXZdVtXBMFwfLuZk1n1h0I61WYen9LGrpMOEDFtltjMHIdtIi3WbYlnWB/fXg3wA6rmL4RoRBzaT39MMizA3bVyeSMEVRCMOepSwBYgIm9NK/10MGnYSQUFMoUx7wInfjs+nb68MUsFH0VnaHNgQzQmzgeEoyXbFizqFwnhCAxPhbKUWQONPnb5OaoYee+rcdVO0Tu94RoT7z9vvyBTRD+2ci23L9HfgW2pcG1zaxOvzFAnF2boG1tCQfLIaVA== 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=kbk4ea+l7RiQ1n/sV75si40nYbfoiOFgokNWzQKJEQE=; b=ISbt8wFO08bgCo6E+xakyDTUR1UqY71PV+ktMlvG4Nt01nSWi+OvPIUHO/vHlALkgufLyZfmkb3Wp1DN8sckcEJL5g/eXXNFLWoy6mRX6GXwU1v5zDhF9Meq76MqfLnspG5yzHDxpgfYrJRTBGIQX62JCVagdL8+1HDzBnUKAt15IzCoOLZnBo3Q/yQqLhLQll7ZnyF9UVq2UKhjvgc9GKy2xmiFr9gxn6j5H0wktuj2865UQkOZCXrhG1lw8h2kDqg3wOxMoyJj48egyWVgJKhpJkU37doZ3ARZuFehz3XhoQ6830YddJous74FS4rehUKQ3SeShig2cP5WrVZpeQ== 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 SN7PR11MB7540.namprd11.prod.outlook.com (2603:10b6:806:340::7) by DS0PR11MB8083.namprd11.prod.outlook.com (2603:10b6:8:15e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 17:02:04 +0000 Received: from SN7PR11MB7540.namprd11.prod.outlook.com ([fe80::10f1:d83:9ee2:bf5d]) by SN7PR11MB7540.namprd11.prod.outlook.com ([fe80::10f1:d83:9ee2:bf5d%3]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 17:02:04 +0000 Date: Tue, 5 Sep 2023 18:53:37 +0200 From: Larysa Zaremba To: Maciej Fijalkowski Message-ID: References: <20230824192703.712881-1-larysa.zaremba@intel.com> <20230824192703.712881-4-larysa.zaremba@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: DUZP191CA0013.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:4f9::10) To SN7PR11MB7540.namprd11.prod.outlook.com (2603:10b6:806:340::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN7PR11MB7540:EE_|DS0PR11MB8083:EE_ X-MS-Office365-Filtering-Correlation-Id: 701d7f1c-bc1b-4785-6305-08dbae31d3e3 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PEYa4PYOo832QdCxRI9D8QBCt+SDU62fELXW0o+2ul30R1ycDvx5S9eAxD7mJHkvmfb2IT1sKiDtgTeXElyKW+ykxPNFVHRK+V5/0zGHwe4Itn2A0oia5ZLYyIwW7RmD7+v3DH2RCNnFlIrqkTn80rP+yek6EQxmlEZQEReLaUCfCC4nDXjvk3DC2EbE8KbcE8V5Qa3jbgwAIbH0n2ThqSAeJTJRF1qccHLRKPvbmP4HBanXjZgcEva6QglOMfFHLknqawAHxAg5uFY/KkWrCMZXXyYN/jORmqRve8zsuIIJhz/GYSZLZKXiAhYq2GcTRObEvbNfSF8J7Fi7hPxpsR4C+vmi7b1aMp1sFmT75PSU+K9zo8nXciO7Qk8w+xPEYk7XTxfT5eijO19YxIuaOvbatgSFo3/AnCjNI5PYBnLBrFz3vg3HGqU/CVXf6xsQGi+qffxCsz8prjQbFxqhb68X5UE8VBS3tFAlF4l0OCmrrVgTcZIGHQhWJLQU9NOQFwrU+2/Z1fd1dFyEF2e0PZYY15OJOyr3MlRSXpNQfiNvcFJPHczlns8+P2Aaajxf X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN7PR11MB7540.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7916004)(39860400002)(346002)(376002)(136003)(396003)(366004)(451199024)(1800799009)(186009)(82960400001)(54906003)(66556008)(66476007)(66946007)(6636002)(478600001)(38100700002)(316002)(2906002)(7416002)(6862004)(8936002)(8676002)(6506007)(44832011)(5660300002)(4326008)(83380400001)(41300700001)(9686003)(6512007)(6486002)(6666004)(26005)(86362001)(33716001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ciHXGsfEVQ+5A1mS3NGYauzRVqMlIUpziZHecXyd1gccFecRIPefSkAB9vLI?= =?us-ascii?Q?GrkZ0vLnLjlZ1KClj03RdDTbSB83aO+DMdz+5zizOEpBZxxSpqB7UqNL6Dpi?= =?us-ascii?Q?gzrKTV/pAVkEQh3oxl+WT9uzjlonKjbo0itssFQUo8P5LmXnkDWK//jqFjJa?= =?us-ascii?Q?jO9ew/wGjoQ82k9aEKfUg0ptVuXJ8gM3EaLU1po4HoVPf5s3KLAPkniRaN8G?= =?us-ascii?Q?wBBpG6DByVWteEeUcE6tm782yamJ9tftHugKLJ1nPJtEmJtadGY6cdEqrHN5?= =?us-ascii?Q?iOk3J/ZHkidVX5jxwscbwh5+CH6GwcYiSeYztjxqZxiY/oejvZDZI6cSEUHa?= =?us-ascii?Q?Xy97Ll2OsFvG1lO8ESkhlFoYsSfS1xnFhpJ30W6oFXPj3kBDrtRST7RRHQsx?= =?us-ascii?Q?0cIwc5St+iias/qJCFV7oZ0oBeg9g/Cbo/B2pVKCQjsyFtLobPCU2pWRcuZ/?= =?us-ascii?Q?bNZN05Q574VNyoSYLWL3ARHiV1uWEXYnPDMqToxA3hDkPNvmqQ0hZlhRM+QS?= =?us-ascii?Q?117I6I4ToWxY46S+9ofeCVPuoEsao/3y2Db7erG8n24uXj8zMS+e9slipwjC?= =?us-ascii?Q?nRkdBsuoGqAXomYwJX6N7sInlXSAsEUvxr7f4QYjZOAasldBcwKjsZTag9ad?= =?us-ascii?Q?PiVOqH113orp4oCiiBGWxCJHdXLNUsQtZF+gB/QsR8h6sEsr2avzDvfZFF+U?= =?us-ascii?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qyFW?= =?us-ascii?Q?IA=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 701d7f1c-bc1b-4785-6305-08dbae31d3e3 X-MS-Exchange-CrossTenant-AuthSource: SN7PR11MB7540.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 17:02:04.1021 (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: 3iGTo5lZiFjcFX8n3lnqtceTkROv0kGRQuNxSTZEv0KsOivF/rMsbXDdt24o23vGM8oYDk9T1KKoq2Z4ct8ml5UmAH9SSkLQKE923ZdFyCw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB8083 X-OriginatorOrg: intel.com Message-ID-Hash: MDSPIYSLUCKKYAWXY734WZ5JDMVE3Q5E X-Message-ID-Hash: MDSPIYSLUCKKYAWXY734WZ5JDMVE3Q5E X-MailFrom: larysa.zaremba@intel.com X-Mailman-Rule-Hits: member-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address CC: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org, Willem de Bruijn , Alexei Starovoitov , Simon Horman , Tariq Toukan , Saeed Mahameed X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [RFC bpf-next 03/23] ice: make RX checksum checking code more reusable List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, Sep 05, 2023 at 05:37:27PM +0200, Maciej Fijalkowski wrote: > On Mon, Sep 04, 2023 at 08:01:06PM +0200, Larysa Zaremba wrote: > > On Mon, Sep 04, 2023 at 05:02:40PM +0200, Maciej Fijalkowski wrote: > > > On Thu, Aug 24, 2023 at 09:26:42PM +0200, Larysa Zaremba wrote: > > > > Previously, we only needed RX checksum flags in skb path, > > > > hence all related code was written with skb in mind. > > > > But with the addition of XDP hints via kfuncs to the ice driver, > > > > the same logic will be needed in .xmo_() callbacks. > > > > > > > > Put generic process of determining checksum status into > > > > a separate function. > > > > > > > > Now we cannot operate directly on skb, when deducing > > > > checksum status, therefore introduce an intermediate enum for checksum > > > > status. Fortunately, in ice, we have only 4 possibilities: checksum > > > > validated at level 0, validated at level 1, no checksum, checksum error. > > > > Use 3 bits for more convenient conversion. > > > > > > > > Signed-off-by: Larysa Zaremba > > > > --- > > > > drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 105 ++++++++++++------ > > > > 1 file changed, 69 insertions(+), 36 deletions(-) > > > > > > > > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > > > > index b2f241b73934..8b155a502b3b 100644 > > > > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > > > > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > > > > @@ -102,18 +102,41 @@ ice_rx_hash_to_skb(const struct ice_rx_ring *rx_ring, > > > > skb_set_hash(skb, hash, ice_ptype_to_htype(rx_ptype)); > > > > } > > > > > > > > +enum ice_rx_csum_status { > > > > + ICE_RX_CSUM_LVL_0 = 0, > > > > + ICE_RX_CSUM_LVL_1 = BIT(0), > > > > + ICE_RX_CSUM_NONE = BIT(1), > > > > + ICE_RX_CSUM_ERROR = BIT(2), > > > > + ICE_RX_CSUM_FAIL = ICE_RX_CSUM_NONE | ICE_RX_CSUM_ERROR, > > > > +}; > > > > + > > > > /** > > > > - * ice_rx_csum - Indicate in skb if checksum is good > > > > - * @ring: the ring we care about > > > > - * @skb: skb currently being received and modified > > > > + * ice_rx_csum_lvl - Get checksum level from status > > > > + * @status: driver-specific checksum status > > nit: describe retval? > I think that kernel-doc is already too much for a one-liner. Also, checksum level is fully explained in sk_buff documentation. > > > > + */ > > > > +static u8 ice_rx_csum_lvl(enum ice_rx_csum_status status) > > > > +{ > > > > + return status & ICE_RX_CSUM_LVL_1; > > > > +} > > > > + > > > > +/** > > > > + * ice_rx_csum_ip_summed - Checksum status from driver-specific to generic > > > > + * @status: driver-specific checksum status > > ditto Same as above. Moreover, there are only 2 possible return values that anyone can easily look up. Describing them here would only balloon the file length. > > > > > + */ > > > > +static u8 ice_rx_csum_ip_summed(enum ice_rx_csum_status status) > > > > +{ > > > > + return status & ICE_RX_CSUM_NONE ? CHECKSUM_NONE : CHECKSUM_UNNECESSARY; > > > > > > return !(status & ICE_RX_CSUM_NONE); > > > > > > ? > > > > status & ICE_RX_CSUM_NONE ? CHECKSUM_NONE : CHECKSUM_UNNECESSARY; > > > > is immediately understandable and results in 3 asm operations (I have checked): > > > > result = status >> 1; > > result ^= 1; > > result &= 1; > > > > I do not think "!(status & ICE_RX_CSUM_NONE);" could produce less. > > oh, nice. Just the fact that branch being added caught my eye. > > (...)