From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>,
netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
Andrew Bowers <andrewx.bowers@intel.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 08/13] ice: Support XDP UMEM wake up mechanism
Date: Wed, 19 Feb 2020 14:06:47 -0800 [thread overview]
Message-ID: <20200219220652.2255171-9-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <20200219220652.2255171-1-jeffrey.t.kirsher@intel.com>
From: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
Add support for a new AF_XDP feature that has already been introduced in
upstreamed Intel NIC drivers. If a user space application signals that
it might sleep using the new bind flag XDP_USE_NEED_WAKEUP, the driver
will then set this flag if it has no more buffers on the NIC Rx ring and
yield to the application. For Tx, it will set the flag if it has no
outstanding Tx completion interrupts and return to the application.
Signed-off-by: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ice/ice_xsk.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
index 55d994f2d71e..3fd31ad73e0e 100644
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@ -937,6 +937,15 @@ int ice_clean_rx_irq_zc(struct ice_ring *rx_ring, int budget)
ice_finalize_xdp_rx(rx_ring, xdp_xmit);
ice_update_rx_ring_stats(rx_ring, total_rx_packets, total_rx_bytes);
+ if (xsk_umem_uses_need_wakeup(rx_ring->xsk_umem)) {
+ if (failure || rx_ring->next_to_clean == rx_ring->next_to_use)
+ xsk_set_rx_need_wakeup(rx_ring->xsk_umem);
+ else
+ xsk_clear_rx_need_wakeup(rx_ring->xsk_umem);
+
+ return (int)total_rx_packets;
+ }
+
return failure ? budget : (int)total_rx_packets;
}
@@ -988,6 +997,8 @@ static bool ice_xmit_zc(struct ice_ring *xdp_ring, int budget)
if (tx_desc) {
ice_xdp_ring_update_tail(xdp_ring);
xsk_umem_consume_tx_done(xdp_ring->xsk_umem);
+ if (xsk_umem_uses_need_wakeup(xdp_ring->xsk_umem))
+ xsk_clear_tx_need_wakeup(xdp_ring->xsk_umem);
}
return budget > 0 && work_done;
@@ -1063,6 +1074,13 @@ bool ice_clean_tx_irq_zc(struct ice_ring *xdp_ring, int budget)
if (xsk_frames)
xsk_umem_complete_tx(xdp_ring->xsk_umem, xsk_frames);
+ if (xsk_umem_uses_need_wakeup(xdp_ring->xsk_umem)) {
+ if (xdp_ring->next_to_clean == xdp_ring->next_to_use)
+ xsk_set_tx_need_wakeup(xdp_ring->xsk_umem);
+ else
+ xsk_clear_tx_need_wakeup(xdp_ring->xsk_umem);
+ }
+
ice_update_tx_ring_stats(xdp_ring, total_packets, total_bytes);
xmit_done = ice_xmit_zc(xdp_ring, ICE_DFLT_IRQ_WORK);
--
2.24.1
next prev parent reply other threads:[~2020-02-19 22:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-19 22:06 [net-next 00/13][pull request] 100GbE Intel Wired LAN Driver Updates 2020-02-19 Jeff Kirsher
2020-02-19 22:06 ` [net-next 01/13] ice: Validate config for SW DCB map Jeff Kirsher
2020-02-19 22:06 ` [net-next 02/13] ice: update malicious driver detection event handling Jeff Kirsher
2020-02-19 22:06 ` [net-next 03/13] ice: Fix for TCAM entry management Jeff Kirsher
2020-02-19 22:06 ` [net-next 04/13] ice: Always clear the QRXFLXP_CNTXT register for VF Rx queues Jeff Kirsher
2020-02-19 22:06 ` [net-next 05/13] ice: Add DCBNL ops required to configure ETS in CEE for SW DCB Jeff Kirsher
2020-02-19 22:06 ` [net-next 06/13] ice: Report correct DCB mode Jeff Kirsher
2020-02-20 9:55 ` Sergei Shtylyov
2020-02-19 22:06 ` [net-next 07/13] ice: SW DCB, report correct max TC value Jeff Kirsher
2020-02-19 22:06 ` Jeff Kirsher [this message]
2020-02-19 22:06 ` [net-next 09/13] ice: increase PF reset wait timeout to 300 milliseconds Jeff Kirsher
2020-02-19 22:06 ` [net-next 10/13] ice: add backslash-n to strings Jeff Kirsher
2020-02-19 22:06 ` [net-next 11/13] ice: add additional E810 device id Jeff Kirsher
2020-02-19 22:06 ` [net-next 12/13] ice: add support for E823 devices Jeff Kirsher
2020-02-19 22:06 ` [net-next 13/13] ice: fix define for E822 backplane device Jeff Kirsher
2020-02-20 23:05 ` [net-next 00/13][pull request] 100GbE Intel Wired LAN Driver Updates 2020-02-19 David Miller
2020-02-21 22:49 ` Jeff Kirsher
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=20200219220652.2255171-9-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=andrewx.bowers@intel.com \
--cc=davem@davemloft.net \
--cc=krzysztof.kazimierczak@intel.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--cc=sassmann@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.