[dpdk-dev,7/7] net/i40e: add support of restoration

Message ID 1495873329-43303-8-git-send-email-wei.dai@intel.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Wei Dai May 27, 2017, 8:22 a.m. UTC
  export dev_uninit and dev_init for restoration to
reset port but keep same port id.

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c    | 2 ++
 drivers/net/i40e/i40e_ethdev_vf.c | 5 +++++
 2 files changed, 7 insertions(+)
  

Comments

Jingjing Wu June 7, 2017, 7:50 a.m. UTC | #1
> -----Original Message-----
> From: Dai, Wei
> Sent: Saturday, May 27, 2017 4:22 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Zhang, Helin <helin.zhang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; Dai, Wei <wei.dai@intel.com>
> Subject: [PATCH 7/7] net/i40e: add support of restoration
> 
> export dev_uninit and dev_init for restoration to
> reset port but keep same port id.
> 
> Signed-off-by: Wei Dai <wei.dai@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c    | 2 ++
>  drivers/net/i40e/i40e_ethdev_vf.c | 5 +++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 4c49673..9512ca4 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -449,6 +449,8 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
>  	.dev_start                    = i40e_dev_start,
>  	.dev_stop                     = i40e_dev_stop,
>  	.dev_close                    = i40e_dev_close,
> +	.dev_init                     = eth_i40e_dev_init,
> +	.dev_uninit                   = eth_i40e_dev_uninit,
>  	.promiscuous_enable           = i40e_dev_promiscuous_enable,
>  	.promiscuous_disable          = i40e_dev_promiscuous_disable,
>  	.allmulticast_enable          = i40e_dev_allmulticast_enable,


you can just get int and unint func point by eth_dev->driver.eth_dev_init and eth_dev->driver.eth_dev_init

No need to define ops here.
  
Wei Dai June 20, 2017, 7:55 a.m. UTC | #2
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Wednesday, June 7, 2017 3:50 PM
> To: Dai, Wei <wei.dai@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>;
> Ananyev, Konstantin <konstantin.ananyev@intel.com>; Zhang, Helin
> <helin.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH 7/7] net/i40e: add support of restoration
> 
> 
> 
> > -----Original Message-----
> > From: Dai, Wei
> > Sent: Saturday, May 27, 2017 4:22 PM
> > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Ananyev, Konstantin
> > <konstantin.ananyev@intel.com>; Zhang, Helin <helin.zhang@intel.com>;
> > Wu, Jingjing <jingjing.wu@intel.com>
> > Cc: dev@dpdk.org; Dai, Wei <wei.dai@intel.com>
> > Subject: [PATCH 7/7] net/i40e: add support of restoration
> >
> > export dev_uninit and dev_init for restoration to reset port but keep
> > same port id.
> >
> > Signed-off-by: Wei Dai <wei.dai@intel.com>
> > ---
> >  drivers/net/i40e/i40e_ethdev.c    | 2 ++
> >  drivers/net/i40e/i40e_ethdev_vf.c | 5 +++++
> >  2 files changed, 7 insertions(+)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > b/drivers/net/i40e/i40e_ethdev.c index 4c49673..9512ca4 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -449,6 +449,8 @@ static const struct eth_dev_ops i40e_eth_dev_ops =
> {
> >  	.dev_start                    = i40e_dev_start,
> >  	.dev_stop                     = i40e_dev_stop,
> >  	.dev_close                    = i40e_dev_close,
> > +	.dev_init                     = eth_i40e_dev_init,
> > +	.dev_uninit                   = eth_i40e_dev_uninit,
> >  	.promiscuous_enable           = i40e_dev_promiscuous_enable,
> >  	.promiscuous_disable          = i40e_dev_promiscuous_disable,
> >  	.allmulticast_enable          = i40e_dev_allmulticast_enable,
> 
> 
> you can just get int and unint func point by eth_dev->driver.eth_dev_init and
> eth_dev->driver.eth_dev_init
> 
> No need to define ops here.

I'm sorry that struct rte_eth_dev doesn't have member driver.
The struct rte_eth_dev_data, struct rte_pci_device and struct rte_pci_device don't have
Any member to refer dev_init() and dev_uninit.
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4c49673..9512ca4 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -449,6 +449,8 @@  static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.dev_start                    = i40e_dev_start,
 	.dev_stop                     = i40e_dev_stop,
 	.dev_close                    = i40e_dev_close,
+	.dev_init                     = eth_i40e_dev_init,
+	.dev_uninit                   = eth_i40e_dev_uninit,
 	.promiscuous_enable           = i40e_dev_promiscuous_enable,
 	.promiscuous_disable          = i40e_dev_promiscuous_disable,
 	.allmulticast_enable          = i40e_dev_allmulticast_enable,
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 859b5e8..9405888 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -163,6 +163,9 @@  static void i40evf_handle_pf_event(__rte_unused struct rte_eth_dev *dev,
 				   uint8_t *msg,
 				   uint16_t msglen);
 
+static int i40evf_dev_init(struct rte_eth_dev *eth_dev);
+static int i40evf_dev_uninit(struct rte_eth_dev *eth_dev);
+
 /* Default hash key buffer for RSS */
 static uint32_t rss_key_default[I40E_VFQF_HKEY_MAX_INDEX + 1];
 
@@ -194,6 +197,8 @@  static const struct eth_dev_ops i40evf_eth_dev_ops = {
 	.dev_configure        = i40evf_dev_configure,
 	.dev_start            = i40evf_dev_start,
 	.dev_stop             = i40evf_dev_stop,
+	.dev_init             = i40evf_dev_init,
+	.dev_uninit           = i40evf_dev_uninit,
 	.promiscuous_enable   = i40evf_dev_promiscuous_enable,
 	.promiscuous_disable  = i40evf_dev_promiscuous_disable,
 	.allmulticast_enable  = i40evf_dev_allmulticast_enable,