From patchwork Mon Jan 6 13:55:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Song, Yoong Siang" X-Patchwork-Id: 13927474 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (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 AC65C1DDC36; Mon, 6 Jan 2025 13:55:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736171761; cv=none; b=o9HeXO0BH5QzWvt6RkVZvGA6jZLIW+XUdYni8ZAtsLmdye+kcBQZ/UZk1aYUmSuSS15tu1nwM29SktrDCJem0FHVKkjrB/F7iwsUjVWtVM5hDf+SjogqdbCpsfBCyl8ZLYt6xpmPK8s6R3DMYIxlWUjT9OwDfb1oFZaKfEnLPfI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736171761; c=relaxed/simple; bh=Fe/o7Mk5+uc0GHrVMRFeiFpbIufBfq1Z8jHhoCn17v8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=YkFuAhDqGiccrp7iNCKGu+yn35R1tc792tXaGz5PsoJD3bdULQtinWbw/sIqtWb3Wso7crUnj45HCSRw8hXvu32hAyglJkjEUVuutwRtnXkNyEeSD7C3R4G6/3BRJ1LbxWajBfm/IaHDw+M0llnr2prI2t4WI8bj93olCjD7xA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=kptByn4B; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kptByn4B" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736171760; x=1767707760; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Fe/o7Mk5+uc0GHrVMRFeiFpbIufBfq1Z8jHhoCn17v8=; b=kptByn4BE0vUo+VLRgNIWrBhemi8AZoztVi1MmXWfsAZUq4r2ke4kT6v PNzhhuQ5dbmI2QsHAwTiIGCUzajqhU5Ns4SKBQIRxodYArGP8aInukIAh FpgSP4xIDVvP9UyYEvZBo1HS5eQ/CLHtA4PTGQJMU92qL/zCzw4FsKc1P 6eAvoIr0waEXQn/+kJyzCsncTJdAmDJJvVLXGcUAu/4ZXFru//fWv9eWM BATvFLfgOvrkYhPC8U81BezMw8vgzuT4eU54YaV8gYeMrjTZgHstlq1tf kxjExJz2O+hv0BokTYqgOpF4N5qIjKjlt4D1prQQ8FLxovyVqBNIOABHP w==; X-CSE-ConnectionGUID: UYZFGN+9RQOls/eW3Yp7yQ== X-CSE-MsgGUID: He6wjoWXRkWwo+sEqo769Q== X-IronPort-AV: E=McAfee;i="6700,10204,11307"; a="36473726" X-IronPort-AV: E=Sophos;i="6.12,292,1728975600"; d="scan'208";a="36473726" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2025 05:55:59 -0800 X-CSE-ConnectionGUID: A4LxAHlWSWC9cCNEMxi8Kw== X-CSE-MsgGUID: QReHGKT/TvOdkEroFunAVg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,292,1728975600"; d="scan'208";a="107407969" Received: from unknown (HELO P12ILL20yoongsia.png.intel.com) ([10.88.227.38]) by orviesa004.jf.intel.com with ESMTP; 06 Jan 2025 05:55:48 -0800 From: Song Yoong Siang To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Willem de Bruijn , Florian Bezdeka , Donald Hunter , Jonathan Corbet , Bjorn Topel , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Andrew Lunn , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Joe Damato , Stanislav Fomichev , Xuan Zhuo , Mina Almasry , Daniel Jurgens , Song Yoong Siang , Amritha Nambiar , Andrii Nakryiko , Eduard Zingerman , Mykola Lysenko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Hao Luo , Jiri Olsa , Shuah Khan , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Tony Nguyen , Przemek Kitszel Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, intel-wired-lan@lists.osuosl.org, xdp-hints@xdp-project.net Subject: [PATCH bpf-next v4 0/4] xsk: TX metadata Launch Time support Date: Mon, 6 Jan 2025 21:55:06 +0800 Message-Id: <20250106135506.9687-1-yoong.siang.song@intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: bpf@iogearbox.net This series expands the XDP TX metadata framework to allow user applications to pass per packet 64-bit launch time directly to the kernel driver, requesting launch time hardware offload support. The XDP TX metadata framework will not perform any clock conversion or packet reordering. Please note that the role of Tx metadata is just to pass the launch time, not to enable the offload feature. Users will need to enable the launch time hardware offload feature of the device by using the respective command, such as the tc-etf command. Although some devices use the tc-etf command to enable their launch time hardware offload feature, xsk packets will not go through the etf qdisc. Therefore, in my opinion, the launch time should always be based on the PTP Hardware Clock (PHC). Thus, i did not include a clock ID to indicate the clock source. To simplify the test steps, I modified the xdp_hw_metadata bpf self-test tool in such a way that it will set the launch time based on the offset provided by the user and the value of the Receive Hardware Timestamp, which is against the PHC. This will eliminate the need to discipline System Clock with the PHC and then use clock_gettime() to get the time. Please note that AF_XDP lacks a feedback mechanism to inform the application if the requested launch time is invalid. So, users are expected to familiar with the horizon of the launch time of the device they use and not request a launch time that is beyond the horizon. Otherwise, the driver might interpret the launch time incorrectly and react wrongly. For stmmac and igc, where modulo computation is used, a launch time larger than the horizon will cause the device to transmit the packet earlier that the requested launch time. Although there is no feedback mechanism for the launch time request for now, user still can check whether the requested launch time is working or not, by requesting the Transmit Completion Hardware Timestamp. Changes since v1: - renamed to use Earliest TxTime First (Willem) - renamed to use txtime (Willem) Changes since v2: - renamed to use launch time (Jesper & Willem) - changed the default launch time in xdp_hw_metadata apps from 1s to 0.1s because some NICs do not support such a large future time. Changes since v3: - added XDP launch time support to the igc driver (Jesper & Florian) - added per-driver launch time limitation on xsk-tx-metadata.rst (Jesper) - added explanation on FIFO behavior on xsk-tx-metadata.rst (Jakub) - added step to enable launch time in the commit message (Jesper & Willem) - explicitly documented the type of launch_time and which clock source it is against (Willem) v1: https://patchwork.kernel.org/project/netdevbpf/cover/20231130162028.852006-1-yoong.siang.song@intel.com/ v2: https://patchwork.kernel.org/project/netdevbpf/cover/20231201062421.1074768-1-yoong.siang.song@intel.com/ v3: https://patchwork.kernel.org/project/netdevbpf/cover/20231203165129.1740512-1-yoong.siang.song@intel.com/ Song Yoong Siang (4): xsk: Add launch time hardware offload support to XDP Tx metadata selftests/bpf: Add Launch Time request to xdp_hw_metadata net: stmmac: Add launch time support to XDP ZC igc: Add launch time support to XDP ZC Documentation/netlink/specs/netdev.yaml | 4 + Documentation/networking/xsk-tx-metadata.rst | 64 +++++++++++++++ drivers/net/ethernet/intel/igc/igc_main.c | 78 +++++++++++++------ drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 + .../net/ethernet/stmicro/stmmac/stmmac_main.c | 13 ++++ include/net/xdp_sock.h | 10 +++ include/net/xdp_sock_drv.h | 1 + include/uapi/linux/if_xdp.h | 10 +++ include/uapi/linux/netdev.h | 3 + net/core/netdev-genl.c | 2 + net/xdp/xsk.c | 3 + tools/include/uapi/linux/if_xdp.h | 10 +++ tools/include/uapi/linux/netdev.h | 3 + tools/testing/selftests/bpf/xdp_hw_metadata.c | 30 ++++++- 14 files changed, 208 insertions(+), 25 deletions(-)