Message ID | 20221122214413.3446006-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 q4csp2455388wrr; Tue, 22 Nov 2022 13:52:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf7rReFyuiiKhSTarV97DhxhlMFeJLjfOZfUTq0hGTsc9HTnRS/8CQSWlr/X7bIplfggU9CZ X-Received: by 2002:a17:90b:3696:b0:214:1df2:b566 with SMTP id mj22-20020a17090b369600b002141df2b566mr28248310pjb.147.1669153941444; Tue, 22 Nov 2022 13:52:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669153941; cv=none; d=google.com; s=arc-20160816; b=0pyA0IwjQYWbdIse+HvH+SZv9UtHu9ozZf7vScP244SC1vgS+cvDlLJfpf1CAQCMHR JVP9/Aafxu4zB8EdniLEOYsPc9bBdTmb2wk66UvcY6vqMxUA32tumoPNmjlTZk6fhx+u bfgu8OXTsXMnhHm0G8wxtUYlB7bJhzroBK2Zb55N79yZeBA88HZE3ucFATkmIWi+X2Tg McGVo5ZWT8OFGEHFNeM6W0p0r5Q3buAzxtW3PKfSD97pZnpVLTIgNcc1x3luj1azUZmM Bm8P5yO23o2m0SGkuKJLokDZk0J0zbUl4XDPjsoAeOCvmVvxKTaHvFkaN+SvVAW//HCT o7PA== 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=Hyv6eu1zvvI1ysPkETgZkmASLijpAW88NehFI8hbIEpKf+T8Pm+jvNHFGYGfKZrrGW +g4IJLN+A4QZTFexZShTugLC0KOs+mX1IAlSDjdhcQAMMCrdY4lCQ3z3VUNy6llptoWs EvAHhyu5HkMWVRIk7qMFcURDwwmxfjIi5UaT3+VlukXpGn9n64ClJ+YPulocT15vGKqu y7tZTmzwRFTaJfb12aqtEe5yFdCvSlDGVbQ0HmOs53q90KE1OoHbrrdG+RngkPjXTaQs gnrEoOcAvOTYRiNfignXZq9pCX5SKDyyro7ZAb8QUapF6assrkhcZdXV1/46nuVhOLPC SBhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=l+ORBpuV; 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 w2-20020a170902e88200b00176e226934dsi16610033plg.367.2022.11.22.13.52.07; Tue, 22 Nov 2022 13:52:21 -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=l+ORBpuV; 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 S234688AbiKVVkx (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Tue, 22 Nov 2022 16:40:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235141AbiKVVkW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 22 Nov 2022 16:40:22 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EE45C6620; Tue, 22 Nov 2022 13:40:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1669153213; x=1700689213; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Hp29edLp8a8OEBxkPTP/BqxOmLMA7en3zD0HWlGqapo=; b=l+ORBpuVVSEyxRrgozTDrDL/P4axGNx5iPZLO+yVYCcWPPqC83k7hpFL tL9fA1d55V0121EDEXgafgjLyKd0fMbkRMdghgYhcFnqBpVMAM1D3sWpN o/uPkaGU3jAYfWySe8AJjwdq+wjHySvcwxWTRwD35EFmggPItOLExVbN2 EylNzVmXK05zL/iidAwnWN87zRZv/W8JQqkeeq7CkSjoZnPJ9MtksOMuF DKQkiqS7n9KmIllLbt6yu0CqSVpqOTFkmsF2AKfLsSstX+3MUfSCKkMSk CLbkEf9YBXaHYa3MGiwSuU9k11YP/Rx7Rf59LBuz5Nf0zasadeDtmeo4R g==; X-IronPort-AV: E=Sophos;i="5.96,185,1665471600"; d="scan'208";a="201008100" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Nov 2022 14:40:13 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 22 Nov 2022 14:40:05 -0700 Received: from soft-dev3-1.microsemi.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 22 Nov 2022 14:40:03 -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>, <alexandr.lobakin@intel.com>, <UNGLinuxDriver@microchip.com>, Horatiu Vultur <horatiu.vultur@microchip.com> Subject: [PATCH net-next v4 4/7] net: lan966x: Update rxq memory model Date: Tue, 22 Nov 2022 22:44:10 +0100 Message-ID: <20221122214413.3446006-5-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221122214413.3446006-1-horatiu.vultur@microchip.com> References: <20221122214413.3446006-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, RCVD_IN_MSPIKE_H2,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?1750234762870519335?= X-GMAIL-MSGID: =?utf-8?q?1750234762870519335?= |
Series |
net: lan966x: Extend xdp support
|
|
Commit Message
Horatiu Vultur
Nov. 22, 2022, 9:44 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
On Tue, Nov 22, 2022 at 10:44:10PM +0100, Horatiu Vultur wrote: > 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; port can be scoped only for the loop below? > + int i; > > rx->page_pool = page_pool_create(&pp_params); > + > + for (i = 0; i < lan966x->num_phys_ports; ++i) { Quoting Alex from some other thread: "Since we're on -std=gnu11 for a bunch of releases already, all new loops are expected to go with the iterator declarations inside them." TBH I wasn't aware of that personally :) > + 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); > } > > -- > 2.38.0 >
The 11/22/2022 23:01, Maciej Fijalkowski wrote: > > On Tue, Nov 22, 2022 at 10:44:10PM +0100, Horatiu Vultur wrote: > > 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; > > port can be scoped only for the loop below? Yes, I will change this. > > > + int i; > > > > rx->page_pool = page_pool_create(&pp_params); > > + > > + for (i = 0; i < lan966x->num_phys_ports; ++i) { > > Quoting Alex from some other thread: > > "Since we're on -std=gnu11 for a bunch of releases already, all new > loops are expected to go with the iterator declarations inside them." > > TBH I wasn't aware of that personally :) Me neither, I will update this and all the other lops introduced in this series. > > > + 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); > > } > > > > -- > > 2.38.0 > >
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); }