From: Magnus Karlsson <magnus.karlsson@gmail.com>
To: magnus.karlsson@intel.com, intel-wired-lan@lists.osuosl.org,
anthony.l.nguyen@intel.com, maciej.fijalkowski@intel.com
Cc: netdev@vger.kernel.org, brouer@redhat.com
Subject: [PATCH intel-net v2 2/6] ice: add correct exception tracing for XDP
Date: Mon, 10 May 2021 11:38:50 +0200 [thread overview]
Message-ID: <20210510093854.31652-3-magnus.karlsson@gmail.com> (raw)
In-Reply-To: <20210510093854.31652-1-magnus.karlsson@gmail.com>
From: Magnus Karlsson <magnus.karlsson@intel.com>
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 <brouer@redhat.com>
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
---
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 e2b4b29ea207..93e5d9ebfd74 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx.c
+++ b/drivers/net/ethernet/intel/ice/ice_txrx.c
@@ -523,7 +523,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);
@@ -532,14 +532,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 faa7b8d96adb..7228e4d427bc 100644
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@ -473,9 +473,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) {
@@ -484,11 +485,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.29.0
next prev parent reply other threads:[~2021-05-10 9:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-10 9:38 [PATCH intel-net v2 0/6] i40e: ice: ixgbe: ixgbevf: igb: igc: add correct exception tracing for XDP Magnus Karlsson
2021-05-10 9:38 ` [PATCH intel-net v2 1/6] i40e: " Magnus Karlsson
2021-05-19 16:12 ` [Intel-wired-lan] " Bhandare, KiranX
2021-05-10 9:38 ` Magnus Karlsson [this message]
2021-05-19 16:14 ` [Intel-wired-lan] [PATCH intel-net v2 2/6] ice: " Bhandare, KiranX
2021-05-10 9:38 ` [PATCH intel-net v2 3/6] ixgbe: " Magnus Karlsson
2021-05-28 4:16 ` [Intel-wired-lan] " Jambekar, Vishakha
2021-05-10 9:38 ` [PATCH intel-net v2 4/6] igb: " Magnus Karlsson
2021-05-21 11:44 ` [Intel-wired-lan] " Jambekar, Vishakha
2021-05-10 9:38 ` [PATCH intel-net v2 5/6] ixgbevf: " Magnus Karlsson
2021-05-21 11:42 ` [Intel-wired-lan] " Jambekar, Vishakha
2021-05-10 9:38 ` [PATCH intel-net v2 6/6] igc: " Magnus Karlsson
2021-05-24 10:05 ` [Intel-wired-lan] " Dvora Fuxbrumer
2021-05-24 10:08 ` Dvora Fuxbrumer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210510093854.31652-3-magnus.karlsson@gmail.com \
--to=magnus.karlsson@gmail.com \
--cc=anthony.l.nguyen@intel.com \
--cc=brouer@redhat.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).