From: Chiqijun chiqijun@huawei.com
driver inclusion category: bugfix bugzilla: 4472
-----------------------------------------------------------------------
According to the number of queues set by the VF driver during hot migration, determine whether data migration is required, and clear the number of queues after the driver is reloaded to prevent accidental migration of useless data.
Signed-off-by: Chiqijun chiqijun@huawei.com Reviewed-by: Luoshaokai luoshaokai@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/huawei/hinic/hinic_eqs.c | 12 ++++++++++-- drivers/net/ethernet/huawei/hinic/hinic_eqs.h | 2 -- drivers/net/ethernet/huawei/hinic/hinic_hw.h | 2 ++ drivers/net/ethernet/huawei/hinic/hinic_lld.c | 1 + drivers/net/ethernet/huawei/hinic/hinic_nic_io.c | 2 ++ 5 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_eqs.c b/drivers/net/ethernet/huawei/hinic/hinic_eqs.c index 024b43f..b8ea8ed 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_eqs.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_eqs.c @@ -229,9 +229,17 @@ static irqreturn_t aeq_interrupt(int irq, void *data); static irqreturn_t ceq_interrupt(int irq, void *data);
-void hinic_qps_num_set(struct hinic_hwdev *hwdev, u32 num_qps) +/** + * hinic_qps_num_set - set the number of queues that are actually opened, + * and instructs the migration driver to migrate specified queues + * during VF live migration. + * + * @hwdev: the pointer to hw device + * @num_qps: number of queue + */ +void hinic_qps_num_set(void *hwdev, u32 num_qps) { - struct hinic_hwif *hwif = hwdev->hwif; + struct hinic_hwif *hwif = ((struct hinic_hwdev *)hwdev)->hwif; u32 addr, val, ctrl;
addr = HINIC_CSR_AEQ_CTRL_0_ADDR(0); diff --git a/drivers/net/ethernet/huawei/hinic/hinic_eqs.h b/drivers/net/ethernet/huawei/hinic/hinic_eqs.h index 84840df..5035f90 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_eqs.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_eqs.h @@ -159,8 +159,6 @@ enum hinic_msg_pipe_state {
void hinic_func_own_bit_set(struct hinic_hwdev *hwdev, u32 cfg);
-void hinic_qps_num_set(struct hinic_hwdev *hwdev, u32 num_qps); - int hinic_aeqs_init(struct hinic_hwdev *hwdev, u16 num_aeqs, struct irq_info *msix_entries);
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw.h b/drivers/net/ethernet/huawei/hinic/hinic_hw.h index 404be1f..0947201 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw.h @@ -377,6 +377,8 @@ enum hinic_func_cap { void hinic_ppf_hwdev_unreg(void *hwdev); void hinic_ppf_hwdev_reg(void *hwdev, void *ppf_hwdev);
+void hinic_qps_num_set(void *hwdev, u32 num_qps); + bool hinic_is_hwdev_mod_inited(void *hwdev, enum hinic_hwdev_init_state state); enum hinic_func_mode hinic_get_func_mode(void *hwdev); u64 hinic_get_func_feature_cap(void *hwdev); diff --git a/drivers/net/ethernet/huawei/hinic/hinic_lld.c b/drivers/net/ethernet/huawei/hinic/hinic_lld.c index f851bb2..e8e446a 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_lld.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_lld.c @@ -2318,6 +2318,7 @@ static int hinic_func_init(struct pci_dev *pdev, true : disable_vf_load;
hinic_set_vf_load_state(pci_adapter, vf_load_state); + hinic_qps_num_set(pci_adapter->hwdev, 0);
pci_adapter->lld_dev.pdev = pdev; pci_adapter->lld_dev.hwdev = pci_adapter->hwdev; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_io.c b/drivers/net/ethernet/huawei/hinic/hinic_nic_io.c index bd5c869..8d13105 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic_io.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_io.c @@ -763,6 +763,8 @@ void hinic_free_qp_ctxts(void *hwdev) if (!hwdev) return;
+ hinic_qps_num_set(hwdev, 0); + err = hinic_clean_root_ctxt(hwdev); if (err) nic_err(((struct hinic_hwdev *)hwdev)->dev_hdl,