Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp545370pxj; Tue, 18 May 2021 08:59:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8jvl7sly3yYGz+K+5VyVExMbE2eFOjJTLamqQtKIPSiRJpjhXJvbNKwXPmtJkDqcqTBUg X-Received: by 2002:a17:906:3b92:: with SMTP id u18mr6817960ejf.450.1621353574924; Tue, 18 May 2021 08:59:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621353574; cv=none; d=google.com; s=arc-20160816; b=foqKeYEIgz7xYuAx6K3vBPuKoUn45LyMibaB0OEu6pm2Em3RXbG6Gcm/DUKWqfi/iq zu4rP4j/y1Jecc2ILGKcdX77sCElWsxk0XnrI87U6wPpJCorUEBiuq60a3MbHXt5+EOH 1zTL8fQrJJLK3GodACSgfgNzLah2sYIp4mMeL6BZIgClYco6VspyWvcjiOUOT86IdigH 54Ms7yRwqslk8MxPpi09+rgJz+RX5iOOzIWJT19DXu8FSXN+ZgwuEE4uRNy2WgG4/dvZ kOkW8afcW+Eq9GBPewIiOxdO7y/pMVED51jlshieBVdSuPySCxVs0l17yIbKf6em8Xki vX6g== 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=9ocA5PaYD6192PbVYFgpQbAylbdLmKHRZBR5AwNXezE=; b=ZzVntv3r53hWI2Sj3HFa024kM8MoXxxgrJ9E7S5xfe4hXcTINfwGxKV32JgYu0asFq anRNo1r9h2ms9eVoQRfj3RKYHR+B1kpxBC8zVz0IzXbgSDHrfvVzzlqeAKGVm2UV1g2c mFDbydZAw21aXVq4UGeC4vQ9DbOSvqCmjTp73L5Nea0JvM1QfcbzLjLQxULkXGYcRSNI Fj1Uh6UOvnxbG+qzTkL12h4UbRIP00nDwvrKOKA4JXcVd0ARAPI8/L85nKrbxQupNDpE SYol0T3KdWnLj0IGr9zAeL7WShuTVaZfmaDs5F4KK75ecWnLDLqtbLt06tMBejrYVMXk 07uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H3AegJAF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m26si19295895edp.58.2021.05.18.08.58.49; Tue, 18 May 2021 08:59:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H3AegJAF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346128AbhEQP6I (ORCPT + 99 others); Mon, 17 May 2021 11:58:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:39334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245225AbhEQPiI (ORCPT ); Mon, 17 May 2021 11:38:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ACAF661CF6; Mon, 17 May 2021 14:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262442; bh=py50fbytoLnctmcc9EJ5l2lc9q9JMW+dksMe7DJR8Iw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H3AegJAF8Ho/JZwlITuJxWlR4n7ahq3G4W+zYBdWWck+YJUWW7WM4HMrLI5Sdvqoi uM7VTDyMyqWyf3cge+r1jes+XC05uYIezp2kpdWNlstzSzdvaINvOiBxWyGBfWv/C+ uaEnQE3wZFErSeV2aaTyreVOeFl4Bxt9m9bAKjc8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesper Dangaard Brouer , Maciej Fijalkowski , Magnus Karlsson , Tony Nguyen , Sasha Levin Subject: [PATCH 5.10 188/289] i40e: fix broken XDP support Date: Mon, 17 May 2021 16:01:53 +0200 Message-Id: <20210517140311.443821823@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Magnus Karlsson [ Upstream commit ae4393dfd472b194c90d75d2123105fb5ed59b04 ] Commit 12738ac4754e ("i40e: Fix sparse errors in i40e_txrx.c") broke XDP support in the i40e driver. That commit was fixing a sparse error in the code by introducing a new variable xdp_res instead of overloading this into the skb pointer. The problem is that the code later uses the skb pointer in if statements and these where not extended to also test for the new xdp_res variable. Fix this by adding the correct tests for xdp_res in these places. The skb pointer was used to store the result of the XDP program by overloading the results in the error pointer ERR_PTR(-result). Therefore, the allocation failure test that used to only test for !skb now need to be extended to also consider !xdp_res. i40e_cleanup_headers() had a check that based on the skb value being an error pointer, i.e. a result from the XDP program != XDP_PASS, and if so start to process a new packet immediately, instead of populating skb fields and sending the skb to the stack. This check is not needed anymore, since we have added an explicit test for xdp_res being set and if so just do continue to pick the next packet from the NIC. Fixes: 12738ac4754e ("i40e: Fix sparse errors in i40e_txrx.c") Acked-by: Jesper Dangaard Brouer Tested-by: Jesper Dangaard Brouer Reported-by: Jesper Dangaard Brouer Reviewed-by: Maciej Fijalkowski Signed-off-by: Magnus Karlsson Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 62b439232fa5..011f484606a3 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -1810,10 +1810,6 @@ static bool i40e_cleanup_headers(struct i40e_ring *rx_ring, struct sk_buff *skb, union i40e_rx_desc *rx_desc) { - /* XDP packets use error pointer so abort at this point */ - if (IS_ERR(skb)) - return true; - /* ERR_MASK will only have valid bits if EOP set, and * what we are doing here is actually checking * I40E_RX_DESC_ERROR_RXE_SHIFT, since it is the zeroth bit in @@ -2426,7 +2422,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) } /* exit if we failed to retrieve a buffer */ - if (!skb) { + if (!xdp_res && !skb) { rx_ring->rx_stats.alloc_buff_failed++; rx_buffer->pagecnt_bias++; break; @@ -2438,7 +2434,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) if (i40e_is_non_eop(rx_ring, rx_desc, skb)) continue; - if (i40e_cleanup_headers(rx_ring, skb, rx_desc)) { + if (xdp_res || i40e_cleanup_headers(rx_ring, skb, rx_desc)) { skb = NULL; continue; } -- 2.30.2