Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5600668rwb; Mon, 14 Nov 2022 07:01:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf49V8h37TkwY+w45iI4YSmIarMVIjKbI6wz1BAuraYB9TvI3md7ikz2hAT1IV6UK7PC8Gw+ X-Received: by 2002:a17:90b:35d1:b0:214:2b29:6bc8 with SMTP id nb17-20020a17090b35d100b002142b296bc8mr14319030pjb.67.1668438116341; Mon, 14 Nov 2022 07:01:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668438116; cv=none; d=google.com; s=arc-20160816; b=RvI5Dat3RanfMu5ew7u5QBL1TnVKpgHdQ8DfuPEbcuAWZVyZ+HRD2Exheb38xXfvfi cGafo6XGuQgGaTQbIIM02NXMPPxgz2BbiByLvrtAo1kjIVPTO4bJ+/H97ajUY1+u8cZL GXBe3B/6sp+TrBt//3x6QIAxARhp5OdG/avFADQcEp97T4pflRAIksGwDi8CdkYJl1CE dIkiCZvQEQNkbIbSrRGaSbwaSBAcFmH4oLYlWT+D9Oc0Z8FvkAvuFmyjhPHYES+DaLqE XDuvwGAHh7OzQhC3yaiQThMkBsFE6+5G1Twphz2j03ZT3nygghDEtx3UvMe70C//4bRY TwPA== 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=nVvU4t+V42J2KFqAZTmGaRrQDw6OcomvPPZvTSC6zKc=; b=mY7Akk6jXVVmtelE4gBDrnEmPhXxi275BKuSaMr9ySRir6CLKjNW2sRHUIQpCJqoPP O7Pj7NMY73zjCZ8NJHs7oGf1rmXRa3oRIINmU/+2A5e56CvPDe+U1a3MwxxSnqpuq8Rf +WlMrx7kBc6CeBGTWHxYkIxTlw82OnTtTd4/ICuCaRY8k04AEBKaXfxxgsZ6USmEpgQV NhCMr9eUo1vteqzWa/tA1resUTvDTxdkzKYNTbLzNW6Pa8BFfJYagZ1Yw35wNlNU47Kx d7c7sQEDgKjtxqgCIO+Yovrv3O4wllVX1LUpIIZMzaCUrY+sOqxHD8ggspcYcVKrJhCG X9OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JInJL6fH; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s10-20020a17090a948a00b00205ebfd6d35si8669117pjo.76.2022.11.14.07.01.24; Mon, 14 Nov 2022 07:01:56 -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=@intel.com header.s=Intel header.b=JInJL6fH; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236931AbiKNOQv (ORCPT + 87 others); Mon, 14 Nov 2022 09:16:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbiKNOQu (ORCPT ); Mon, 14 Nov 2022 09:16:50 -0500 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75EED24F19; Mon, 14 Nov 2022 06:16:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668435409; x=1699971409; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VWZRwieL0MnAqoIr5PqiCwKsEkjOEOCAdig3LNLeXLs=; b=JInJL6fHxfszv6AIfgcM+yVBL9NrJyJD+ELjabrUwctUT9YV94hK4jjG rdmT+DShEDCxc+h9i8OZ6mLtCaN/FzKYKuOX/lvnr2qjKA1Qm2JId0LSe TV6uNGY4fGQF41iuoln8BR3gICXAXKfYJAG8O0I7ZVTzfPpDHUqrYVPSI Pcxks7ISMZD96XBLVSICsHfzzKwQZsdregvV1xRlokcY/cJ4JU2E4VAqV V4GFdX9VpJrNNxPuZiDKkU8uxhsthrdahxNB4+qN3LcDpqMvVKRaBk+SR 6Snen+Vx1EWoq0musqDu/W7iZQybhlTmeZAg9cj2yC0mMTbb9My9GKrRl Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="299494588" X-IronPort-AV: E=Sophos;i="5.96,161,1665471600"; d="scan'208";a="299494588" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 06:16:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="671573894" X-IronPort-AV: E=Sophos;i="5.96,161,1665471600"; d="scan'208";a="671573894" Received: from irvmail001.ir.intel.com ([10.43.11.63]) by orsmga001.jf.intel.com with ESMTP; 14 Nov 2022 06:16:46 -0800 Received: from newjersey.igk.intel.com (newjersey.igk.intel.com [10.102.20.203]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 2AEEGiQ8012563; Mon, 14 Nov 2022 14:16:44 GMT From: Alexander Lobakin To: Horatiu Vultur Cc: Alexander Lobakin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, 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 Subject: Re: [PATCH net-next 1/5] net: lan966x: Add XDP_PACKET_HEADROOM Date: Mon, 14 Nov 2022 15:16:33 +0100 Message-Id: <20221114141633.699268-1-alexandr.lobakin@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221113111559.1028030-2-horatiu.vultur@microchip.com> References: <20221113111559.1028030-1-horatiu.vultur@microchip.com> <20221113111559.1028030-2-horatiu.vultur@microchip.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit 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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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: X-Mailing-List: linux-kernel@vger.kernel.org From: Horatiu Vultur Date: Sun, 13 Nov 2022 12:15:55 +0100 > Update the page_pool params to allocate XDP_PACKET_HEADROOM space as > headroom for all received frames. > This is needed for when the XDP_TX and XDP_REDIRECT are implemented. > > Signed-off-by: Horatiu Vultur > --- [...] > @@ -466,7 +472,8 @@ static struct sk_buff *lan966x_fdma_rx_get_frame(struct lan966x_rx *rx, > > skb_mark_for_recycle(skb); > > - skb_put(skb, FDMA_DCB_STATUS_BLOCKL(db->status)); > + skb_put(skb, FDMA_DCB_STATUS_BLOCKL(db->status) + XDP_PACKET_HEADROOM); > + skb_pull(skb, XDP_PACKET_HEADROOM); These two must be: + skb_reserve(skb, XDP_PACKET_HEADROOM); skb_put(skb, FDMA_DCB_STATUS_BLOCKL(db->status)); i.e. you only need to add reserve, and that's it. It's not only faster, but also moves ::tail, which is essential. > > lan966x_ifh_get_timestamp(skb->data, ×tamp); > [...] > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_xdp.c > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_xdp.c > @@ -44,8 +44,9 @@ int lan966x_xdp_run(struct lan966x_port *port, struct page *page, u32 data_len) > > xdp_init_buff(&xdp, PAGE_SIZE << lan966x->rx.page_order, > &port->xdp_rxq); > - xdp_prepare_buff(&xdp, page_address(page), IFH_LEN_BYTES, > - data_len - IFH_LEN_BYTES, false); > + xdp_prepare_buff(&xdp, page_address(page), > + IFH_LEN_BYTES + XDP_PACKET_HEADROOM, > + data_len - IFH_LEN_BYTES - XDP_PACKET_HEADROOM, false); Are you sure you need to substract %XDP_PACKET_HEADROOM from @data_len? I think @data_len is the frame length, so headroom is not included? > act = bpf_prog_run_xdp(xdp_prog, &xdp); > switch (act) { > case XDP_PASS: > -- > 2.38.0 Thanks, Olek