DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Wenzhuo Lu <wenzhuo.lu@intel.com>
Cc: <dev@dpdk.org>, <konstantin.ananyev@intel.com>,
	<bruce.richardson@intel.com>, <jing.d.chen@intel.com>,
	<cunming.liang@intel.com>, <jingjing.wu@intel.com>,
	<helin.zhang@intel.com>, <thomas.monjalon@6wind.com>
Subject: Re: [dpdk-dev] [PATCH v6 1/4] lib/librte_ether: support device reset
Date: Mon, 20 Jun 2016 14:44:11 +0530	[thread overview]
Message-ID: <20160620091410.GA9323@localhost.localdomain> (raw)
In-Reply-To: <1466403870-6840-2-git-send-email-wenzhuo.lu@intel.com>

On Mon, Jun 20, 2016 at 02:24:27PM +0800, Wenzhuo Lu wrote:
> Add an API to reset the device.
> It's for VF device in this scenario, kernel PF + DPDK VF.
> When the PF port down->up, APP should call this API to
> reset VF port. Most likely, APP should call it in its
> management thread and guarantee the thread safe. It means
> APP should stop the rx/tx and the device, then reset the
> device, then recover the device and rx/tx.

Following is _a_ use-case for Device reset. But may be not be _the_ use
case. IMO, We need to first say expected behavior of this API and add a use-case
later.

Other use-case would be, PCIe VF with functional level reset for SRIOV
migration.
Are we on same page?

> 
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> ---
>  doc/guides/nics/overview.rst           |  1 +
>  lib/librte_ether/rte_ethdev.c          | 17 +++++++++++++++++
>  lib/librte_ether/rte_ethdev.h          | 24 ++++++++++++++++++++++++
>  lib/librte_ether/rte_ether_version.map |  7 +++++++
>  4 files changed, 49 insertions(+)
> 
> diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst
> index 0bd8fae..c8a4985 100644
> --- a/doc/guides/nics/overview.rst
> +++ b/doc/guides/nics/overview.rst
> @@ -89,6 +89,7 @@ Most of these differences are summarized below.
>     Speed capabilities
>     Link status            Y Y   Y Y   Y Y Y     Y   Y Y Y Y         Y Y         Y Y   Y Y Y Y
>     Link status event      Y Y     Y     Y Y     Y   Y Y             Y Y         Y Y     Y
> +   Link reset                               Y Y   Y     Y Y

More appropriate would be "Device reset" ? Right?

>     Queue status event                                                                   Y
>     Rx interrupt                   Y     Y Y Y Y Y Y Y Y Y Y Y Y Y Y
>     Queue start/stop             Y   Y Y Y Y Y Y     Y Y     Y Y Y Y Y Y               Y   Y Y
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index e148028..6c0449b 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -3346,3 +3346,20 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
>  				-ENOTSUP);
>  	return (*dev->dev_ops->l2_tunnel_offload_set)(dev, l2_tunnel, mask, en);
>  }
> +
> +int
> +rte_eth_dev_reset(uint8_t port_id)
> +{
> +	struct rte_eth_dev *dev;
> +	int diag;
> +
> +	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> +
> +	dev = &rte_eth_devices[port_id];
> +
> +	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP);
> +
> +	diag = (*dev->dev_ops->dev_reset)(dev);
> +
> +	return diag;
> +}
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 2757510..5b3ba12 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -1318,6 +1318,9 @@ typedef int (*eth_l2_tunnel_offload_set_t)
>  	 uint8_t en);
>  /**< @internal enable/disable the l2 tunnel offload functions */
>  
> +typedef int  (*eth_dev_reset_t)(struct rte_eth_dev *dev);
> +/**< @internal Function used to reset a configured Ethernet device. */
> +
>  #ifdef RTE_NIC_BYPASS
>  
>  enum {
> @@ -1508,6 +1511,8 @@ struct eth_dev_ops {
>  	eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf;
>  	/** Enable/disable l2 tunnel offload functions */
>  	eth_l2_tunnel_offload_set_t l2_tunnel_offload_set;
> +	/** Reset device. */
> +	eth_dev_reset_t dev_reset;
>  };
>  
>  /**
> @@ -4253,6 +4258,25 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
>  				  uint32_t mask,
>  				  uint8_t en);
>  
> +/**
> + * Reset an ethernet device when it's not working. One scenario is, after PF
> + * port is down and up, the related VF port should be reset.
> + * The API will stop the port, clear the rx/tx queues, re-setup the rx/tx
> + * queues, restart the port.
> + * Before calling this API, APP should stop the rx/tx. When tx is being stopped,
> + * APP can drop the packets and release the buffer instead of sending them.

Same as first comment.

> + *
> + * @param port_id
> + *   The port identifier of the Ethernet device.
> + *
> + * @return
> + *   - (0) if successful.
> + *   - (-ENODEV) if port identifier is invalid.
> + *   - (-ENOTSUP) if hardware doesn't support this function.
> + */
> +int
> +rte_eth_dev_reset(uint8_t port_id);
> +
>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
> index 214ecc7..c34207e 100644
> --- a/lib/librte_ether/rte_ether_version.map
> +++ b/lib/librte_ether/rte_ether_version.map
> @@ -132,3 +132,10 @@ DPDK_16.04 {
>  	rte_eth_tx_buffer_set_err_callback;
>  
>  } DPDK_2.2;
> +
> +DPDK_16.07 {
> +	global:
> +
> +	rte_eth_dev_reset;
> +
> +} DPDK_16.04;
> -- 
> 1.9.3
> 

  reply	other threads:[~2016-06-20  9:14 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06  5:40 [dpdk-dev] [PATCH 0/8] support reset of VF link Wenzhuo Lu
2016-06-06  5:40 ` [dpdk-dev] [PATCH 1/8] lib/librte_ether: support device reset Wenzhuo Lu
2016-06-06  5:40 ` [dpdk-dev] [PATCH 2/8] lib/librte_ether: defind RX/TX lock mode Wenzhuo Lu
2016-06-08  2:15   ` Stephen Hemminger
2016-06-08  7:34     ` Lu, Wenzhuo
2016-06-09  7:50       ` Olivier Matz
2016-06-12  5:25         ` Lu, Wenzhuo
2016-06-10 18:12       ` Stephen Hemminger
2016-06-12  5:27         ` Lu, Wenzhuo
2016-06-06  5:40 ` [dpdk-dev] [PATCH 3/8] ixgbe: RX/TX with lock on VF Wenzhuo Lu
2016-06-06  5:40 ` [dpdk-dev] [PATCH 4/8] ixgbe: implement device reset " Wenzhuo Lu
2016-06-06  5:40 ` [dpdk-dev] [PATCH 5/8] igb: RX/TX with lock " Wenzhuo Lu
2016-06-06  5:40 ` [dpdk-dev] [PATCH 6/8] igb: implement device reset " Wenzhuo Lu
2016-06-06  5:40 ` [dpdk-dev] [PATCH 7/8] i40e:RX/TX with lock " Wenzhuo Lu
2016-06-06  5:40 ` [dpdk-dev] [PATCH 8/8] i40e: implement device reset " Wenzhuo Lu
2016-06-15  3:03 ` [dpdk-dev] [PATCH v5 0/4] support reset of VF link Wenzhuo Lu
2016-06-15  3:03   ` [dpdk-dev] [PATCH v5 1/4] lib/librte_ether: support device reset Wenzhuo Lu
2016-06-16 15:31     ` Bruce Richardson
2016-06-16 15:36     ` Thomas Monjalon
2016-06-15  3:03   ` [dpdk-dev] [PATCH v5 2/4] ixgbe: implement device reset on VF Wenzhuo Lu
2016-06-15  3:03   ` [dpdk-dev] [PATCH v5 3/4] igb: " Wenzhuo Lu
2016-06-15  3:03   ` [dpdk-dev] [PATCH v5 4/4] i40e: " Wenzhuo Lu
2016-06-20  6:24 ` [dpdk-dev] [PATCH v6 0/4] support reset of VF link Wenzhuo Lu
2016-06-20  6:24   ` [dpdk-dev] [PATCH v6 1/4] lib/librte_ether: support device reset Wenzhuo Lu
2016-06-20  9:14     ` Jerin Jacob [this message]
2016-06-20 16:17       ` Stephen Hemminger
2016-06-21  3:51         ` Jerin Jacob
2016-06-21  6:14           ` Lu, Wenzhuo
2016-06-21  7:37             ` Jerin Jacob
2016-06-21  8:24               ` Lu, Wenzhuo
2016-06-21  8:55                 ` Jerin Jacob
2016-06-21  9:26                   ` Ananyev, Konstantin
2016-06-21 10:57                     ` Jerin Jacob
2016-06-21 13:10                       ` Ananyev, Konstantin
2016-06-21 13:30                         ` Jerin Jacob
2016-06-21 14:03                           ` Ananyev, Konstantin
2016-06-21 14:29                             ` Jerin Jacob
2016-06-22  1:35                               ` Lu, Wenzhuo
2016-06-22  2:37                                 ` Jerin Jacob
2016-06-22  3:32                                   ` Lu, Wenzhuo
2016-06-22  4:14                                     ` Jerin Jacob
2016-06-22  5:05                                       ` Lu, Wenzhuo
2016-06-22  6:10                                         ` Jerin Jacob
2016-06-22  6:42                                           ` Lu, Wenzhuo
2016-06-22  7:59                                             ` Jerin Jacob
2016-06-22  8:17                                               ` Thomas Monjalon
2016-06-22  8:25                                                 ` Lu, Wenzhuo
2016-06-22  9:18                                                   ` Thomas Monjalon
2016-06-22 11:06                                                     ` Jerin Jacob
2016-06-23  0:45                                                       ` Lu, Wenzhuo
2016-06-23  0:39                                                     ` Lu, Wenzhuo
2016-06-21  0:51       ` Lu, Wenzhuo
2016-06-20  6:24   ` [dpdk-dev] [PATCH v6 2/4] ixgbe: implement device reset on VF Wenzhuo Lu
2016-06-20  6:24   ` [dpdk-dev] [PATCH v6 3/4] igb: " Wenzhuo Lu
2016-06-20  6:24   ` [dpdk-dev] [PATCH v6 4/4] i40e: " Wenzhuo Lu
2016-07-04 15:48   ` [dpdk-dev] [PATCH v6 0/4] support reset of VF link Luca Boccassi
2016-07-05  0:52     ` Lu, Wenzhuo
2016-07-05  9:52       ` Luca Boccassi
2016-07-06  0:45         ` Lu, Wenzhuo
2016-07-06 16:26           ` Luca Boccassi
     [not found]           ` <1467822182.32466.34.camel@brocade.com>
2016-07-07  1:09             ` Lu, Wenzhuo
2016-07-07 10:20               ` Luca Boccassi
2016-07-07 13:12                 ` Lu, Wenzhuo
2016-07-07 16:19                   ` Luca Boccassi
2016-07-08  0:14                     ` Lu, Wenzhuo
2016-07-08 17:15                       ` Luca Boccassi
2016-07-11  1:32                         ` Lu, Wenzhuo
2016-07-11 12:02                           ` Luca Boccassi
2016-07-11 15:43                             ` Luca Boccassi
2016-07-12  1:19                               ` Lu, Wenzhuo
2016-08-26 12:58                               ` Luca Boccassi
2016-08-29  1:04                                 ` Lu, Wenzhuo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160620091410.GA9323@localhost.localdomain \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=bruce.richardson@intel.com \
    --cc=cunming.liang@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=jing.d.chen@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=thomas.monjalon@6wind.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).