Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1333892lqd; Thu, 25 Apr 2024 12:12:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXOttRuF5d3zPqoALmyt967/EaoJ0on/bGa6Pd7RYZjxyJ4SkZzBfIMt9YwkgXpiSopxrVBYx9W/GO8gCJWiM/NcHlNOOwW9h/nTVdn2g== X-Google-Smtp-Source: AGHT+IG84aeXMNKP8vqt0uZmuczkQY4iu/GUBL16HqqzWZmsTYpTmp1pUyUTFIdgSIrByzsC8c5+ X-Received: by 2002:a05:6a21:811b:b0:1ac:c8dc:3e5e with SMTP id pc27-20020a056a21811b00b001acc8dc3e5emr611587pzb.24.1714072338474; Thu, 25 Apr 2024 12:12:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714072338; cv=pass; d=google.com; s=arc-20160816; b=RhvubLVw8lALT2lAMqVqGNbkskMwjeuLIexM/GOdUvXJr7dZARfaMANMJHnio1KxPL entnn+QdGzMvOIqCrZQrtKtylh5J5MGClkaM1MgaPKueTLl7CFsTydiw0TJ0YS7EYtD8 FfO9uTMFJKbw0JJPh53lXwC7jzsu/H9v5RQw+a3xHALSMaVqC5sReHoCoBlG4Qd4rPDs zHUGfLJwVyJys816QRjKgHcMU+9ROqUEAjzfkYU/HXoBfG9uxcgCg4p/EsAMRrAxa08w uMP4Xv4lObsdMXBH/nX1th8jiMMeK9kvf+u+offbZatSX9t6DI7eQXuxzmyhbW79E4Lf RmnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=v/PYIYzkJqGqylQaGpFlLt9ov7N8tLZ1LAEa89j9rUs=; fh=uhTEl8kPg6xs3Bvr46hHutHWH7IuZTkFWyRreB+zyKc=; b=j2VMyaa4w0+W5NTWdc4czy8qXzddv4qgfC0xyZDkp8phqW4JrwQBSQo5p34OclOHdG C7r07QgeR796U2yeoTMX0kvFQ5RuK2aKZkn+SULadN6huCivteiGoBs6KDWPzXaK2yrn WhhM6wpb+xFvhKW/UOJvAW6Ef6xeqZ5ju72fwCdz7NnZ3qsbDTWGR5daRZ1MoJQaovu7 I5rs11bVKv/y+eFcEW00Vxi8zkSbWz+LQlMHGjl6Al/qGk+j+o1GN9etvvqmKaBKc/LI T2F5iGDQ7DfZsh/uuvrSQuEqnTfwz7RIIo7S9dzYS+v6ns1RsIaxCe9npd1zEZxAPOwJ AuAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ZsDIeNga; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-159053-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159053-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i15-20020a17090332cf00b001e7d4e1ba17si13550715plr.318.2024.04.25.12.12.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 12:12:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159053-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ZsDIeNga; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-159053-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159053-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A0C7DB24F6A for ; Thu, 25 Apr 2024 19:03:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B7FD1514CC; Thu, 25 Apr 2024 19:03:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="ZsDIeNga" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 182D238FB6; Thu, 25 Apr 2024 19:03:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714071797; cv=none; b=ccNipz0WwzBxzWHCmCusjNIYCB3zsDy5rOZzsxemDQHKLleUMTrh1Eom2LCG1zryI7kkYzuQKQdU0E34XqeJQJqKjKEbOWw86En64ilqgnnpb0UqVQKSVjE14qqxOo8OsWC2QfBj1aX1LPvIfp1i5jG0ZJ8v6bH3NM9ybFhH8ZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714071797; c=relaxed/simple; bh=fQMju6pl3GAVTlWaCN8Cg4LCisN2oyIKCLp10Fy+GBA=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=k/QPUKoKnwgn4gWDLlkyzNIYQNeVfk9he2pKrbDZvT0kpVgoxjKWGvP4YkVL/kLw/wOn9l2QNQOOiHtTQ8IbGaudI5LPPaEHM3gvD7CohJnnQmIxfERkzwqUBqF5yRDCbevk15o4Q3x8MbUUqGP5/dS8BiIEqNPNilbfA83LVlo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=ZsDIeNga; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43PGFjPS017155; Thu, 25 Apr 2024 19:02:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=v/PYIYzkJqGqylQaGpFlLt9ov7N8tLZ1LAEa89j9rUs=; b=Zs DIeNga0zJxjgmzCblBnMaF9ZEfEWMXe5nm6pm4l9X5/o93nTRJqjSe2Mr+lZw1xA d7tsXWUN8bqkRyeJCPPB2G6AdsIsPM1hh3tM1CxlmOi1ScswdZXRTl5nIyfQX8gk Qfx6fT0y0T6daog7pKpDNPLcqi2HU64/RsDvK+sCtWiV0xgN7FE+HN8F0wNGJc16 CpxVcrC+ObE+756UzEamZV/y2y0mlCijYsLoZLwh4FDTyiGB3Kjalq/2PFmRv9Fz tYjQA9k6wg6B1F3W68ciT4xKy5yAcqtlbdU74/wtv+7mI3V4btGHusHqUEc1gUEN q8ehRsacSc3i1p0sOL2Q== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xqthv0c4j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 19:02:49 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43PJ2lrL001630 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 19:02:47 GMT Received: from [10.46.19.239] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 25 Apr 2024 12:02:43 -0700 Message-ID: Date: Thu, 25 Apr 2024 12:02:42 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH bpf-next v5 1/2] net: Rename mono_delivery_time to tstamp_type for scalabilty To: Willem de Bruijn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , , , Andrew Halaney , "Martin KaFai Lau" , Martin KaFai Lau , Daniel Borkmann , bpf CC: References: <20240424222028.1080134-1-quic_abchauha@quicinc.com> <20240424222028.1080134-2-quic_abchauha@quicinc.com> <662a69475869_1de39b29415@willemb.c.googlers.com.notmuch> Content-Language: en-US From: "Abhishek Chauhan (ABC)" In-Reply-To: <662a69475869_1de39b29415@willemb.c.googlers.com.notmuch> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: qWVlQCgbGNXPkuCTwWrIqa3G5YnBTx2i X-Proofpoint-GUID: qWVlQCgbGNXPkuCTwWrIqa3G5YnBTx2i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-25_19,2024-04-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 phishscore=0 suspectscore=0 bulkscore=0 mlxlogscore=898 malwarescore=0 adultscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404250136 On 4/25/2024 7:31 AM, Willem de Bruijn wrote: > Abhishek Chauhan wrote: >> mono_delivery_time was added to check if skb->tstamp has delivery >> time in mono clock base (i.e. EDT) otherwise skb->tstamp has >> timestamp in ingress and delivery_time at egress. >> >> Renaming the bitfield from mono_delivery_time to tstamp_type is for >> extensibilty for other timestamps such as userspace timestamp >> (i.e. SO_TXTIME) set via sock opts. >> >> As we are renaming the mono_delivery_time to tstamp_type, it makes >> sense to start assigning tstamp_type based on enum defined >> in this commit. >> >> Earlier we used bool arg flag to check if the tstamp is mono in >> function skb_set_delivery_time, Now the signature of the functions >> accepts tstamp_type to distinguish between mono and real time. >> >> Introduce a new function to set tstamp_type based on clockid. >> >> In future tstamp_type:1 can be extended to support userspace timestamp >> by increasing the bitfield. >> >> Link: https://lore.kernel.org/netdev/bc037db4-58bb-4861-ac31-a361a93841d3@linux.dev/ >> Signed-off-by: Abhishek Chauhan > >> +static inline void skb_set_tstamp_type_frm_clkid(struct sk_buff *skb, >> + ktime_t kt, clockid_t clockid) >> +{ > > Please don't garble words to save a few characters: .._from_clockid. > Noted and apologies for using garble words here. I will correct it. > And this is essentially skb_set_delivery_type, just taking another > type. So skb_set_delivery_type_(by|from)_clockid. > > Also, instead of reimplementing the same logic with a different > type, could implement as a conversion function that calls the main > function. It won't save lines. But will avoid duplicate logic that > needs to be kept in sync whenever there are future changes (fragile). > I thought about doing this but as you remember that some places in the network stack, we are passing tstamp_type and some places we are passing clockid. So in the previous patchset we decided with two variants. 1. One that assigns the tstamp_type directly 2. Other one which computes tstamp_type based on clockid But i agree on the above comment that if we implement two different variants then in future it requires maintenance to both functions. I will make sure i handle both cases in one func. > static inline void skb_set_delivery_type_by_clockid(struct sk_buff *skb, > ktime_t kt, clockid_t clockid) > { > u8 tstamp_type = SKB_CLOCK_REAL; > > switch(clockid) { > case CLOCK_REALTIME: > break; > case CLOCK_MONOTONIC: > tstamp_type = SKB_CLOCK_MONO; > break; > default: > WARN_ON_ONCE(1); > kt = 0; > }; > > skb_set_delivery_type(skb, kt, tstamp_type); > } > > >> + skb->tstamp = kt; >> + >> + if (!kt) { >> + skb->tstamp_type = SKB_CLOCK_REALTIME; >> + return; >> + } >> + >> + switch (clockid) { >> + case CLOCK_REALTIME: >> + skb->tstamp_type = SKB_CLOCK_REALTIME; >> + break; >> + case CLOCK_MONOTONIC: >> + skb->tstamp_type = SKB_CLOCK_MONOTONIC; >> + break; >> + } >> +} >> + >> static inline void skb_set_delivery_time(struct sk_buff *skb, ktime_t kt, >> - bool mono) >> + u8 tstamp_type) > > Indentation change: error? >>> @@ -9444,7 +9444,7 @@ static struct bpf_insn *bpf_convert_tstamp_read(const struct bpf_prog *prog, >> TC_AT_INGRESS_MASK | SKB_MONO_DELIVERY_TIME_MASK); >> *insn++ = BPF_JMP32_IMM(BPF_JNE, tmp_reg, >> TC_AT_INGRESS_MASK | SKB_MONO_DELIVERY_TIME_MASK, 2); >> - /* skb->tc_at_ingress && skb->mono_delivery_time, >> + /* skb->tc_at_ingress && skb->tstamp_type:1, > > Is the :1 a stale comment after we discussed how to handle the 2-bit This is first patch which does not add tstamp_type:2 at the moment. This series is divided into two patches 1. One patchset => Just rename (So the comment is still skb->tstamp_type:1) 2. Second patchset => add another bit (comment is changed to skb->tstamp_type:2) > field going forward? I.e., not by ignoring the second bit. > >