DPDK patches and discussions
 help / color / mirror / Atom feed
From: Radu Nicolau <radu.nicolau@intel.com>
To: dev@dpdk.org
Cc: marko.kovacevic@intel.com, john.mcnamara@intel.com,
	declan.doherty@intel.com, ferruh.yigit@intel.com,
	Radu Nicolau <radu.nicolau@intel.com>
Subject: [dpdk-dev] [PATCH] net/bonding: check dequeue result before proceeding
Date: Mon, 22 Jan 2018 16:43:56 +0000	[thread overview]
Message-ID: <1516639436-15040-1-git-send-email-radu.nicolau@intel.com> (raw)

Fixes Coverity issue 257015

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 158f3aa..cc06ff4 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1435,17 +1435,17 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
 		if (likely(rte_ring_empty(port->tx_ring)))
 			continue;
 
-		rte_ring_dequeue(port->tx_ring,	(void **)&ctrl_pkt);
-
-		slave_tx_count = rte_eth_tx_burst(slave_port_ids[i],
+		if (rte_ring_dequeue(port->tx_ring,
+				     (void **)&ctrl_pkt) != -ENOENT) {
+			slave_tx_count = rte_eth_tx_burst(slave_port_ids[i],
 					bd_tx_q->queue_id, &ctrl_pkt, 1);
-
-		/*
-		 * re-enqueue LAG control plane packets to buffering
-		 * ring if transmission fails so the packet isn't lost.
-		 */
-		if (slave_tx_count != 1)
-			rte_ring_enqueue(port->tx_ring,	ctrl_pkt);
+			/*
+			 * re-enqueue LAG control plane packets to buffering
+			 * ring if transmission fails so the packet isn't lost.
+			 */
+			if (slave_tx_count != 1)
+				rte_ring_enqueue(port->tx_ring,	ctrl_pkt);
+		}
 	}
 
 	return total_tx_count;
-- 
2.7.5

             reply	other threads:[~2018-01-22 16:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-22 16:43 Radu Nicolau [this message]
2018-01-23 17:43 ` Mcnamara, John
2018-01-24 13:11 ` [dpdk-dev] [PATCH v2] " Radu Nicolau
2018-01-25 14:21   ` 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=1516639436-15040-1-git-send-email-radu.nicolau@intel.com \
    --to=radu.nicolau@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=marko.kovacevic@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: 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).