From patchwork Sat Apr 15 06:45:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Song, Yoong Siang" X-Patchwork-Id: 13212310 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1EC85C77B73 for ; Sat, 15 Apr 2023 06:46:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=eSh95c7N2JZ4QVzbBViOY2gcl1QV51Y4XnKx1qZvxig=; b=M+c9y/5jin0fwa 9l9TXHpJU1Vc4hfHNWhMRuiaM0tPH6lbC7PKsnJR5525YIakIinrPymIzwWQO6WblEGBCHBjsudfD gJejOdgS6wPftkQB0eV9vHyonCOLmyhILxHUNC2BXHHpdmCk/LyRr7S0yHIU/NOq7SFRtN5lKZAIY 1FIc+YrZWUPzh2SS+agauMX4onNM+HKGlUP2/r0t+HQQbG7X8zyDZ+6Gq0x6hREKe9tpv6eMreJ6H Wc2Q7L9GYhEU0ECVwnX1Ik9VRBSX6jTF0bGsj0PvBBIbW8+t4TURPWJiQ4HsLOJb79oPDQ5DSOIXw 0SSV9u6pf++m2vXvpYQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pnZfP-00BTpE-2D; Sat, 15 Apr 2023 06:45:47 +0000 Received: from mga04.intel.com ([192.55.52.120]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pnZfM-00BTo1-1J for linux-arm-kernel@lists.infradead.org; Sat, 15 Apr 2023 06:45:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681541144; x=1713077144; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=XPf0NWZspgmTmraWV1B8of1VGZ27Uk2q/PwjqH0foXk=; b=BwtOOBKL8Yy0OBsw4PV7g0e3bbdT8a6h1Y8Phc+ysNzQBPSgE7tNNtES m5zstwhjFOnTItdDxVlqZ4lr2DKzfR30t178AtXBcS/zyIit7UHRfwh1O DMI9NlfSfU0z7Qtfbynt54B33EYngwXr3bqHajPT7jCaHJ7ET4Q5M6ZI8 eUPb24tC9iaOEdzTD6KM56vXE+HDp6/W1WLTy67ogMdSy4PP9XquSyAEg PKqYFyQYT8b7C7lRWxLZh0TCQjUPzMxy105ALpLCbat3+xDe5S5G+LFZk QsRHZfUYu4AHwktuqpgSqOYlFmrm9lE5F5sMl65m8MI4Y1VLutbHlqTlA Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10680"; a="343379267" X-IronPort-AV: E=Sophos;i="5.99,199,1677571200"; d="scan'208";a="343379267" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2023 23:45:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10680"; a="754727538" X-IronPort-AV: E=Sophos;i="5.99,199,1677571200"; d="scan'208";a="754727538" Received: from p12ill20yoongsia.png.intel.com ([10.88.227.28]) by fmsmga008.fm.intel.com with ESMTP; 14 Apr 2023 23:45:33 -0700 From: Song Yoong Siang To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Alexander Duyck , Jesper Dangaard Brouer , Ong Boon Leong , Jacob Keller Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, xdp-hints@xdp-project.net, Song Yoong Siang Subject: [PATCH net-next v6 0/3] XDP Rx HWTS metadata for stmmac driver Date: Sat, 15 Apr 2023 14:45:00 +0800 Message-Id: <20230415064503.3225835-1-yoong.siang.song@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230414_234544_457556_711AB4FF X-CRM114-Status: UNSURE ( 6.72 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Implemented XDP receive hardware timestamp metadata for stmmac driver. This patchset is tested with tools/testing/selftests/bpf/xdp_hw_metadata. Below are the test steps and results. Command on DUT: sudo ./xdp_hw_metadata Command on Link Partner: echo -n xdp | nc -u -q1 9091 echo -n skb | nc -u -q1 9092 Result for port 9091: poll: 1 (0) skip=1 fail=0 redir=1 xsk_ring_cons__peek: 1 0x55f69f65f6d0: rx_desc[0]->addr=100000000008000 addr=8100 comp_addr=8000 rx_timestamp: 1677762069053692631 No rx_hash err=-95 0x55f69f65f6d0: complete idx=8 addr=8000 Result for port 9092: poll: 1 (0) skip=2 fail=0 redir=1 found skb hwtstamp = 1677762071.937207680 changelog: v5 -> v6: improve field naming of struct stmmac_xdp_buff v4 -> v5: remove zeroing operation on ctx variable v3 -> v4: directly retrieve Rx HWTS in stmmac_xdp_rx_timestamp(), instead of reuse stmmac_get_rx_hwtstamp() v2 -> v3: To reduce packet processing cost, get the Rx HWTS only when xmo_rx_timestamp() is called v1 -> v2: Add static to stmmac_xdp_metadata_ops declaration --- Song Yoong Siang (3): net: stmmac: introduce wrapper for struct xdp_buff net: stmmac: add Rx HWTS metadata to XDP receive pkt net: stmmac: add Rx HWTS metadata to XDP ZC receive pkt drivers/net/ethernet/stmicro/stmmac/stmmac.h | 7 ++ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 80 ++++++++++++++++--- 2 files changed, 77 insertions(+), 10 deletions(-)