DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: dev@dpdk.org
Cc: Igor Romanov <igor.romanov@oktetlabs.ru>,
	Andy Moreton <amoreton@xilinx.com>,
	Ivan Malov <ivan.malov@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 09/38] net/sfc: move adapter state enum to separate header
Date: Fri, 27 Aug 2021 09:56:48 +0300	[thread overview]
Message-ID: <20210827065717.1838258-10-andrew.rybchenko@oktetlabs.ru> (raw)
In-Reply-To: <20210827065717.1838258-1-andrew.rybchenko@oktetlabs.ru>

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 --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;
 
 	/*
-- 
2.30.2


  parent reply	other threads:[~2021-08-27  6:58 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27  6:56 [dpdk-dev] [PATCH 00/38] net/sfc: support port representors Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 01/38] common/sfc_efx/base: update MCDI headers Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 02/38] common/sfc_efx/base: update EF100 registers definitions Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 03/38] net/sfc: add switch mode device argument Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 04/38] net/sfc: insert switchdev mode MAE rules Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 05/38] common/sfc_efx/base: add an API to get mport ID by selector Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 06/38] net/sfc: support EF100 Tx override prefix Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 07/38] net/sfc: add representors proxy infrastructure Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 08/38] net/sfc: reserve TxQ and RxQ for port representors Andrew Rybchenko
2021-08-27  6:56 ` Andrew Rybchenko [this message]
2021-08-27  6:56 ` [dpdk-dev] [PATCH 10/38] common/sfc_efx/base: allow creating invalid mport selectors Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 11/38] net/sfc: add port representors infrastructure Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 12/38] common/sfc_efx/base: add filter ingress mport matching field Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 13/38] common/sfc_efx/base: add API to get mport selector by ID Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 14/38] common/sfc_efx/base: add mport alias MCDI wrappers Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 15/38] net/sfc: add representor proxy port API Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 16/38] net/sfc: implement representor queue setup and release Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 17/38] net/sfc: implement representor RxQ start/stop Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 18/38] net/sfc: implement representor TxQ start/stop Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 19/38] net/sfc: implement port representor start and stop Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 20/38] net/sfc: implement port representor link update Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 21/38] net/sfc: support multiple device probe Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 22/38] net/sfc: implement representor Tx routine Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 23/38] net/sfc: use xword type for EF100 Rx prefix Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 24/38] net/sfc: handle ingress m-port in " Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 25/38] net/sfc: implement representor Rx routine Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 26/38] net/sfc: add simple port representor statistics Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 27/38] net/sfc: free MAE lock once switch domain is assigned Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 28/38] common/sfc_efx/base: add multi-host function M-port selector Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 29/38] common/sfc_efx/base: retrieve function interfaces for VNICs Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 30/38] common/sfc_efx/base: add a means to read MAE mport journal Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 31/38] common/sfc_efx/base: allow getting VNIC MCDI client handles Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 32/38] net/sfc: maintain controller to EFX interface mapping Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 33/38] net/sfc: store PCI address for represented entities Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 34/38] net/sfc: include controller and port in representor name Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 35/38] net/sfc: support new representor parameter syntax Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 36/38] net/sfc: use switch port ID as representor ID Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 37/38] net/sfc: implement the representor info API Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 38/38] net/sfc: update comment about representor support Andrew Rybchenko
2021-10-11 14:48 ` [dpdk-dev] [PATCH v2 00/38] net/sfc: support port representors Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 01/38] common/sfc_efx/base: update MCDI headers Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 02/38] common/sfc_efx/base: update EF100 registers definitions Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 03/38] net/sfc: add switch mode device argument Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 04/38] net/sfc: insert switchdev mode MAE rules Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 05/38] common/sfc_efx/base: add an API to get mport ID by selector Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 06/38] net/sfc: support EF100 Tx override prefix Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 07/38] net/sfc: add representors proxy infrastructure Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 08/38] net/sfc: reserve TxQ and RxQ for port representors Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 09/38] net/sfc: move adapter state enum to separate header Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 10/38] common/sfc_efx/base: allow creating invalid mport selectors Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 11/38] net/sfc: add port representors infrastructure Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 12/38] common/sfc_efx/base: add filter ingress mport matching field Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 13/38] common/sfc_efx/base: add API to get mport selector by ID Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 14/38] common/sfc_efx/base: add mport alias MCDI wrappers Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 15/38] net/sfc: add representor proxy port API Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 16/38] net/sfc: implement representor queue setup and release Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 17/38] net/sfc: implement representor RxQ start/stop Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 18/38] net/sfc: implement representor TxQ start/stop Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 19/38] net/sfc: implement port representor start and stop Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 20/38] net/sfc: implement port representor link update Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 21/38] net/sfc: support multiple device probe Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 22/38] net/sfc: implement representor Tx routine Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 23/38] net/sfc: use xword type for EF100 Rx prefix Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 24/38] net/sfc: handle ingress m-port in " Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 25/38] net/sfc: implement representor Rx routine Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 26/38] net/sfc: add simple port representor statistics Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 27/38] net/sfc: free MAE lock once switch domain is assigned Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 28/38] common/sfc_efx/base: add multi-host function M-port selector Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 29/38] common/sfc_efx/base: retrieve function interfaces for VNICs Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 30/38] common/sfc_efx/base: add a means to read MAE mport journal Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 31/38] common/sfc_efx/base: allow getting VNIC MCDI client handles Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 32/38] net/sfc: maintain controller to EFX interface mapping Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 33/38] net/sfc: store PCI address for represented entities Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 34/38] net/sfc: include controller and port in representor name Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 35/38] net/sfc: support new representor parameter syntax Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 36/38] net/sfc: use switch port ID as representor ID Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 37/38] net/sfc: implement the representor info API Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 38/38] net/sfc: update comment about representor support Andrew Rybchenko
2021-10-12 16:45   ` [dpdk-dev] [PATCH v2 00/38] net/sfc: support port representors 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=20210827065717.1838258-10-andrew.rybchenko@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=amoreton@xilinx.com \
    --cc=dev@dpdk.org \
    --cc=igor.romanov@oktetlabs.ru \
    --cc=ivan.malov@oktetlabs.ru \
    /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).