All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Pryazhennikov <denis.pryazhennikov@arknetworks.am>
To: dev@dpdk.org
Cc: Ferruh Yigit <ferruh.yigit@amd.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Ivan Malov <ivan.malov@arknetworks.am>,
	Andy Moreton <amoreton@xilinx.com>,
	Andrew Rybchenko <arybchenko@oktetlabs.ru>
Subject: [PATCH v2 1/3] net/sfc: split link update function
Date: Thu, 15 Jun 2023 12:38:45 +0400	[thread overview]
Message-ID: <20230615083847.75590-2-denis.pryazhennikov@arknetworks.am> (raw)
In-Reply-To: <20230615083847.75590-1-denis.pryazhennikov@arknetworks.am>

Separate the original link update function into
two functions: state retrieval and update.
This improves code clarity and maintainability.

Signed-off-by: Denis Pryazhennikov <denis.pryazhennikov@arknetworks.am>
Reviewed-by: Ivan Malov <ivan.malov@arknetworks.am>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Acked-by: Andrew Rybchenko <arybchenko@oktetlabs.ru>
---
 drivers/net/sfc/sfc_ethdev.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 320043145495..6d41eb000345 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -248,28 +248,38 @@ sfc_dev_start(struct rte_eth_dev *dev)
 	return -rc;
 }
 
-static int
-sfc_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
+static void
+sfc_dev_get_rte_link(struct rte_eth_dev *dev, int wait_to_complete,
+		     struct rte_eth_link *link)
 {
 	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
-	struct rte_eth_link current_link;
-	int ret;
 
-	sfc_log_init(sa, "entry");
+	SFC_ASSERT(link != NULL);
 
 	if (sa->state != SFC_ETHDEV_STARTED) {
-		sfc_port_link_mode_to_info(EFX_LINK_UNKNOWN, &current_link);
+		sfc_port_link_mode_to_info(EFX_LINK_UNKNOWN, link);
 	} else if (wait_to_complete) {
 		efx_link_mode_t link_mode;
 
 		if (efx_port_poll(sa->nic, &link_mode) != 0)
 			link_mode = EFX_LINK_UNKNOWN;
-		sfc_port_link_mode_to_info(link_mode, &current_link);
-
+		sfc_port_link_mode_to_info(link_mode, link);
 	} else {
 		sfc_ev_mgmt_qpoll(sa);
-		rte_eth_linkstatus_get(dev, &current_link);
+		rte_eth_linkstatus_get(dev, link);
 	}
+}
+
+static int
+sfc_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
+{
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
+	struct rte_eth_link current_link;
+	int ret;
+
+	sfc_log_init(sa, "entry");
+
+	sfc_dev_get_rte_link(dev, wait_to_complete, &current_link);
 
 	ret = rte_eth_linkstatus_set(dev, &current_link);
 	if (ret == 0)
-- 
2.37.0 (Apple Git-136)


  reply	other threads:[~2023-06-15  8:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01 22:23 [PATCH 0/3] net/sfc: support FEC feature Denis Pryazhennikov
2023-06-01 22:23 ` [PATCH 1/3] net/sfc: split link update function Denis Pryazhennikov
2023-06-02  8:52   ` Andrew Rybchenko
2023-06-20 11:25     ` Ferruh Yigit
2023-06-20 11:43       ` Andrew Rybchenko
2023-06-01 22:23 ` [PATCH 2/3] common/sfc_efx/base: add FEC related macros Denis Pryazhennikov
2023-06-02  8:53   ` Andrew Rybchenko
2023-06-01 22:23 ` [PATCH 3/3] net/sfc: support FEC feature Denis Pryazhennikov
2023-06-02  9:09   ` Andrew Rybchenko
2023-06-15  8:38 ` [PATCH v2 0/3] " Denis Pryazhennikov
2023-06-15  8:38   ` Denis Pryazhennikov [this message]
2023-06-15  8:38   ` [PATCH v2 2/3] common/sfc_efx/base: add FEC related macros Denis Pryazhennikov
2023-06-20 11:34     ` Ferruh Yigit
2023-06-15  8:38   ` [PATCH v2 3/3] net/sfc: support FEC feature Denis Pryazhennikov
2023-06-19  9:39     ` Andrew Rybchenko
2023-06-20 11:33       ` Ferruh Yigit
2023-06-20 11:47   ` [PATCH v2 0/3] " 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=20230615083847.75590-2-denis.pryazhennikov@arknetworks.am \
    --to=denis.pryazhennikov@arknetworks.am \
    --cc=amoreton@xilinx.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=arybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=ivan.malov@arknetworks.am \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.