diff mbox series

[09/38] net/sfc: move adapter state enum to separate header

Message ID 20210827065717.1838258-10-andrew.rybchenko@oktetlabs.ru (mailing list archive)
State Superseded
Delegated to: Ferruh Yigit
Headers show
Series net/sfc: support port representors | expand

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Andrew Rybchenko Aug. 27, 2021, 6:56 a.m. UTC
From: Igor Romanov <igor.romanov@oktetlabs.ru>

Adapter state will be reused by representors, that will have
a separate adapter. Rename adapter state to ethdev state
so that the meaning of it is clearer.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
---
 drivers/net/sfc/sfc.c              | 47 ++++++++++---------
 drivers/net/sfc/sfc.h              | 54 +---------------------
 drivers/net/sfc/sfc_ethdev.c       | 40 ++++++++---------
 drivers/net/sfc/sfc_ethdev_state.h | 72 ++++++++++++++++++++++++++++++
 drivers/net/sfc/sfc_flow.c         | 10 ++---
 drivers/net/sfc/sfc_intr.c         | 12 ++---
 drivers/net/sfc/sfc_mae.c          |  2 +-
 drivers/net/sfc/sfc_port.c         |  2 +-
 8 files changed, 130 insertions(+), 109 deletions(-)
 create mode 100644 drivers/net/sfc/sfc_ethdev_state.h
diff mbox series

Patch

diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c
index 9abd6d600b..152234cb61 100644
--- a/drivers/net/sfc/sfc.c
+++ b/drivers/net/sfc/sfc.c
@@ -26,7 +26,6 @@ 
 #include "sfc_tweak.h"
 #include "sfc_sw_stats.h"
 
-
 bool
 sfc_repr_supported(const struct sfc_adapter *sa)
 {
@@ -440,7 +439,7 @@  sfc_try_start(struct sfc_adapter *sa)
 	sfc_log_init(sa, "entry");
 
 	SFC_ASSERT(sfc_adapter_is_locked(sa));
-	SFC_ASSERT(sa->state == SFC_ADAPTER_STARTING);
+	SFC_ASSERT(sa->state == SFC_ETHDEV_STARTING);
 
 	sfc_log_init(sa, "set FW subvariant");
 	rc = sfc_set_fw_subvariant(sa);
@@ -545,9 +544,9 @@  sfc_start(struct sfc_adapter *sa)
 	SFC_ASSERT(sfc_adapter_is_locked(sa));
 
 	switch (sa->state) {
-	case SFC_ADAPTER_CONFIGURED:
+	case SFC_ETHDEV_CONFIGURED:
 		break;
-	case SFC_ADAPTER_STARTED:
+	case SFC_ETHDEV_STARTED:
 		sfc_notice(sa, "already started");
 		return 0;
 	default:
@@ -555,7 +554,7 @@  sfc_start(struct sfc_adapter *sa)
 		goto fail_bad_state;
 	}
 
-	sa->state = SFC_ADAPTER_STARTING;
+	sa->state = SFC_ETHDEV_STARTING;
 
 	rc = 0;
 	do {
@@ -578,13 +577,13 @@  sfc_start(struct sfc_adapter *sa)
 	if (rc != 0)
 		goto fail_try_start;
 
-	sa->state = SFC_ADAPTER_STARTED;
+	sa->state = SFC_ETHDEV_STARTED;
 	sfc_log_init(sa, "done");
 	return 0;
 
 fail_try_start:
 fail_sriov_vswitch_create:
-	sa->state = SFC_ADAPTER_CONFIGURED;
+	sa->state = SFC_ETHDEV_CONFIGURED;
 fail_bad_state:
 	sfc_log_init(sa, "failed %d", rc);
 	return rc;
@@ -598,9 +597,9 @@  sfc_stop(struct sfc_adapter *sa)
 	SFC_ASSERT(sfc_adapter_is_locked(sa));
 
 	switch (sa->state) {
-	case SFC_ADAPTER_STARTED:
+	case SFC_ETHDEV_STARTED:
 		break;
-	case SFC_ADAPTER_CONFIGURED:
+	case SFC_ETHDEV_CONFIGURED:
 		sfc_notice(sa, "already stopped");
 		return;
 	default:
@@ -609,7 +608,7 @@  sfc_stop(struct sfc_adapter *sa)
 		return;
 	}
 
-	sa->state = SFC_ADAPTER_STOPPING;
+	sa->state = SFC_ETHDEV_STOPPING;
 
 	sfc_repr_proxy_stop(sa);
 	sfc_flow_stop(sa);
@@ -620,7 +619,7 @@  sfc_stop(struct sfc_adapter *sa)
 	sfc_intr_stop(sa);
 	efx_nic_fini(sa->nic);
 
-	sa->state = SFC_ADAPTER_CONFIGURED;
+	sa->state = SFC_ETHDEV_CONFIGURED;
 	sfc_log_init(sa, "done");
 }
 
@@ -631,7 +630,7 @@  sfc_restart(struct sfc_adapter *sa)
 
 	SFC_ASSERT(sfc_adapter_is_locked(sa));
 
-	if (sa->state != SFC_ADAPTER_STARTED)
+	if (sa->state != SFC_ETHDEV_STARTED)
 		return EINVAL;
 
 	sfc_stop(sa);
@@ -652,7 +651,7 @@  sfc_restart_if_required(void *arg)
 	if (rte_atomic32_cmpset((volatile uint32_t *)&sa->restart_required,
 				1, 0)) {
 		sfc_adapter_lock(sa);
-		if (sa->state == SFC_ADAPTER_STARTED)
+		if (sa->state == SFC_ETHDEV_STARTED)
 			(void)sfc_restart(sa);
 		sfc_adapter_unlock(sa);
 	}
@@ -685,9 +684,9 @@  sfc_configure(struct sfc_adapter *sa)
 
 	SFC_ASSERT(sfc_adapter_is_locked(sa));
 
-	SFC_ASSERT(sa->state == SFC_ADAPTER_INITIALIZED ||
-		   sa->state == SFC_ADAPTER_CONFIGURED);
-	sa->state = SFC_ADAPTER_CONFIGURING;
+	SFC_ASSERT(sa->state == SFC_ETHDEV_INITIALIZED ||
+		   sa->state == SFC_ETHDEV_CONFIGURED);
+	sa->state = SFC_ETHDEV_CONFIGURING;
 
 	rc = sfc_check_conf(sa);
 	if (rc != 0)
@@ -713,7 +712,7 @@  sfc_configure(struct sfc_adapter *sa)
 	if (rc != 0)
 		goto fail_sw_xstats_configure;
 
-	sa->state = SFC_ADAPTER_CONFIGURED;
+	sa->state = SFC_ETHDEV_CONFIGURED;
 	sfc_log_init(sa, "done");
 	return 0;
 
@@ -731,7 +730,7 @@  sfc_configure(struct sfc_adapter *sa)
 
 fail_intr_configure:
 fail_check_conf:
-	sa->state = SFC_ADAPTER_INITIALIZED;
+	sa->state = SFC_ETHDEV_INITIALIZED;
 	sfc_log_init(sa, "failed %d", rc);
 	return rc;
 }
@@ -743,8 +742,8 @@  sfc_close(struct sfc_adapter *sa)
 
 	SFC_ASSERT(sfc_adapter_is_locked(sa));
 
-	SFC_ASSERT(sa->state == SFC_ADAPTER_CONFIGURED);
-	sa->state = SFC_ADAPTER_CLOSING;
+	SFC_ASSERT(sa->state == SFC_ETHDEV_CONFIGURED);
+	sa->state = SFC_ETHDEV_CLOSING;
 
 	sfc_sw_xstats_close(sa);
 	sfc_tx_close(sa);
@@ -752,7 +751,7 @@  sfc_close(struct sfc_adapter *sa)
 	sfc_port_close(sa);
 	sfc_intr_close(sa);
 
-	sa->state = SFC_ADAPTER_INITIALIZED;
+	sa->state = SFC_ETHDEV_INITIALIZED;
 	sfc_log_init(sa, "done");
 }
 
@@ -993,7 +992,7 @@  sfc_attach(struct sfc_adapter *sa)
 	if (rc != 0)
 		goto fail_sriov_vswitch_create;
 
-	sa->state = SFC_ADAPTER_INITIALIZED;
+	sa->state = SFC_ETHDEV_INITIALIZED;
 
 	sfc_log_init(sa, "done");
 	return 0;
@@ -1067,7 +1066,7 @@  sfc_detach(struct sfc_adapter *sa)
 	efx_tunnel_fini(sa->nic);
 	sfc_sriov_detach(sa);
 
-	sa->state = SFC_ADAPTER_UNINITIALIZED;
+	sa->state = SFC_ETHDEV_UNINITIALIZED;
 }
 
 static int
@@ -1325,7 +1324,7 @@  sfc_unprobe(struct sfc_adapter *sa)
 	sfc_mem_bar_fini(sa);
 
 	sfc_flow_fini(sa);
-	sa->state = SFC_ADAPTER_UNINITIALIZED;
+	sa->state = SFC_ETHDEV_UNINITIALIZED;
 }
 
 uint32_t
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index 79f9d7979e..628f32c13f 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -32,62 +32,12 @@ 
 #include "sfc_dp.h"
 #include "sfc_repr_proxy.h"
 #include "sfc_service.h"
+#include "sfc_ethdev_state.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/*
- * +---------------+
- * | UNINITIALIZED |<-----------+
- * +---------------+		|
- *	|.eth_dev_init		|.eth_dev_uninit
- *	V			|
- * +---------------+------------+
- * |  INITIALIZED  |
- * +---------------+<-----------<---------------+
- *	|.dev_configure		|		|
- *	V			|failed		|
- * +---------------+------------+		|
- * |  CONFIGURING  |				|
- * +---------------+----+			|
- *	|success	|			|
- *	|		|		+---------------+
- *	|		|		|    CLOSING    |
- *	|		|		+---------------+
- *	|		|			^
- *	V		|.dev_configure		|
- * +---------------+----+			|.dev_close
- * |  CONFIGURED   |----------------------------+
- * +---------------+<-----------+
- *	|.dev_start		|
- *	V			|
- * +---------------+		|
- * |   STARTING    |------------^
- * +---------------+ failed	|
- *	|success		|
- *	|		+---------------+
- *	|		|   STOPPING    |
- *	|		+---------------+
- *	|			^
- *	V			|.dev_stop
- * +---------------+------------+
- * |    STARTED    |
- * +---------------+
- */
-enum sfc_adapter_state {
-	SFC_ADAPTER_UNINITIALIZED = 0,
-	SFC_ADAPTER_INITIALIZED,
-	SFC_ADAPTER_CONFIGURING,
-	SFC_ADAPTER_CONFIGURED,
-	SFC_ADAPTER_CLOSING,
-	SFC_ADAPTER_STARTING,
-	SFC_ADAPTER_STARTED,
-	SFC_ADAPTER_STOPPING,
-
-	SFC_ADAPTER_NSTATES
-};
-
 enum sfc_dev_filter_mode {
 	SFC_DEV_FILTER_MODE_PROMISC = 0,
 	SFC_DEV_FILTER_MODE_ALLMULTI,
@@ -245,7 +195,7 @@  struct sfc_adapter {
 	 * change its state should acquire the lock.
 	 */
 	rte_spinlock_t			lock;
-	enum sfc_adapter_state		state;
+	enum sfc_ethdev_state		state;
 	struct rte_eth_dev		*eth_dev;
 	struct rte_kvargs		*kvargs;
 	int				socket_id;
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 8e17189875..ff762bb90b 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -213,9 +213,9 @@  sfc_dev_configure(struct rte_eth_dev *dev)
 
 	sfc_adapter_lock(sa);
 	switch (sa->state) {
-	case SFC_ADAPTER_CONFIGURED:
+	case SFC_ETHDEV_CONFIGURED:
 		/* FALLTHROUGH */
-	case SFC_ADAPTER_INITIALIZED:
+	case SFC_ETHDEV_INITIALIZED:
 		rc = sfc_configure(sa);
 		break;
 	default:
@@ -257,7 +257,7 @@  sfc_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 
 	sfc_log_init(sa, "entry");
 
-	if (sa->state != SFC_ADAPTER_STARTED) {
+	if (sa->state != SFC_ETHDEV_STARTED) {
 		sfc_port_link_mode_to_info(EFX_LINK_UNKNOWN, &current_link);
 	} else if (wait_to_complete) {
 		efx_link_mode_t link_mode;
@@ -346,15 +346,15 @@  sfc_dev_close(struct rte_eth_dev *dev)
 
 	sfc_adapter_lock(sa);
 	switch (sa->state) {
-	case SFC_ADAPTER_STARTED:
+	case SFC_ETHDEV_STARTED:
 		sfc_stop(sa);
-		SFC_ASSERT(sa->state == SFC_ADAPTER_CONFIGURED);
+		SFC_ASSERT(sa->state == SFC_ETHDEV_CONFIGURED);
 		/* FALLTHROUGH */
-	case SFC_ADAPTER_CONFIGURED:
+	case SFC_ETHDEV_CONFIGURED:
 		sfc_close(sa);
-		SFC_ASSERT(sa->state == SFC_ADAPTER_INITIALIZED);
+		SFC_ASSERT(sa->state == SFC_ETHDEV_INITIALIZED);
 		/* FALLTHROUGH */
-	case SFC_ADAPTER_INITIALIZED:
+	case SFC_ETHDEV_INITIALIZED:
 		break;
 	default:
 		sfc_err(sa, "unexpected adapter state %u on close", sa->state);
@@ -410,7 +410,7 @@  sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 			sfc_warn(sa, "the change is to be applied on the next "
 				     "start provided that isolated mode is "
 				     "disabled prior the next start");
-		} else if ((sa->state == SFC_ADAPTER_STARTED) &&
+		} else if ((sa->state == SFC_ETHDEV_STARTED) &&
 			   ((rc = sfc_set_rx_mode(sa)) != 0)) {
 			*toggle = !(enabled);
 			sfc_warn(sa, "Failed to %s %s mode, rc = %d",
@@ -704,7 +704,7 @@  sfc_stats_reset(struct rte_eth_dev *dev)
 
 	sfc_adapter_lock(sa);
 
-	if (sa->state != SFC_ADAPTER_STARTED) {
+	if (sa->state != SFC_ETHDEV_STARTED) {
 		/*
 		 * The operation cannot be done if port is not started; it
 		 * will be scheduled to be done during the next port start
@@ -905,7 +905,7 @@  sfc_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 
 	sfc_adapter_lock(sa);
 
-	if (sa->state == SFC_ADAPTER_STARTED)
+	if (sa->state == SFC_ETHDEV_STARTED)
 		efx_mac_fcntl_get(sa->nic, &wanted_fc, &link_fc);
 	else
 		link_fc = sa->port.flow_ctrl;
@@ -971,7 +971,7 @@  sfc_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 
 	sfc_adapter_lock(sa);
 
-	if (sa->state == SFC_ADAPTER_STARTED) {
+	if (sa->state == SFC_ETHDEV_STARTED) {
 		rc = efx_mac_fcntl_set(sa->nic, fcntl, fc_conf->autoneg);
 		if (rc != 0)
 			goto fail_mac_fcntl_set;
@@ -1051,7 +1051,7 @@  sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 		goto fail_check_scatter;
 
 	if (pdu != sa->port.pdu) {
-		if (sa->state == SFC_ADAPTER_STARTED) {
+		if (sa->state == SFC_ETHDEV_STARTED) {
 			sfc_stop(sa);
 
 			old_pdu = sa->port.pdu;
@@ -1128,7 +1128,7 @@  sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)
 		goto unlock;
 	}
 
-	if (sa->state != SFC_ADAPTER_STARTED) {
+	if (sa->state != SFC_ETHDEV_STARTED) {
 		sfc_notice(sa, "the port is not started");
 		sfc_notice(sa, "the new MAC address will be set on port start");
 
@@ -1215,7 +1215,7 @@  sfc_set_mc_addr_list(struct rte_eth_dev *dev,
 
 	port->nb_mcast_addrs = nb_mc_addr;
 
-	if (sa->state != SFC_ADAPTER_STARTED)
+	if (sa->state != SFC_ETHDEV_STARTED)
 		return 0;
 
 	rc = efx_mac_multicast_list_set(sa->nic, port->mcast_addrs,
@@ -1356,7 +1356,7 @@  sfc_rx_queue_start(struct rte_eth_dev *dev, uint16_t ethdev_qid)
 	sfc_adapter_lock(sa);
 
 	rc = EINVAL;
-	if (sa->state != SFC_ADAPTER_STARTED)
+	if (sa->state != SFC_ETHDEV_STARTED)
 		goto fail_not_started;
 
 	rxq_info = sfc_rxq_info_by_ethdev_qid(sas, sfc_ethdev_qid);
@@ -1420,7 +1420,7 @@  sfc_tx_queue_start(struct rte_eth_dev *dev, uint16_t ethdev_qid)
 	sfc_adapter_lock(sa);
 
 	rc = EINVAL;
-	if (sa->state != SFC_ADAPTER_STARTED)
+	if (sa->state != SFC_ETHDEV_STARTED)
 		goto fail_not_started;
 
 	txq_info = sfc_txq_info_by_ethdev_qid(sas, ethdev_qid);
@@ -1528,7 +1528,7 @@  sfc_dev_udp_tunnel_op(struct rte_eth_dev *dev,
 	if (rc != 0)
 		goto fail_op;
 
-	if (sa->state == SFC_ADAPTER_STARTED) {
+	if (sa->state == SFC_ETHDEV_STARTED) {
 		rc = efx_tunnel_reconfigure(sa->nic);
 		if (rc == EAGAIN) {
 			/*
@@ -1664,7 +1664,7 @@  sfc_dev_rss_hash_update(struct rte_eth_dev *dev,
 	}
 
 	if (rss_conf->rss_key != NULL) {
-		if (sa->state == SFC_ADAPTER_STARTED) {
+		if (sa->state == SFC_ETHDEV_STARTED) {
 			for (key_i = 0; key_i < n_contexts; key_i++) {
 				rc = efx_rx_scale_key_set(sa->nic,
 							  contexts[key_i],
@@ -1791,7 +1791,7 @@  sfc_dev_rss_reta_update(struct rte_eth_dev *dev,
 		}
 	}
 
-	if (sa->state == SFC_ADAPTER_STARTED) {
+	if (sa->state == SFC_ETHDEV_STARTED) {
 		rc = efx_rx_scale_tbl_set(sa->nic, EFX_RSS_CONTEXT_DEFAULT,
 					  rss_tbl_new, EFX_RSS_TBL_SIZE);
 		if (rc != 0)
diff --git a/drivers/net/sfc/sfc_ethdev_state.h b/drivers/net/sfc/sfc_ethdev_state.h
new file mode 100644
index 0000000000..51fb51e20e
--- /dev/null
+++ b/drivers/net/sfc/sfc_ethdev_state.h
@@ -0,0 +1,72 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright(c) 2019-2021 Xilinx, Inc.
+ * Copyright(c) 2019 Solarflare Communications Inc.
+ *
+ * This software was jointly developed between OKTET Labs (under contract
+ * for Solarflare) and Solarflare Communications, Inc.
+ */
+
+#ifndef _SFC_ETHDEV_STATE_H
+#define _SFC_ETHDEV_STATE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * +---------------+
+ * | UNINITIALIZED |<-----------+
+ * +---------------+		|
+ *	|.eth_dev_init		|.eth_dev_uninit
+ *	V			|
+ * +---------------+------------+
+ * |  INITIALIZED  |
+ * +---------------+<-----------<---------------+
+ *	|.dev_configure		|		|
+ *	V			|failed		|
+ * +---------------+------------+		|
+ * |  CONFIGURING  |				|
+ * +---------------+----+			|
+ *	|success	|			|
+ *	|		|		+---------------+
+ *	|		|		|    CLOSING    |
+ *	|		|		+---------------+
+ *	|		|			^
+ *	V		|.dev_configure		|
+ * +---------------+----+			|.dev_close
+ * |  CONFIGURED   |----------------------------+
+ * +---------------+<-----------+
+ *	|.dev_start		|
+ *	V			|
+ * +---------------+		|
+ * |   STARTING    |------------^
+ * +---------------+ failed	|
+ *	|success		|
+ *	|		+---------------+
+ *	|		|   STOPPING    |
+ *	|		+---------------+
+ *	|			^
+ *	V			|.dev_stop
+ * +---------------+------------+
+ * |    STARTED    |
+ * +---------------+
+ */
+enum sfc_ethdev_state {
+	SFC_ETHDEV_UNINITIALIZED = 0,
+	SFC_ETHDEV_INITIALIZED,
+	SFC_ETHDEV_CONFIGURING,
+	SFC_ETHDEV_CONFIGURED,
+	SFC_ETHDEV_CLOSING,
+	SFC_ETHDEV_STARTING,
+	SFC_ETHDEV_STARTED,
+	SFC_ETHDEV_STOPPING,
+
+	SFC_ETHDEV_NSTATES
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _SFC_ETHDEV_STATE_H */
diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c
index 4f5993a68d..36ee79f331 100644
--- a/drivers/net/sfc/sfc_flow.c
+++ b/drivers/net/sfc/sfc_flow.c
@@ -2724,7 +2724,7 @@  sfc_flow_create(struct rte_eth_dev *dev,
 
 	TAILQ_INSERT_TAIL(&sa->flow_list, flow, entries);
 
-	if (sa->state == SFC_ADAPTER_STARTED) {
+	if (sa->state == SFC_ETHDEV_STARTED) {
 		rc = sfc_flow_insert(sa, flow, error);
 		if (rc != 0)
 			goto fail_flow_insert;
@@ -2767,7 +2767,7 @@  sfc_flow_destroy(struct rte_eth_dev *dev,
 		goto fail_bad_value;
 	}
 
-	if (sa->state == SFC_ADAPTER_STARTED)
+	if (sa->state == SFC_ETHDEV_STARTED)
 		rc = sfc_flow_remove(sa, flow, error);
 
 	TAILQ_REMOVE(&sa->flow_list, flow, entries);
@@ -2790,7 +2790,7 @@  sfc_flow_flush(struct rte_eth_dev *dev,
 	sfc_adapter_lock(sa);
 
 	while ((flow = TAILQ_FIRST(&sa->flow_list)) != NULL) {
-		if (sa->state == SFC_ADAPTER_STARTED) {
+		if (sa->state == SFC_ETHDEV_STARTED) {
 			int rc;
 
 			rc = sfc_flow_remove(sa, flow, error);
@@ -2828,7 +2828,7 @@  sfc_flow_query(struct rte_eth_dev *dev,
 		goto fail_no_backend;
 	}
 
-	if (sa->state != SFC_ADAPTER_STARTED) {
+	if (sa->state != SFC_ETHDEV_STARTED) {
 		ret = rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
 			"Can't query the flow: the adapter is not started");
@@ -2858,7 +2858,7 @@  sfc_flow_isolate(struct rte_eth_dev *dev, int enable,
 	int ret = 0;
 
 	sfc_adapter_lock(sa);
-	if (sa->state != SFC_ADAPTER_INITIALIZED) {
+	if (sa->state != SFC_ETHDEV_INITIALIZED) {
 		rte_flow_error_set(error, EBUSY,
 				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 				   NULL, "please close the port first");
diff --git a/drivers/net/sfc/sfc_intr.c b/drivers/net/sfc/sfc_intr.c
index c2298ed23c..69414fd839 100644
--- a/drivers/net/sfc/sfc_intr.c
+++ b/drivers/net/sfc/sfc_intr.c
@@ -60,9 +60,9 @@  sfc_intr_line_handler(void *cb_arg)
 
 	sfc_log_init(sa, "entry");
 
-	if (sa->state != SFC_ADAPTER_STARTED &&
-	    sa->state != SFC_ADAPTER_STARTING &&
-	    sa->state != SFC_ADAPTER_STOPPING) {
+	if (sa->state != SFC_ETHDEV_STARTED &&
+	    sa->state != SFC_ETHDEV_STARTING &&
+	    sa->state != SFC_ETHDEV_STOPPING) {
 		sfc_log_init(sa,
 			     "interrupt on stopped adapter, don't reenable");
 		goto exit;
@@ -106,9 +106,9 @@  sfc_intr_message_handler(void *cb_arg)
 
 	sfc_log_init(sa, "entry");
 
-	if (sa->state != SFC_ADAPTER_STARTED &&
-	    sa->state != SFC_ADAPTER_STARTING &&
-	    sa->state != SFC_ADAPTER_STOPPING) {
+	if (sa->state != SFC_ETHDEV_STARTED &&
+	    sa->state != SFC_ETHDEV_STARTING &&
+	    sa->state != SFC_ETHDEV_STOPPING) {
 		sfc_log_init(sa, "adapter not-started, don't reenable");
 		goto exit;
 	}
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index b3607a178b..7be77054ab 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -3414,7 +3414,7 @@  sfc_mae_flow_verify(struct sfc_adapter *sa,
 
 	SFC_ASSERT(sfc_adapter_is_locked(sa));
 
-	if (sa->state != SFC_ADAPTER_STARTED)
+	if (sa->state != SFC_ETHDEV_STARTED)
 		return EAGAIN;
 
 	if (outer_rule != NULL) {
diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c
index adb2b2cb81..7a3f59a112 100644
--- a/drivers/net/sfc/sfc_port.c
+++ b/drivers/net/sfc/sfc_port.c
@@ -48,7 +48,7 @@  sfc_port_update_mac_stats(struct sfc_adapter *sa, boolean_t force_upload)
 
 	SFC_ASSERT(sfc_adapter_is_locked(sa));
 
-	if (sa->state != SFC_ADAPTER_STARTED)
+	if (sa->state != SFC_ETHDEV_STARTED)
 		return 0;
 
 	/*