Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp948062pxb; Wed, 6 Apr 2022 05:05:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKvMZFiEZG0MvF9hcUub/BKA5pcvONoiAbL7BIeGbtI/rZYjARhxu6WnaoRrTJijqmwK76 X-Received: by 2002:a17:902:ccd0:b0:156:7ac2:5600 with SMTP id z16-20020a170902ccd000b001567ac25600mr8413751ple.156.1649246727255; Wed, 06 Apr 2022 05:05:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649246727; cv=none; d=google.com; s=arc-20160816; b=M9Ow4bz2mENkFX2DbrE5Ii8et3HTalCxSXutVc8XWnpHWuhUpDytPAZH8Y6fVZ3Ivf z6y58RnJNxcx2HiJhJHQBRXQWsebRuizcDmMaC3ilXsu2D+wk4CLwhuECVuCXQs9C4+3 XHK0W3lUTLmRee8d9gBTB0porm8RJl4eb1YRsxy0VYwbqqH7dml7cG2sS935cckOch74 o1XY6H7jjNThjjIM+0CRG0XEGk95UMKf7zGEedacyg8AqBrMG2I6QrdLnlYNTw2hnjtc d1jxeUaQU1aRbXoTYldj4iA9YdJRS4j4VAAgH8+wwR2s8BS20lp0mT7F4av7ldJKVCwQ /oPg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0YW52zwjIHL5mcX5H6VMTo+RAlflr7z5INNlaqp/twk=; b=lD4V4gOa27gHiovkKNXAoawKAXcLhqUHMzL5mQye/4zb+x5rCO6tf+Pe/6Xed7Qqn+ YiXRK4AL17Gj8zkZiaCido74TzRpHadFI706LB/vSLw7HapBcBWSnR869hdBzphMBnuF XB78LVSsj8Pf87nRm7f6AhSQWR7wuWAtycYsoyzNizUOKeEVU1WbkwwvqS1ffONg+XxT tg6o3YrjwDcJxaGiqHMihC1pvAARY40eIurIhh16y604CcL4PFGg1rpS41l6r5Aq/Gy5 WQWTgalExGRCSZARssWzy41anhFsgLLTmkwjNTVswMQ3x2RY+Mahlla1rtVs2Bo5N3v8 21Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="o9enPU8/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bd34-20020a056a0027a200b004fe3c4e5a05si4879525pfb.205.2022.04.06.05.05.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:05:27 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="o9enPU8/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BDB8B67F9C1; Wed, 6 Apr 2022 03:33:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583619AbiDEXxW (ORCPT + 99 others); Tue, 5 Apr 2022 19:53:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349046AbiDEJtB (ORCPT ); Tue, 5 Apr 2022 05:49:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45523A94D1; Tue, 5 Apr 2022 02:39:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D66B7615E5; Tue, 5 Apr 2022 09:39:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6D5FC385A2; Tue, 5 Apr 2022 09:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151556; bh=+x0Cg1YiibWJ/0p4t+c8hKcmMjMN0foh24vEtn1R3II=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o9enPU8/F8HW4JJs4xsDbV97n+a6lYGWnEoxkEwvtJ+zDNw+bEAxpEpHkB+JFgmwi Vvn5P4ibINFDXkQqW3nOKzS6Pe1v6oaXgVJRD/ulKvIodBvceQjrwGeCMlSnONb1dR bnUD9F8XrxztBig8/CY7j36XUzbPUPHaJ4v1Pvp8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Lobakin , Michal Swiatkowski , Jesper Dangaard Brouer , Kiran Bhandare , Tony Nguyen , Sasha Levin Subject: [PATCH 5.15 410/913] i40e: dont reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb Date: Tue, 5 Apr 2022 09:24:32 +0200 Message-Id: <20220405070352.135227483@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: Alexander Lobakin [ Upstream commit bc97f9c6f988b31b728eb47a94ca825401dbeffe ] {__,}napi_alloc_skb() allocates and reserves additional NET_SKB_PAD + NET_IP_ALIGN for any skb. OTOH, i40e_construct_skb_zc() currently allocates and reserves additional `xdp->data - xdp->data_hard_start`, which is XDP_PACKET_HEADROOM for XSK frames. There's no need for that at all as the frame is post-XDP and will go only to the networking stack core. Pass the size of the actual data only to __napi_alloc_skb() and don't reserve anything. This will give enough headroom for stack processing. Fixes: 0a714186d3c0 ("i40e: add AF_XDP zero-copy Rx support") Signed-off-by: Alexander Lobakin Reviewed-by: Michal Swiatkowski Acked-by: Jesper Dangaard Brouer Tested-by: Kiran Bhandare Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c index e7e778ca074c..48f5319a3d41 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c @@ -248,13 +248,11 @@ static struct sk_buff *i40e_construct_skb_zc(struct i40e_ring *rx_ring, struct sk_buff *skb; /* allocate a skb to store the frags */ - skb = __napi_alloc_skb(&rx_ring->q_vector->napi, - xdp->data_end - xdp->data_hard_start, + skb = __napi_alloc_skb(&rx_ring->q_vector->napi, datasize, GFP_ATOMIC | __GFP_NOWARN); if (unlikely(!skb)) goto out; - skb_reserve(skb, xdp->data - xdp->data_hard_start); memcpy(__skb_put(skb, datasize), xdp->data, datasize); if (metasize) skb_metadata_set(skb, metasize); -- 2.34.1