[v9,04/21] net/cpfl: support device start and stop
Checks
Commit Message
Add dev ops dev_start, dev_stop and link_update.
Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
---
drivers/net/cpfl/cpfl_ethdev.c | 35 ++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
@@ -181,12 +181,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_vport_ena_dis(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_vport_ena_dis(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);
@@ -204,6 +237,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,
};