[PATCH v2 04/21] net/cpfl: support device start and stop
Mingxia Liu
mingxia.liu at intel.com
Fri Jan 13 09:19:14 CET 2023
Add dev ops dev_start, dev_stop and link_update.
Signed-off-by: Mingxia Liu <mingxia.liu at intel.com>
---
drivers/net/cpfl/cpfl_ethdev.c | 35 ++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index a113ed0de0..05c3ad1a9c 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -185,12 +185,45 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
return 0;
}
+static int
+cpfl_dev_start(struct rte_eth_dev *dev)
+{
+ struct idpf_vport *vport = dev->data->dev_private;
+ int ret;
+
+ ret = idpf_vc_ena_dis_vport(vport, true);
+ if (ret != 0) {
+ PMD_DRV_LOG(ERR, "Failed to enable vport");
+ return ret;
+ }
+
+ vport->stopped = 0;
+
+ return 0;
+}
+
+static int
+cpfl_dev_stop(struct rte_eth_dev *dev)
+{
+ struct idpf_vport *vport = dev->data->dev_private;
+
+ if (vport->stopped == 1)
+ return 0;
+
+ idpf_vc_ena_dis_vport(vport, false);
+
+ vport->stopped = 1;
+
+ return 0;
+}
+
static int
cpfl_dev_close(struct rte_eth_dev *dev)
{
struct idpf_vport *vport = dev->data->dev_private;
struct cpfl_adapter_ext *adapter = CPFL_ADAPTER_TO_EXT(vport->adapter);
+ cpfl_dev_stop(dev);
idpf_vport_deinit(vport);
adapter->cur_vports &= ~RTE_BIT32(vport->devarg_id);
@@ -539,6 +572,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
.rx_queue_setup = cpfl_rx_queue_setup,
.tx_queue_setup = cpfl_tx_queue_setup,
.dev_infos_get = cpfl_dev_info_get,
+ .dev_start = cpfl_dev_start,
+ .dev_stop = cpfl_dev_stop,
.link_update = cpfl_dev_link_update,
.dev_supported_ptypes_get = cpfl_dev_supported_ptypes_get,
};
--
2.25.1
More information about the dev
mailing list