DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yong Wang <yongwang@vmware.com>
To: <stephen@networkplumber.org>
Cc: <dev@dpdk.org>, <sothy.e98@gmail.com>, <gyang@vmware.com>,
	<diproiettod@vmware.com>, Yong Wang <yongwang@vmware.com>
Subject: [dpdk-dev] [PATCH 1/4] net/vmxnet3: improve error checks and return values
Date: Fri, 12 Aug 2016 17:58:26 -0700	[thread overview]
Message-ID: <1471049909-18117-2-git-send-email-yongwang@vmware.com> (raw)
In-Reply-To: <1471049909-18117-1-git-send-email-yongwang@vmware.com>

Signed-off-by: Yong Wang <yongwang@vmware.com>
---
 drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 5874215..f5035bb 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -360,9 +360,16 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	if (dev->data->nb_rx_queues > UINT8_MAX ||
-	    dev->data->nb_tx_queues > UINT8_MAX)
+	if (dev->data->nb_rx_queues > VMXNET3_MAX_TX_QUEUES ||
+	    dev->data->nb_tx_queues > VMXNET3_MAX_RX_QUEUES) {
+		PMD_INIT_LOG(ERR, "ERROR: Number of queues not supported");
 		return -EINVAL;
+	}
+
+	if (!rte_is_power_of_2(dev->data->nb_rx_queues)) {
+		PMD_INIT_LOG(ERR, "ERROR: Number of rx queues not power of 2");
+		return -EINVAL;
+	}
 
 	size = dev->data->nb_rx_queues * sizeof(struct Vmxnet3_TxQueueDesc) +
 		dev->data->nb_tx_queues * sizeof(struct Vmxnet3_RxQueueDesc);
@@ -550,7 +557,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
 static int
 vmxnet3_dev_start(struct rte_eth_dev *dev)
 {
-	int status, ret;
+	int ret;
 	struct vmxnet3_hw *hw = dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
@@ -567,11 +574,11 @@ vmxnet3_dev_start(struct rte_eth_dev *dev)
 
 	/* Activate device by register write */
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_ACTIVATE_DEV);
-	status = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_CMD);
+	ret = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_CMD);
 
-	if (status != 0) {
+	if (ret != 0) {
 		PMD_INIT_LOG(ERR, "Device activation: UNSUCCESSFUL");
-		return -1;
+		return -EINVAL;
 	}
 
 	/* Disable interrupts */
@@ -583,7 +590,7 @@ vmxnet3_dev_start(struct rte_eth_dev *dev)
 	 */
 	ret = vmxnet3_dev_rxtx_init(dev);
 	if (ret != VMXNET3_SUCCESS) {
-		PMD_INIT_LOG(ERR, "Device receive init: UNSUCCESSFUL");
+		PMD_INIT_LOG(ERR, "Device queue init: UNSUCCESSFUL");
 		return ret;
 	}
 
@@ -598,7 +605,7 @@ vmxnet3_dev_start(struct rte_eth_dev *dev)
 	PMD_INIT_LOG(DEBUG, "Reading events: 0x%X", events);
 	vmxnet3_process_events(hw);
 #endif
-	return status;
+	return VMXNET3_SUCCESS;
 }
 
 /*
-- 
1.9.1

  reply	other threads:[~2016-08-13  1:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-13  0:58 [dpdk-dev] [PATCH 0/4] various vmxnet3 fixes and enhancement Yong Wang
2016-08-13  0:58 ` Yong Wang [this message]
2016-08-13  0:58 ` [dpdk-dev] [PATCH 2/4] net/vmxnet3: coding style changes Yong Wang
2016-08-13  0:58 ` [dpdk-dev] [PATCH 3/4] net/vmxnet3: reallocate shared memzone on re-config Yong Wang
2016-08-13  0:58 ` [dpdk-dev] [PATCH 4/4] net/vmxnet3: enable lro Yong Wang
2016-08-22 11:21   ` Thomas Monjalon
2016-08-24  0:05   ` [dpdk-dev] [PATCH v2 0/6] various vmxnet3 fixes and enhancement Yong Wang
2016-08-24  0:05     ` [dpdk-dev] [PATCH v2 1/6] net/vmxnet3: improve error checks and return values Yong Wang
2016-08-29 19:18       ` [dpdk-dev] [PATCH v3 0/6] various vmxnet3 fixes and enhancement Yong Wang
2016-08-29 19:18         ` [dpdk-dev] [PATCH v3 1/6] net/vmxnet3: improve error checks and return values Yong Wang
2016-08-29 19:18         ` [dpdk-dev] [PATCH v3 2/6] net/vmxnet3: coding style changes Yong Wang
2016-08-29 19:18         ` [dpdk-dev] [PATCH v3 3/6] net/vmxnet3: reallocate shared memzone on re-config Yong Wang
2016-08-29 19:18         ` [dpdk-dev] [PATCH v3 4/6] net/vmxnet3: update feature doc Yong Wang
2016-08-29 19:18         ` [dpdk-dev] [PATCH v3 5/6] net/vmxnet3: update nic doc Yong Wang
2016-08-29 19:18         ` [dpdk-dev] [PATCH v3 6/6] net/vmxnet3: enable lro Yong Wang
2016-09-19 14:44         ` [dpdk-dev] [PATCH v3 0/6] various vmxnet3 fixes and enhancement Bruce Richardson
2016-08-24  0:05     ` [dpdk-dev] [PATCH v2 2/6] net/vmxnet3: coding style changes Yong Wang
2016-08-24  0:05     ` [dpdk-dev] [PATCH v2 3/6] net/vmxnet3: reallocate shared memzone on re-config Yong Wang
2016-08-24  0:05     ` [dpdk-dev] [PATCH v2 4/6] net/vmxnet3: update feature doc Yong Wang
2016-08-24  0:05     ` [dpdk-dev] [PATCH v2 5/6] net/vmxnet3: update nic doc Yong Wang
2016-08-24  0:05     ` [dpdk-dev] [PATCH v2 6/6] net/vmxnet3: enable lro Yong Wang
2016-08-24 19:17     ` [dpdk-dev] [PATCH v2 0/6] various vmxnet3 fixes and enhancement Stephen Hemminger

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=1471049909-18117-2-git-send-email-yongwang@vmware.com \
    --to=yongwang@vmware.com \
    --cc=dev@dpdk.org \
    --cc=diproiettod@vmware.com \
    --cc=gyang@vmware.com \
    --cc=sothy.e98@gmail.com \
    --cc=stephen@networkplumber.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).