DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com,
	Qin Ke <qin.ke@corigine.com>,
	Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 3/5] net/nfp: standardize the logic for nfp reconfig function
Date: Mon, 22 May 2023 16:04:58 +0800	[thread overview]
Message-ID: <20230522080500.2014001-4-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20230522080500.2014001-1-chaoyong.he@corigine.com>

From: Qin Ke <qin.ke@corigine.com>

There are some issues about return value and code style related with
nfp_net_reconfig(), standardizes them.

The line of code nn_cfg_writel(hw, NFP_NET_CFG_CTRL, ctrl) only needs
to be executed once, deletes the redundant line in nfp_net_start() which
has called nfp_net_reconfig() including the line.

Signed-off-by: Qin Ke <qin.ke@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/nfp_common.c | 32 ++++++++++++++++++--------------
 drivers/net/nfp/nfp_ethdev.c |  1 -
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index c9fea765a4..0644f6f1a8 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -256,22 +256,27 @@ __nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t update)
 	return 0;
 }
 
-/*
- * Reconfigure the NIC
- * @nn:    device to reconfigure
- * @ctrl:    The value for the ctrl field in the BAR config
- * @update:  The value for the update field in the BAR config
+/**
+ * Reconfigure the NIC.
  *
  * Write the update word to the BAR and ping the reconfig queue. Then poll
  * until the firmware has acknowledged the update by zeroing the update word.
+ *
+ * @param hw
+ *   Device to reconfigure.
+ * @param ctrl
+ *   The value for the ctrl field in the BAR config.
+ * @param update
+ *   The value for the update field in the BAR config.
+ *
+ * @return
+ *   - (0) if OK to reconfigure the device.
+ *   - (EIO) if I/O err and fail to reconfigure the device.
  */
 int
 nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t ctrl, uint32_t update)
 {
-	uint32_t err;
-
-	PMD_DRV_LOG(DEBUG, "nfp_net_reconfig: ctrl=%08x update=%08x",
-		    ctrl, update);
+	int ret;
 
 	if (hw->pf_dev != NULL && hw->pf_dev->app_fw_id == NFP_APP_FW_CORE_NIC)
 		nfp_net_notify_port_speed(hw->eth_dev);
@@ -283,18 +288,17 @@ nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t ctrl, uint32_t update)
 
 	rte_wmb();
 
-	err = __nfp_net_reconfig(hw, update);
+	ret = __nfp_net_reconfig(hw, update);
 
 	rte_spinlock_unlock(&hw->reconfig_lock);
 
-	if (err != 0) {
-		PMD_INIT_LOG(ERR, "Error nfp_net reconfig for ctrl: %x update: %x",
-			     ctrl, update);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Error nfp net reconfig: ctrl=%#08x update=%#08x",
+				ctrl, update);
 		return -EIO;
 	}
 
 	return 0;
-
 }
 
 /*
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 722ec17dce..1ddb7a92ee 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -144,7 +144,6 @@ nfp_net_start(struct rte_eth_dev *dev)
 	if (hw->cap & NFP_NET_CFG_CTRL_RINGCFG)
 		new_ctrl |= NFP_NET_CFG_CTRL_RINGCFG;
 
-	nn_cfg_writel(hw, NFP_NET_CFG_CTRL, new_ctrl);
 	if (nfp_net_reconfig(hw, new_ctrl, update) < 0)
 		return -EIO;
 
-- 
2.39.1


  parent reply	other threads:[~2023-05-22  8:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22  8:04 [PATCH 0/5] Add support of report packet type Chaoyong He
2023-05-22  8:04 ` [PATCH 1/5] mailmap: update contributor entry Chaoyong He
2023-05-22  8:04 ` [PATCH 2/5] net/nfp: rename field and add comment for Rx descriptor Chaoyong He
2023-05-22  8:04 ` Chaoyong He [this message]
2023-05-22  8:04 ` [PATCH 4/5] net/nfp: remove logic of reporting packet type by hash type Chaoyong He
2023-05-22  8:05 ` [PATCH 5/5] net/nfp: report packet type by Rx descriptor Chaoyong He
2023-06-02 16:26 ` [PATCH 0/5] Add support of report packet type 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=20230522080500.2014001-4-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=niklas.soderlund@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=qin.ke@corigine.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).