DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Iremonger, Bernard" <bernard.iremonger@intel.com>
To: "Qiu, Michael" <michael.qiu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "He, Shaopeng" <shaopeng.he@intel.com>
Subject: Re: [dpdk-dev] [PATCH 2/2 v2] fm10k: Add hotplug support for fm10k
Date: Thu, 18 Jun 2015 16:42:09 +0000	[thread overview]
Message-ID: <8CEF83825BEC744B83065625E567D7C204A37E29@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <1434530691-16242-1-git-send-email-michael.qiu@intel.com>

> -----Original Message-----
> From: Qiu, Michael
> Sent: Wednesday, June 17, 2015 9:45 AM
> To: dev@dpdk.org
> Cc: Chen, Jing D; Iremonger, Bernard; He, Shaopeng; Qiu, Michael
> Subject: [PATCH 2/2 v2] fm10k: Add hotplug support for fm10k
> 
> Add hotplug support for fm10k.
> 
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>

Hi Michael,

There is one comment inline.

> ---
>  drivers/net/fm10k/fm10k_ethdev.c | 97
> +++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 96 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> b/drivers/net/fm10k/fm10k_ethdev.c
> index e310698..0d3eaf1 100644
> --- a/drivers/net/fm10k/fm10k_ethdev.c
> +++ b/drivers/net/fm10k/fm10k_ethdev.c
> @@ -1412,6 +1412,36 @@ fm10k_dev_enable_intr_pf(struct rte_eth_dev
> *dev)  }
> 
>  static void
> +fm10k_dev_disable_intr_pf(struct rte_eth_dev *dev) {
> +	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> +	uint32_t int_map = FM10K_INT_MAP_DISABLE;
> +
> +	int_map |= 0;
> +
> +	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_Mailbox),
> int_map);
> +	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_PCIeFault),
> int_map);
> +	FM10K_WRITE_REG(hw,
> FM10K_INT_MAP(fm10k_int_SwitchUpDown), int_map);
> +	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SwitchEvent),
> int_map);
> +	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SRAM),
> int_map);
> +	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_VFLR),
> int_map);
> +
> +	/* Disable misc causes */
> +	FM10K_WRITE_REG(hw, FM10K_EIMR,
> FM10K_EIMR_DISABLE(PCA_FAULT) |
> +				FM10K_EIMR_DISABLE(THI_FAULT) |
> +				FM10K_EIMR_DISABLE(FUM_FAULT) |
> +				FM10K_EIMR_DISABLE(MAILBOX) |
> +				FM10K_EIMR_DISABLE(SWITCHREADY) |
> +				FM10K_EIMR_DISABLE(SWITCHNOTREADY) |
> +				FM10K_EIMR_DISABLE(SRAMERROR) |
> +				FM10K_EIMR_DISABLE(VFLR));
> +
> +	/* Disable ITR 0 */
> +	FM10K_WRITE_REG(hw, FM10K_ITR(0), FM10K_ITR_MASK_SET);
> +	FM10K_WRITE_FLUSH(hw);
> +}
> +
> +static void
>  fm10k_dev_enable_intr_vf(struct rte_eth_dev *dev)  {
>  	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> @@ -1429,6 +1459,22 @@ fm10k_dev_enable_intr_vf(struct rte_eth_dev
> *dev)
>  	FM10K_WRITE_FLUSH(hw);
>  }
> 
> +static void
> +fm10k_dev_disable_intr_vf(struct rte_eth_dev *dev) {
> +	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> +	uint32_t int_map = FM10K_INT_MAP_DISABLE;
> +
> +	int_map |= 0;
> +
> +	/* Only INT 0 available, other 15 are reserved. */
> +	FM10K_WRITE_REG(hw, FM10K_VFINT_MAP, int_map);
> +
> +	/* Disable ITR 0 */
> +	FM10K_WRITE_REG(hw, FM10K_VFITR(0), FM10K_ITR_MASK_SET);
> +	FM10K_WRITE_FLUSH(hw);
> +}
> +
>  static int
>  fm10k_dev_handle_fault(struct fm10k_hw *hw, uint32_t eicr)  { @@ -
> 1858,6 +1904,54 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
>  	return 0;
>  }
> 
> +static int
> +eth_fm10k_dev_uninit(struct rte_eth_dev *dev) {
> +	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> +
> +	PMD_INIT_FUNC_TRACE();
> +
> +	/* only uninitialize in the primary process */
> +	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> +		return 0;
> +
> +	/* safe to close dev here */

Should a flag be added so as not to call fm10k_dev_close() if it has been called already ?

Regards,

Bernard.

> +	fm10k_dev_close(dev);
> +
> +	dev->dev_ops = NULL;
> +	dev->rx_pkt_burst = NULL;
> +	dev->tx_pkt_burst = NULL;
> +
> +	/* disable uio/vfio intr */
> +	rte_intr_disable(&(dev->pci_dev->intr_handle));
> +
> +	/*PF/VF has different interrupt handling mechanism */
> +	if (hw->mac.type == fm10k_mac_pf) {
> +		/* disable interrupt */
> +		fm10k_dev_disable_intr_pf(dev);
> +
> +		/* unregister callback func to eal lib */
> +		rte_intr_callback_unregister(&(dev->pci_dev->intr_handle),
> +			fm10k_dev_interrupt_handler_pf, (void *)dev);
> +	} else {
> +		/* disable interrupt */
> +		fm10k_dev_disable_intr_vf(dev);
> +
> +		rte_intr_callback_unregister(&(dev->pci_dev->intr_handle),
> +			fm10k_dev_interrupt_handler_vf, (void *)dev);
> +	}
> +
> +	/* free mac memory */
> +	if (dev->data->mac_addrs) {
> +		rte_free(dev->data->mac_addrs);
> +		dev->data->mac_addrs = NULL;
> +	}
> +
> +	memset(hw, 0, sizeof(*hw));
> +
> +	return 0;
> +}
> +
>  /*
>   * The set of PCI devices this driver supports. This driver will enable both PF
>   * and SRIOV-VF devices.
> @@ -1873,9 +1967,10 @@ static struct eth_driver rte_pmd_fm10k = {
>  	{
>  		.name = "rte_pmd_fm10k",
>  		.id_table = pci_id_fm10k_map,
> -		.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
> +		.drv_flags = RTE_PCI_DRV_NEED_MAPPING |
> RTE_PCI_DRV_DETACHABLE,
>  	},
>  	.eth_dev_init = eth_fm10k_dev_init,
> +	.eth_dev_uninit = eth_fm10k_dev_uninit,
>  	.dev_private_size = sizeof(struct fm10k_adapter),  };
> 
> --
> 1.9.3

  reply	other threads:[~2015-06-18 16:42 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-31 14:37 [dpdk-dev] [RFC PATCH] librte_pmd_fm10k: " Michael Qiu
2015-06-02  8:26 ` Iremonger, Bernard
2015-06-02  9:36   ` Qiu, Michael
2015-06-10 12:21 ` [dpdk-dev] [PATCH 0/2 v2] Enable " Michael Qiu
2015-06-10 12:21   ` [dpdk-dev] [PATCH 1/2] fm10k: Free queues when close port Michael Qiu
2015-06-12  7:27     ` Chen, Jing D
2015-06-17  7:59     ` [dpdk-dev] [PATCH 1/2 v2] " Michael Qiu
2015-06-18  7:32       ` Chen, Jing D
2015-06-18 16:29       ` Iremonger, Bernard
2015-06-19  7:36         ` Qiu, Michael
2015-06-17  8:44     ` [dpdk-dev] [PATCH 2/2 v2] fm10k: Add hotplug support for fm10k Michael Qiu
2015-06-18 16:42       ` Iremonger, Bernard [this message]
2015-06-19  7:41         ` Qiu, Michael
2015-06-10 12:21   ` [dpdk-dev] [PATCH 2/2] " Michael Qiu
2015-06-10 12:24   ` [dpdk-dev] [PATCH 0/2 v2] Enable " Qiu, Michael
2015-06-19  8:31   ` [dpdk-dev] [PATCH 0/2 v3] " Michael Qiu
2015-06-19  8:31     ` [dpdk-dev] [PATCH 1/2 v3] fm10k: Free queues when close port Michael Qiu
2015-06-19  8:31     ` [dpdk-dev] [PATCH 2/2 v2] fm10k: Add hotplug support for fm10k Michael Qiu
2015-06-19  8:36       ` Qiu, Michael
2015-06-26  8:29     ` [dpdk-dev] [PATCH 0/2 v4] Enable " Michael Qiu
2015-06-26  8:29       ` [dpdk-dev] [PATCH 1/2 v4] fm10k: Free queues when close port Michael Qiu
2015-06-26 11:02         ` Iremonger, Bernard
2015-06-29  8:17           ` Qiu, Michael
2015-06-29  8:57             ` Iremonger, Bernard
2015-06-29  9:20               ` Qiu, Michael
2015-06-29  9:53                 ` Iremonger, Bernard
2015-06-29 14:58                   ` Qiu, Michael
2015-06-29 15:15                     ` Qiu, Michael
2015-06-29 11:08                 ` Ananyev, Konstantin
2015-06-29 15:14                   ` Qiu, Michael
2015-06-26  8:29       ` [dpdk-dev] [PATCH 2/2 v4] fm10k: Add hotplug support for fm10k Michael Qiu
2015-07-14 12:45       ` [dpdk-dev] [PATCH 0/2 v5] Enable " Michael Qiu
2015-07-14 12:45         ` [dpdk-dev] [PATCH 1/2 v5] fm10k: Free queues when close port Michael Qiu
2015-07-14 12:45         ` [dpdk-dev] [PATCH 2/2 v5] fm10k: Add hotplug support for fm10k Michael Qiu
2015-07-19 20:26         ` [dpdk-dev] [PATCH 0/2 v5] Enable " Thomas Monjalon

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=8CEF83825BEC744B83065625E567D7C204A37E29@IRSMSX108.ger.corp.intel.com \
    --to=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=michael.qiu@intel.com \
    --cc=shaopeng.he@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).