[v3,11/11] net/octeon_ep: set secondary process dev ops

Message ID 20230424122835.39493-12-sedara@marvell.com (mailing list archive)
State Not Applicable, archived
Delegated to: Jerin Jacob
Headers
Series extend octeon ep driver functionality |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Sathesh B Edara April 24, 2023, 12:28 p.m. UTC
  Sets the dev ops and transmit/receive callbacks
for secondary process.

Signed-off-by: Sathesh Edara <sedara@marvell.com>
---
 doc/guides/nics/features/octeon_ep.ini |  1 +
 drivers/net/octeon_ep/otx_ep_ethdev.c  | 22 +++++++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)
  

Patch

diff --git a/doc/guides/nics/features/octeon_ep.ini b/doc/guides/nics/features/octeon_ep.ini
index f3b821c89e..d52491afa3 100644
--- a/doc/guides/nics/features/octeon_ep.ini
+++ b/doc/guides/nics/features/octeon_ep.ini
@@ -11,4 +11,5 @@  x86-64               = Y
 Basic stats          = Y
 Link status          = Y
 MTU update           = Y
+Multiprocess aware   = Y
 Usage doc            = Y
diff --git a/drivers/net/octeon_ep/otx_ep_ethdev.c b/drivers/net/octeon_ep/otx_ep_ethdev.c
index 885fbb475f..a9868909f8 100644
--- a/drivers/net/octeon_ep/otx_ep_ethdev.c
+++ b/drivers/net/octeon_ep/otx_ep_ethdev.c
@@ -527,9 +527,17 @@  otx_ep_dev_stats_get(struct rte_eth_dev *eth_dev,
 static int
 otx_ep_dev_close(struct rte_eth_dev *eth_dev)
 {
-	struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev);
+	struct otx_ep_device *otx_epvf;
 	uint32_t num_queues, q_no;
 
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		eth_dev->dev_ops = NULL;
+		eth_dev->rx_pkt_burst = NULL;
+		eth_dev->tx_pkt_burst = NULL;
+		return 0;
+	}
+
+	otx_epvf = OTX_EP_DEV(eth_dev);
 	otx_ep_mbox_send_dev_exit(eth_dev);
 	otx_epvf->fn_list.disable_io_queues(otx_epvf);
 	num_queues = otx_epvf->nb_rx_queues;
@@ -593,8 +601,12 @@  static const struct eth_dev_ops otx_ep_eth_dev_ops = {
 static int
 otx_ep_eth_dev_uninit(struct rte_eth_dev *eth_dev)
 {
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		eth_dev->dev_ops = NULL;
+		eth_dev->rx_pkt_burst = NULL;
+		eth_dev->tx_pkt_burst = NULL;
 		return 0;
+	}
 
 	eth_dev->dev_ops = NULL;
 	eth_dev->rx_pkt_burst = NULL;
@@ -642,8 +654,12 @@  otx_ep_eth_dev_init(struct rte_eth_dev *eth_dev)
 	struct rte_ether_addr vf_mac_addr;
 
 	/* Single process support */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		eth_dev->dev_ops = &otx_ep_eth_dev_ops;
+		eth_dev->rx_pkt_burst = &otx_ep_recv_pkts;
+		eth_dev->tx_pkt_burst = &otx2_ep_xmit_pkts;
 		return 0;
+	}
 
 	rte_eth_copy_pci_info(eth_dev, pdev);
 	otx_epvf->eth_dev = eth_dev;