* [dpdk-dev] [PATCH] net/ice: fix link status recovery
@ 2019-11-04 5:40 Qiming Yang
2019-11-04 15:02 ` Stillwell Jr, Paul M
0 siblings, 1 reply; 4+ messages in thread
From: Qiming Yang @ 2019-11-04 5:40 UTC (permalink / raw)
To: dev; +Cc: wenzhuo.lu, Qiming Yang, stable
This patch fix a kernel driver link status issue by recovering
link status when device stop.
Fixes: e6161345d8a9 ("net/ice: support link status change")
Cc: stable@dpdk.org
Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
drivers/net/ice/ice_ethdev.c | 26 +++++++++++++++++++++++++-
drivers/net/ice/ice_ethdev.h | 1 +
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index d746758..c9972cf 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2277,7 +2277,10 @@ ice_dev_stop(struct rte_eth_dev *dev)
/* Clear all queues and release mbufs */
ice_clear_queues(dev);
- ice_dev_set_link_down(dev);
+ if (pf->init_link_status)
+ ice_dev_set_link_up(dev);
+ else
+ ice_dev_set_link_down(dev);
/* Clean datapath event and queue/vec mapping */
rte_intr_efd_disable(intr_handle);
@@ -2648,6 +2651,25 @@ ice_rxq_intr_setup(struct rte_eth_dev *dev)
return 0;
}
+static void ice_get_init_link_status(struct rte_eth_dev *dev)
+{
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ bool enable_lse = dev->data->dev_conf.intr_conf.lsc ? true : false;
+ struct ice_link_status link_status;
+ int ret;
+
+ ret = ice_aq_get_link_info(hw->port_info, enable_lse,
+ &link_status, NULL);
+ if (ret != ICE_SUCCESS) {
+ PMD_DRV_LOG(ERR, "Failed to get link info");
+ pf->init_link_status = false;
+ }
+
+ if (link_status.link_info & ICE_AQ_LINK_UP)
+ pf->init_link_status = true;
+}
+
static int
ice_dev_start(struct rte_eth_dev *dev)
{
@@ -2717,6 +2739,8 @@ ice_dev_start(struct rte_eth_dev *dev)
if (ret != ICE_SUCCESS)
PMD_DRV_LOG(WARNING, "Fail to set phy mask");
+ ice_get_init_link_status(dev);
+
ice_dev_set_link_up(dev);
/* Call get_link_info aq commond to enable/disable LSE */
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index de67e59..27db4e7 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -369,6 +369,7 @@ struct ice_pf {
struct ice_parser_list rss_parser_list;
struct ice_parser_list perm_parser_list;
struct ice_parser_list dist_parser_list;
+ bool init_link_status;
};
#define ICE_MAX_QUEUE_NUM 2048
--
2.9.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] net/ice: fix link status recovery
2019-11-04 5:40 [dpdk-dev] [PATCH] net/ice: fix link status recovery Qiming Yang
@ 2019-11-04 15:02 ` Stillwell Jr, Paul M
2019-11-05 2:40 ` Yang, Qiming
0 siblings, 1 reply; 4+ messages in thread
From: Stillwell Jr, Paul M @ 2019-11-04 15:02 UTC (permalink / raw)
To: Yang, Qiming, dev; +Cc: Lu, Wenzhuo, Yang, Qiming, stable
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Qiming Yang
> Sent: Sunday, November 3, 2019 9:40 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/ice: fix link status recovery
>
> This patch fix a kernel driver link status issue by recovering link status when
> device stop.
>
> Fixes: e6161345d8a9 ("net/ice: support link status change")
> Cc: stable@dpdk.org
>
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
> drivers/net/ice/ice_ethdev.c | 26 +++++++++++++++++++++++++-
> drivers/net/ice/ice_ethdev.h | 1 +
> 2 files changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
> index d746758..c9972cf 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -2277,7 +2277,10 @@ ice_dev_stop(struct rte_eth_dev *dev)
> /* Clear all queues and release mbufs */
> ice_clear_queues(dev);
>
> - ice_dev_set_link_down(dev);
> + if (pf->init_link_status)
> + ice_dev_set_link_up(dev);
> + else
> + ice_dev_set_link_down(dev);
>
> /* Clean datapath event and queue/vec mapping */
> rte_intr_efd_disable(intr_handle);
> @@ -2648,6 +2651,25 @@ ice_rxq_intr_setup(struct rte_eth_dev *dev)
> return 0;
> }
>
> +static void ice_get_init_link_status(struct rte_eth_dev *dev) {
> + struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> + struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data-
> >dev_private);
> + bool enable_lse = dev->data->dev_conf.intr_conf.lsc ? true : false;
> + struct ice_link_status link_status;
> + int ret;
> +
> + ret = ice_aq_get_link_info(hw->port_info, enable_lse,
> + &link_status, NULL);
> + if (ret != ICE_SUCCESS) {
> + PMD_DRV_LOG(ERR, "Failed to get link info");
> + pf->init_link_status = false;
You should probably just return here instead of continuing on. If the FW doesn't clear out the link_status variable then there could be garbage in there that would match the test below for link_info & ICE_AQ_LINK_UP, thus setting init_link_status to true after you just set it to false.
> + }
> +
> + if (link_status.link_info & ICE_AQ_LINK_UP)
> + pf->init_link_status = true;
> +}
> +
> static int
> ice_dev_start(struct rte_eth_dev *dev)
> {
> @@ -2717,6 +2739,8 @@ ice_dev_start(struct rte_eth_dev *dev)
> if (ret != ICE_SUCCESS)
> PMD_DRV_LOG(WARNING, "Fail to set phy mask");
>
> + ice_get_init_link_status(dev);
> +
> ice_dev_set_link_up(dev);
>
> /* Call get_link_info aq commond to enable/disable LSE */ diff --git
> a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index
> de67e59..27db4e7 100644
> --- a/drivers/net/ice/ice_ethdev.h
> +++ b/drivers/net/ice/ice_ethdev.h
> @@ -369,6 +369,7 @@ struct ice_pf {
> struct ice_parser_list rss_parser_list;
> struct ice_parser_list perm_parser_list;
> struct ice_parser_list dist_parser_list;
> + bool init_link_status;
> };
>
> #define ICE_MAX_QUEUE_NUM 2048
> --
> 2.9.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] net/ice: fix link status recovery
2019-11-04 15:02 ` Stillwell Jr, Paul M
@ 2019-11-05 2:40 ` Yang, Qiming
0 siblings, 0 replies; 4+ messages in thread
From: Yang, Qiming @ 2019-11-05 2:40 UTC (permalink / raw)
To: Stillwell Jr, Paul M, dev; +Cc: Lu, Wenzhuo, stable
Yes, I know this bug, will fix it in the next version.
-----Original Message-----
From: Stillwell Jr, Paul M
Sent: Monday, November 4, 2019 23:03
To: Yang, Qiming <qiming.yang@intel.com>; dev@dpdk.org
Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming <qiming.yang@intel.com>; stable@dpdk.org
Subject: RE: [dpdk-dev] [PATCH] net/ice: fix link status recovery
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Qiming Yang
> Sent: Sunday, November 3, 2019 9:40 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/ice: fix link status recovery
>
> This patch fix a kernel driver link status issue by recovering link
> status when device stop.
>
> Fixes: e6161345d8a9 ("net/ice: support link status change")
> Cc: stable@dpdk.org
>
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
> drivers/net/ice/ice_ethdev.c | 26 +++++++++++++++++++++++++-
> drivers/net/ice/ice_ethdev.h | 1 +
> 2 files changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ice/ice_ethdev.c
> b/drivers/net/ice/ice_ethdev.c index d746758..c9972cf 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -2277,7 +2277,10 @@ ice_dev_stop(struct rte_eth_dev *dev)
> /* Clear all queues and release mbufs */ ice_clear_queues(dev);
>
> -ice_dev_set_link_down(dev);
> +if (pf->init_link_status)
> +ice_dev_set_link_up(dev);
> +else
> +ice_dev_set_link_down(dev);
>
> /* Clean datapath event and queue/vec mapping */
> rte_intr_efd_disable(intr_handle);
> @@ -2648,6 +2651,25 @@ ice_rxq_intr_setup(struct rte_eth_dev *dev)
> return 0; }
>
> +static void ice_get_init_link_status(struct rte_eth_dev *dev) {
> +struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> +struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data-
> >dev_private);
> +bool enable_lse = dev->data->dev_conf.intr_conf.lsc ? true : false;
> +struct ice_link_status link_status; int ret;
> +
> +ret = ice_aq_get_link_info(hw->port_info, enable_lse,
> + &link_status, NULL);
> +if (ret != ICE_SUCCESS) {
> +PMD_DRV_LOG(ERR, "Failed to get link info");
> +pf->init_link_status = false;
You should probably just return here instead of continuing on. If the FW doesn't clear out the link_status variable then there could be garbage in there that would match the test below for link_info & ICE_AQ_LINK_UP, thus setting init_link_status to true after you just set it to false.
> +}
> +
> +if (link_status.link_info & ICE_AQ_LINK_UP)
> +pf->init_link_status = true;
> +}
> +
> static int
> ice_dev_start(struct rte_eth_dev *dev) { @@ -2717,6 +2739,8 @@
> ice_dev_start(struct rte_eth_dev *dev) if (ret != ICE_SUCCESS)
> PMD_DRV_LOG(WARNING, "Fail to set phy mask");
>
> +ice_get_init_link_status(dev);
> +
> ice_dev_set_link_up(dev);
>
> /* Call get_link_info aq commond to enable/disable LSE */ diff --git
> a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index
> de67e59..27db4e7 100644
> --- a/drivers/net/ice/ice_ethdev.h
> +++ b/drivers/net/ice/ice_ethdev.h
> @@ -369,6 +369,7 @@ struct ice_pf {
> struct ice_parser_list rss_parser_list; struct ice_parser_list
> perm_parser_list; struct ice_parser_list dist_parser_list;
> +bool init_link_status;
> };
>
> #define ICE_MAX_QUEUE_NUM 2048
> --
> 2.9.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH] net/ice: fix link status recovery
@ 2019-11-05 5:08 Qiming Yang
0 siblings, 0 replies; 4+ messages in thread
From: Qiming Yang @ 2019-11-05 5:08 UTC (permalink / raw)
To: dev; +Cc: wenzhuo.lu, paul.m.stillwell.jr, Qiming Yang, stable
This patch fix a kernel driver link status issue by recovering
link status when device stop.
Fixes: e6161345d8a9 ("net/ice: support link status change")
Cc: stable@dpdk.org
Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
drivers/net/ice/ice_ethdev.c | 26 +++++++++++++++++++++++++-
drivers/net/ice/ice_ethdev.h | 1 +
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index d746758..c9972cf 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2277,7 +2277,10 @@ ice_dev_stop(struct rte_eth_dev *dev)
/* Clear all queues and release mbufs */
ice_clear_queues(dev);
- ice_dev_set_link_down(dev);
+ if (pf->init_link_status)
+ ice_dev_set_link_up(dev);
+ else
+ ice_dev_set_link_down(dev);
/* Clean datapath event and queue/vec mapping */
rte_intr_efd_disable(intr_handle);
@@ -2648,6 +2651,25 @@ ice_rxq_intr_setup(struct rte_eth_dev *dev)
return 0;
}
+static void ice_get_init_link_status(struct rte_eth_dev *dev)
+{
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ bool enable_lse = dev->data->dev_conf.intr_conf.lsc ? true : false;
+ struct ice_link_status link_status;
+ int ret;
+
+ ret = ice_aq_get_link_info(hw->port_info, enable_lse,
+ &link_status, NULL);
+ if (ret != ICE_SUCCESS) {
+ PMD_DRV_LOG(ERR, "Failed to get link info");
+ pf->init_link_status = false;
+ }
+
+ if (link_status.link_info & ICE_AQ_LINK_UP)
+ pf->init_link_status = true;
+}
+
static int
ice_dev_start(struct rte_eth_dev *dev)
{
@@ -2717,6 +2739,8 @@ ice_dev_start(struct rte_eth_dev *dev)
if (ret != ICE_SUCCESS)
PMD_DRV_LOG(WARNING, "Fail to set phy mask");
+ ice_get_init_link_status(dev);
+
ice_dev_set_link_up(dev);
/* Call get_link_info aq commond to enable/disable LSE */
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index de67e59..27db4e7 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -369,6 +369,7 @@ struct ice_pf {
struct ice_parser_list rss_parser_list;
struct ice_parser_list perm_parser_list;
struct ice_parser_list dist_parser_list;
+ bool init_link_status;
};
#define ICE_MAX_QUEUE_NUM 2048
--
2.9.5
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-11-05 5:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04 5:40 [dpdk-dev] [PATCH] net/ice: fix link status recovery Qiming Yang
2019-11-04 15:02 ` Stillwell Jr, Paul M
2019-11-05 2:40 ` Yang, Qiming
2019-11-05 5:08 Qiming Yang
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).