net/hns3: fix configure FEC when concurrent with reset
[dpdk.git] / drivers / net / hns3 / hns3_ethdev.c
index 53a0b54..846e5a2 100644 (file)
@@ -6433,11 +6433,16 @@ hns3_fec_set(struct rte_eth_dev *dev, uint32_t mode)
                return -EINVAL;
        }
 
+       rte_spinlock_lock(&hw->lock);
        ret = hns3_set_fec_hw(hw, mode);
-       if (ret)
+       if (ret) {
+               rte_spinlock_unlock(&hw->lock);
                return ret;
+       }
 
        pf->fec_mode = mode;
+       rte_spinlock_unlock(&hw->lock);
+
        return 0;
 }