From patchwork Mon Apr 12 15:41:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ong Boon Leong X-Patchwork-Id: 12198359 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03907C433ED for ; Mon, 12 Apr 2021 15:39:16 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8B51561249 for ; Mon, 12 Apr 2021 15:39:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B51561249 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=HZaJQUuu0cb4Pj1t5MNC/SICNm2cSnsi7myLfQLLk9I=; b=cp6sBfH32zTPjWKItkobR1ITgl QoZ0nNKDyxhLknSh22oqYxQV+vEC5UU/xjZbTE4ie4esw1gHxuRb9K2NnuL6clv65SkIEXH0pjlBC sjgm0CGGBeiODO88guxPKtVziu5VVAoAOXvjCgp/ogOSD9TSv27Ii0sZE9bLzVTl9aE4vtTfX5LzG UcUp799MLq3c+lTQ/St4tnuKpKnXNnC52S/jFQBluLR+rRTaI+SHAPHT4XSWdxdA9aCZdNyWVl3pD El+EVbtMrHf6vxwcf03a1zQ29FVaLKYQwgnfZHy47iruNBIiXgiuWA+M1nUH05KHNwc6KWAcZ82vL kv0+givA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVydB-0077Pk-U7; Mon, 12 Apr 2021 15:37:42 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVycs-0077ME-4h for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 15:37:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=MMx1rCxzGCIAqHOE4kKvyvYzd+yIkmxiXyS4/cmXssA=; b=4dhUS616qGWxhR2f5NVnIEkIsE Zdt1EL9kInm+bfoeVUTck0sJECz+AXpzSnF2+5XPLgXRVlEqJyPogyNFnfPbIXt32I2ahawAgC2P/ xDDeMogOE2U6M6BALd99/SDTrGl4pqD+rDFIBfZJ9C75QH0jZUbKZGbwqBWSpTA2e9n2x9cfJ6JsY z7cCc+ofQ8VZSPcnI2jAo+pkWxRf0LJgMx4M01IG5rqleJ07L720MaOJj/5dF1vyeIREXFV+Y2ymi QXTPypaLAWKaFcoTOxfrvWWeayIEWWaNrBckCi1iTp84uTQAn3+PggDAphPyWLdTft9byzI3M2So3 ogjGuVMw==; Received: from mga07.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVycn-006LlP-KN for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 15:37:19 +0000 IronPort-SDR: ePoF3AzBfAy33G532bBi5pq0lqJRyM1Pwlgv6xJSQdxRqIYhfjdNIBZW/tUxYPEtXB85jsm+qV B3Yvbumd9uOg== X-IronPort-AV: E=McAfee;i="6200,9189,9952"; a="258195885" X-IronPort-AV: E=Sophos;i="5.82,216,1613462400"; d="scan'208";a="258195885" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2021 08:37:13 -0700 IronPort-SDR: cuw1ILpAp+18grYJ1Py8CvzrFuIfh3PdUuswheY9KGzzGGlkVDLoDpn/2iyE//8a6gJJY2sSKI G+rqQGam+/4Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,216,1613462400"; d="scan'208";a="614609528" Received: from glass.png.intel.com ([10.158.65.59]) by fmsmga005.fm.intel.com with ESMTP; 12 Apr 2021 08:37:06 -0700 From: Ong Boon Leong To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend Cc: Maxime Coquelin , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , 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, Ong Boon Leong Subject: [PATCH net-next 0/7] stmmac: add XDP ZC support Date: Mon, 12 Apr 2021 23:41:23 +0800 Message-Id: <20210412154130.20742-1-boon.leong.ong@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_083717_751074_A7E6EFE3 X-CRM114-Status: UNSURE ( 9.94 ) 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 Hi, This is the v1 patch series to add XDP ZC support to stmmac driver and the changes are as listed in below summary:- 1-4/7: Refactor RX & TX buffer allocation and initialization to prepare stmmac driver for XSK RX & TX pool enabling and disabling. 5/7: Refactor stmmac_xdp_run_prog() for XDP ZC use which does not need to check for XDP program loaded. 6-7/7: XDP ZC RX and TX enabling. The above patch series have been tested using xdpsock app in samples/bpf directory on Intel mGbE controller. The DUT receives burst traffic packets generated by using pktgen_sample03_burst_single_flow.sh in samples/pktgen. ######################################################################## ========== A) RX-Only ========== root@intel-corei7-64:~ $ ./xdpsock -i eth0 -r -S sock0@eth0:0 rxdrop xdp-skb pps pkts 1.00 rx 112161 12229475 tx 0 0 sock0@eth0:0 rxdrop xdp-skb pps pkts 1.00 rx 112280 12341779 tx 0 0 sock0@eth0:0 rxdrop xdp-skb pps pkts 1.00 rx 112358 12454155 tx 0 0 ==================================================== root@intel-corei7-64:~ $ ./xdpsock -i eth0 -r -N -c sock0@eth0:0 rxdrop xdp-drv pps pkts 1.00 rx 681082 2616133 tx 0 0 sock0@eth0:0 rxdrop xdp-drv pps pkts 1.00 rx 681205 3297415 tx 0 0 sock0@eth0:0 rxdrop xdp-drv pps pkts 1.00 rx 681386 3978873 tx 0 0 ==================================================== root@intel-corei7-64:~ $ ./xdpsock -i eth0 -r -z sock0@eth0:0 rxdrop xdp-drv pps pkts 1.00 rx 703915 19579779 tx 0 0 sock0@eth0:0 rxdrop xdp-drv pps pkts 1.00 rx 703766 20283768 tx 0 0 sock0@eth0:0 rxdrop xdp-drv pps pkts 1.00 rx 703383 20987229 tx 0 0 ========== B) TX-Only ========== root@intel-corei7-64:~ $ ./xdpsock -i eth0 -t -S sock0@eth0:0 txonly xdp-skb pps pkts 1.00 rx 0 0 tx 140269 4326720 sock0@eth0:0 txonly xdp-skb pps pkts 1.00 rx 0 0 tx 140514 4467264 sock0@eth0:0 txonly xdp-skb pps pkts 1.00 rx 0 0 tx 140009 4607296 ==================================================== root@intel-corei7-64:~ $ ./xdpsock -i eth0 -t -N -c sock0@eth0:0 txonly xdp-drv pps pkts 1.00 rx 0 0 tx 138222 3108160 sock0@eth0:0 txonly xdp-drv pps pkts 1.00 rx 0 0 tx 139629 3247872 sock0@eth0:0 txonly xdp-drv pps pkts 1.00 rx 0 0 tx 139821 3387712 ==================================================== root@intel-corei7-64:~ $ ./xdpsock -i eth0 -t -z sock0@eth0:0 txonly xdp-drv pps pkts 1.00 rx 0 0 tx 447382 13390848 sock0@eth0:0 txonly xdp-drv pps pkts 1.00 rx 0 0 tx 447384 13838272 sock0@eth0:0 txonly xdp-drv pps pkts 1.00 rx 0 0 tx 447384 14285696 ================ C) L2 Forwarding ================ root@intel-corei7-64:~ $ ./xdpsock -i eth0 -l -S sock0@eth0:0 l2fwd xdp-skb pps pkts 1.00 rx 85021 7363434 tx 85021 7363434 sock0@eth0:0 l2fwd xdp-skb pps pkts 1.00 rx 85003 7448446 tx 85003 7448446 sock0@eth0:0 l2fwd xdp-skb pps pkts 1.00 rx 84946 7533403 tx 84946 7533403 ==================================================== root@intel-corei7-64:~ $ ./xdpsock -i eth0 -l -N -c sock0@eth0:0 l2fwd xdp-drv pps pkts 1.00 rx 132136 1092673 tx 132072 1092609 sock0@eth0:0 l2fwd xdp-drv pps pkts 1.00 rx 132428 1225118 tx 132428 1225054 sock0@eth0:0 l2fwd xdp-drv pps pkts 1.00 rx 132623 1357757 tx 132623 1357693 ==================================================== root@intel-corei7-64:~ $ ./xdpsock -i eth0 -l -z sock0@eth0:0 l2fwd xdp-drv pps pkts 1.00 rx 468476 43619530 tx 468476 43619466 sock0@eth0:0 l2fwd xdp-drv pps pkts 1.00 rx 468633 44088218 tx 468633 44088154 sock0@eth0:0 l2fwd xdp-drv pps pkts 1.00 rx 468439 44556775 tx 468439 44556711 ######################################################################## Based on the results obtained from above using xdpsock test cases, the result looks promising. It will be great if community can help to review and test the above patch series on your respective platform and provide me feedback for any improvement. Thank you very much, Boon Leong Ong Boon Leong (7): net: stmmac: rearrange RX buffer allocation and free functions net: stmmac: introduce dma_recycle_rx_skbufs for stmmac_reinit_rx_buffers net: stmmac: refactor stmmac_init_rx_buffers for stmmac_reinit_rx_buffers net: stmmac: rearrange RX and TX desc init into per-queue basis net: stmmac: Refactor __stmmac_xdp_run_prog for XDP ZC net: stmmac: Enable RX via AF_XDP zero-copy net: stmmac: Add TX via XDP zero-copy socket drivers/net/ethernet/stmicro/stmmac/stmmac.h | 24 +- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 1698 +++++++++++++---- .../net/ethernet/stmicro/stmmac/stmmac_xdp.c | 94 + .../net/ethernet/stmicro/stmmac/stmmac_xdp.h | 3 + 4 files changed, 1396 insertions(+), 423 deletions(-)