From: Magnus Karlsson <magnus.karlsson@intel.com> To: magnus.karlsson@intel.com, bjorn.topel@intel.com, ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org, brouer@redhat.com Cc: bpf@vger.kernel.org, bruce.richardson@intel.com, ciara.loftus@intel.com, jakub.kicinski@netronome.com, xiaolong.ye@intel.com, qi.z.zhang@intel.com, maximmi@mellanox.com, sridhar.samudrala@intel.com, kevin.laatz@intel.com, ilias.apalodimas@linaro.org, kiran.patil@intel.com, axboe@kernel.dk, maciej.fijalkowski@intel.com, maciejromanfijalkowski@gmail.com, intel-wired-lan@lists.osuosl.org Subject: [PATCH bpf-next 3/6] i40e: add support for AF_XDP need_wakup feature Date: Thu, 13 Jun 2019 09:37:27 +0200 [thread overview] Message-ID: <1560411450-29121-4-git-send-email-magnus.karlsson@intel.com> (raw) In-Reply-To: <1560411450-29121-1-git-send-email-magnus.karlsson@intel.com> This patch adds support for the need_wakeup feature of AF_XDP. If the application has told the kernel 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: Magnus Karlsson <magnus.karlsson@intel.com> --- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c index 32be3dd..1863974 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c @@ -625,6 +625,15 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget) i40e_finalize_xdp_rx(rx_ring, xdp_xmit); i40e_update_rx_stats(rx_ring, total_rx_bytes, total_rx_packets); + + if (xsk_umem_uses_might_sleep(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; } @@ -758,6 +767,13 @@ bool i40e_clean_xdp_tx_irq(struct i40e_vsi *vsi, out_xmit: xmit_done = i40e_xmit_zc(tx_ring, budget); + if (xsk_umem_uses_might_sleep(tx_ring->xsk_umem)) { + if (tx_ring->next_to_clean == tx_ring->next_to_use) + xsk_set_tx_need_wakeup(tx_ring->xsk_umem); + else + xsk_clear_tx_need_wakeup(tx_ring->xsk_umem); + } + return work_done && xmit_done; } -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: Magnus Karlsson <magnus.karlsson@intel.com> To: intel-wired-lan@osuosl.org Subject: [Intel-wired-lan] [PATCH bpf-next 3/6] i40e: add support for AF_XDP need_wakup feature Date: Thu, 13 Jun 2019 09:37:27 +0200 [thread overview] Message-ID: <1560411450-29121-4-git-send-email-magnus.karlsson@intel.com> (raw) In-Reply-To: <1560411450-29121-1-git-send-email-magnus.karlsson@intel.com> This patch adds support for the need_wakeup feature of AF_XDP. If the application has told the kernel 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: Magnus Karlsson <magnus.karlsson@intel.com> --- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c index 32be3dd..1863974 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c @@ -625,6 +625,15 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget) i40e_finalize_xdp_rx(rx_ring, xdp_xmit); i40e_update_rx_stats(rx_ring, total_rx_bytes, total_rx_packets); + + if (xsk_umem_uses_might_sleep(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; } @@ -758,6 +767,13 @@ bool i40e_clean_xdp_tx_irq(struct i40e_vsi *vsi, out_xmit: xmit_done = i40e_xmit_zc(tx_ring, budget); + if (xsk_umem_uses_might_sleep(tx_ring->xsk_umem)) { + if (tx_ring->next_to_clean == tx_ring->next_to_use) + xsk_set_tx_need_wakeup(tx_ring->xsk_umem); + else + xsk_clear_tx_need_wakeup(tx_ring->xsk_umem); + } + return work_done && xmit_done; } -- 2.7.4
next prev parent reply other threads:[~2019-06-13 16:36 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-13 7:37 [PATCH bpf-next 0/6] add need_wakeup flag to the AF_XDP rings Magnus Karlsson 2019-06-13 7:37 ` [Intel-wired-lan] " Magnus Karlsson 2019-06-13 7:37 ` [PATCH bpf-next 1/6] xsk: replace ndo_xsk_async_xmit with ndo_xsk_wakeup Magnus Karlsson 2019-06-13 7:37 ` [Intel-wired-lan] " Magnus Karlsson 2019-06-13 7:37 ` [PATCH bpf-next 2/6] xsk: add support for need_wakeup flag in AF_XDP rings Magnus Karlsson 2019-06-13 7:37 ` [Intel-wired-lan] " Magnus Karlsson 2019-06-13 19:04 ` Jakub Kicinski 2019-06-13 19:04 ` [Intel-wired-lan] " Jakub Kicinski 2019-06-13 19:07 ` Magnus Karlsson 2019-06-13 19:07 ` [Intel-wired-lan] " Magnus Karlsson 2019-06-13 7:37 ` Magnus Karlsson [this message] 2019-06-13 7:37 ` [Intel-wired-lan] [PATCH bpf-next 3/6] i40e: add support for AF_XDP need_wakup feature Magnus Karlsson 2019-06-13 7:37 ` [PATCH bpf-next 4/6] ixgbe: " Magnus Karlsson 2019-06-13 7:37 ` [Intel-wired-lan] " Magnus Karlsson 2019-06-13 7:37 ` [PATCH bpf-next 5/6] libbpf: add support for need_wakeup flag in AF_XDP part Magnus Karlsson 2019-06-13 7:37 ` [Intel-wired-lan] " Magnus Karlsson 2019-06-13 7:37 ` [PATCH bpf-next 6/6] samples/bpf: add use of need_sleep flag in xdpsock Magnus Karlsson 2019-06-13 7:37 ` [Intel-wired-lan] " Magnus Karlsson 2019-06-13 23:34 ` [Intel-wired-lan] [PATCH bpf-next 0/6] add need_wakeup flag to the AF_XDP rings Jeff Kirsher 2019-06-13 23:34 ` Jeff Kirsher 2019-06-14 13:38 ` Maxim Mikityanskiy 2019-06-14 13:38 ` [Intel-wired-lan] " Maxim Mikityanskiy 2019-06-14 14:17 ` Maciej Fijalkowski 2019-06-14 14:17 ` [Intel-wired-lan] " Maciej Fijalkowski 2019-06-15 19:13 ` Magnus Karlsson 2019-06-15 19:13 ` [Intel-wired-lan] " Magnus Karlsson
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=1560411450-29121-4-git-send-email-magnus.karlsson@intel.com \ --to=magnus.karlsson@intel.com \ --cc=ast@kernel.org \ --cc=axboe@kernel.dk \ --cc=bjorn.topel@intel.com \ --cc=bpf@vger.kernel.org \ --cc=brouer@redhat.com \ --cc=bruce.richardson@intel.com \ --cc=ciara.loftus@intel.com \ --cc=daniel@iogearbox.net \ --cc=ilias.apalodimas@linaro.org \ --cc=intel-wired-lan@lists.osuosl.org \ --cc=jakub.kicinski@netronome.com \ --cc=kevin.laatz@intel.com \ --cc=kiran.patil@intel.com \ --cc=maciej.fijalkowski@intel.com \ --cc=maciejromanfijalkowski@gmail.com \ --cc=maximmi@mellanox.com \ --cc=netdev@vger.kernel.org \ --cc=qi.z.zhang@intel.com \ --cc=sridhar.samudrala@intel.com \ --cc=xiaolong.ye@intel.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: linkBe 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.