From: Jeff Guo Date: Fri, 11 Sep 2020 10:18:48 +0000 (+0800) Subject: net/iavf: fix command after PF reset X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1eab95fe2e36e191ad85a9aacf82a44e7c8011fc;p=dpdk.git net/iavf: fix command after PF reset If PF reset is finished but VF reset is pending, VF should no need to send any invalid cmd to PF. That would avoid mass unexpected behaviors affecting the robust. Fixes: 22b123a36d07 ("net/avf: initialize PMD") Fixes: 9e03acd726cf ("net/iavf: fix flow access") Cc: stable@dpdk.org Signed-off-by: Jeff Guo Tested-by: Hailin Xu Acked-by: Qi Zhang --- diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 9ad331ee92..3198d85b3a 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -134,7 +134,7 @@ struct iavf_info { uint16_t mc_addrs_num; /* Multicast mac addresses number */ struct iavf_vsi vsi; - bool vf_reset; + bool vf_reset; /* true for VF reset pending, false for no VF reset */ uint64_t flags; uint8_t *rss_lut; diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index e1ff38e8be..6bb915d816 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1285,6 +1285,8 @@ iavf_init_vf(struct rte_eth_dev *dev) } } + vf->vf_reset = false; + return 0; err_rss: rte_free(vf->rss_key); diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c index ff77d71356..ddc6df8495 100644 --- a/drivers/net/iavf/iavf_hash.c +++ b/drivers/net/iavf/iavf_hash.c @@ -457,6 +457,9 @@ iavf_hash_init(struct iavf_adapter *ad) struct iavf_flow_parser *parser; int ret; + if (vf->vf_reset) + return -EIO; + if (!vf->vf_res) return -EINVAL; @@ -967,6 +970,11 @@ iavf_hash_destroy(__rte_unused struct iavf_adapter *ad, static void iavf_hash_uninit(struct iavf_adapter *ad) { + struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad); + + if (vf->vf_reset) + return; + if (iavf_hash_default_set(ad, false)) PMD_DRV_LOG(ERR, "fail to delete default RSS"); diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 69e1dc72aa..76f8e38d1e 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -76,6 +76,9 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args) if (_atomic_set_cmd(vf, args->ops)) return -1; + if (vf->vf_reset) + return -EIO; + ret = iavf_aq_send_msg_to_pf(hw, args->ops, IAVF_SUCCESS, args->in_args, args->in_args_size, NULL); if (ret) {