Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4829391pxj; Wed, 9 Jun 2021 02:56:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjCpkX+z02BFM0k9JuJfk7+s9F4v1wRzSW+S3KZUGb0DvFzm4FLFXGoYFUxEMnuWqfqvOd X-Received: by 2002:a6b:cd08:: with SMTP id d8mr22969488iog.86.1623232590688; Wed, 09 Jun 2021 02:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623232590; cv=none; d=google.com; s=arc-20160816; b=afuv6u81taVQbZGCptt005Eldh9VkGicNAZTzK6OgaPPY7Xchj0kcvPQXWfSqufVO5 zozc4ax2cZhW4lzyexwEnuHbIwc3POH4D0iu8Gksuo1xDPyq3NJPJxi1CVTCtmemvVS2 +a+mZUNpcd9s/WwSHCMraRvhNN2Uvb/gdbsfcGKz/BTAJF1undTpAYEVIdrt9swvgxkW 6Q6DHW6WMiesk+nl8UHxGZsF3/UHcBhPK7LHt+N0OyHcsbaIftAHZGf4lYZknyTWCP/3 iw5iTZSGzLfvHOeWeBTDIysq65YuOsyXIGdUXkr4j5gERk+syFWf5YyNCaOvK/qX7O9y QDCA== 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=V8XvDu5rMWk8+n/8Gi2yzAdo7R2RZTgC/VA/hJxxyK0=; b=h4+f1RLL5QM4x9jpoQFsCqtQ3jEG0/5+6MIuWQHBgFdljTiVeZcKk5YZJl/wl/DRUH An49xQDkHi0pT3zRt5cgF8GKyyMzHZPsNWvt06Phtcme8kCNQ9hIQk/F3AoWHeCAitvw fl8ECFPFev0ETtVYManVWEXz/TtV4bsoHEmah0KjsgBXOAuln9anfbHgagz2apl+8VFU bQmLCNB+ce9friBDrS8+I3Xz3zuJC5e/2y+/y3m96zvASHXHaH1mm1mxq0S28w0LYI8M +R5nAGUax7XGaaIWVelcM3Np+6pF8l4wCV9uguJJqXAbNhGaQ9s80OVrJ7g5PP7ZEPGb Y5yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zeNOCVbU; 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 l8si2289825iol.25.2021.06.09.02.56.18; Wed, 09 Jun 2021 02:56:30 -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=zeNOCVbU; 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 S235827AbhFHStV (ORCPT + 99 others); Tue, 8 Jun 2021 14:49:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:43250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235215AbhFHSoD (ORCPT ); Tue, 8 Jun 2021 14:44:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7A18D61447; Tue, 8 Jun 2021 18:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623177378; bh=DPrMbdnY8S/sgFP567lPc1guUDYA2NWfBDZ9Xd3km6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zeNOCVbUrtseuqv0AnoY4IsBLRJK5CkXtR83Tnr7jraHW8AOyTakUhgre86uWPSw+ Eo8rqY3U+GKsIUziCGpO3BJJybcHuYdVtawTGvnD+ow9K+ec0EH4VLYG8PoDqlSl/R pDBsDBzgB2HUfu4yfc2oxoUZcVkbbRBs27A7OFcg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesper Dangaard Brouer , Magnus Karlsson , Kiran Bhandare , Tony Nguyen , Sasha Levin Subject: [PATCH 5.4 29/78] i40e: add correct exception tracing for XDP Date: Tue, 8 Jun 2021 20:26:58 +0200 Message-Id: <20210608175936.245694638@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175935.254388043@linuxfoundation.org> References: <20210608175935.254388043@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 f6c10b48f8c8da44adaff730d8e700b6272add2b ] Add missing exception tracing to XDP when a number of different errors can occur. The support was only partial. Several errors where not logged which would confuse the user quite a lot not knowing where and why the packets disappeared. Fixes: 74608d17fe29 ("i40e: add support for XDP_TX action") Fixes: 0a714186d3c0 ("i40e: add AF_XDP zero-copy Rx support") Reported-by: Jesper Dangaard Brouer Signed-off-by: Magnus Karlsson Tested-by: Kiran Bhandare Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 7 ++++++- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 8 ++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 218aada8949d..68a2fcf4c0bf 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -2233,15 +2233,20 @@ static struct sk_buff *i40e_run_xdp(struct i40e_ring *rx_ring, case XDP_TX: xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index]; result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring); + if (result == I40E_XDP_CONSUMED) + goto out_failure; break; case XDP_REDIRECT: err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); - result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED; + if (err) + goto out_failure; + result = I40E_XDP_REDIR; break; default: bpf_warn_invalid_xdp_action(act); /* fall through */ case XDP_ABORTED: +out_failure: trace_xdp_exception(rx_ring->netdev, xdp_prog, act); /* fall through -- handle aborts by dropping packet */ case XDP_DROP: diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c index 17499c0d10bb..a9ad788c4913 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c @@ -214,9 +214,10 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp) if (likely(act == XDP_REDIRECT)) { err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); - result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED; + if (err) + goto out_failure; rcu_read_unlock(); - return result; + return I40E_XDP_REDIR; } switch (act) { @@ -225,11 +226,14 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp) case XDP_TX: xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index]; result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring); + if (result == I40E_XDP_CONSUMED) + goto out_failure; break; default: bpf_warn_invalid_xdp_action(act); /* fall through */ case XDP_ABORTED: +out_failure: trace_xdp_exception(rx_ring->netdev, xdp_prog, act); /* fallthrough -- handle aborts by dropping packet */ case XDP_DROP: -- 2.30.2