DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kiran Kumar <kkokkilagadda@caviumnetworks.com>
To: jerin.jacob@caviumnetworks.com, maciej.czekaj@caviumnetworks.com,
	ferruh.yigit@intel.com
Cc: dev@dpdk.org, Kiran Kumar <kkokkilagadda@caviumnetworks.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2] net/thunderx: avoid sq door bell writes on zero packets
Date: Wed, 11 Jul 2018 13:54:36 +0530	[thread overview]
Message-ID: <1531297476-4604-1-git-send-email-kkokkilagadda@caviumnetworks.com> (raw)
In-Reply-To: <1531293723-930-1-git-send-email-kkokkilagadda@caviumnetworks.com>

Avoid sq door bell write on zero packet case to reduce additional
traffic on register bus.

Fixes: 1c421f18e0 ("net/thunderx: add single and multi-segment Tx")
Cc: stable@dpdk.org

Signed-off-by: Kiran Kumar <kkokkilagadda@caviumnetworks.com>
---
 v2 Changes:
 - changed summery and description.
 - added same optimization to nicvf_xmit_pkts_multiseg

 drivers/net/thunderx/nicvf_rxtx.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/net/thunderx/nicvf_rxtx.c b/drivers/net/thunderx/nicvf_rxtx.c
index 72305d9..6e075e2 100644
--- a/drivers/net/thunderx/nicvf_rxtx.c
+++ b/drivers/net/thunderx/nicvf_rxtx.c
@@ -162,12 +162,14 @@ nicvf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		free_desc -= TX_DESC_PER_PKT;
 	}

-	sq->tail = tail;
-	sq->xmit_bufs += i;
-	rte_wmb();
+	if (likely(i)) {
+		sq->tail = tail;
+		sq->xmit_bufs += i;
+		rte_wmb();

-	/* Inform HW to xmit the packets */
-	nicvf_addr_write(sq->sq_door, i * TX_DESC_PER_PKT);
+		/* Inform HW to xmit the packets */
+		nicvf_addr_write(sq->sq_door, i * TX_DESC_PER_PKT);
+	}
 	return i;
 }

@@ -218,12 +220,14 @@ nicvf_xmit_pkts_multiseg(void *tx_queue, struct rte_mbuf **tx_pkts,
 		}
 	}

-	sq->tail = tail;
-	sq->xmit_bufs += used_bufs;
-	rte_wmb();
+	if (likely(used_desc)) {
+		sq->tail = tail;
+		sq->xmit_bufs += used_bufs;
+		rte_wmb();

-	/* Inform HW to xmit the packets */
-	nicvf_addr_write(sq->sq_door, used_desc);
+		/* Inform HW to xmit the packets */
+		nicvf_addr_write(sq->sq_door, used_desc);
+	}
 	return i;
 }

--
2.7.4

  parent reply	other threads:[~2018-07-11  8:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-11  7:22 [dpdk-dev] [PATCH] net/thunderx: Block sq door writes on zero pkts Kiran Kumar
2018-07-11  7:37 ` Jerin Jacob
2018-07-11  8:24 ` Kiran Kumar [this message]
2018-07-11  9:05   ` [dpdk-dev] [PATCH v2] net/thunderx: avoid sq door bell writes on zero packets Jerin Jacob
2018-07-18  9:41     ` 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=1531297476-4604-1-git-send-email-kkokkilagadda@caviumnetworks.com \
    --to=kkokkilagadda@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=maciej.czekaj@caviumnetworks.com \
    --cc=stable@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).