The secondary process probe path returns early without attaching the
already-created ethdev or assigning its dev_ops, leaving the device
unusable in secondary processes. Attach the ethdev and set the matching
PF/VF ops.

Fixes: 468368457681 ("net/hinic3: add device initialization")
Cc: [email protected]

Signed-off-by: Jiacheng Ye <[email protected]>
---
 drivers/net/hinic3/hinic3_ethdev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/hinic3/hinic3_ethdev.c 
b/drivers/net/hinic3/hinic3_ethdev.c
index d9821d1c9f..aaae6f4364 100644
--- a/drivers/net/hinic3/hinic3_ethdev.c
+++ b/drivers/net/hinic3/hinic3_ethdev.c
@@ -2135,6 +2135,9 @@ hinic3_dev_close(struct rte_eth_dev *eth_dev)
                HINIC3_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
        int ret;
 
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return 0;
+
        if (hinic3_test_and_set_bit(HINIC3_DEV_CLOSE, &nic_dev->dev_status)) {
                PMD_DRV_LOG(WARNING, "Device %s already closed",
                            nic_dev->dev_name);
@@ -3408,6 +3411,13 @@ hinic3_func_init(struct rte_eth_dev *eth_dev)
                PMD_DRV_LOG(INFO, "Initialize %s in secondary process",
                            eth_dev->data->name);
 
+               nic_dev = HINIC3_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
+
+               if (HINIC3_FUNC_TYPE(nic_dev->hwdev) == TYPE_VF)
+                       eth_dev->dev_ops = &hinic3_pmd_vf_ops;
+               else
+                       eth_dev->dev_ops = &hinic3_pmd_ops;
+
                return 0;
        }
 
-- 
2.33.0

Reply via email to