Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp431736rdb; Thu, 30 Nov 2023 08:22:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGe41/S9Gan7nIQlT0//zT8p2DzDGP2eJN9hmq1bjmSxOsGonGsVPNcr/gPjlOad0yObyIU X-Received: by 2002:aca:d11:0:b0:3b8:3399:8731 with SMTP id 17-20020aca0d11000000b003b833998731mr2750oin.57.1701361361906; Thu, 30 Nov 2023 08:22:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701361361; cv=none; d=google.com; s=arc-20160816; b=laxqsM97f5RJT0PvA/VvRP4Apci6PQiZs0Cvki5a55BdQWY/P3m0BqxYAcd8KR1ORW yhRJgu4KAUGzpNSyFlENlx5J3jN/QYwoyUrEz5B9fwLTxBP8jryatDW8VSnIr+8Hf1x4 qelPPvK3SHasR7ioBsmpZ49+hlunuKbmshiI2DwHo7W3atVSOwCY3UWiQ2756+bQcOlB +JZddEp+MlFu6ocHpuuMlg3KjxejaMY9bJH4RiuAx3P8VbplMfP2D4lyyflB2iweuOYS 8LVanFdT/PFVYPHBcWhYMkxZqBXoNeyCSLHK7+wjsAxw3Id/jb3eVePWoa3Me0PyHa6L 53tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iiyiGO4K9o/ohz0AEClfZBYhzibNVL1BawuPAgVkgkk=; fh=YTkuaskr0lgfdZdN3raKefSjBLb6uuCywA/U9wJpjjU=; b=iFaPfybFY1arG3a0+c8MQEsSoAX5haMdwbIVcwq6O68caX2dLhhS1v/5K273APatDC PiezgWXYaPtw55/5p1os89dPyxwbQDGQ83RbEwuvIPTuODvTYYTH4PfqT5iOyCzERaYU 4kxcpwpNScTeAoBXYYlZl7GiVDzD7OGxOtUBvoJ91e5TFdNyJ+DnvL/ycJtCrQ53MpnT /B/su6o/nIW2AAhWcDD9HutDHabMp/vQs0bGNauTZEHOiTXGYw4381kUymgk5dL869u8 0ncY7VPGEiNVGR2xvpJsJ8e7QcleYXR1y9CwSHXKHLgfhCWDO7Yd99Q2wdPZF3zgqUmC S7WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fdksiZi8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id l6-20020a63ba46000000b00589fcc39ef1si1539081pgu.365.2023.11.30.08.22.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 08:22:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fdksiZi8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 152238047546; Thu, 30 Nov 2023 08:22:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232220AbjK3QWH (ORCPT + 99 others); Thu, 30 Nov 2023 11:22:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232211AbjK3QVx (ORCPT ); Thu, 30 Nov 2023 11:21:53 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D77E810F9; Thu, 30 Nov 2023 08:21:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701361320; x=1732897320; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RxQigYZX0AwiQz5iF7nEbIkSvowYJwMREZVwWRXD5sM=; b=fdksiZi8seE9H/LblACmagwbZ3sX4Vvzhpk1CuqmzGqyyViVKBX+M4KE pfZ0VZEKvnfgq0MMn9/CRTZ1EEKnkf8xUCJUNoF0wJhQy5YaFOJYtQGLi mTAaMBP5Ztnof3SREo6opZH2sf9i0UlwMgVsSx48pIOg3qydrpCfJtNlv 7FYd39Jey4tGZHbcciFQPRE+VL3NqWpaTE+SouhrbV+dVm/7SRY7MfUEp 760GAeULNfMNjK1VEj17wmCa60kA2CZFvzME4tTDjSEWjiIUGJNDIIl2X BZkZCpvFuGQaxZacFmpAXYLBm0NQfhI17cTnh1lQae4YDw3jd5ekpn3wL g==; X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="383744595" X-IronPort-AV: E=Sophos;i="6.04,239,1695711600"; d="scan'208";a="383744595" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2023 08:21:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="803758602" X-IronPort-AV: E=Sophos;i="6.04,239,1695711600"; d="scan'208";a="803758602" Received: from p12ill20yoongsia.png.intel.com ([10.88.227.28]) by orsmga001.jf.intel.com with ESMTP; 30 Nov 2023 08:21:42 -0800 From: Song Yoong Siang To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Bjorn Topel , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Lorenzo Bianconi , Tariq Toukan , Willem de Bruijn , Maxime Coquelin , Andrii Nakryiko , Mykola Lysenko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Hao Luo , Jiri Olsa , Shuah Khan , Alexandre Torgue , Jose Abreu Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, bpf@vger.kernel.org, xdp-hints@xdp-project.net, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Song Yoong Siang Subject: [PATCH bpf-next 2/3] net: stmmac: Add launch time support to XDP ZC Date: Fri, 1 Dec 2023 00:20:27 +0800 Message-Id: <20231130162028.852006-3-yoong.siang.song@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231130162028.852006-1-yoong.siang.song@intel.com> References: <20231130162028.852006-1-yoong.siang.song@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 30 Nov 2023 08:22:39 -0800 (PST) This patch enables launch time support to XDP zero copy via XDP Tx metadata framework. Signed-off-by: Song Yoong Siang --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 686c94c2e8a7..e8538af6e207 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -105,6 +105,8 @@ struct stmmac_metadata_request { struct stmmac_priv *priv; struct dma_desc *tx_desc; bool *set_ic; + struct dma_edesc *edesc; + int tbs; }; struct stmmac_xsk_tx_complete { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index c2ac88aaffed..c33517d3850a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2465,9 +2465,20 @@ static u64 stmmac_xsk_fill_timestamp(void *_priv) return 0; } +static void stmmac_xsk_request_launch_time(u64 launch_time, void *_priv) +{ + struct stmmac_metadata_request *meta_req = _priv; + struct timespec64 ts = ns_to_timespec64(launch_time); + + if ((meta_req->tbs & STMMAC_TBS_EN) && launch_time > 0) + stmmac_set_desc_tbs(meta_req->priv, meta_req->edesc, ts.tv_sec, + ts.tv_nsec); +} + static const struct xsk_tx_metadata_ops stmmac_xsk_tx_metadata_ops = { .tmo_request_timestamp = stmmac_xsk_request_timestamp, .tmo_fill_timestamp = stmmac_xsk_fill_timestamp, + .tmo_request_launch_time = stmmac_xsk_request_launch_time, }; static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) @@ -2545,6 +2556,8 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) meta_req.priv = priv; meta_req.tx_desc = tx_desc; meta_req.set_ic = &set_ic; + meta_req.tbs = tx_q->tbs; + meta_req.edesc = &tx_q->dma_entx[entry]; xsk_tx_metadata_request(meta, &stmmac_xsk_tx_metadata_ops, &meta_req); if (set_ic) { -- 2.34.1