Message ID | 20221121212850.3212649-5-horatiu.vultur@microchip.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1844191wrr; Mon, 21 Nov 2022 13:30:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf5PmFYdNwstOGimUnARsOfp9jOTejJ6i6PUjJ4Yy52oMKNyj4OA+9Jvim2JOXHrOsys3x0R X-Received: by 2002:a05:6402:456:b0:461:9955:b54a with SMTP id p22-20020a056402045600b004619955b54amr7099828edw.159.1669066216758; Mon, 21 Nov 2022 13:30:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669066216; cv=none; d=google.com; s=arc-20160816; b=oLQf+v5SX9ZStMi8X7L050oRPz1Y2vlVBkQOP0zljEmitIu045S29E+FgRzD6Stjus kzanG9ogLjZE+Az2i2IezUrx04mWA0PbA7XcG2uij8ZQoRqvsR95nT0eFczu3LXHmTRc Le5ZqJztzBuvB/NkXZoqGyws73lvHxwAvkUy1ZdeXOvuN6UwwC6S8oES9AAQMpeE8HHL 5udg4VeGUhZCeotrK0q5p2tPU9SLbHSXtnGiNMf6VNLP/l0Py1jv0Lxs9vpO/P1sz5wh QvyfxjMbYYFFv0CbyGTFyrh3VTrKkwYRtoDfMMKldkWvoNty9C/XKHaqBtgeRFgnG9k4 Sk/g== 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=pLtyNYbwTS6UwI7s4ntrsfBuNT7TIR6M6ZMzknBdrgI=; b=zI0T+VmRCXiaIDSdydtt31ZUryQEd6qWwdxp/yK/IwnWgvzpkwR/HJViQw9mHIGtvj E7Gstm9aaDTUOntkC3wV2A/4fEC8IpeIxNu5+/W9QBXeb1lJ4dX7ViBQt8KYCxxbeSqC 7ERrYsmJBN2HV5UkwFoSko5fSkgu5MR1IkYzg6XzT7lkkjROjLHpb2Wkam8WwuDRDmVA qFdTryC/o7ZeE6Io/pSYwo4bPlcerSYFmynwinSwS0YCMyXEjVg91XYSutX0CLme9WOS 4RADvtk1ld2kGzv7Z0Yk/y9nciNFkwAOUWttLDW6FnN9RcXy4eVP5Bi+BupxFSA5kykC kijg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=Zoo45D5A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i14-20020a05640242ce00b0046751a6076bsi11853548edc.318.2022.11.21.13.29.53; Mon, 21 Nov 2022 13:30:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=Zoo45D5A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231598AbiKUVZF (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Mon, 21 Nov 2022 16:25:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231546AbiKUVY4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 21 Nov 2022 16:24:56 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0A5CB9614; Mon, 21 Nov 2022 13:24:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1669065889; x=1700601889; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Hp29edLp8a8OEBxkPTP/BqxOmLMA7en3zD0HWlGqapo=; b=Zoo45D5A+MyMUQYePz6R1z0eh/iC4zAt+Tcj59p70gWJpuQPO5dgi7RR wQBAjmi1K+ec9kr+HwHU6uOVRJLkrTjrMzcNNsQq1tctuyvABjrHPmgL0 SrJOq6bKDGS7gXmO5WrcCHjmSjOox9opgVsNNmeDDq7WRcBhg7hACd2vj eZEDIoG8J2r7ToCfPwvwy71VlKXGF5jMJZ69pzgKxfX1Wu6FwIYHWkyiy Oh65mDvabM3wcXmAhrcmLlGJT95+rknHLE0E4D4sViH2QOswZ0+aD2aIQ 7ClX5oRxy4eQxj1ztlyZpCBoQVs7rvOiXk9ZPptb9ClsloeCyIypu5Z26 w==; X-IronPort-AV: E=Sophos;i="5.96,182,1665471600"; d="scan'208";a="124468641" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 21 Nov 2022 14:24:45 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Mon, 21 Nov 2022 14:24:44 -0700 Received: from soft-dev3-1.microsemi.net (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Mon, 21 Nov 2022 14:24:41 -0700 From: Horatiu Vultur <horatiu.vultur@microchip.com> To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <bpf@vger.kernel.org> CC: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <ast@kernel.org>, <daniel@iogearbox.net>, <hawk@kernel.org>, <john.fastabend@gmail.com>, <UNGLinuxDriver@microchip.com>, Horatiu Vultur <horatiu.vultur@microchip.com> Subject: [PATCH net-next v3 4/7] net: lan966x: Update rxq memory model Date: Mon, 21 Nov 2022 22:28:47 +0100 Message-ID: <20221121212850.3212649-5-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221121212850.3212649-1-horatiu.vultur@microchip.com> References: <20221121212850.3212649-1-horatiu.vultur@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,T_SPF_TEMPERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750142777063032988?= X-GMAIL-MSGID: =?utf-8?q?1750142777063032988?= |
Series |
net: lan966x: Extend xdp support
|
|
Commit Message
Horatiu Vultur
Nov. 21, 2022, 9:28 p.m. UTC
By default the rxq memory model is MEM_TYPE_PAGE_SHARED but to be able
to reuse pages on the TX side, when the XDP action XDP_TX it is required
to update the memory model to PAGE_POOL.
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
.../net/ethernet/microchip/lan966x/lan966x_fdma.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
Comments
From: Horatiu Vultur <horatiu.vultur@microchip.com> Date: Mon, 21 Nov 2022 22:28:47 +0100 > By default the rxq memory model is MEM_TYPE_PAGE_SHARED but to be able > to reuse pages on the TX side, when the XDP action XDP_TX it is required > to update the memory model to PAGE_POOL. > > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> > --- > .../net/ethernet/microchip/lan966x/lan966x_fdma.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c > index 384ed34197d58..483d1470c8362 100644 > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c > @@ -78,8 +78,22 @@ static int lan966x_fdma_rx_alloc_page_pool(struct lan966x_rx *rx) > .max_len = rx->max_mtu - > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), > }; > + struct lan966x_port *port; > + int i; > > rx->page_pool = page_pool_create(&pp_params); > + > + for (i = 0; i < lan966x->num_phys_ports; ++i) { > + if (!lan966x->ports[i]) > + continue; > + > + port = lan966x->ports[i]; > + > + xdp_rxq_info_unreg_mem_model(&port->xdp_rxq); xdp_rxq_info_unreg_mem_model() can emit a splat if currently the corresponding xdp_rxq_info is not registered[0]. Can't we face it here if called from lan966x_fdma_init()? > + xdp_rxq_info_reg_mem_model(&port->xdp_rxq, MEM_TYPE_PAGE_POOL, > + rx->page_pool); > + } > + > return PTR_ERR_OR_ZERO(rx->page_pool); > } > > -- > 2.38.0 Thanks, Olek
The 11/22/2022 12:38, Alexander Lobakin wrote: > > From: Horatiu Vultur <horatiu.vultur@microchip.com> > Date: Mon, 21 Nov 2022 22:28:47 +0100 > > > By default the rxq memory model is MEM_TYPE_PAGE_SHARED but to be able > > to reuse pages on the TX side, when the XDP action XDP_TX it is required > > to update the memory model to PAGE_POOL. > > > > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> > > --- > > .../net/ethernet/microchip/lan966x/lan966x_fdma.c | 14 ++++++++++++++ > > 1 file changed, 14 insertions(+) > > > > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c > > index 384ed34197d58..483d1470c8362 100644 > > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c > > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c > > @@ -78,8 +78,22 @@ static int lan966x_fdma_rx_alloc_page_pool(struct lan966x_rx *rx) > > .max_len = rx->max_mtu - > > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), > > }; > > + struct lan966x_port *port; > > + int i; > > > > rx->page_pool = page_pool_create(&pp_params); > > + > > + for (i = 0; i < lan966x->num_phys_ports; ++i) { > > + if (!lan966x->ports[i]) > > + continue; > > + > > + port = lan966x->ports[i]; > > + > > + xdp_rxq_info_unreg_mem_model(&port->xdp_rxq); > > xdp_rxq_info_unreg_mem_model() can emit a splat if currently the > corresponding xdp_rxq_info is not registered[0]. Can't we face it > here if called from lan966x_fdma_init()? We will not face that issue here because before lan966x_fdma_init is called, we call lan966x_xdp_port_init which registers xdp_rxq_info. > > > + xdp_rxq_info_reg_mem_model(&port->xdp_rxq, MEM_TYPE_PAGE_POOL, > > + rx->page_pool); > > + } > > + > > return PTR_ERR_OR_ZERO(rx->page_pool); > > } > > > > -- > > 2.38.0 > > Thanks, > Olek
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c index 384ed34197d58..483d1470c8362 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c @@ -78,8 +78,22 @@ static int lan966x_fdma_rx_alloc_page_pool(struct lan966x_rx *rx) .max_len = rx->max_mtu - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), }; + struct lan966x_port *port; + int i; rx->page_pool = page_pool_create(&pp_params); + + for (i = 0; i < lan966x->num_phys_ports; ++i) { + if (!lan966x->ports[i]) + continue; + + port = lan966x->ports[i]; + + xdp_rxq_info_unreg_mem_model(&port->xdp_rxq); + xdp_rxq_info_reg_mem_model(&port->xdp_rxq, MEM_TYPE_PAGE_POOL, + rx->page_pool); + } + return PTR_ERR_OR_ZERO(rx->page_pool); }