Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4850045pxj; Wed, 9 Jun 2021 03:30:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+oKbD/6VaRKSp4ueUSW9jWyVPNzZ3c16bajTFaykWr9Mvp0mjCTDf/jIviI+zPC356JsC X-Received: by 2002:a17:906:35db:: with SMTP id p27mr27660220ejb.391.1623234615744; Wed, 09 Jun 2021 03:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623234615; cv=none; d=google.com; s=arc-20160816; b=T6AbXpI8vl1BZhw0knu4FBVgQCKYDUA44Fgm4tayLyikO8ejLRt1sRyTBco4kozPXa 2Rlr17ZoSOvRGuZZczaFR3HPBa44JUgJ3bkvx4UMYnS1gpfAI9qb3uVP241NZzkQS3oQ q61DqfR1bAzxTOxkUCvQBO5qq2vOU/R4B8xeo3ZfseiAXv+VqQoBmSujqduNro8H+A4t C9dNnBpDrq6lQbqqI0Sp2zawneiuvmk12rfUmztkLTnZaRkdIovmn45POtLpaVfykP3u QK5sG0quB8XAJfhN/bOCm6vnVRtdcgoAghp1cyWCCAVJE3S6cjiuGJTmjHsx2szyHFy5 Fm3A== 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=eYWD3MOJRMKkFSbn0VxGkhEtY3B3Kvap9iJsvldW8rw=; b=WFfDd0vemxuDzjVrlaHvB0xGa1j92lmYNArYlHuQO362oYjpA6D90W7jwGeZYShTRi 9S5tt1+670Z1TpNGtpmji+08WCYhqxEJeq0wJhyo+GdTFq47J02LMXzBgxrLCgv+wxdq 6OXhkwgIzDEWixjDFOu9CUaVL0x1tfZnZ1v+tg4rbV3J4+i7ccSUi4AOhOveNuEASWd+ uJ+3LkxkmAfX9i+2IiQ8+YAKyofmKDesgFJ49U63R+ajru674AZFh8vvBySZohk/mDha YvTXKHsmgs/bnioQ9i46MaeHUtzsahQsz1bgIqVcuRunr79LzuqSw3r8TGgcYeNCVV04 RYaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EgfMZiwC; 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 z11si2129868edx.62.2021.06.09.03.29.52; Wed, 09 Jun 2021 03:30:15 -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=EgfMZiwC; 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 S237444AbhFHTAj (ORCPT + 99 others); Tue, 8 Jun 2021 15:00:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:49558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236462AbhFHSyP (ORCPT ); Tue, 8 Jun 2021 14:54:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B619761380; Tue, 8 Jun 2021 18:41:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623177672; bh=cwq7Ez0lq08bTQeMoR26Yn+K4gWm8Pk52eGqW6LoxAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EgfMZiwCsqbWSTJLmxpwkkMiwJDd/YGoJ9LSZWCEUbW7/hqbOVEfKX5UeXZYDrJcl vKqb4HfaAJYxsbsT1B5mwd7CosPiCQvTnziUlBDxHw0jPYfAI9QsNb64BXFP0dXG28 ddILInVnhVwDMQFJdDV4DY8eUR7ViOuQlJY+KDBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesper Dangaard Brouer , Magnus Karlsson , Vishakha Jambekar , Tony Nguyen , Sasha Levin Subject: [PATCH 5.10 058/137] ixgbe: add correct exception tracing for XDP Date: Tue, 8 Jun 2021 20:26:38 +0200 Message-Id: <20210608175944.345198093@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175942.377073879@linuxfoundation.org> References: <20210608175942.377073879@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 8281356b1cab1cccc71412eb4cf28b99d6bb2c19 ] 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: 33fdc82f0883 ("ixgbe: add support for XDP_TX action") Fixes: d0bcacd0a130 ("ixgbe: add AF_XDP zero-copy Rx support") Reported-by: Jesper Dangaard Brouer Signed-off-by: Magnus Karlsson Tested-by: Vishakha Jambekar Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 16 ++++++++-------- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 14 ++++++++------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 0b9fddbc5db4..1bfba87f1ff6 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -2218,23 +2218,23 @@ static struct sk_buff *ixgbe_run_xdp(struct ixgbe_adapter *adapter, break; case XDP_TX: xdpf = xdp_convert_buff_to_frame(xdp); - if (unlikely(!xdpf)) { - result = IXGBE_XDP_CONSUMED; - break; - } + if (unlikely(!xdpf)) + goto out_failure; result = ixgbe_xmit_xdp_ring(adapter, xdpf); + if (result == IXGBE_XDP_CONSUMED) + goto out_failure; break; case XDP_REDIRECT: err = xdp_do_redirect(adapter->netdev, xdp, xdp_prog); - if (!err) - result = IXGBE_XDP_REDIR; - else - result = IXGBE_XDP_CONSUMED; + if (err) + goto out_failure; + result = IXGBE_XDP_REDIR; break; default: bpf_warn_invalid_xdp_action(act); fallthrough; case XDP_ABORTED: +out_failure: trace_xdp_exception(rx_ring->netdev, xdp_prog, act); fallthrough; /* handle aborts by dropping packet */ case XDP_DROP: diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c index 91ad5b902673..f72d2978263b 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c @@ -106,9 +106,10 @@ static int ixgbe_run_xdp_zc(struct ixgbe_adapter *adapter, if (likely(act == XDP_REDIRECT)) { err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); - result = !err ? IXGBE_XDP_REDIR : IXGBE_XDP_CONSUMED; + if (err) + goto out_failure; rcu_read_unlock(); - return result; + return IXGBE_XDP_REDIR; } switch (act) { @@ -116,16 +117,17 @@ static int ixgbe_run_xdp_zc(struct ixgbe_adapter *adapter, break; case XDP_TX: xdpf = xdp_convert_buff_to_frame(xdp); - if (unlikely(!xdpf)) { - result = IXGBE_XDP_CONSUMED; - break; - } + if (unlikely(!xdpf)) + goto out_failure; result = ixgbe_xmit_xdp_ring(adapter, xdpf); + if (result == IXGBE_XDP_CONSUMED) + goto out_failure; break; default: bpf_warn_invalid_xdp_action(act); fallthrough; 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