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 | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/net/hinic3/hinic3_ethdev.c
b/drivers/net/hinic3/hinic3_ethdev.c
index eb5ddd9de6..9944edf978 100644
--- a/drivers/net/hinic3/hinic3_ethdev.c
+++ b/drivers/net/hinic3/hinic3_ethdev.c
@@ -2125,6 +2125,9 @@ hinic3_dev_close(struct rte_eth_dev *eth_dev)
{
struct hinic3_nic_dev *nic_dev =
HINIC3_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
int ret;
if (hinic3_test_and_set_bit(HINIC3_DEV_CLOSE, &nic_dev->dev_status)) {
@@ -3400,6 +3403,18 @@ 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 (nic_dev == NULL) {
+ PMD_DRV_LOG(ERR, "nic_dev hwdev is NULL, dev_name: %s",
+ eth_dev->data->name);
+ return -ENOMEM;
+ }
+
+ 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