From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mail.toke.dk (Postfix) with ESMTPS id 37FBEA085A4 for ; Fri, 19 May 2023 18:53:40 +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=S6UgAXkA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684515220; x=1716051220; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=B9ZSoLldXVUidDjWhScKU0flJ5XjWUwxzw5SkJeW1kU=; b=S6UgAXkAhTjnKGqYh6WZolHNtYKI6UaWYcjiT2cZx1SaMQN7UeTmBwIU NtHv3CPhhEpsKBDiyoJJZ2khhg3X868/F0/Wk75wLAm42TZiEsHAVZ+xo Cs4bLLG1nopYyrw1Ef3/0J311fJcHS1+8UoCH1oKhkopLVokvOhrBVPBJ HQsS+h4IFVoltYUtx/z2cKoy/olJep9CJc9rxTlhkCYFIi3N17UYke4UL ZbiCY6h1uxKwfICKOqjd4MG1pKSJP9/6dwyHTEdv2Z2QLydCWnY0r4y7h 0QaJYX7OcvFDLFRuHma/HBxDZ9k4ItKDfzz+IJFRcWnUHi++nDwthcWnz Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10715"; a="349937323" X-IronPort-AV: E=Sophos;i="6.00,177,1681196400"; d="scan'208";a="349937323" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2023 09:53:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10715"; a="767676867" X-IronPort-AV: E=Sophos;i="6.00,177,1681196400"; d="scan'208";a="767676867" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga008.fm.intel.com with ESMTP; 19 May 2023 09:53:37 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 19 May 2023 09:53:37 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Fri, 19 May 2023 09:53:37 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.45) 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.23; Fri, 19 May 2023 09:53:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VUdRZpM1zz+WpOWeOgJ+86ILj9RXoRewCbQjbMrZW0ND52X/AQ6IwzqqgBYAZSwLQmWqKsVW8Eef4tNX2Uduk/st3Pgo6YUJTY5bbHe87VjsJGlmzxIHQvgN7is/YOQqKM4LsE/+xT17rrKWMWeqaFKqa8L4Nt1SRJTQTnnBtuncvYAtjMxQyPo0RJPk/aYgjZWa1RxWT0ts11H7ZfoUWmEqZDdzRhtLK7yryd22c5+wE6qybI+ke1B0AplMRa2X4CS4nmlaOyVrwjewvGRO5CZW1Nc0haXm7o215e6pF1v4HobtgAUCmMxHn40++Wju+0AYHnA+QRuZprcW9c1F9g== 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=Di19W1XF1oJP0mXEAoXmw1CKbArGdd4rqF4Ec0GodKw=; b=lB+gp9lkLv5kxtwtZaiCcfYSTtzPZL88dQgBd63vUS3Yp7zhLSnMmNj1XXw+D4mIS23AXByJZgF/aGQa/bzyjG2IznqDmV62I8cAsip9MKW9+56Ui2esbTqquyxBOk3/XCVFt7Rwo1eFKgBztfKo+xCEjBUNMaEErJVqOvFRsXz3UpgKdm7v3qd8170Xc0+BsQh+JvJpqDAt97wkFIt/CooZze76AuWYHIbMGYImGvXnKevVSakbj1TblHZdvWpEaxuDLxBbB/8cHmX5hzg8J8gVSFXkiU7V1Hnl1JkM5+hW/9hOQbZUZVO6PemABSTdNYvItcU6gsHp6WgFFgFGcA== 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 DM6PR11MB3625.namprd11.prod.outlook.com (2603:10b6:5:13a::21) by PH0PR11MB7710.namprd11.prod.outlook.com (2603:10b6:510:298::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.19; Fri, 19 May 2023 16:53:23 +0000 Received: from DM6PR11MB3625.namprd11.prod.outlook.com ([fe80::64d9:76b5:5b43:1590]) by DM6PR11MB3625.namprd11.prod.outlook.com ([fe80::64d9:76b5:5b43:1590%2]) with mapi id 15.20.6411.019; Fri, 19 May 2023 16:53:23 +0000 Message-ID: Date: Fri, 19 May 2023 18:52:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Content-Language: en-US To: Larysa Zaremba References: <20230512152607.992209-1-larysa.zaremba@intel.com> <20230512152607.992209-3-larysa.zaremba@intel.com> From: Alexander Lobakin In-Reply-To: <20230512152607.992209-3-larysa.zaremba@intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0057.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::21) To DM6PR11MB3625.namprd11.prod.outlook.com (2603:10b6:5:13a::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR11MB3625:EE_|PH0PR11MB7710:EE_ X-MS-Office365-Filtering-Correlation-Id: c3307129-48a2-49f7-0de9-08db58898ec2 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: k5MWNKe7mNO1Ok9Qyrzgy5HWUxMz7hmoj6XvcmsDeQMFGAD/kKIViOtS706IeimTTVA0fRpkEneSUI+SDtZKazHaoobWAfMokPLTpJOrwKxVMFst/6x2WdzQZXfoFL9jBiFky5A7BG2OkDnatbkK0UmsIPZigj0oKzGG0I4ZwCrSdz6vMQ/eOVNfgk+H6Br8tgvXzjE2NgKctSE8ExLK42PpeXquKgkmRbRmbU44Kb5N7xeOHlOP1iApsn4p9rwdawnqzr/V/I2oiy2OCnjHU2T9COw9WUwnBZUb/64s+3+xU7WY9XOqeO5l70B9YcP83wCWjYPBcWp6XsEoDZyuxIZgm6D2FTYkr7vzMFIQd+OfYPnNHZYRTXXUrYKptuQ8LO0/8ROCcfV/2kjxpwRDf+LaufcP4taegoXy6ufT/Wlk8zidn/mIqHtAhabwTLDT7RBCS47RGQ6FzQrLgYSotbHRTm8zUrWlc/4Nw8hgwR3TjKuM10JcqjyMBGw6bTgqiDcPOJyURhIRNPsHTYBi1rI6dbZw/trF/luYd950Cap/fBxnhqteIU0ZY3u93FW3Fs8zv0DBHwHv8vdxj0hlvuncwblUm1j+ThzRwsrFLWAF8D4JpCvXKUykBXOiTXZ8mdJ8leM7fSqStkwNWqkpCQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB3625.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(366004)(396003)(376002)(346002)(39860400002)(451199021)(8676002)(2906002)(8936002)(478600001)(4326008)(31686004)(41300700001)(6862004)(6636002)(316002)(54906003)(37006003)(7416002)(6486002)(66476007)(66946007)(66556008)(5660300002)(6666004)(36756003)(6506007)(6512007)(26005)(82960400001)(186003)(83380400001)(86362001)(31696002)(38100700002)(2616005)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N2lyc05oa1FuQjVWOXc1QnZtSjFyTE9pdEJ4Q09qMTFYU25vd2R6Yy82b1FG?= =?utf-8?B?TjBUYjFTVkh0UXhCVmtGRWUxcjIzcHBOL1dXN0RTUkVSdVJoSWptVDJqWWhG?= =?utf-8?B?R082bWRHaTR0YXkzQTRycXVMeHFOOEhqaHRLMGlaVklKSGd1eVJ3Wjd3ZWF4?= =?utf-8?B?TkFVRnh2U3FRbFJ1MisyWUZxVElpWmYyQSs3T2pzczZCdVE4b1dPWklXNlBa?= =?utf-8?B?L2ZIVEFtd1B5THZSc2l1Zm93dHVQdnJLWHU3NVFNK3RTdnV2K2pON2k5VDBL?= =?utf-8?B?SCt1TnNObGVJTzk5ZzNaRGpMN2pTa29yNU1lejdwL3JjMEY3RnVSRTRhZHY3?= =?utf-8?B?dlBjMFVmZ2cvSWVpaVkyb1BzbENLWWpFVEwxNXhxa3F5eTEvcVNoTVpDcnlF?= =?utf-8?B?cEduTGdBOWswdFdBRjN4NURGK29tbHl2M09ET3Y4VUVZVGRYTHlMeDJqakFR?= =?utf-8?B?aHJUUDFvWnRzblJ5elZyQlhoVDdUTi9EVlZVY0RodGVwdExHSzVhbTJSM0Rx?= =?utf-8?B?OEJxNkVPSGFTUEdnUlpuMWhtbEE0NTJiS1JH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0Z0T251RTVKT1Fud0JtZkZMMjZEZzA3R2kxMFk5Tk9UT3RI?= =?utf-8?B?azl2eHE0OWNLcThDWlc3dUdTU1NKeVE3YmUycVVCZGN0dEdYeVE1L3JvcDB1?= =?utf-8?B?OXgxZUp0U25RcVBqQnBBQ1hQeHovZ2dEaGdnVFpZbldrSVFwK2Z4SUNYZXcv?= =?utf-8?B?dkwxRzIwc2ZRQVA2UjJQZ0lOeExrWmhRbVU0c3pDUmZqa1E1SEViUVB6djFP?= =?utf-8?B?M21MR21tTkdaSHJ0ZUhDTHM0Y2o4bHpwUERJQmFra1VNV1BwbzlGaEpqWGEv?= =?utf-8?B?aDE5ZEFQM3JGRVBLN1VMS28wRWl1akI1TFFiUmpHVWwvZGVNamJmZHdyT054?= =?utf-8?B?WWpwcFdGMjhQTFpBUWZrWWJaUUJmRnM0T1VBNktkV0JHMmF3c216N0IxZDZS?= =?utf-8?B?M0ZHazVCTlBjZ2RkYkJqYjJ3MUl0RCtUSU81c09LWEp0cVFjWVhLbitVOTBn?= =?utf-8?B?RURBWkJTTDYyWHRlVkFOK0NpckIzRUU5OWlBd3FLS3VkN3BYT283VFJTcFJH?= =?utf-8?B?MzlEOVV2ZnQ0WkJYVEJ4LzZpMWZSNm1TQmJsY0Vjc1ZFamlDK2JRRjB1VkJ0?= =?utf-8?B?QzZLRE9VV1Z2YUFIM3pZM2pTeThBMng2Q29mUUpnZDlnb09YS0Z4dUUzNXFn?= =?utf-8?B?VEV3SUVsZ2MvN3phWmFSQ29RSWhwTnZOc0VVVnh4U1d5ZWhyeFJTaDJmeUFP?= =?utf-8?B?ZHc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: c3307129-48a2-49f7-0de9-08db58898ec2 X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB3625.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 16:53:23.5607 (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: bNfyA1XnvurKoetgCdVyLnS1/SuFIq3CLNIR4iTuc0qzyfL0MDJ4BLJkvBTxkz0BvqgwVLLN0jvp1sP9SYa8MMHqH/mdLJR0IImsif93GZc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB7710 X-OriginatorOrg: intel.com Message-ID-Hash: 53IZ2F2I4DTRMNLLDPNQJYKATSISCYCF X-Message-ID-Hash: 53IZ2F2I4DTRMNLLDPNQJYKATSISCYCF X-MailFrom: aleksander.lobakin@intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: bpf@vger.kernel.org, Stanislav Fomichev , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Jakub Kicinski , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Jiri Olsa , Jesse Brandeburg , Tony Nguyen , Anatoly Burakov , Jesper Dangaard Brouer , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH RESEND bpf-next 02/15] ice: make RX HW timestamp reading code more reusable List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Larysa Zaremba Date: Fri, 12 May 2023 17:25:54 +0200 > Previously, we only needed RX HW timestamp 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. [...] > @@ -2176,9 +2174,8 @@ ice_ptp_rx_hwtstamp(struct ice_rx_ring *rx_ring, > ts_high = le32_to_cpu(rx_desc->wb.flex_ts.ts_high); > ts_ns = ice_ptp_extend_32b_ts(cached_time, ts_high); > > - hwtstamps = skb_hwtstamps(skb); > - memset(hwtstamps, 0, sizeof(*hwtstamps)); > - hwtstamps->hwtstamp = ns_to_ktime(ts_ns); > + *dst = ts_ns; > + return true; Can't we use the same I wrote in the prev. comment, i.e. return 0 or timestamp? I don't think ts == 0 is valid. > } > > /** [...] > + * The driver receives a notification in the receive descriptor with timestamp. > + * The timestamp is in ns, so we must convert the result first. > + */ > +static void > +ice_ptp_rx_hwts_to_skb(struct ice_rx_ring *rx_ring, > + union ice_32b_rx_flex_desc *rx_desc, > + struct sk_buff *skb) > +{ > + struct skb_shared_hwtstamps *hwtstamps; > + u64 ts_ns; > + > + if (!ice_ptp_copy_rx_hwts_from_desc(rx_ring, rx_desc, &ts_ns)) > + return; > + > + hwtstamps = skb_hwtstamps(skb); > + memset(hwtstamps, 0, sizeof(*hwtstamps)); > + hwtstamps->hwtstamp = ns_to_ktime(ts_ns); Ok, my optimizations aren't in this series :D If you look at the hwtimestamps in skb, you'll see all that can be minimized to just: *skb_hwtstamps(skb) = (struct skb_shared_hwtstamps){ .hwtstamp = ns_to_ktime(ts_ns), }; Compiler will probably do its job, but I wouldn't always rely on it. Sometimes it's even able to not expand memset(8 bytes) to *(u64 *) = 0. > +} > + > /** > * ice_process_skb_fields - Populate skb header fields from Rx descriptor > * @rx_ring: Rx descriptor ring packet is being transacted on > @@ -210,7 +235,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring, > ice_rx_csum(rx_ring, skb, rx_desc, ptype); > > if (rx_ring->ptp_rx) > - ice_ptp_rx_hwtstamp(rx_ring, rx_desc, skb); > + ice_ptp_rx_hwts_to_skb(rx_ring, rx_desc, skb); > } > > /** Thanks, Olek