diff mbox series

[v3,04/11] net/octeontx: handle port reconfiguration

Message ID 20220524084235.17796-4-hkalra@marvell.com (mailing list archive)
State Accepted
Delegated to: Jerin Jacob
Headers show
Series [v3,01/11] event/octeontx: fix SSO fastpath | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Harman Kalra May 24, 2022, 8:42 a.m. UTC
Adding support for port reconfiguration as user may require to
do so on a running system.

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 drivers/net/octeontx/octeontx_ethdev.c | 38 +++++++++++++++-----------
 drivers/net/octeontx/octeontx_ethdev.h |  1 +
 2 files changed, 23 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 9b13e22089..9351fcb5c7 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -518,30 +518,34 @@  octeontx_dev_configure(struct rte_eth_dev *dev)
 
 	nic->num_tx_queues = dev->data->nb_tx_queues;
 
-	ret = octeontx_pko_channel_open(nic->pko_vfid * PKO_VF_NUM_DQ,
-					nic->num_tx_queues,
-					nic->base_ochan);
-	if (ret) {
-		octeontx_log_err("failed to open channel %d no-of-txq %d",
-			   nic->base_ochan, nic->num_tx_queues);
-		return -EFAULT;
-	}
+	if (!nic->reconfigure) {
+		ret = octeontx_pko_channel_open(nic->pko_vfid * PKO_VF_NUM_DQ,
+						nic->num_tx_queues,
+						nic->base_ochan);
+		if (ret) {
+			octeontx_log_err("failed to open channel %d no-of-txq %d",
+					 nic->base_ochan, nic->num_tx_queues);
+			return -EFAULT;
+		}
 
-	ret = octeontx_dev_vlan_offload_init(dev);
-	if (ret) {
-		octeontx_log_err("failed to initialize vlan offload");
-		return -EFAULT;
-	}
+		ret = octeontx_dev_vlan_offload_init(dev);
+		if (ret) {
+			octeontx_log_err("failed to initialize vlan offload");
+			return -EFAULT;
+		}
 
-	nic->pki.classifier_enable = false;
-	nic->pki.hash_enable = true;
-	nic->pki.initialized = false;
+		nic->pki.classifier_enable = false;
+		nic->pki.hash_enable = true;
+		nic->pki.initialized = false;
+	}
 
 	nic->rx_offloads |= rxmode->offloads;
 	nic->tx_offloads |= txmode->offloads;
 	nic->rx_offload_flags |= octeontx_rx_offload_flags(dev);
 	nic->tx_offload_flags |= octeontx_tx_offload_flags(dev);
 
+	nic->reconfigure = true;
+
 	return 0;
 }
 
@@ -583,6 +587,7 @@  octeontx_dev_close(struct rte_eth_dev *dev)
 	}
 
 	octeontx_port_close(nic);
+	nic->reconfigure = false;
 
 	return 0;
 }
@@ -1431,6 +1436,7 @@  octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,
 	nic->ev_queues = 1;
 	nic->ev_ports = 1;
 	nic->print_flag = -1;
+	nic->reconfigure = false;
 
 	data->dev_link.link_status = RTE_ETH_LINK_DOWN;
 	data->dev_started = 0;
diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h
index c493fa7a03..7e04faddb8 100644
--- a/drivers/net/octeontx/octeontx_ethdev.h
+++ b/drivers/net/octeontx/octeontx_ethdev.h
@@ -144,6 +144,7 @@  struct octeontx_nic {
 	struct octeontx_vlan_info vlan_info;
 	int print_flag;
 	struct octeontx_fc_info fc;
+	bool reconfigure;
 } __rte_cache_aligned;
 
 struct octeontx_txq {