Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp235239rdb; Tue, 16 Jan 2024 23:34:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGb6W8HXra18FskSW/26s4eicEE0fivHXU1j1AqBVsryvvyHGez/PQ5oRPZH+z2PNDsLhq7 X-Received: by 2002:a17:902:6e01:b0:1d4:2ebf:66eb with SMTP id u1-20020a1709026e0100b001d42ebf66ebmr8146702plk.81.1705476848413; Tue, 16 Jan 2024 23:34:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705476848; cv=pass; d=google.com; s=arc-20160816; b=hm/mmn4/4o4k3Vn6KCTew+2tNHKDoE0z/9PK4P1SxFGfXZuZvBsO9N5b8JoNoY7Fbq 1lMIM12o0MV28QfkCWJEriwKnytZP0/prCDwrwg9GduDIr283Qth7GPTduxS+Uqsetkk i51AwDpGhV0MXvXRPP9iL9d5KU+unWZV7NkW1GqUQXW/0rtiAcUFa7EhwVX4M1DtBORH fHzVetf67vMUvFrByFII+vIHwLjueKV9srpH8HftIhDdwYWxVy2mmzWcSwg9S94yIsg+ 7xqSpA+N+VaA1mJvZu/WHCcCadKEM8kUxW4kL4rKVPzGkAEP+XHQwqLE4nR7Tk+7tjdV h4uw== 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:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=oceJQDqoX4I7y29qmqcV6++w314V1TBOmZ9jW9CBGiQ=; fh=8uFqGdCQ895UmkffkEM0CVkd1JR6sR9cQVKRo2xOG94=; b=D82feL2XE5WMpJRhZNnUg6CNMJ/A0KqjWdQdavuzJwPFNZcWrR55Ah7rnjpk8Sc/gE EYJomY5CHwUKci3SpeJ0K/ixEWVAuVQOOGoHZ6BYBO2bcW1/phgb4JrbANgEjXrEgUrd lpW7WGrruaEsPXD5p8FB8NkMU4SByCveGLxk5ClSfybXKJFYiauMdWrJdJ7MoQoMN3/j GlrkrnlfAOIO4KYqYSpBCR6h2VPSOR8eHGNnHbLcanBJeFVoq6nQ0HEt0JYhJDBzaeUK w2gn2GRXDV+OqfHaCDO8Tf68rAMNZUE4fB+/PN2g9QjpLMXJ4OyoT1N6TroRIMWBkhZP ZNyw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=aQdvwjzu; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-28600-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28600-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lc15-20020a170902fa8f00b001d4b0bf2d75si12634938plb.28.2024.01.16.23.34.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 23:34:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28600-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=@linux.dev header.s=key1 header.b=aQdvwjzu; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-28600-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28600-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 32010B24341 for ; Wed, 17 Jan 2024 07:34:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 318DFBE65; Wed, 17 Jan 2024 07:33:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="aQdvwjzu" Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (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 CA6DBC133 for ; Wed, 17 Jan 2024 07:33:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705476833; cv=none; b=Ub1CCMpMxEiBu5lrWVp3RaTKzaSa+PYikUzXABQIqD69QFp8uN5gqYO+C4nyKhyztnP43Zp9uLq/pKzMiItVgMJ53OyQwmVvhoJyTXDwXeWicJpvXKsNMrUc3aCGtGBV689izLqFJHd7YFODiIzxZoN9cqZkPLi93jtlw2ZqKg8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705476833; c=relaxed/simple; bh=3YX7pDoceQX+E+TvVPVvV9f2P0ODXQ1tsjMOk7kPRaE=; h=Message-ID:DKIM-Signature:Date:MIME-Version:Subject: Content-Language:To:Cc:References:X-Report-Abuse:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-Migadu-Flow; b=b4tSdTJJGhbjAtDQhL5+LrjMNCyCRmS4mL/BHYgSXeua5IMvEEdPKQNezs1C2NX975TBXgtmli4PeQemty0AT6YsNbq1DkR1aj9M7ntHRmtYUxNa0vm3g86OXpuI0IWjYVDT2kjJKEpbGSKmANjOnn958+w3/267+PrHr4WCgYc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=aQdvwjzu; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <51fd5249-140a-4f1b-b20e-703f159e88a3@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1705476829; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oceJQDqoX4I7y29qmqcV6++w314V1TBOmZ9jW9CBGiQ=; b=aQdvwjzuKH4Mw5ibWflyGPsS2g6+/CnLCjfdWOoPu0k8znSNt+CmydaGi3uV2EL0WxLGIj HOh40RCMoLdQ5nCvicBMUfyAcwmxm+kSVLSCdG3nstmn6gvvdTFHBlB5ZxjM1kHTX/1RBu BRRVKyn3CHDDArGpEzjoYJHSW7U+2oc= Date: Tue, 16 Jan 2024 23:33:39 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf-next] bpf: Allow setting SO_TIMESTAMPING* with bpf_setsockopt() Content-Language: en-US To: =?UTF-8?Q?J=C3=B6rn-Thorben_Hinz?= Cc: Willem de Bruijn , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Arnd Bergmann , Deepa Dinamani , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20240115134110.11624-1-j-t.hinz@alumni.tu-berlin.de> <65a69e1be51ef_380df0294d9@willemb.c.googlers.com.notmuch> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: <65a69e1be51ef_380df0294d9@willemb.c.googlers.com.notmuch> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 1/16/24 7:17 AM, Willem de Bruijn wrote: > Jörn-Thorben Hinz wrote: >> A BPF application, e.g., a TCP congestion control, might benefit from or >> even require precise (=hardware) packet timestamps. These timestamps are >> already available through __sk_buff.hwtstamp and >> bpf_sock_ops.skb_hwtstamp, but could not be requested: BPF programs were >> not allowed to set SO_TIMESTAMPING* on sockets. This patch only uses the SOF_TIMESTAMPING_RX_HARDWARE in the selftest. How about others? e.g. the SOF_TIMESTAMPING_TX_* that will affect the sk->sk_error_queue which seems not good. If rx tstamp is useful, tx tstamp should be useful also? >> >> Enable BPF programs to actively request the generation of timestamps >> from a stream socket. The also required ioctl(SIOCSHWTSTAMP) on the >> network device must still be done separately, in user space. hmm... so both ioctl(SIOCSHWTSTAMP) of the netdevice and the SOF_TIMESTAMPING_RX_HARDWARE of the sk must be done? I likely miss something. When skb is created in the driver rx path, the sk is not known yet though. How the SOF_TIMESTAMPING_RX_HARDWARE of the sk affects the skb_shinfo(skb)->hwtstamps?