netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Magnus Karlsson <magnus.karlsson@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 v2 13/13] i40e: fix potential RX buffer starvation for AF_XDP
Date: Wed, 11 Sep 2019 09:50:14 -0700	[thread overview]
Message-ID: <20190911165014.10742-14-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <20190911165014.10742-1-jeffrey.t.kirsher@intel.com>

From: Magnus Karlsson <magnus.karlsson@intel.com>

When the RX rings are created they are also populated with buffers
so that packets can be received. Usually these are kernel buffers,
but for AF_XDP in zero-copy mode, these are user-space buffers and
in this case the application might not have sent down any buffers
to the driver at this point. And if no buffers are allocated at ring
creation time, no packets can be received and no interrupts will be
generated so the NAPI poll function that allocates buffers to the
rings will never get executed.

To rectify this, we kick the NAPI context of any queue with an
attached AF_XDP zero-copy socket in two places in the code. Once
after an XDP program has loaded and once after the umem is registered.
This take care of both cases: XDP program gets loaded first then AF_XDP
socket is created, and the reverse, AF_XDP socket is created first,
then XDP program is loaded.

Fixes: 0a714186d3c0 ("i40e: add AF_XDP zero-copy Rx support")
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_xsk.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
index 0373bc6c7e61..feb5bd54d840 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
@@ -157,6 +157,11 @@ static int i40e_xsk_umem_disable(struct i40e_vsi *vsi, u16 qid)
 		err = i40e_queue_pair_enable(vsi, qid);
 		if (err)
 			return err;
+
+		/* Kick start the NAPI context so that receiving will start */
+		err = i40e_xsk_wakeup(vsi->netdev, qid, XDP_WAKEUP_RX);
+		if (err)
+			return err;
 	}
 
 	return 0;
-- 
2.21.0


  parent reply	other threads:[~2019-09-11 16:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-11 16:50 [net-next v2 00/13][pull request] Intel Wired LAN Driver Updates 2019-09-11 Jeff Kirsher
2019-09-11 16:50 ` [net-next v2 01/13] ixgbe: fix memory leaks Jeff Kirsher
2019-09-11 16:50 ` [net-next v2 02/13] i40e: check __I40E_VF_DISABLE bit in i40e_sync_filters_subtask Jeff Kirsher
2019-09-11 16:50 ` [net-next v2 03/13] ixgbe: use skb_get_queue_mapping in tx path Jeff Kirsher
2019-09-11 16:50 ` [net-next v2 04/13] i40e: use ktime_get_real_ts64 instead of ktime_to_timespec64 Jeff Kirsher
2019-09-11 16:50 ` [net-next v2 05/13] i40e: remove I40E_AQC_ADD_CLOUD_FILTER_OIP Jeff Kirsher
2019-09-11 16:50 ` [net-next v2 06/13] i40e: mark additional missing bits as reserved Jeff Kirsher
2019-09-11 16:50 ` [net-next v2 07/13] i40e: fix missed "Negotiated" string in i40e_print_link_message() Jeff Kirsher
2019-09-11 16:50 ` [net-next v2 08/13] i40e: Fix message for other card without FEC Jeff Kirsher
2019-09-11 16:50 ` [net-next v2 09/13] i40e: use BIT macro to specify the cloud filter field flags Jeff Kirsher
2019-09-11 16:50 ` [net-next v2 10/13] i40e: clear __I40E_VIRTCHNL_OP_PENDING on invalid min Tx rate Jeff Kirsher
2019-09-11 16:50 ` [net-next v2 11/13] iavf: fix MAC address setting for VFs when filter is rejected Jeff Kirsher
2019-09-11 16:50 ` [net-next v2 12/13] net/ixgbevf: make array api static const, makes object smaller Jeff Kirsher
2019-09-11 16:50 ` Jeff Kirsher [this message]
2019-09-13 13:48 ` [net-next v2 00/13][pull request] Intel Wired LAN Driver Updates 2019-09-11 David Miller

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=20190911165014.10742-14-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=andrewx.bowers@intel.com \
    --cc=davem@davemloft.net \
    --cc=magnus.karlsson@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 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).