[v2] net/iavf: enable port reset

Message ID 20200401071214.109641-1-lunyuanx.cui@intel.com (mailing list archive)
State Accepted, archived
Delegated to: xiaolong ye
Headers
Series [v2] net/iavf: enable port reset |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance fail Performance Testing issues
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Cui, LunyuanX April 1, 2020, 7:12 a.m. UTC
  This patch is intended to add iavf_dev_reset ops, enable iavf to support
"port reset all".

Signed-off-by: Lunyuan Cui <lunyuanx.cui@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
  

Comments

Chen, Zhaoyan April 7, 2020, 1:37 a.m. UTC | #1
Tested-by: Chen, Zhaoyan <zhaoyan.chen@intel.com>

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Lunyuan Cui
> Sent: Wednesday, April 1, 2020 3:12 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Cui, LunyuanX <lunyuanx.cui@intel.com>
> Subject: [dpdk-dev] [PATCH v2] net/iavf: enable port reset
> 
> This patch is intended to add iavf_dev_reset ops, enable iavf to support
> "port reset all".
> 
> Signed-off-by: Lunyuan Cui <lunyuanx.cui@intel.com>
> Acked-by: Jingjing Wu <jingjing.wu@intel.com>
> ---
>  drivers/net/iavf/iavf_ethdev.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index 7a8bec9c9..382530a43 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -32,6 +32,7 @@ static int iavf_dev_configure(struct rte_eth_dev
> *dev);  static int iavf_dev_start(struct rte_eth_dev *dev);  static void
> iavf_dev_stop(struct rte_eth_dev *dev);  static void iavf_dev_close(struct
> rte_eth_dev *dev);
> +static int iavf_dev_reset(struct rte_eth_dev *dev);
>  static int iavf_dev_info_get(struct rte_eth_dev *dev,
>  			     struct rte_eth_dev_info *dev_info);  static
> const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev);
> @@ -91,6 +92,7 @@ static const struct eth_dev_ops iavf_eth_dev_ops = {
>  	.dev_start                  = iavf_dev_start,
>  	.dev_stop                   = iavf_dev_stop,
>  	.dev_close                  = iavf_dev_close,
> +	.dev_reset                  = iavf_dev_reset,
>  	.dev_infos_get              = iavf_dev_info_get,
>  	.dev_supported_ptypes_get   = iavf_dev_supported_ptypes_get,
>  	.link_update                = iavf_dev_link_update,
> @@ -1419,6 +1421,21 @@ iavf_dev_uninit(struct rte_eth_dev *dev)
>  	return 0;
>  }
> 
> +/*
> + * Reset VF device only to re-initialize resources in PMD layer  */
> +static int iavf_dev_reset(struct rte_eth_dev *dev) {
> +	int ret;
> +
> +	ret = iavf_dev_uninit(dev);
> +	if (ret)
> +		return ret;
> +
> +	return iavf_dev_init(dev);
> +}
> +
>  static int
>  iavf_dcf_cap_check_handler(__rte_unused const char *key,
>  			   const char *value, __rte_unused void *opaque)
> --
> 2.17.1
  
Xiaolong Ye April 8, 2020, 6:47 a.m. UTC | #2
On 04/01, Lunyuan Cui wrote:
>This patch is intended to add iavf_dev_reset ops, enable iavf to support
>"port reset all".
>
>Signed-off-by: Lunyuan Cui <lunyuanx.cui@intel.com>
>Acked-by: Jingjing Wu <jingjing.wu@intel.com>
>---
> drivers/net/iavf/iavf_ethdev.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
>diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
>index 7a8bec9c9..382530a43 100644
>--- a/drivers/net/iavf/iavf_ethdev.c
>+++ b/drivers/net/iavf/iavf_ethdev.c
>@@ -32,6 +32,7 @@ static int iavf_dev_configure(struct rte_eth_dev *dev);
> static int iavf_dev_start(struct rte_eth_dev *dev);
> static void iavf_dev_stop(struct rte_eth_dev *dev);
> static void iavf_dev_close(struct rte_eth_dev *dev);
>+static int iavf_dev_reset(struct rte_eth_dev *dev);
> static int iavf_dev_info_get(struct rte_eth_dev *dev,
> 			     struct rte_eth_dev_info *dev_info);
> static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev);
>@@ -91,6 +92,7 @@ static const struct eth_dev_ops iavf_eth_dev_ops = {
> 	.dev_start                  = iavf_dev_start,
> 	.dev_stop                   = iavf_dev_stop,
> 	.dev_close                  = iavf_dev_close,
>+	.dev_reset                  = iavf_dev_reset,
> 	.dev_infos_get              = iavf_dev_info_get,
> 	.dev_supported_ptypes_get   = iavf_dev_supported_ptypes_get,
> 	.link_update                = iavf_dev_link_update,
>@@ -1419,6 +1421,21 @@ iavf_dev_uninit(struct rte_eth_dev *dev)
> 	return 0;
> }
> 
>+/*
>+ * Reset VF device only to re-initialize resources in PMD layer
>+ */
>+static int
>+iavf_dev_reset(struct rte_eth_dev *dev)
>+{
>+	int ret;
>+
>+	ret = iavf_dev_uninit(dev);
>+	if (ret)
>+		return ret;
>+
>+	return iavf_dev_init(dev);
>+}
>+
> static int
> iavf_dcf_cap_check_handler(__rte_unused const char *key,
> 			   const char *value, __rte_unused void *opaque)
>-- 
>2.17.1
>

Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>

Applied to dpdk-next-net-intel, Thanks.
  

Patch

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 7a8bec9c9..382530a43 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -32,6 +32,7 @@  static int iavf_dev_configure(struct rte_eth_dev *dev);
 static int iavf_dev_start(struct rte_eth_dev *dev);
 static void iavf_dev_stop(struct rte_eth_dev *dev);
 static void iavf_dev_close(struct rte_eth_dev *dev);
+static int iavf_dev_reset(struct rte_eth_dev *dev);
 static int iavf_dev_info_get(struct rte_eth_dev *dev,
 			     struct rte_eth_dev_info *dev_info);
 static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -91,6 +92,7 @@  static const struct eth_dev_ops iavf_eth_dev_ops = {
 	.dev_start                  = iavf_dev_start,
 	.dev_stop                   = iavf_dev_stop,
 	.dev_close                  = iavf_dev_close,
+	.dev_reset                  = iavf_dev_reset,
 	.dev_infos_get              = iavf_dev_info_get,
 	.dev_supported_ptypes_get   = iavf_dev_supported_ptypes_get,
 	.link_update                = iavf_dev_link_update,
@@ -1419,6 +1421,21 @@  iavf_dev_uninit(struct rte_eth_dev *dev)
 	return 0;
 }
 
+/*
+ * Reset VF device only to re-initialize resources in PMD layer
+ */
+static int
+iavf_dev_reset(struct rte_eth_dev *dev)
+{
+	int ret;
+
+	ret = iavf_dev_uninit(dev);
+	if (ret)
+		return ret;
+
+	return iavf_dev_init(dev);
+}
+
 static int
 iavf_dcf_cap_check_handler(__rte_unused const char *key,
 			   const char *value, __rte_unused void *opaque)