DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] net/iavf: fix invalid cmd after pf reset
@ 2020-09-11  5:21 Jeff Guo
  2020-09-11  9:45 ` Xu, HailinX
  2020-09-11 10:18 ` [dpdk-dev] [PATCH v2] " Jeff Guo
  0 siblings, 2 replies; 4+ messages in thread
From: Jeff Guo @ 2020-09-11  5:21 UTC (permalink / raw)
  To: jingjing.wu, qi.z.zhang, beilei.xing; +Cc: dev, jia.guo

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")

Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
 drivers/net/iavf/iavf.h        | 2 +-
 drivers/net/iavf/iavf_ethdev.c | 2 ++
 drivers/net/iavf/iavf_hash.c   | 8 ++++++++
 drivers/net/iavf/iavf_vchnl.c  | 4 ++++
 4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index 9be8a2381..2b76c4b11 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -130,7 +130,7 @@ struct iavf_info {
 	uint32_t link_speed;
 
 	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 c3aa4cd72..5c3f8eac0 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1240,6 +1240,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 c06b52ea9..8df2adb9d 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -3694,6 +3694,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;
 
@@ -3994,6 +3997,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 33acea54a..1a9f7aa39 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -73,6 +73,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) {
@@ -183,6 +186,7 @@ iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg,
 	switch (pf_msg->event) {
 	case VIRTCHNL_EVENT_RESET_IMPENDING:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event");
+		vf->vf_reset = true;
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
 					      NULL);
 		break;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v1] net/iavf: fix invalid cmd after pf reset
  2020-09-11  5:21 [dpdk-dev] [PATCH v1] net/iavf: fix invalid cmd after pf reset Jeff Guo
@ 2020-09-11  9:45 ` Xu, HailinX
  2020-09-11 10:18 ` [dpdk-dev] [PATCH v2] " Jeff Guo
  1 sibling, 0 replies; 4+ messages in thread
From: Xu, HailinX @ 2020-09-11  9:45 UTC (permalink / raw)
  To: Guo, Jia, Wu, Jingjing, Zhang, Qi Z, Xing, Beilei; +Cc: dev, Guo, Jia

Tested-by:  Xu, HailinX <hailinx.xu@intel.com>

Regards,
Xu, Hailin

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jeff Guo
Sent: Friday, September 11, 2020 1:21 PM
To: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>
Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>
Subject: [dpdk-dev] [PATCH v1] net/iavf: fix invalid cmd 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")

Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
 drivers/net/iavf/iavf.h        | 2 +-
 drivers/net/iavf/iavf_ethdev.c | 2 ++
 drivers/net/iavf/iavf_hash.c   | 8 ++++++++
 drivers/net/iavf/iavf_vchnl.c  | 4 ++++
 4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 9be8a2381..2b76c4b11 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -130,7 +130,7 @@ struct iavf_info {
 	uint32_t link_speed;
 
 	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 c3aa4cd72..5c3f8eac0 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1240,6 +1240,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 c06b52ea9..8df2adb9d 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -3694,6 +3694,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;
 
@@ -3994,6 +3997,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 33acea54a..1a9f7aa39 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -73,6 +73,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) {
@@ -183,6 +186,7 @@ iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg,
 	switch (pf_msg->event) {
 	case VIRTCHNL_EVENT_RESET_IMPENDING:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event");
+		vf->vf_reset = true;
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
 					      NULL);
 		break;
--
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] net/iavf: fix invalid cmd after pf reset
  2020-09-11  5:21 [dpdk-dev] [PATCH v1] net/iavf: fix invalid cmd after pf reset Jeff Guo
  2020-09-11  9:45 ` Xu, HailinX
@ 2020-09-11 10:18 ` Jeff Guo
  2020-09-11 10:45   ` Zhang, Qi Z
  1 sibling, 1 reply; 4+ messages in thread
From: Jeff Guo @ 2020-09-11 10:18 UTC (permalink / raw)
  To: jingjing.wu, qi.z.zhang, beilei.xing; +Cc: dev, jia.guo, Xu, HailinX

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")

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Tested-by: Xu, HailinX <hailinx.xu@intel.com>
---
v2->v1:
rebase patch.
---
 drivers/net/iavf/iavf.h        | 2 +-
 drivers/net/iavf/iavf_ethdev.c | 2 ++
 drivers/net/iavf/iavf_hash.c   | 8 ++++++++
 drivers/net/iavf/iavf_vchnl.c  | 4 ++++
 4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index 9ad331ee9..3198d85b3 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 8e1d8a8d3..8fe81409c 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1288,6 +1288,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 ff77d7135..ddc6df849 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 34c31a153..1871ba299 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -77,6 +77,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) {
@@ -187,6 +190,7 @@ iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg,
 	switch (pf_msg->event) {
 	case VIRTCHNL_EVENT_RESET_IMPENDING:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event");
+		vf->vf_reset = true;
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
 					      NULL);
 		break;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/iavf: fix invalid cmd after pf reset
  2020-09-11 10:18 ` [dpdk-dev] [PATCH v2] " Jeff Guo
@ 2020-09-11 10:45   ` Zhang, Qi Z
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Qi Z @ 2020-09-11 10:45 UTC (permalink / raw)
  To: Guo, Jia, Wu, Jingjing, Xing, Beilei; +Cc: dev, Xu, Xu, HailinX



> -----Original Message-----
> From: Guo, Jia <jia.guo@intel.com>
> Sent: Friday, September 11, 2020 6:19 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>;
> Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>; Xu; Xu, HailinX
> <hailinx.xu@intel.com>
> Subject: [PATCH v2] net/iavf: fix invalid cmd 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")
> 
> Signed-off-by: Jeff Guo <jia.guo@intel.com>
> Tested-by: Xu, HailinX <hailinx.xu@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-11 10:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11  5:21 [dpdk-dev] [PATCH v1] net/iavf: fix invalid cmd after pf reset Jeff Guo
2020-09-11  9:45 ` Xu, HailinX
2020-09-11 10:18 ` [dpdk-dev] [PATCH v2] " Jeff Guo
2020-09-11 10:45   ` Zhang, Qi Z

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).