From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Jiawen Wu <jiawenwu@trustnetic.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v7 19/19] net/ngbe: support to close and reset device
Date: Wed, 7 Jul 2021 17:12:43 +0300 [thread overview]
Message-ID: <b5195f94-7690-a781-dc1c-52c8ab8002e6@oktetlabs.ru> (raw)
In-Reply-To: <20210706095545.10776-20-jiawenwu@trustnetic.com>
On 7/6/21 12:55 PM, Jiawen Wu wrote:
> Support to close and reset device.
>
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> ---
> drivers/net/ngbe/ngbe_ethdev.c | 63 ++++++++++++++++++++++++++++++++--
> drivers/net/ngbe/ngbe_ethdev.h | 2 ++
> drivers/net/ngbe/ngbe_rxtx.c | 20 +++++++++++
> 3 files changed, 82 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c
> index 944fea6a11..1e3c11533b 100644
> --- a/drivers/net/ngbe/ngbe_ethdev.c
> +++ b/drivers/net/ngbe/ngbe_ethdev.c
> @@ -256,7 +256,7 @@ eth_ngbe_dev_uninit(struct rte_eth_dev *eth_dev)
>
> ngbe_dev_close(eth_dev);
>
> - return -EINVAL;
> + return 0;
> }
>
> static int
> @@ -557,11 +557,66 @@ ngbe_dev_stop(struct rte_eth_dev *dev)
> static int
> ngbe_dev_close(struct rte_eth_dev *dev)
> {
> + struct ngbe_hw *hw = ngbe_dev_hw(dev);
> + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
> + struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
> + int retries = 0;
> + int ret;
> +
> PMD_INIT_FUNC_TRACE();
>
> - RTE_SET_USED(dev);
> + ngbe_pf_reset_hw(hw);
> +
> + ret = ngbe_dev_stop(dev);
Is it OK that the ret ignored?
> +
> + ngbe_dev_free_queues(dev);
> +
> + /* reprogram the RAR[0] in case user changed it. */
> + ngbe_set_rar(hw, 0, hw->mac.addr, 0, true);
> +
> + /* Unlock any pending hardware semaphore */
> + ngbe_swfw_lock_reset(hw);
> +
> + /* disable uio intr before callback unregister */
> + rte_intr_disable(intr_handle);
> +
> + do {
> + ret = rte_intr_callback_unregister(intr_handle,
> + ngbe_dev_interrupt_handler, dev);
> + if (ret >= 0 || ret == -ENOENT) {
> + break;
> + } else if (ret != -EAGAIN) {
> + PMD_INIT_LOG(ERR,
> + "intr callback unregister failed: %d",
> + ret);
> + }
> + rte_delay_ms(100);
> + } while (retries++ < (10 + NGBE_LINK_UP_TIME));
> +
> + rte_free(dev->data->mac_addrs);
> + dev->data->mac_addrs = NULL;
> +
> + rte_free(dev->data->hash_mac_addrs);
> + dev->data->hash_mac_addrs = NULL;
> +
> + return ret;
> +}
> +
> +/*
> + * Reset PF device.
> + */
> +static int
> +ngbe_dev_reset(struct rte_eth_dev *dev)
> +{
> + int ret;
> +
> + ret = eth_ngbe_dev_uninit(dev);
> + if (ret)
Compare vs 0
[snip]
next prev parent reply other threads:[~2021-07-07 14:12 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-06 9:55 [dpdk-dev] [PATCH v7 00/19] net: ngbe PMD Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 01/19] net/ngbe: add build and doc infrastructure Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 02/19] net/ngbe: support probe and remove Jiawen Wu
2021-07-07 13:48 ` Andrew Rybchenko
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 03/19] net/ngbe: add log type and error type Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 04/19] net/ngbe: define registers Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 05/19] net/ngbe: set MAC type and LAN ID with device initialization Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 06/19] net/ngbe: init and validate EEPROM Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 07/19] net/ngbe: add HW initialization Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 08/19] net/ngbe: identify PHY and reset PHY Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 09/19] net/ngbe: store MAC address Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 10/19] net/ngbe: support link update Jiawen Wu
2021-07-07 13:50 ` Andrew Rybchenko
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 11/19] net/ngbe: setup the check PHY link Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 12/19] net/ngbe: add Rx queue setup and release Jiawen Wu
2021-07-07 13:56 ` Andrew Rybchenko
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 13/19] net/ngbe: add Tx " Jiawen Wu
2021-07-07 14:00 ` Andrew Rybchenko
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 14/19] net/ngbe: add device start and stop operations Jiawen Wu
2021-07-07 14:04 ` Andrew Rybchenko
2021-07-08 6:09 ` Jiawen Wu
2021-07-08 7:36 ` Andrew Rybchenko
2021-07-08 7:50 ` Jiawen Wu
2021-07-08 8:07 ` Andrew Rybchenko
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 15/19] net/ngbe: add Tx queue start and stop Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 16/19] net/ngbe: add Rx " Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 17/19] net/ngbe: add simple Rx flow Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 18/19] net/ngbe: add simple Tx flow Jiawen Wu
2021-07-06 9:55 ` [dpdk-dev] [PATCH v7 19/19] net/ngbe: support to close and reset device Jiawen Wu
2021-07-07 14:12 ` Andrew Rybchenko [this message]
2021-07-08 8:56 ` Jiawen Wu
2021-07-07 14:13 ` [dpdk-dev] [PATCH v7 00/19] net: ngbe PMD Andrew Rybchenko
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=b5195f94-7690-a781-dc1c-52c8ab8002e6@oktetlabs.ru \
--to=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=jiawenwu@trustnetic.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).