DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jakub Palider <jpa@semihalf.com>
To: dev@dpdk.org
Cc: evgenys@amazon.com, matua@amazon.com,
	Tal Avraham <talavr@annapurnalabs.com>,
	netanel@amazon.com
Subject: [dpdk-dev] [PATCH 2/2] net/ena: check for free buffers prior to xmit
Date: Sat, 29 Oct 2016 03:06:15 +0200	[thread overview]
Message-ID: <1477703175-21344-3-git-send-email-jpa@semihalf.com> (raw)
In-Reply-To: <1477703175-21344-1-git-send-email-jpa@semihalf.com>

Signed-off-by: Tal Avraham <talavr@annapurnalabs.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
---
 drivers/net/ena/ena_ethdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index adf94f2..ab9a178 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1583,7 +1583,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	struct ena_tx_buffer *tx_info;
 	struct ena_com_buf *ebuf;
 	uint16_t rc, req_id, total_tx_descs = 0;
-	uint16_t sent_idx = 0;
+	uint16_t sent_idx = 0, empty_tx_reqs;
 	int nb_hw_desc;
 
 	/* Check adapter state */
@@ -1593,6 +1593,10 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		return 0;
 	}
 
+	empty_tx_reqs = ring_size - (next_to_use - next_to_clean);
+	if (nb_pkts > empty_tx_reqs)
+		nb_pkts = empty_tx_reqs;
+
 	for (sent_idx = 0; sent_idx < nb_pkts; sent_idx++) {
 		mbuf = tx_pkts[sent_idx];
 
-- 
2.5.0

  parent reply	other threads:[~2016-10-29  1:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-29  1:06 [dpdk-dev] [PATCH 0/2] net/ena: check for free descriptors Jakub Palider
2016-10-29  1:06 ` [dpdk-dev] [PATCH 1/2] net/ena: use unmasked head/tail values Jakub Palider
2016-10-29  1:06 ` Jakub Palider [this message]
2016-11-07 16:58 ` [dpdk-dev] [PATCH 0/2] net/ena: check for free descriptors Thomas Monjalon

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=1477703175-21344-3-git-send-email-jpa@semihalf.com \
    --to=jpa@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=evgenys@amazon.com \
    --cc=matua@amazon.com \
    --cc=netanel@amazon.com \
    --cc=talavr@annapurnalabs.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).