summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei Hu (Xavier) <xavier.huwei@huawei.com>2019-11-22 20:06:20 +0800
committerFerruh Yigit <ferruh.yigit@intel.com>2019-11-25 16:41:03 +0000
commit860df6643b8ef9f86ba2b66f86967b5e4b75aec9 (patch)
tree905c1fcec1b995f8b67b1d4c8aa34a4a12f5a319
parentcb76df3f55f5d0c53d64ca21fe60033739c84e37 (diff)
downloaddpdk-next-net-intel-860df6643b8ef9f86ba2b66f86967b5e4b75aec9.zip
dpdk-next-net-intel-860df6643b8ef9f86ba2b66f86967b5e4b75aec9.tar.gz
dpdk-next-net-intel-860df6643b8ef9f86ba2b66f86967b5e4b75aec9.tar.xz
net/hns3: fix VF configuration after abnormal exit
When the application using VF device exits abnormally, for example, when it is killed by 'kill -9', kernel PF netdev driver also stores the corresponding configuration table entries of VF device. This patch fixes it by adding message of deleting VF configuration table entry corresponds to the revision of kernel hns3 netdev driver, the new message is added to notify the kernel PF netdev driver to clean up the VF configuration initialization during VF initialization. This revision is compatible with the old version of kernel hns3 netdev driver. The old version of kernel pf netdev driver will ignore this message. Fixes: a5475d61fa34 ("net/hns3: support VF") Cc: stable@dpdk.org Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
-rw-r--r--drivers/net/hns3/hns3_ethdev_vf.c14
-rw-r--r--drivers/net/hns3/hns3_mbx.h6
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 4036749..2274ac3 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1097,6 +1097,14 @@ err_init_hardware:
}
static int
+hns3vf_clear_vport_list(struct hns3_hw *hw)
+{
+ return hns3_send_mbx_msg(hw, HNS3_MBX_HANDLE_VF_TBL,
+ HNS3_MBX_VPORT_LIST_CLEAR, NULL, 0, false,
+ NULL, 0);
+}
+
+static int
hns3vf_init_vf(struct rte_eth_dev *eth_dev)
{
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
@@ -1147,6 +1155,12 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev)
rte_eth_random_addr(hw->mac.mac_addr); /* Generate a random mac addr */
+ ret = hns3vf_clear_vport_list(hw);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to clear tbl list: %d", ret);
+ goto err_get_config;
+ }
+
ret = hns3vf_init_hardware(hns);
if (ret)
goto err_get_config;
diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h
index ee6e823..01eddb8 100644
--- a/drivers/net/hns3/hns3_mbx.h
+++ b/drivers/net/hns3/hns3_mbx.h
@@ -39,6 +39,8 @@ enum HNS3_MBX_OPCODE {
HNS3_MBX_SET_ALIVE, /* (VF -> PF) set alive state */
HNS3_MBX_SET_MTU, /* (VF -> PF) set mtu */
HNS3_MBX_GET_QID_IN_PF, /* (VF -> PF) get queue id in pf */
+
+ HNS3_MBX_HANDLE_VF_TBL = 38, /* (VF -> PF) store/clear hw cfg tbl */
};
/* below are per-VF mac-vlan subcodes */
@@ -58,6 +60,10 @@ enum hns3_mbx_vlan_cfg_subcode {
HNS3_MBX_VLAN_RX_OFF_CFG, /* set rx side vlan offload */
};
+enum hns3_mbx_tbl_cfg_subcode {
+ HNS3_MBX_VPORT_LIST_CLEAR = 0,
+};
+
#define HNS3_MBX_MAX_MSG_SIZE 16
#define HNS3_MBX_MAX_RESP_DATA_SIZE 8
#define HNS3_MBX_RING_MAP_BASIC_MSG_NUM 3