DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Boyer <aboyer@pensando.io>
To: dev@dpdk.org
Cc: Alfredo Cardigliano <cardigliano@ntop.org>,
	Andrew Boyer <aboyer@pensando.io>
Subject: [dpdk-dev] [PATCH v2 8/9] net/ionic: minor refactorings and helper variables
Date: Thu,  3 Dec 2020 12:34:17 -0800
Message-ID: <20201203203418.15064-9-aboyer@pensando.io> (raw)
In-Reply-To: <20201203203418.15064-1-aboyer@pensando.io>
In-Reply-To: <20201102183527.69209-1-aboyer@pensando.io>

This makes the code clearer and conserves resources.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
---
 drivers/net/ionic/ionic_ethdev.c |  5 ++---
 drivers/net/ionic/ionic_lif.c    | 15 ++++++++++-----
 drivers/net/ionic/ionic_main.c   | 18 +++++++-----------
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index ce6ca9671..a1c35ace3 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -901,7 +901,7 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
 	struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
 	struct ionic_adapter *adapter = lif->adapter;
 	struct ionic_dev *idev = &adapter->idev;
-	uint32_t allowed_speeds;
+	uint32_t speed, allowed_speeds;
 	int err;
 
 	IONIC_PRINT_CALL();
@@ -929,8 +929,7 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
 	}
 
 	if (eth_dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED) {
-		uint32_t speed = ionic_parse_link_speeds(dev_conf->link_speeds);
-
+		speed = ionic_parse_link_speeds(dev_conf->link_speeds);
 		if (speed)
 			ionic_dev_cmd_port_speed(idev, speed);
 	}
diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index 2e33fb8d9..722a89565 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -77,11 +77,14 @@ void
 ionic_lif_reset(struct ionic_lif *lif)
 {
 	struct ionic_dev *idev = &lif->adapter->idev;
+	int err;
 
 	IONIC_PRINT_CALL();
 
 	ionic_dev_cmd_lif_reset(idev, lif->index);
-	ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+	err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+	if (err)
+		IONIC_PRINT(WARNING, "Failed to reset lif");
 }
 
 static void
@@ -305,10 +308,11 @@ ionic_dev_add_mac(struct rte_eth_dev *eth_dev,
 }
 
 void
-ionic_dev_remove_mac(struct rte_eth_dev *eth_dev, uint32_t index __rte_unused)
+ionic_dev_remove_mac(struct rte_eth_dev *eth_dev, uint32_t index)
 {
 	struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
 	struct ionic_adapter *adapter = lif->adapter;
+	struct rte_ether_addr *mac_addr;
 
 	IONIC_PRINT_CALL();
 
@@ -319,11 +323,12 @@ ionic_dev_remove_mac(struct rte_eth_dev *eth_dev, uint32_t index __rte_unused)
 		return;
 	}
 
-	if (!rte_is_valid_assigned_ether_addr(&eth_dev->data->mac_addrs[index]))
+	mac_addr = &eth_dev->data->mac_addrs[index];
+
+	if (!rte_is_valid_assigned_ether_addr(mac_addr))
 		return;
 
-	ionic_lif_addr_del(lif, (const uint8_t *)
-		&eth_dev->data->mac_addrs[index]);
+	ionic_lif_addr_del(lif, (const uint8_t *)mac_addr);
 }
 
 int
diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c
index f77bddaa4..92cf0f398 100644
--- a/drivers/net/ionic/ionic_main.c
+++ b/drivers/net/ionic/ionic_main.c
@@ -188,8 +188,7 @@ ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
 	done = ionic_wait_ctx_for_completion(lif, qcq, ctx,
 		IONIC_DEVCMD_TIMEOUT);
 
-	err = ionic_adminq_check_err(ctx, !done /* timed out */);
-	return err;
+	return ionic_adminq_check_err(ctx, !done /* timed out */);
 }
 
 static int
@@ -241,10 +240,11 @@ ionic_dev_cmd_wait_check(struct ionic_dev *idev, unsigned long max_wait)
 	int err;
 
 	err = ionic_dev_cmd_wait(idev, max_wait);
-	if (err)
-		return err;
 
-	return ionic_dev_cmd_check_error(idev);
+	if (!err)
+		err = ionic_dev_cmd_check_error(idev);
+
+	return err;
 }
 
 int
@@ -299,22 +299,18 @@ int
 ionic_init(struct ionic_adapter *adapter)
 {
 	struct ionic_dev *idev = &adapter->idev;
-	int err;
 
 	ionic_dev_cmd_init(idev);
-	err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
-	return err;
+	return ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
 }
 
 int
 ionic_reset(struct ionic_adapter *adapter)
 {
 	struct ionic_dev *idev = &adapter->idev;
-	int err;
 
 	ionic_dev_cmd_reset(idev);
-	err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
-	return err;
+	return ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
 }
 
 int
-- 
2.17.1


  parent reply	other threads:[~2020-12-03 20:37 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02 18:35 [dpdk-dev] [PATCH 0/8] net/ionic: minor updates and documentation Andrew Boyer
2020-11-02 18:35 ` [dpdk-dev] [PATCH 1/8] ionic: update documentation and MAINTAINERS Andrew Boyer
2020-11-03 12:35   ` Ferruh Yigit
2020-11-03 14:43     ` Andrew Boyer
2020-11-02 18:35 ` [dpdk-dev] [PATCH 2/8] ionic: connect to the meson build system Andrew Boyer
2020-11-02 18:35 ` [dpdk-dev] [PATCH 3/8] ionic: update ionic_if.h to the latest version Andrew Boyer
2020-11-03 12:44   ` Ferruh Yigit
2020-11-03 14:36     ` Andrew Boyer
2020-11-03 15:55       ` Ferruh Yigit
2020-11-02 18:35 ` [dpdk-dev] [PATCH 4/8] ionic: check for devcmd/admincmd completion more frequently Andrew Boyer
2020-11-02 18:35 ` [dpdk-dev] [PATCH 5/8] ionic: remove some unused fields Andrew Boyer
2020-11-02 18:35 ` [dpdk-dev] [PATCH 6/8] ionic: convert 'deferred' boolean to a flag bit Andrew Boyer
2020-11-02 18:35 ` [dpdk-dev] [PATCH 7/8] ionic: warn if RTE tries to enable loopback mode Andrew Boyer
2020-11-03 12:52   ` Ferruh Yigit
2020-11-02 18:35 ` [dpdk-dev] [PATCH 8/8] ionic: nits - whitespace, logging, helper variables Andrew Boyer
2020-11-03 13:06   ` Ferruh Yigit
2020-11-03 14:00     ` Andrew Boyer
2020-11-03 14:02       ` Ferruh Yigit
2020-11-03 13:11 ` [dpdk-dev] [PATCH 0/8] net/ionic: minor updates and documentation Ferruh Yigit
2020-11-03 14:45   ` Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 0/9] " Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 " Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 " Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 " Andrew Boyer
2020-12-10 12:31         ` Ferruh Yigit
2020-12-10 14:44           ` [dpdk-dev] Patchworks " Andrew Boyer
2020-12-10 15:06             ` Ferruh Yigit
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 1/9] net/ionic: connect ionic to the build system Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 2/9] net/ionic: update interface file to the latest version Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 3/9] net/ionic: update documentation and MAINTAINERS Andrew Boyer
2020-12-10 12:01         ` Ferruh Yigit
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 4/9] net/ionic: check for cmd completion more frequently Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 5/9] net/ionic: remove some unused fields Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 6/9] net/ionic: convert 'deferred' boolean to a flag bit Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 7/9] net/ionic: warn if loopback mode is requested Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 8/9] net/ionic: minor refactorings and helper variables Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 9/9] net/ionic: minor logging fixups Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 1/9] net/ionic: connect ionic to the build system Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 2/9] net/ionic: update interface file to the latest version Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 3/9] net/ionic: update documentation and MAINTAINERS Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 4/9] net/ionic: check for cmd completion more frequently Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 5/9] net/ionic: remove some unused fields Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 6/9] net/ionic: convert 'deferred' boolean to a flag bit Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 7/9] net/ionic: warn if loopback mode is requested Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 8/9] net/ionic: minor refactorings and helper variables Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 9/9] net/ionic: minor logging fixups Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 1/9] net/ionic: connect ionic to the build system Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 2/9] net/ionic: update interface file to the latest version Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 3/9] net/ionic: update documentation and MAINTAINERS Andrew Boyer
2020-12-09 12:03     ` Ferruh Yigit
2020-12-09 14:36       ` Andrew Boyer
2020-12-09 15:24         ` Ferruh Yigit
2020-12-09 16:24           ` Andrew Boyer
2020-12-09 17:15             ` Ferruh Yigit
2020-12-09 19:05               ` Andrew Boyer
2020-12-10  9:23                 ` Ferruh Yigit
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 4/9] net/ionic: check for cmd completion more frequently Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 5/9] net/ionic: remove some unused fields Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 6/9] net/ionic: convert 'deferred' boolean to a flag bit Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 7/9] net/ionic: warn if loopback mode is requested Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 8/9] net/ionic: minor refactorings and helper variables Andrew Boyer
2020-12-09 13:04     ` Ferruh Yigit
2020-12-09 14:39       ` Andrew Boyer
2020-12-09 15:25         ` Ferruh Yigit
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 9/9] net/ionic: minor logging fixups Andrew Boyer
2020-12-09 13:47     ` Ferruh Yigit
2020-12-09 14:45       ` Andrew Boyer
2020-12-09 15:42         ` Ferruh Yigit
2020-12-09 19:26           ` Andrew Boyer
2020-12-10  9:58             ` Ferruh Yigit
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 1/9] net/ionic: connect ionic to the build system Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 2/9] net/ionic: update interface file to the latest version Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 3/9] net/ionic: update documentation and MAINTAINERS Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 4/9] net/ionic: check for cmd completion more frequently Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 5/9] net/ionic: remove some unused fields Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 6/9] net/ionic: convert 'deferred' boolean to a flag bit Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 7/9] net/ionic: warn if loopback mode is requested Andrew Boyer
2020-12-03 20:34 ` Andrew Boyer [this message]
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 9/9] net/ionic: minor logging fixups Andrew Boyer

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=20201203203418.15064-9-aboyer@pensando.io \
    --to=aboyer@pensando.io \
    --cc=cardigliano@ntop.org \
    --cc=dev@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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git