Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4850031pxj; Wed, 9 Jun 2021 03:30:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfhJYKOriVyd1Tri6xklKneWDoZTh8OB/W6oUQOtCJXF01+pUniQY3gBGx+WW0ibsZrlkU X-Received: by 2002:a17:906:a1d2:: with SMTP id bx18mr27600977ejb.423.1623234613549; Wed, 09 Jun 2021 03:30:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623234613; cv=none; d=google.com; s=arc-20160816; b=DnsHarhb7qGr+Eeo99da+Go4vGptNs40KqySc/6G+YOgoFtNgov9eN4MgR7/YCmptO xfXPkCiz8bbVnmAeTtfwOKkvVfZh80WCPPDRSj2ZFqPZnYlhyU6s+F8FiH/U0P1wpT4d dxCLNVq1KiSrk5CD1fg/imW4mUXEN+F1pz/Bs0xxN8grw9tYwXepZhvEYZUpCu+s7x05 019HnfJv0c/BVMEXKG6C15n8N/bZqqCon0Nnc3V5AvUIbyKsxvsSt0ACwbCp/34srtcz nOXN8NVMNV5vFh4+ezQbcDBRGnA3uA+4RkofH2KLZNq3Jjds4d5UAPPvm48wBtlxoMYE mBrQ== 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=9xFDnc8wRl8kf+zRcZ7Bqbb9xT470JDVPaGMQQbG9EU=; b=IA4FCMQN1GSABz+ttIySwTMaGkwaHS1ZaEoeGcArI9uY9BUbOs7FVULjOCkKXap71v cDdf1mIPo45PlrbK9rXWD1Mrmzua8PN2dMzMpZVi6tILOW+N4jD8CLAqgdRoJvIUoK4Z UIQ8MebzrrzBAIiLc5f5CJZjw6UqKNWnheiogndKvFfFDAGxSPOBmE0hVVGbtxzRpJUo TF2jJ0R0VfB94ZVop6FUZKAoSg8+otVhp2dzpoJrvmQb87oexur3waHSxzJjgGvnwUkj 4BsmSevzYDQM7yOXLfEYkegkor57HcKCYqYQGW3KsvdrtO+lulr8mReVgFodPiE88AVT rApg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NTl7WbFA; 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 3si2210151ejx.158.2021.06.09.03.29.49; Wed, 09 Jun 2021 03:30:13 -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=NTl7WbFA; 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 S237426AbhFHTAh (ORCPT + 99 others); Tue, 8 Jun 2021 15:00:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:49530 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236442AbhFHSyN (ORCPT ); Tue, 8 Jun 2021 14:54:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 355B5613B9; Tue, 8 Jun 2021 18:41:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623177666; bh=exxU2QBT0BIKzp7zsd9zIcFFVDZZN+mQA4L5TKN5tz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NTl7WbFAdt6hZfdi0GZngNQl52XvHch/5cyuLpX/aSR1F26lTcrpr2fqb8tHs2BeS rNShSa7As4jPi4CnYE6htNUS1gA6Ns8v2lWJQOojEoMJ+iKjS8sqwQp3+Bme6IsD3Y o15eyw16QSJQnOqT5uqNNRrJj3o+IOReq9okqEvc= 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.10 056/137] ice: add correct exception tracing for XDP Date: Tue, 8 Jun 2021 20:26:36 +0200 Message-Id: <20210608175944.282684697@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 89d65df024c59988291f643b4e45d1528c51aef9 ] 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: efc2214b6047 ("ice: Add support for XDP") Fixes: 2d4238f55697 ("ice: Add support for AF_XDP") 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/ice/ice_txrx.c | 12 +++++++++--- drivers/net/ethernet/intel/ice/ice_xsk.c | 8 ++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c index 5cc2854a5d48..442a9bcbf60a 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c @@ -538,7 +538,7 @@ ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp, struct bpf_prog *xdp_prog) { struct ice_ring *xdp_ring; - int err; + int err, result; u32 act; act = bpf_prog_run_xdp(xdp_prog, xdp); @@ -547,14 +547,20 @@ ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp, return ICE_XDP_PASS; case XDP_TX: xdp_ring = rx_ring->vsi->xdp_rings[smp_processor_id()]; - return ice_xmit_xdp_buff(xdp, xdp_ring); + result = ice_xmit_xdp_buff(xdp, xdp_ring); + if (result == ICE_XDP_CONSUMED) + goto out_failure; + return result; case XDP_REDIRECT: err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); - return !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED; + if (err) + goto out_failure; + return ICE_XDP_REDIR; default: bpf_warn_invalid_xdp_action(act); fallthrough; case XDP_ABORTED: +out_failure: trace_xdp_exception(rx_ring->netdev, xdp_prog, act); fallthrough; case XDP_DROP: diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c index 952148eede30..9f36f8d7a985 100644 --- a/drivers/net/ethernet/intel/ice/ice_xsk.c +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c @@ -527,9 +527,10 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp) if (likely(act == XDP_REDIRECT)) { err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); - result = !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED; + if (err) + goto out_failure; rcu_read_unlock(); - return result; + return ICE_XDP_REDIR; } switch (act) { @@ -538,11 +539,14 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp) case XDP_TX: xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->q_index]; result = ice_xmit_xdp_buff(xdp, xdp_ring); + if (result == ICE_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; case XDP_DROP: -- 2.30.2