DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kaijun Zeng <corezeng@gmail.com>
To: dev@dpdk.org
Cc: Ferruh Yigit <ferruh.yigit@amd.com>,
	Kaijun Zeng <corezeng@gmail.com>,
	stable@dpdk.org, Jochen Behrens <jbehrens@vmware.com>,
	Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH v3] net/vmxnet3: fix return code in initializing
Date: Wed,  7 Jun 2023 13:57:25 -0400	[thread overview]
Message-ID: <20230607175725.17488-1-corezeng@gmail.com> (raw)
In-Reply-To: <20230602164438.45939-1-corezeng@gmail.com>

Improve error handling

Bugzilla ID: 1239
Fixes: dfaff37fc46d ("vmxnet3: import new vmxnet3 poll mode driver implementation")
Cc: stable@dpdk.org

Signed-off-by: Kaijun Zeng <corezeng@gmail.com>
---
v3:
* Improve coding style

v2:
* Improve error handling
---
 drivers/net/vmxnet3/vmxnet3_rxtx.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index a875ffec07..e6e36dca93 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -1311,11 +1311,18 @@ vmxnet3_dev_rxtx_init(struct rte_eth_dev *dev)
 		for (j = 0; j < VMXNET3_RX_CMDRING_SIZE; j++) {
 			/* Passing 0 as alloc_num will allocate full ring */
 			ret = vmxnet3_post_rx_bufs(rxq, j);
-			if (ret <= 0) {
+
+			/* Zero number of descriptors in the configuration of the RX queue */
+			if (ret == 0) {
 				PMD_INIT_LOG(ERR,
-					     "ERROR: Posting Rxq: %d buffers ring: %d",
-					     i, j);
-				return -ret;
+					"Invalid configuration in Rx queue: %d, buffers ring: %d\n",
+					i, j);
+				return -EINVAL;
+			}
+			/* Return the error number */
+			if (ret < 0) {
+				PMD_INIT_LOG(ERR, "Posting Rxq: %d buffers ring: %d", i, j);
+				return ret;
 			}
 			/*
 			 * Updating device with the index:next2fill to fill the
-- 
2.30.2


  parent reply	other threads:[~2023-06-07 20:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-28 14:37 [PATCH] drivers: fix vmxnet3 return wrong error " root
2023-06-01 15:12 ` Ferruh Yigit
2023-06-02 16:44 ` [PATCH v2] net/vmxnet3: fix return " Kaijun Zeng
2023-06-06  9:08   ` Ferruh Yigit
2023-06-06 15:36   ` Stephen Hemminger
2023-06-07 15:49     ` Ferruh Yigit
2023-06-07 17:57   ` Kaijun Zeng [this message]
2023-06-09 18:08     ` [PATCH v3] " Ferruh Yigit
2023-06-07 16:54 ` [PATCH] " Kaijun Zeng

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=20230607175725.17488-1-corezeng@gmail.com \
    --to=corezeng@gmail.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=jbehrens@vmware.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).