DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH 4/7] net/netvsc: check the vmbus ring buffer more often
Date: Thu, 30 Apr 2020 12:08:50 -0700	[thread overview]
Message-ID: <20200430190853.498-5-stephen@networkplumber.org> (raw)
In-Reply-To: <20200430190853.498-1-stephen@networkplumber.org>

Since VF notfications are handled as VMBUS notifications on the
primary channel (and not as hotplug). The channel should be checked
before deciding to use VF for Rx or Tx.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/netvsc/hn_rxtx.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 19f00a05285f..773ba31fcc64 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -1372,25 +1372,29 @@ hn_xmit_pkts(void *ptxq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	struct hn_data *hv = txq->hv;
 	struct rte_eth_dev *vf_dev;
 	bool need_sig = false;
-	uint16_t nb_tx, avail;
+	uint16_t nb_tx, tx_thresh;
 	int ret;
 
 	if (unlikely(hv->closed))
 		return 0;
 
+	/*
+	 * Always check for events on the primary channel
+	 * because that is where hotplug notifications occur.
+	 */
+	tx_thresh = RTE_MAX(txq->free_thresh, nb_pkts);
+	if (txq->queue_id == 0 ||
+	    rte_mempool_avail_count(txq->txdesc_pool) < tx_thresh)
+		hn_process_events(hv, txq->queue_id, 0);
+
 	/* Transmit over VF if present and up */
 	vf_dev = hn_get_vf_dev(hv);
-
 	if (vf_dev && vf_dev->data->dev_started) {
 		void *sub_q = vf_dev->data->tx_queues[queue_id];
 
 		return (*vf_dev->tx_pkt_burst)(sub_q, tx_pkts, nb_pkts);
 	}
 
-	avail = rte_mempool_avail_count(txq->txdesc_pool);
-	if (nb_pkts > avail || avail <= txq->free_thresh)
-		hn_process_events(hv, txq->queue_id, 0);
-
 	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
 		struct rte_mbuf *m = tx_pkts[nb_tx];
 		uint32_t pkt_size = m->pkt_len + HN_RNDIS_PKT_LEN;
@@ -1487,10 +1491,7 @@ hn_recv_pkts(void *prxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 	if (unlikely(hv->closed))
 		return 0;
 
-	/* Receive from VF if present and up */
-	vf_dev = hn_get_vf_dev(hv);
-
-	/* Check for new completions */
+	/* Check for new completions (and hotplug) */
 	if (likely(rte_ring_count(rxq->rx_ring) < nb_pkts))
 		hn_process_events(hv, rxq->queue_id, 0);
 
@@ -1499,6 +1500,7 @@ hn_recv_pkts(void *prxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 					   (void **)rx_pkts, nb_pkts, NULL);
 
 	/* If VF is available, check that as well */
+	vf_dev = hn_get_vf_dev(hv);
 	if (vf_dev && vf_dev->data->dev_started)
 		nb_rcv += hn_recv_vf(vf_dev->data->port_id, rxq,
 				     rx_pkts + nb_rcv, nb_pkts - nb_rcv);
-- 
2.20.1


  parent reply	other threads:[~2020-04-30 19:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 19:08 [dpdk-dev] [PATCH 0/7] net/netvsc: more minor fixes Stephen Hemminger
2020-04-30 19:08 ` [dpdk-dev] [PATCH 1/7] net/netvsc: fix comment spelling errors Stephen Hemminger
2020-04-30 19:08 ` [dpdk-dev] [PATCH 2/7] bus/vmbus: " Stephen Hemminger
2020-04-30 19:08 ` [dpdk-dev] [PATCH 3/7] net/vmbus: add missing barrier Stephen Hemminger
2020-04-30 19:08 ` Stephen Hemminger [this message]
2020-04-30 19:08 ` [dpdk-dev] [PATCH 5/7] net/netvsc: manage VF port under rwlock Stephen Hemminger
2020-04-30 19:08 ` [dpdk-dev] [PATCH 6/7] net/netvsc: do RSS across rx queue only Stephen Hemminger
2020-04-30 19:08 ` [dpdk-dev] [PATCH 7/7] net/netvsc: don't configure RSS if disabled Stephen Hemminger
2020-05-05 18:14 ` [dpdk-dev] [PATCH 0/7] net/netvsc: more minor fixes Ferruh Yigit

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=20200430190853.498-5-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.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).