From: Magnus Karlsson <magnus.karlsson@gmail.com>
To: magnus.karlsson@intel.com, bjorn.topel@intel.com,
intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com
Cc: netdev@vger.kernel.org, maciej.fijalkowski@intel.com,
maciejromanfijalkowski@gmail.com
Subject: [PATCH net-next 3/3] ice: optimize for XDP_REDIRECT in xsk path
Date: Wed, 2 Dec 2020 16:07:24 +0100 [thread overview]
Message-ID: <20201202150724.31439-4-magnus.karlsson@gmail.com> (raw)
In-Reply-To: <20201202150724.31439-1-magnus.karlsson@gmail.com>
From: Magnus Karlsson <magnus.karlsson@intel.com>
Optimize ice_run_xdp_zc() for the XDP program verdict being
XDP_REDIRECT in the zsk zero-copy path. This path is only used when
having AF_XDP zero-copy on and in that case most packets will be
directed to user space. This provides a little over 100k extra packets
in throughput on my server when running l2fwd in xdpsock.
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
---
drivers/net/ethernet/intel/ice/ice_xsk.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
index 797886524054..3b180e52112f 100644
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@ -521,6 +521,14 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp)
}
act = bpf_prog_run_xdp(xdp_prog, xdp);
+
+ if (likely(act == XDP_REDIRECT)) {
+ err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
+ result = !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED;
+ rcu_read_unlock();
+ return result;
+ }
+
switch (act) {
case XDP_PASS:
break;
@@ -528,10 +536,6 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp)
xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->q_index];
result = ice_xmit_xdp_buff(xdp, xdp_ring);
break;
- case XDP_REDIRECT:
- err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
- result = !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED;
- break;
default:
bpf_warn_invalid_xdp_action(act);
fallthrough;
--
2.29.0
next prev parent reply other threads:[~2020-12-02 15:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-02 15:07 [PATCH net-next 0/3] i40e, ice, ixgbe: optimize for XDP_REDIRECT in xsk path Magnus Karlsson
2020-12-02 15:07 ` [PATCH net-next 1/3] i40: " Magnus Karlsson
2021-02-05 16:08 ` [Intel-wired-lan] " Kuruvinakunnel, George
2020-12-02 15:07 ` [PATCH net-next 2/3] ixgbe: " Magnus Karlsson
2021-03-10 4:19 ` [Intel-wired-lan] " Jambekar, Vishakha
2020-12-02 15:07 ` Magnus Karlsson [this message]
2021-02-05 16:09 ` [Intel-wired-lan] [PATCH net-next 3/3] ice: " Kuruvinakunnel, George
2020-12-02 20:40 ` [PATCH net-next 0/3] i40e, ice, ixgbe: " Maciej Fijalkowski
2020-12-03 6:58 ` Magnus Karlsson
2020-12-03 17:21 ` Nguyen, Anthony L
-- strict thread matches above, loose matches on Subject: below --
2021-03-16 16:42 [PATCH net-next 0/3][pull request] 40GbE Intel Wired LAN Driver Updates 2021-03-16 Tony Nguyen
2021-03-16 16:42 ` [PATCH net-next 3/3] ice: optimize for XDP_REDIRECT in xsk path Tony Nguyen
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=20201202150724.31439-4-magnus.karlsson@gmail.com \
--to=magnus.karlsson@gmail.com \
--cc=anthony.l.nguyen@intel.com \
--cc=bjorn.topel@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=maciej.fijalkowski@intel.com \
--cc=maciejromanfijalkowski@gmail.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).