* [dpdk-dev] [RFC PATCH] librte_pmd_ixgbe: changes to support PCI Port Hotplug
[not found] <RFC PATCH>
@ 2015-04-08 10:02 ` Bernard Iremonger
2015-04-22 3:14 ` Qiu, Michael
2015-04-08 14:11 ` [dpdk-dev] [RFC PATCH] librte_pmd_e1000: igb and em1000 PCI Port Hotplug changes Bernard Iremonger
` (25 subsequent siblings)
26 siblings, 1 reply; 95+ messages in thread
From: Bernard Iremonger @ 2015-04-08 10:02 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_ixgbe_pmd and
rte_ixgbevf_pmd.pmd.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 87 +++++++++++++++++++++++++++++++++-
lib/librte_pmd_ixgbe/ixgbe_ethdev.h | 4 +-
lib/librte_pmd_ixgbe/ixgbe_pf.c | 30 ++++++++++++-
3 files changed, 116 insertions(+), 5 deletions(-)
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 5caee22..464398a 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -117,6 +117,7 @@
#define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / sizeof(hw_stats->qprc[0]))
static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev);
static int ixgbe_dev_configure(struct rte_eth_dev *dev);
static int ixgbe_dev_start(struct rte_eth_dev *dev);
static void ixgbe_dev_stop(struct rte_eth_dev *dev);
@@ -183,6 +184,7 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_conf
/* For Virtual Function support */
static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev);
static int ixgbevf_dev_configure(struct rte_eth_dev *dev);
static int ixgbevf_dev_start(struct rte_eth_dev *dev);
static void ixgbevf_dev_stop(struct rte_eth_dev *dev);
@@ -917,6 +919,49 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct ixgbe_hw *hw;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if ((eth_dev == NULL) ||
+ (eth_dev->data == NULL) ||
+ (eth_dev->data->dev_private == NULL) ||
+ (eth_dev->pci_dev == NULL))
+ return -EINVAL;
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+ pci_dev = eth_dev->pci_dev;
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ /* Unlock any pending hardware semaphore */
+ ixgbe_swfw_lock_reset(hw);
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ ixgbe_dev_interrupt_handler, (void *)eth_dev);
+
+ /* uninitialize PF if max_vfs not zero */
+ ixgbe_pf_host_uninit(eth_dev);
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ rte_free(eth_dev->data->hash_mac_addrs);
+ eth_dev->data->hash_mac_addrs = NULL;
+
+ return 0;
+}
/*
* Negotiate mailbox API version with the PF.
@@ -1087,13 +1132,48 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+/*
+ * Virtual Function device uninit
+ */
+static int
+eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct ixgbe_hw *hw;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if ((eth_dev == NULL) ||
+ (eth_dev->data == NULL) ||
+ (eth_dev->data->dev_private == NULL))
+ return -EINVAL;
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ /* Disable the interrupts for VF */
+ ixgbevf_intr_disable(hw);
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ return 0;
+}
+
static struct eth_driver rte_ixgbe_pmd = {
{
.name = "rte_ixgbe_pmd",
.id_table = pci_id_ixgbe_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_ixgbe_dev_init,
+ .eth_dev_uninit = eth_ixgbe_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
@@ -1104,9 +1184,10 @@ static struct eth_driver rte_ixgbevf_pmd = {
{
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_ixgbevf_dev_init,
+ .eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
index ffe3471..ad7e190 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -376,6 +376,8 @@ void ixgbe_vlan_hw_strip_disable_all(struct rte_eth_dev *dev);
void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev);
+void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev);
+
void ixgbe_pf_mbx_process(struct rte_eth_dev *eth_dev);
int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev);
diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c b/lib/librte_pmd_ixgbe/ixgbe_pf.c
index dbda9b5..b7491a8 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -144,6 +144,34 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)
return;
}
+void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct ixgbe_vf_info **vfinfo;
+ uint16_t vf_num;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if ((eth_dev == NULL) ||
+ (eth_dev->data == NULL) ||
+ (eth_dev->data->dev_private == NULL))
+ return;
+
+ vfinfo = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
+
+ RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = 0;
+
+ vf_num = dev_num_vf(eth_dev);
+ if (vf_num == 0)
+ return;
+
+ rte_free(*vfinfo);
+ *vfinfo = NULL;
+}
+
+
int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
{
uint32_t vtctl, fcrth;
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH] librte_pmd_ixgbe: changes to support PCI Port Hotplug
2015-04-08 10:02 ` [dpdk-dev] [RFC PATCH] librte_pmd_ixgbe: changes to support PCI Port Hotplug Bernard Iremonger
@ 2015-04-22 3:14 ` Qiu, Michael
0 siblings, 0 replies; 95+ messages in thread
From: Qiu, Michael @ 2015-04-22 3:14 UTC (permalink / raw)
To: Iremonger, Bernard, dev
On 4/8/2015 6:03 PM, Bernard Iremonger wrote:
> This patch depends on the Port Hotplug Framework.
> It implements the eth_dev_uninit functions for rte_ixgbe_pmd and
> rte_ixgbevf_pmd.pmd.
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
Tested-by: Michael Qiu <michael.qiu@intel.com>
> lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 87 +++++++++++++++++++++++++++++++++-
> lib/librte_pmd_ixgbe/ixgbe_ethdev.h | 4 +-
> lib/librte_pmd_ixgbe/ixgbe_pf.c | 30 ++++++++++++-
> 3 files changed, 116 insertions(+), 5 deletions(-)
>
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> index 5caee22..464398a 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> @@ -1,7 +1,7 @@
> /*-
> * BSD LICENSE
> *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
> * All rights reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> @@ -117,6 +117,7 @@
> #define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / sizeof(hw_stats->qprc[0]))
>
> static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev);
> +static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev);
> static int ixgbe_dev_configure(struct rte_eth_dev *dev);
> static int ixgbe_dev_start(struct rte_eth_dev *dev);
> static void ixgbe_dev_stop(struct rte_eth_dev *dev);
> @@ -183,6 +184,7 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_conf
>
> /* For Virtual Function support */
> static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev);
> +static int eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev);
> static int ixgbevf_dev_configure(struct rte_eth_dev *dev);
> static int ixgbevf_dev_start(struct rte_eth_dev *dev);
> static void ixgbevf_dev_stop(struct rte_eth_dev *dev);
> @@ -917,6 +919,49 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
> return 0;
> }
>
> +static int
> +eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)
> +{
> + struct rte_pci_device *pci_dev;
> + struct ixgbe_hw *hw;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + if ((eth_dev == NULL) ||
> + (eth_dev->data == NULL) ||
> + (eth_dev->data->dev_private == NULL) ||
> + (eth_dev->pci_dev == NULL))
> + return -EINVAL;
> +
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> + return -EPERM;
> +
> + hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
> + pci_dev = eth_dev->pci_dev;
> +
> + eth_dev->dev_ops = NULL;
> + eth_dev->rx_pkt_burst = NULL;
> + eth_dev->tx_pkt_burst = NULL;
> +
> + /* Unlock any pending hardware semaphore */
> + ixgbe_swfw_lock_reset(hw);
> +
> + /* disable uio intr before callback unregister */
> + rte_intr_disable(&(pci_dev->intr_handle));
> + rte_intr_callback_unregister(&(pci_dev->intr_handle),
> + ixgbe_dev_interrupt_handler, (void *)eth_dev);
> +
> + /* uninitialize PF if max_vfs not zero */
> + ixgbe_pf_host_uninit(eth_dev);
> +
> + rte_free(eth_dev->data->mac_addrs);
> + eth_dev->data->mac_addrs = NULL;
> +
> + rte_free(eth_dev->data->hash_mac_addrs);
> + eth_dev->data->hash_mac_addrs = NULL;
> +
> + return 0;
> +}
>
> /*
> * Negotiate mailbox API version with the PF.
> @@ -1087,13 +1132,48 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
> return 0;
> }
>
> +/*
> + * Virtual Function device uninit
> + */
> +static int
> +eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
> +{
> + struct ixgbe_hw *hw;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + if ((eth_dev == NULL) ||
> + (eth_dev->data == NULL) ||
> + (eth_dev->data->dev_private == NULL))
> + return -EINVAL;
> +
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> + return -EPERM;
> +
> + hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
> +
> + eth_dev->dev_ops = NULL;
> + eth_dev->rx_pkt_burst = NULL;
> + eth_dev->tx_pkt_burst = NULL;
> +
> + /* Disable the interrupts for VF */
> + ixgbevf_intr_disable(hw);
> +
> + rte_free(eth_dev->data->mac_addrs);
> + eth_dev->data->mac_addrs = NULL;
> +
> + return 0;
> +}
> +
> static struct eth_driver rte_ixgbe_pmd = {
> {
> .name = "rte_ixgbe_pmd",
> .id_table = pci_id_ixgbe_map,
> - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
> + RTE_PCI_DRV_DETACHABLE,
> },
> .eth_dev_init = eth_ixgbe_dev_init,
> + .eth_dev_uninit = eth_ixgbe_dev_uninit,
> .dev_private_size = sizeof(struct ixgbe_adapter),
> };
>
> @@ -1104,9 +1184,10 @@ static struct eth_driver rte_ixgbevf_pmd = {
> {
> .name = "rte_ixgbevf_pmd",
> .id_table = pci_id_ixgbevf_map,
> - .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
> },
> .eth_dev_init = eth_ixgbevf_dev_init,
> + .eth_dev_uninit = eth_ixgbevf_dev_uninit,
> .dev_private_size = sizeof(struct ixgbe_adapter),
> };
>
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
> index ffe3471..ad7e190 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
> +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
> @@ -1,7 +1,7 @@
> /*-
> * BSD LICENSE
> *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
> * All rights reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> @@ -376,6 +376,8 @@ void ixgbe_vlan_hw_strip_disable_all(struct rte_eth_dev *dev);
>
> void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev);
>
> +void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev);
> +
> void ixgbe_pf_mbx_process(struct rte_eth_dev *eth_dev);
>
> int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev);
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c b/lib/librte_pmd_ixgbe/ixgbe_pf.c
> index dbda9b5..b7491a8 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
> @@ -1,7 +1,7 @@
> /*-
> * BSD LICENSE
> *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
> * All rights reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> @@ -144,6 +144,34 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)
> return;
> }
>
> +void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
> +{
> + struct ixgbe_vf_info **vfinfo;
> + uint16_t vf_num;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + if ((eth_dev == NULL) ||
> + (eth_dev->data == NULL) ||
> + (eth_dev->data->dev_private == NULL))
> + return;
> +
> + vfinfo = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
> +
> + RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
> + RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 0;
> + RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = 0;
> + RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = 0;
> +
> + vf_num = dev_num_vf(eth_dev);
> + if (vf_num == 0)
> + return;
> +
> + rte_free(*vfinfo);
> + *vfinfo = NULL;
> +}
> +
> +
> int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
> {
> uint32_t vtctl, fcrth;
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH] librte_pmd_e1000: igb and em1000 PCI Port Hotplug changes
[not found] <RFC PATCH>
2015-04-08 10:02 ` [dpdk-dev] [RFC PATCH] librte_pmd_ixgbe: changes to support PCI Port Hotplug Bernard Iremonger
@ 2015-04-08 14:11 ` Bernard Iremonger
2015-04-30 13:16 ` [dpdk-dev] [RFC PATCH 1/1] librte_pmd_ring: changes to support PCI Port Hotplug Bernard Iremonger
` (24 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-04-08 14:11 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_em_pmd,
rte_igb_pmd and rte_igbvf_pmd.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_pmd_e1000/e1000_ethdev.h | 4 +-
lib/librte_pmd_e1000/em_ethdev.c | 36 ++++++++++++++++-
lib/librte_pmd_e1000/igb_ethdev.c | 73 +++++++++++++++++++++++++++++++++-
lib/librte_pmd_e1000/igb_pf.c | 29 +++++++++++++-
4 files changed, 135 insertions(+), 7 deletions(-)
diff --git a/lib/librte_pmd_e1000/e1000_ethdev.h b/lib/librte_pmd_e1000/e1000_ethdev.h
index c451faa..51720b9 100644
--- a/lib/librte_pmd_e1000/e1000_ethdev.h
+++ b/lib/librte_pmd_e1000/e1000_ethdev.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -298,6 +298,8 @@ void eth_igbvf_tx_init(struct rte_eth_dev *dev);
*/
void igb_pf_host_init(struct rte_eth_dev *eth_dev);
+void igb_pf_host_uninit(struct rte_eth_dev *eth_dev);
+
void igb_pf_mbx_process(struct rte_eth_dev *eth_dev);
int igb_pf_host_configure(struct rte_eth_dev *eth_dev);
diff --git a/lib/librte_pmd_e1000/em_ethdev.c b/lib/librte_pmd_e1000/em_ethdev.c
index 76f45c9..2f68251 100644
--- a/lib/librte_pmd_e1000/em_ethdev.c
+++ b/lib/librte_pmd_e1000/em_ethdev.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -280,13 +280,45 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)
return (0);
}
+static int
+eth_em_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (eth_dev->pci_dev == NULL)
+ return -EINVAL;
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ pci_dev = eth_dev->pci_dev;
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ eth_em_interrupt_handler, (void *)eth_dev);
+
+ return 0;
+}
+
static struct eth_driver rte_em_pmd = {
{
.name = "rte_em_pmd",
.id_table = pci_id_em_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_em_dev_init,
+ .eth_dev_uninit = eth_em_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
diff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c
index b3892a5..f7e3da6 100644
--- a/lib/librte_pmd_e1000/igb_ethdev.c
+++ b/lib/librte_pmd_e1000/igb_ethdev.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -608,6 +608,48 @@ err_late:
return (error);
}
+static int
+eth_igb_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct e1000_hw *hw;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if ((eth_dev == NULL) ||
+ (eth_dev->data == NULL) ||
+ (eth_dev->data->dev_private == NULL) ||
+ (eth_dev->pci_dev == NULL))
+ return -EINVAL;
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ hw = E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+ pci_dev = eth_dev->pci_dev;
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ /* Reset any pending lock */
+ igb_reset_swfw_lock(hw);
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ /* uninitialize PF if max_vfs not zero */
+ igb_pf_host_uninit(eth_dev);
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ eth_igb_interrupt_handler, (void *)eth_dev);
+
+ return 0;
+}
+
+
/*
* Virtual Function device init
*/
@@ -679,13 +721,37 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ PMD_INIT_FUNC_TRACE();
+
+ if ((eth_dev == NULL) ||
+ (eth_dev->data == NULL))
+ return -EINVAL;
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ return 0;
+}
+
static struct eth_driver rte_igb_pmd = {
{
.name = "rte_igb_pmd",
.id_table = pci_id_igb_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_igb_dev_init,
+ .eth_dev_uninit = eth_igb_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
@@ -696,9 +762,10 @@ static struct eth_driver rte_igbvf_pmd = {
{
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_igbvf_dev_init,
+ .eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
diff --git a/lib/librte_pmd_e1000/igb_pf.c b/lib/librte_pmd_e1000/igb_pf.c
index bc3816a..8c0b764 100644
--- a/lib/librte_pmd_e1000/igb_pf.c
+++ b/lib/librte_pmd_e1000/igb_pf.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -127,6 +127,33 @@ void igb_pf_host_init(struct rte_eth_dev *eth_dev)
return;
}
+void igb_pf_host_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct e1000_vf_info **vfinfo;
+ uint16_t vf_num;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if ((eth_dev == NULL) ||
+ (eth_dev->data == NULL) ||
+ (eth_dev->data->dev_private == NULL))
+ return;
+
+ vfinfo = E1000_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
+
+ RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = 0;
+
+ vf_num = dev_num_vf(eth_dev);
+ if (vf_num == 0)
+ return;
+
+ rte_free(*vfinfo);
+ *vfinfo = NULL;
+}
+
#define E1000_RAH_POOLSEL_SHIFT (18)
int igb_pf_host_configure(struct rte_eth_dev *eth_dev)
{
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 1/1] librte_pmd_ring: changes to support PCI Port Hotplug
[not found] <RFC PATCH>
2015-04-08 10:02 ` [dpdk-dev] [RFC PATCH] librte_pmd_ixgbe: changes to support PCI Port Hotplug Bernard Iremonger
2015-04-08 14:11 ` [dpdk-dev] [RFC PATCH] librte_pmd_e1000: igb and em1000 PCI Port Hotplug changes Bernard Iremonger
@ 2015-04-30 13:16 ` Bernard Iremonger
2015-04-30 15:40 ` [dpdk-dev] [RFC PATCH 1/4] librte_pmd_i40e: " Bernard Iremonger
` (23 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-04-30 13:16 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the rte_dev_uninit_t() function for the ring pmd.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_pmd_ring/rte_eth_ring.c | 93 ++++++++++++++++++++++++++++--------
1 files changed, 72 insertions(+), 21 deletions(-)
diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c
index 6832f01..0d643ae 100644
--- a/lib/librte_pmd_ring/rte_eth_ring.c
+++ b/lib/librte_pmd_ring/rte_eth_ring.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -252,6 +252,15 @@ static const struct eth_dev_ops ops = {
.mac_addr_add = eth_mac_addr_add,
};
+static struct eth_driver rte_ring_pmd = {
+ .pci_drv = {
+ .name = "rte_ring_pmd",
+ .drv_flags = RTE_PCI_DRV_DETACHABLE,
+ },
+};
+
+static struct rte_pci_id id_table;
+
int
rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
const unsigned nb_rx_queues,
@@ -263,8 +272,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
struct rte_pci_device *pci_dev = NULL;
struct pmd_internals *internals = NULL;
struct rte_eth_dev *eth_dev = NULL;
- struct eth_driver *eth_drv = NULL;
- struct rte_pci_id *id_table = NULL;
unsigned i;
@@ -288,10 +295,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
if (pci_dev == NULL)
goto error;
- id_table = rte_zmalloc_socket(name, sizeof(*id_table), 0, numa_node);
- if (id_table == NULL)
- goto error;
-
internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
if (internals == NULL)
goto error;
@@ -301,9 +304,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
if (eth_dev == NULL)
goto error;
- eth_drv = rte_zmalloc_socket(name, sizeof(*eth_drv), 0, numa_node);
- if (eth_drv == NULL)
- goto error;
/* now put it all together
* - store queue data in internals,
@@ -323,21 +323,22 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
internals->tx_ring_queues[i].rng = tx_queues[i];
}
- eth_drv->pci_drv.name = ring_ethdev_driver_name;
- eth_drv->pci_drv.id_table = id_table;
+ rte_ring_pmd.pci_drv.name = ring_ethdev_driver_name;
+ rte_ring_pmd.pci_drv.id_table = &id_table;
pci_dev->numa_node = numa_node;
- pci_dev->driver = ð_drv->pci_drv;
+ pci_dev->driver = &rte_ring_pmd.pci_drv;
data->dev_private = internals;
data->port_id = eth_dev->data->port_id;
+ memmove(data->name, eth_dev->data->name, sizeof(data->name));
data->nb_rx_queues = (uint16_t)nb_rx_queues;
data->nb_tx_queues = (uint16_t)nb_tx_queues;
data->dev_link = pmd_link;
data->mac_addrs = &internals->address;
eth_dev->data = data;
- eth_dev->driver = eth_drv;
+ eth_dev->driver = &rte_ring_pmd;
eth_dev->dev_ops = &ops;
eth_dev->pci_dev = pci_dev;
TAILQ_INIT(&(eth_dev->link_intr_cbs));
@@ -531,20 +532,34 @@ rte_pmd_ring_devinit(const char *name, const char *params)
RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name);
- if (params == NULL || params[0] == '\0')
- eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ if (params == NULL || params[0] == '\0') {
+ ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ if (ret == -1) {
+ RTE_LOG(INFO, PMD, "Attach to pmd_ring for %s\n", name);
+ ret = eth_dev_ring_create(name, rte_socket_id(),
+ DEV_ATTACH);
+ }
+ }
else {
kvlist = rte_kvargs_parse(params, valid_arguments);
if (!kvlist) {
RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
" rings-backed ethernet device\n");
- eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
- return 0;
+ ret = eth_dev_ring_create(name, rte_socket_id(),
+ DEV_CREATE);
+ if (ret == -1) {
+ RTE_LOG(INFO, PMD, "Attach to pmd_ring for %s\n",
+ name);
+ ret = eth_dev_ring_create(name, rte_socket_id(),
+ DEV_ATTACH);
+ }
+ return ret;
} else {
ret = rte_kvargs_count(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG);
- info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) +
- (sizeof(struct node_action_pair) * ret), 0);
+ info = rte_zmalloc("struct node_action_list",
+ sizeof(struct node_action_list) +
+ (sizeof(struct node_action_pair) * ret), 0);
if (!info)
goto out_free;
@@ -558,8 +573,17 @@ rte_pmd_ring_devinit(const char *name, const char *params)
goto out_free;
for (info->count = 0; info->count < info->total; info->count++) {
- eth_dev_ring_create(name, info->list[info->count].node,
+ ret = eth_dev_ring_create(name,
+ info->list[info->count].node,
info->list[info->count].action);
+ if ((ret == -1) &&
+ (info->list[info->count].action == DEV_CREATE)) {
+ RTE_LOG(INFO, PMD,
+ "Attach to pmd_ring for %s\n",
+ name);
+ ret = eth_dev_ring_create(name,
+ info->list[info->count].node, DEV_ATTACH);
+ }
}
}
}
@@ -570,10 +594,37 @@ out_free:
return ret;
}
+static int
+rte_pmd_ring_devuninit(const char *name)
+{
+ struct rte_eth_dev *eth_dev = NULL;
+
+ RTE_LOG(INFO, PMD, "Un-Initializing pmd_ring for %s\n", name);
+
+ if (name == NULL)
+ return -EINVAL;
+
+ /* find an ethdev entry */
+ eth_dev = rte_eth_dev_allocated(name);
+ if (eth_dev == NULL)
+ return -ENODEV;
+
+ eth_dev_stop(eth_dev);
+ rte_free(eth_dev->data->dev_private);
+ rte_free(eth_dev->data);
+ rte_free(&rte_ring_pmd.pci_drv);
+ rte_free(eth_dev->pci_dev);
+
+ rte_eth_dev_release_port(eth_dev);
+ return 0;
+}
+
+
static struct rte_driver pmd_ring_drv = {
.name = "eth_ring",
.type = PMD_VDEV,
.init = rte_pmd_ring_devinit,
+ .uninit = rte_pmd_ring_devuninit,
};
PMD_REGISTER_DRIVER(pmd_ring_drv);
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 1/4] librte_pmd_i40e: changes to support PCI Port Hotplug
[not found] <RFC PATCH>
` (2 preceding siblings ...)
2015-04-30 13:16 ` [dpdk-dev] [RFC PATCH 1/1] librte_pmd_ring: changes to support PCI Port Hotplug Bernard Iremonger
@ 2015-04-30 15:40 ` Bernard Iremonger
2015-04-30 15:41 ` [dpdk-dev] [RFC PATCH 2/4] librte_pmd_i40e: release vmdq vsi's in dev_close Bernard Iremonger
` (22 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-04-30 15:40 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_i40e_pmd and
rte_i40evf_pmd.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_pmd_i40e/i40e_ethdev.c | 69 +++++++++++++++++++++++++++++++++-
lib/librte_pmd_i40e/i40e_ethdev_vf.c | 48 ++++++++++++++++++++++-
lib/librte_pmd_i40e/i40e_pf.c | 36 +++++++++++++++++-
lib/librte_pmd_i40e/i40e_pf.h | 3 +-
4 files changed, 150 insertions(+), 6 deletions(-)
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 43762f2..e21ebed 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -107,6 +107,7 @@
(1UL << RTE_ETH_FLOW_L2_PAYLOAD))
static int eth_i40e_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_i40e_dev_uninit(struct rte_eth_dev *eth_dev);
static int i40e_dev_configure(struct rte_eth_dev *dev);
static int i40e_dev_start(struct rte_eth_dev *dev);
static void i40e_dev_stop(struct rte_eth_dev *dev);
@@ -268,9 +269,11 @@ static struct eth_driver rte_i40e_pmd = {
{
.name = "rte_i40e_pmd",
.id_table = pci_id_i40e_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_i40e_dev_init,
+ .eth_dev_uninit = eth_i40e_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
@@ -405,6 +408,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
hw->bus.device = pci_dev->addr.devid;
hw->bus.func = pci_dev->addr.function;
+ hw->adapter_stopped = FALSE;
/* Make sure all is clean before doing PF reset */
i40e_clear_hw(hw);
@@ -584,6 +588,64 @@ err_get_capabilities:
}
static int
+eth_i40e_dev_uninit(struct rte_eth_dev *dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct i40e_hw *hw;
+ struct i40e_filter_control_settings settings;
+ int ret;
+ uint8_t aq_fail = 0;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
+
+ hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ pci_dev = dev->pci_dev;
+
+ if (hw->adapter_stopped == FALSE)
+ i40e_dev_close(dev);
+
+ dev->dev_ops = NULL;
+ dev->rx_pkt_burst = NULL;
+ dev->tx_pkt_burst = NULL;
+
+ /* Disable LLDP */
+ ret = i40e_aq_stop_lldp(hw, true, NULL);
+ if (ret != I40E_SUCCESS) /* Its failure can be ignored */
+ PMD_INIT_LOG(INFO, "Failed to stop lldp");
+
+ /* Clear PXE mode */
+ i40e_clear_pxe_mode(hw);
+
+ /* Unconfigure filter control */
+ memset(&settings, 0, sizeof(settings));
+ ret = i40e_set_filter_control(hw, &settings);
+ if (ret)
+ PMD_INIT_LOG(WARNING, "setup_pf_filter_control failed: %d", ret);
+
+ /* Disable flow control */
+ hw->fc.requested_mode = I40E_FC_NONE;
+ i40e_set_fc(hw, &aq_fail, TRUE);
+
+ /* uninitialize pf host driver */
+ i40e_pf_host_uninit(dev);
+
+ rte_free(dev->data->mac_addrs);
+ dev->data->mac_addrs = NULL;
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+
+ /* register callback func to eal lib */
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ i40e_dev_interrupt_handler, (void *)dev);
+
+ return 0;
+}
+
+static int
i40e_dev_configure(struct rte_eth_dev *dev)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -854,6 +916,8 @@ i40e_dev_start(struct rte_eth_dev *dev)
struct i40e_vsi *main_vsi = pf->main_vsi;
int ret, i;
+ hw->adapter_stopped = FALSE;
+
if ((dev->data->dev_conf.link_duplex != ETH_LINK_AUTONEG_DUPLEX) &&
(dev->data->dev_conf.link_duplex != ETH_LINK_FULL_DUPLEX)) {
PMD_INIT_LOG(ERR, "Invalid link_duplex (%hu) for port %hhu",
@@ -961,6 +1025,7 @@ i40e_dev_close(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
i40e_dev_stop(dev);
+ hw->adapter_stopped = TRUE;
/* Disable interrupt */
i40e_pf_disable_irq0(hw);
diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
index a0d808f..7c5b3f5 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -1146,6 +1146,23 @@ err:
}
static int
+i40evf_uninit_vf(struct rte_eth_dev *dev)
+{
+ struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (hw->adapter_stopped == FALSE)
+ i40evf_dev_close(dev);
+ rte_free(vf->vf_res);
+ vf->vf_res = NULL;
+
+ return 0;
+}
+
+
+static int
i40evf_dev_init(struct rte_eth_dev *eth_dev)
{
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(\
@@ -1175,6 +1192,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
hw->bus.device = eth_dev->pci_dev->addr.devid;
hw->bus.func = eth_dev->pci_dev->addr.function;
hw->hw_addr = (void *)eth_dev->pci_dev->mem_resource[0].addr;
+ hw->adapter_stopped = FALSE;
if(i40evf_init_vf(eth_dev) != 0) {
PMD_INIT_LOG(ERR, "Init vf failed");
@@ -1195,6 +1213,28 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+i40evf_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ if (i40evf_uninit_vf(eth_dev) != 0) {
+ PMD_INIT_LOG(ERR, "i40evf_uninit_vf failed");
+ return -1;
+ }
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ return 0;
+}
/*
* virtual function driver struct
*/
@@ -1202,9 +1242,10 @@ static struct eth_driver rte_i40evf_pmd = {
{
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = i40evf_dev_init,
+ .eth_dev_uninit = i40evf_dev_uninit,
.dev_private_size = sizeof(struct i40e_vf),
};
@@ -1473,6 +1514,8 @@ i40evf_dev_start(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
+ hw->adapter_stopped = FALSE;
+
vf->max_pkt_len = dev->data->dev_conf.rxmode.max_rx_pkt_len;
if (dev->data->dev_conf.rxmode.jumbo_frame == 1) {
if (vf->max_pkt_len <= ETHER_MAX_LEN ||
@@ -1680,6 +1723,7 @@ i40evf_dev_close(struct rte_eth_dev *dev)
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
i40evf_dev_stop(dev);
+ hw->adapter_stopped = TRUE;
i40evf_reset_vf(hw);
i40e_shutdown_adminq(hw);
}
diff --git a/lib/librte_pmd_i40e/i40e_pf.c b/lib/librte_pmd_i40e/i40e_pf.c
index cbb2dcc..29fedb3 100644
--- a/lib/librte_pmd_i40e/i40e_pf.c
+++ b/lib/librte_pmd_i40e/i40e_pf.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -1061,3 +1061,37 @@ fail:
return ret;
}
+
+int
+i40e_pf_host_uninit(struct rte_eth_dev *dev)
+{
+ struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+ uint32_t val;
+
+ PMD_INIT_FUNC_TRACE();
+
+ /**
+ * return if SRIOV not enabled, VF number not configured or
+ * no queue assigned.
+ */
+ if ((!hw->func_caps.sr_iov_1_1) ||
+ (pf->vf_num == 0) ||
+ (pf->vf_nb_qps == 0))
+ return I40E_SUCCESS;
+
+ /* free memory to store VF structure */
+ rte_free(pf->vfs);
+ pf->vfs = NULL;
+
+ /* Disable irq0 for VFR event */
+ i40e_pf_disable_irq0(hw);
+
+ /* Disable VF link status interrupt */
+ val = I40E_READ_REG(hw, I40E_PFGEN_PORTMDIO_NUM);
+ val &= ~I40E_PFGEN_PORTMDIO_NUM_VFLINK_STAT_ENA_MASK;
+ I40E_WRITE_REG(hw, I40E_PFGEN_PORTMDIO_NUM, val);
+ I40E_WRITE_FLUSH(hw);
+
+ return I40E_SUCCESS;
+}
diff --git a/lib/librte_pmd_i40e/i40e_pf.h b/lib/librte_pmd_i40e/i40e_pf.h
index 8bf83c2..9c01829 100644
--- a/lib/librte_pmd_i40e/i40e_pf.h
+++ b/lib/librte_pmd_i40e/i40e_pf.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -123,5 +123,6 @@ void i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
__rte_unused uint32_t retval,
uint8_t *msg, uint16_t msglen);
int i40e_pf_host_init(struct rte_eth_dev *dev);
+int i40e_pf_host_uninit(struct rte_eth_dev *dev);
#endif /* _I40E_PF_H_ */
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 2/4] librte_pmd_i40e: release vmdq vsi's in dev_close
[not found] <RFC PATCH>
` (3 preceding siblings ...)
2015-04-30 15:40 ` [dpdk-dev] [RFC PATCH 1/4] librte_pmd_i40e: " Bernard Iremonger
@ 2015-04-30 15:41 ` Bernard Iremonger
2015-04-30 15:42 ` [dpdk-dev] [RFC PATCH 3/4] librte_pmd_i40e: increase ASQ_DELAY_MS to 100 in i40evf_wait_cmd_done() Bernard Iremonger
` (21 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-04-30 15:41 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_pmd_i40e/i40e_ethdev.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index e21ebed..5cff6df 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -623,7 +623,8 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
memset(&settings, 0, sizeof(settings));
ret = i40e_set_filter_control(hw, &settings);
if (ret)
- PMD_INIT_LOG(WARNING, "setup_pf_filter_control failed: %d", ret);
+ PMD_INIT_LOG(WARNING, "setup_pf_filter_control failed: %d",
+ ret);
/* Disable flow control */
hw->fc.requested_mode = I40E_FC_NONE;
@@ -1021,6 +1022,7 @@ i40e_dev_close(struct rte_eth_dev *dev)
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t reg;
+ int i;
PMD_INIT_FUNC_TRACE();
@@ -1038,6 +1040,12 @@ i40e_dev_close(struct rte_eth_dev *dev)
i40e_fdir_teardown(pf);
i40e_vsi_release(pf->main_vsi);
+ for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++)
+ i40e_vsi_release(pf->vmdq[i].vsi);
+
+ rte_free(pf->vmdq);
+ pf->vmdq = NULL;
+
/* shutdown the adminq */
i40e_aq_queue_shutdown(hw, true);
i40e_shutdown_adminq(hw);
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 3/4] librte_pmd_i40e: increase ASQ_DELAY_MS to 100 in i40evf_wait_cmd_done()
[not found] <RFC PATCH>
` (4 preceding siblings ...)
2015-04-30 15:41 ` [dpdk-dev] [RFC PATCH 2/4] librte_pmd_i40e: release vmdq vsi's in dev_close Bernard Iremonger
@ 2015-04-30 15:42 ` Bernard Iremonger
2015-04-30 15:42 ` [dpdk-dev] [RFC PATCH 4/4] librte_pmd_i40e: call _clear_cmd() when error occurs Bernard Iremonger
` (20 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-04-30 15:42 UTC (permalink / raw)
To: dev
Increase delay to avoid i40evf_read_pfmsg() failures.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_pmd_i40e/i40e_ethdev_vf.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
index 7c5b3f5..af45064 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
@@ -299,7 +299,7 @@ i40evf_wait_cmd_done(struct rte_eth_dev *dev,
enum i40evf_aq_result ret;
#define MAX_TRY_TIMES 10
-#define ASQ_DELAY_MS 50
+#define ASQ_DELAY_MS 100
do {
/* Delay some time first */
rte_delay_ms(ASQ_DELAY_MS);
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 4/4] librte_pmd_i40e: call _clear_cmd() when error occurs
[not found] <RFC PATCH>
` (5 preceding siblings ...)
2015-04-30 15:42 ` [dpdk-dev] [RFC PATCH 3/4] librte_pmd_i40e: increase ASQ_DELAY_MS to 100 in i40evf_wait_cmd_done() Bernard Iremonger
@ 2015-04-30 15:42 ` Bernard Iremonger
2015-05-01 14:36 ` [dpdk-dev] [RFC PATCH] librte_pmd_bond: add support for PCI Port Hotplug Bernard Iremonger
` (19 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-04-30 15:42 UTC (permalink / raw)
To: dev
_clear_cmd() was not being called in failure situations,
resulting in the next command also failing.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_pmd_i40e/i40e_ethdev_vf.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
index af45064..e31f582 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
@@ -361,6 +361,7 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args)
args->in_args, args->in_args_size, NULL);
if (err) {
PMD_DRV_LOG(ERR, "fail to send cmd %d", args->ops);
+ _clear_cmd(vf);
return err;
}
@@ -368,8 +369,10 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args)
/* read message and it's expected one */
if (!err && args->ops == info.ops)
_clear_cmd(vf);
- else if (err)
+ else if (err) {
PMD_DRV_LOG(ERR, "Failed to read message from AdminQ");
+ _clear_cmd(vf);
+ }
else if (args->ops != info.ops)
PMD_DRV_LOG(ERR, "command mismatch, expect %u, get %u",
args->ops, info.ops);
@@ -794,7 +797,7 @@ i40evf_stop_queues(struct rte_eth_dev *dev)
/* Stop TX queues first */
for (i = 0; i < dev->data->nb_tx_queues; i++) {
if (i40evf_dev_tx_queue_stop(dev, i) != 0) {
- PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
+ PMD_DRV_LOG(ERR, "Fail to stop queue %u", i);
return -1;
}
}
@@ -802,7 +805,7 @@ i40evf_stop_queues(struct rte_eth_dev *dev)
/* Then stop RX queues */
for (i = 0; i < dev->data->nb_rx_queues; i++) {
if (i40evf_dev_rx_queue_stop(dev, i) != 0) {
- PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
+ PMD_DRV_LOG(ERR, "Fail to stop queue %u", i);
return -1;
}
}
@@ -1432,7 +1435,7 @@ i40evf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
err = i40evf_switch_queue(dev, FALSE, tx_queue_id, FALSE);
if (err) {
- PMD_DRV_LOG(ERR, "Failed to switch TX queue %u of",
+ PMD_DRV_LOG(ERR, "Failed to switch TX queue %u off",
tx_queue_id);
return err;
}
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH] librte_pmd_bond: add support for PCI Port Hotplug
[not found] <RFC PATCH>
` (6 preceding siblings ...)
2015-04-30 15:42 ` [dpdk-dev] [RFC PATCH 4/4] librte_pmd_i40e: call _clear_cmd() when error occurs Bernard Iremonger
@ 2015-05-01 14:36 ` Bernard Iremonger
2015-05-01 15:17 ` Neil Horman
2015-05-01 15:28 ` [dpdk-dev] [RFC PATCH] librte_pmd_virtio: " Bernard Iremonger
` (18 subsequent siblings)
26 siblings, 1 reply; 95+ messages in thread
From: Bernard Iremonger @ 2015-05-01 14:36 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the rte_dev_uninit_t() function for the link bonding pmd.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_pmd_bond/rte_eth_bond.h | 13 ++++-
lib/librte_pmd_bond/rte_eth_bond_api.c | 84 ++++++++++++++++++++--------
lib/librte_pmd_bond/rte_eth_bond_pmd.c | 23 +++++++-
lib/librte_pmd_bond/rte_eth_bond_private.h | 5 +-
4 files changed, 97 insertions(+), 28 deletions(-)
diff --git a/lib/librte_pmd_bond/rte_eth_bond.h b/lib/librte_pmd_bond/rte_eth_bond.h
index d688fc3..8efbf07 100644
--- a/lib/librte_pmd_bond/rte_eth_bond.h
+++ b/lib/librte_pmd_bond/rte_eth_bond.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -131,6 +131,17 @@ int
rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id);
/**
+ * Free a bonded rte_eth_dev device
+ *
+ * @param name Name of the link bonding device.
+ *
+ * @return
+ * 0 on success, negative value otherwise
+ */
+int
+rte_eth_bond_free(const char *name);
+
+/**
* Add a rte_eth_dev device as a slave to the bonded device
*
* @param bonded_port_id Port ID of bonded device.
diff --git a/lib/librte_pmd_bond/rte_eth_bond_api.c b/lib/librte_pmd_bond/rte_eth_bond_api.c
index e91a623..b91ef24 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_api.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_api.c
@@ -44,6 +44,13 @@
#define DEFAULT_POLLING_INTERVAL_10_MS (10)
+static struct eth_driver rte_bond_pmd = {
+ .pci_drv = {
+ .name = "rte_bond_pmd",
+ .drv_flags = RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_DETACHABLE,
+ },
+};
+
int
valid_bonded_ethdev(struct rte_eth_dev *eth_dev)
{
@@ -193,6 +200,7 @@ number_of_sockets(void)
}
const char *driver_name = "Link Bonding PMD";
+static struct rte_pci_id pci_id_table = {0};
int
rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
@@ -200,9 +208,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
struct rte_pci_device *pci_dev = NULL;
struct bond_dev_private *internals = NULL;
struct rte_eth_dev *eth_dev = NULL;
- struct eth_driver *eth_drv = NULL;
struct rte_pci_driver *pci_drv = NULL;
- struct rte_pci_id *pci_id_table = NULL;
+
/* now do all data allocation - for eth_dev structure, dummy pci driver
* and internal (private) data
*/
@@ -224,26 +231,14 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
goto err;
}
- eth_drv = rte_zmalloc_socket(name, sizeof(*eth_drv), 0, socket_id);
- if (eth_drv == NULL) {
- RTE_BOND_LOG(ERR, "Unable to malloc eth_drv on socket");
- goto err;
- }
+ pci_drv = &rte_bond_pmd.pci_drv;
- pci_drv = ð_drv->pci_drv;
+ pci_id_table.device_id = PCI_ANY_ID;
+ pci_id_table.subsystem_device_id = PCI_ANY_ID;
+ pci_id_table.vendor_id = PCI_ANY_ID;
+ pci_id_table.subsystem_vendor_id = PCI_ANY_ID;
- pci_id_table = rte_zmalloc_socket(name, sizeof(*pci_id_table), 0, socket_id);
- if (pci_id_table == NULL) {
- RTE_BOND_LOG(ERR, "Unable to malloc pci_id_table on socket");
- goto err;
- }
- pci_id_table->device_id = PCI_ANY_ID;
- pci_id_table->subsystem_device_id = PCI_ANY_ID;
- pci_id_table->vendor_id = PCI_ANY_ID;
- pci_id_table->subsystem_vendor_id = PCI_ANY_ID;
-
- pci_drv->id_table = pci_id_table;
- pci_drv->drv_flags = RTE_PCI_DRV_INTR_LSC;
+ pci_drv->id_table = &pci_id_table;
internals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id);
if (internals == NULL) {
@@ -260,8 +255,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
pci_dev->numa_node = socket_id;
pci_drv->name = driver_name;
-
- eth_dev->driver = eth_drv;
+ eth_dev->driver = &rte_bond_pmd;
eth_dev->data->dev_private = internals;
eth_dev->data->nb_rx_queues = (uint16_t)1;
eth_dev->data->nb_tx_queues = (uint16_t)1;
@@ -317,13 +311,55 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
err:
rte_free(pci_dev);
- rte_free(pci_id_table);
- rte_free(eth_drv);
rte_free(internals);
+ rte_free(eth_dev->data->mac_addrs);
return -1;
}
+int
+rte_eth_bond_free(const char *name)
+{
+ struct rte_eth_dev *eth_dev = NULL;
+ struct bond_dev_private *internals = NULL;
+
+ /* now free all data allocation - for eth_dev structure,
+ * dummy pci driver and internal (private) data
+ */
+
+ /* find an ethdev entry */
+ eth_dev = rte_eth_dev_allocated(name);
+ if (eth_dev == NULL)
+ return -ENODEV;
+
+ if (eth_dev->data->dev_started == 1)
+ bond_ethdev_stop(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ internals = eth_dev->data->dev_private;
+ rte_spinlock_lock(&internals->lock);
+
+ if (internals->mode == BONDING_MODE_8023AD) {
+ bond_mode_8023ad_stop(eth_dev);
+ bond_mode_8023ad_deactivate_slave(eth_dev, internals->port_id);
+ } else if (internals->mode == BONDING_MODE_TLB
+ || internals->mode == BONDING_MODE_ALB)
+ bond_tlb_disable(internals);
+
+ rte_spinlock_unlock(&internals->lock);
+
+ rte_free(eth_dev->pci_dev);
+ rte_free(eth_dev->data->dev_private);
+ rte_free(eth_dev->data->mac_addrs);
+
+ rte_eth_dev_release_port(eth_dev);
+
+ return 0;
+}
+
static int
__eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
{
diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index c937e6b..45d5b89 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -1503,7 +1503,7 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev)
return 0;
}
-static void
+void
bond_ethdev_stop(struct rte_eth_dev *eth_dev)
{
struct bond_dev_private *internals = eth_dev->data->dev_private;
@@ -2038,6 +2038,24 @@ parse_error:
return -1;
}
+static int
+bond_uninit(const char *name)
+{
+ int ret;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ RTE_LOG(INFO, EAL, "Uninitializing pmd_bond for %s\n", name);
+
+ /* free link bonding eth device */
+ ret = rte_eth_bond_free(name);
+ if (ret < 0)
+ RTE_LOG(ERR, EAL, "Failed to free %s\n", name);
+
+ return ret;
+}
+
/* this part will resolve the slave portids after all the other pdev and vdev
* have been allocated */
static int
@@ -2264,6 +2282,7 @@ static struct rte_driver bond_drv = {
.name = "eth_bond",
.type = PMD_VDEV,
.init = bond_init,
+ .uninit = bond_uninit,
};
PMD_REGISTER_DRIVER(bond_drv);
diff --git a/lib/librte_pmd_bond/rte_eth_bond_private.h b/lib/librte_pmd_bond/rte_eth_bond_private.h
index 45e5c65..8551ddd 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_private.h
+++ b/lib/librte_pmd_bond/rte_eth_bond_private.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -284,4 +284,7 @@ bond_tlb_enable(struct bond_dev_private *internals);
void
bond_tlb_activate_slave(struct bond_dev_private *internals);
+void
+bond_ethdev_stop(struct rte_eth_dev *eth_dev);
+
#endif
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH] librte_pmd_bond: add support for PCI Port Hotplug
2015-05-01 14:36 ` [dpdk-dev] [RFC PATCH] librte_pmd_bond: add support for PCI Port Hotplug Bernard Iremonger
@ 2015-05-01 15:17 ` Neil Horman
0 siblings, 0 replies; 95+ messages in thread
From: Neil Horman @ 2015-05-01 15:17 UTC (permalink / raw)
To: Bernard Iremonger; +Cc: dev
On Fri, May 01, 2015 at 03:36:19PM +0100, Bernard Iremonger wrote:
> This patch depends on the Port Hotplug Framework.
> It implements the rte_dev_uninit_t() function for the link bonding pmd.
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
> lib/librte_pmd_bond/rte_eth_bond.h | 13 ++++-
> lib/librte_pmd_bond/rte_eth_bond_api.c | 84 ++++++++++++++++++++--------
> lib/librte_pmd_bond/rte_eth_bond_pmd.c | 23 +++++++-
> lib/librte_pmd_bond/rte_eth_bond_private.h | 5 +-
> 4 files changed, 97 insertions(+), 28 deletions(-)
>
> diff --git a/lib/librte_pmd_bond/rte_eth_bond.h b/lib/librte_pmd_bond/rte_eth_bond.h
> index d688fc3..8efbf07 100644
> --- a/lib/librte_pmd_bond/rte_eth_bond.h
> +++ b/lib/librte_pmd_bond/rte_eth_bond.h
> @@ -1,7 +1,7 @@
> /*-
> * BSD LICENSE
> *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
> * All rights reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> @@ -131,6 +131,17 @@ int
> rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id);
>
> /**
> + * Free a bonded rte_eth_dev device
> + *
> + * @param name Name of the link bonding device.
> + *
> + * @return
> + * 0 on success, negative value otherwise
> + */
> +int
> +rte_eth_bond_free(const char *name);
> +
> +/**
> * Add a rte_eth_dev device as a slave to the bonded device
> *
You need to add the free routine to the version map, or shared libraries won't
work. You need to test with shared libraries as well.
> * @param bonded_port_id Port ID of bonded device.
> diff --git a/lib/librte_pmd_bond/rte_eth_bond_api.c b/lib/librte_pmd_bond/rte_eth_bond_api.c
> index e91a623..b91ef24 100644
> --- a/lib/librte_pmd_bond/rte_eth_bond_api.c
> +++ b/lib/librte_pmd_bond/rte_eth_bond_api.c
> @@ -44,6 +44,13 @@
>
> #define DEFAULT_POLLING_INTERVAL_10_MS (10)
>
> +static struct eth_driver rte_bond_pmd = {
> + .pci_drv = {
> + .name = "rte_bond_pmd",
> + .drv_flags = RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_DETACHABLE,
> + },
> +};
> +
> int
> valid_bonded_ethdev(struct rte_eth_dev *eth_dev)
> {
> @@ -193,6 +200,7 @@ number_of_sockets(void)
> }
>
> const char *driver_name = "Link Bonding PMD";
> +static struct rte_pci_id pci_id_table = {0};
>
> int
> rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
> @@ -200,9 +208,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
> struct rte_pci_device *pci_dev = NULL;
> struct bond_dev_private *internals = NULL;
> struct rte_eth_dev *eth_dev = NULL;
> - struct eth_driver *eth_drv = NULL;
> struct rte_pci_driver *pci_drv = NULL;
> - struct rte_pci_id *pci_id_table = NULL;
> +
> /* now do all data allocation - for eth_dev structure, dummy pci driver
> * and internal (private) data
> */
> @@ -224,26 +231,14 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
> goto err;
> }
>
> - eth_drv = rte_zmalloc_socket(name, sizeof(*eth_drv), 0, socket_id);
> - if (eth_drv == NULL) {
> - RTE_BOND_LOG(ERR, "Unable to malloc eth_drv on socket");
> - goto err;
> - }
> + pci_drv = &rte_bond_pmd.pci_drv;
>
> - pci_drv = ð_drv->pci_drv;
> + pci_id_table.device_id = PCI_ANY_ID;
> + pci_id_table.subsystem_device_id = PCI_ANY_ID;
> + pci_id_table.vendor_id = PCI_ANY_ID;
> + pci_id_table.subsystem_vendor_id = PCI_ANY_ID;
>
> - pci_id_table = rte_zmalloc_socket(name, sizeof(*pci_id_table), 0, socket_id);
> - if (pci_id_table == NULL) {
> - RTE_BOND_LOG(ERR, "Unable to malloc pci_id_table on socket");
> - goto err;
> - }
> - pci_id_table->device_id = PCI_ANY_ID;
> - pci_id_table->subsystem_device_id = PCI_ANY_ID;
> - pci_id_table->vendor_id = PCI_ANY_ID;
> - pci_id_table->subsystem_vendor_id = PCI_ANY_ID;
> -
> - pci_drv->id_table = pci_id_table;
> - pci_drv->drv_flags = RTE_PCI_DRV_INTR_LSC;
> + pci_drv->id_table = &pci_id_table;
>
> internals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id);
> if (internals == NULL) {
> @@ -260,8 +255,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
>
> pci_dev->numa_node = socket_id;
> pci_drv->name = driver_name;
> -
> - eth_dev->driver = eth_drv;
> + eth_dev->driver = &rte_bond_pmd;
> eth_dev->data->dev_private = internals;
> eth_dev->data->nb_rx_queues = (uint16_t)1;
> eth_dev->data->nb_tx_queues = (uint16_t)1;
> @@ -317,13 +311,55 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
>
> err:
> rte_free(pci_dev);
> - rte_free(pci_id_table);
> - rte_free(eth_drv);
> rte_free(internals);
> + rte_free(eth_dev->data->mac_addrs);
>
> return -1;
> }
>
> +int
> +rte_eth_bond_free(const char *name)
> +{
> + struct rte_eth_dev *eth_dev = NULL;
> + struct bond_dev_private *internals = NULL;
> +
> + /* now free all data allocation - for eth_dev structure,
> + * dummy pci driver and internal (private) data
> + */
> +
> + /* find an ethdev entry */
> + eth_dev = rte_eth_dev_allocated(name);
> + if (eth_dev == NULL)
> + return -ENODEV;
> +
> + if (eth_dev->data->dev_started == 1)
> + bond_ethdev_stop(eth_dev);
> +
> + eth_dev->dev_ops = NULL;
> + eth_dev->rx_pkt_burst = NULL;
> + eth_dev->tx_pkt_burst = NULL;
> +
> + internals = eth_dev->data->dev_private;
> + rte_spinlock_lock(&internals->lock);
> +
> + if (internals->mode == BONDING_MODE_8023AD) {
> + bond_mode_8023ad_stop(eth_dev);
> + bond_mode_8023ad_deactivate_slave(eth_dev, internals->port_id);
> + } else if (internals->mode == BONDING_MODE_TLB
> + || internals->mode == BONDING_MODE_ALB)
> + bond_tlb_disable(internals);
> +
> + rte_spinlock_unlock(&internals->lock);
> +
> + rte_free(eth_dev->pci_dev);
> + rte_free(eth_dev->data->dev_private);
> + rte_free(eth_dev->data->mac_addrs);
> +
> + rte_eth_dev_release_port(eth_dev);
> +
> + return 0;
> +}
> +
> static int
> __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
> {
> diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
> index c937e6b..45d5b89 100644
> --- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
> +++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
> @@ -1,7 +1,7 @@
> /*-
> * BSD LICENSE
> *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
> * All rights reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> @@ -1503,7 +1503,7 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev)
> return 0;
> }
>
> -static void
> +void
> bond_ethdev_stop(struct rte_eth_dev *eth_dev)
> {
> struct bond_dev_private *internals = eth_dev->data->dev_private;
> @@ -2038,6 +2038,24 @@ parse_error:
> return -1;
> }
>
> +static int
> +bond_uninit(const char *name)
> +{
> + int ret;
> +
> + if (name == NULL)
> + return -EINVAL;
> +
> + RTE_LOG(INFO, EAL, "Uninitializing pmd_bond for %s\n", name);
> +
> + /* free link bonding eth device */
> + ret = rte_eth_bond_free(name);
> + if (ret < 0)
> + RTE_LOG(ERR, EAL, "Failed to free %s\n", name);
> +
> + return ret;
> +}
> +
> /* this part will resolve the slave portids after all the other pdev and vdev
> * have been allocated */
> static int
> @@ -2264,6 +2282,7 @@ static struct rte_driver bond_drv = {
> .name = "eth_bond",
> .type = PMD_VDEV,
> .init = bond_init,
> + .uninit = bond_uninit,
> };
>
> PMD_REGISTER_DRIVER(bond_drv);
> diff --git a/lib/librte_pmd_bond/rte_eth_bond_private.h b/lib/librte_pmd_bond/rte_eth_bond_private.h
> index 45e5c65..8551ddd 100644
> --- a/lib/librte_pmd_bond/rte_eth_bond_private.h
> +++ b/lib/librte_pmd_bond/rte_eth_bond_private.h
> @@ -1,7 +1,7 @@
> /*-
> * BSD LICENSE
> *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
> * All rights reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> @@ -284,4 +284,7 @@ bond_tlb_enable(struct bond_dev_private *internals);
> void
> bond_tlb_activate_slave(struct bond_dev_private *internals);
>
> +void
> +bond_ethdev_stop(struct rte_eth_dev *eth_dev);
> +
> #endif
> --
> 1.7.4.1
>
>
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH] librte_pmd_virtio: add support for PCI Port Hotplug
[not found] <RFC PATCH>
` (7 preceding siblings ...)
2015-05-01 14:36 ` [dpdk-dev] [RFC PATCH] librte_pmd_bond: add support for PCI Port Hotplug Bernard Iremonger
@ 2015-05-01 15:28 ` Bernard Iremonger
2015-05-05 14:36 ` [dpdk-dev] [RFC PATCH V2] librte_pmd_ring: changes to support " Bernard Iremonger
` (17 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-05-01 15:28 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit_t() function for virtio pmd.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_pmd_virtio/virtio_ethdev.c | 39 ++++++++++++++++++++++++++++++++-
1 files changed, 38 insertions(+), 1 deletions(-)
diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c
index e63dbfb..3c4691f 100644
--- a/lib/librte_pmd_virtio/virtio_ethdev.c
+++ b/lib/librte_pmd_virtio/virtio_ethdev.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -63,6 +63,7 @@
static int eth_virtio_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev);
static int virtio_dev_configure(struct rte_eth_dev *dev);
static int virtio_dev_start(struct rte_eth_dev *dev);
static void virtio_dev_stop(struct rte_eth_dev *dev);
@@ -1237,12 +1238,48 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+
+
+static int
+eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct virtio_hw *hw = eth_dev->data->dev_private;
+
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+ return -EPERM;
+
+ if (hw->started == 1) {
+ virtio_dev_stop(eth_dev);
+ virtio_dev_close(eth_dev);
+ }
+ pci_dev = eth_dev->pci_dev;
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+
+ /* Allocate memory for storing MAC addresses */
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ /* reset interrupt callback */
+ if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)
+ rte_intr_callback_unregister(&pci_dev->intr_handle,
+ virtio_interrupt_handler, eth_dev);
+
+ return 0;
+}
+
+
static struct eth_driver rte_virtio_pmd = {
{
.name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
+ .drv_flags = RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_virtio_dev_init,
+ .eth_dev_uninit = eth_virtio_dev_uninit,
.dev_private_size = sizeof(struct virtio_hw),
};
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V2] librte_pmd_ring: changes to support PCI Port Hotplug
[not found] <RFC PATCH>
` (8 preceding siblings ...)
2015-05-01 15:28 ` [dpdk-dev] [RFC PATCH] librte_pmd_virtio: " Bernard Iremonger
@ 2015-05-05 14:36 ` Bernard Iremonger
2015-05-06 16:15 ` Bruce Richardson
2015-05-06 10:22 ` [dpdk-dev] [RFC PATCH V2] librte_pmd_ixgbe: " Bernard Iremonger
` (16 subsequent siblings)
26 siblings, 1 reply; 95+ messages in thread
From: Bernard Iremonger @ 2015-05-05 14:36 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the rte_dev_uninit_t() function for the ring pmd.
Changes in V2:
Fix crash in the rte_pmd_ring_devuninit() function.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_pmd_ring/rte_eth_ring.c | 92 +++++++++++++++++++++++++++--------
1 files changed, 71 insertions(+), 21 deletions(-)
diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c
index 6832f01..6d32e6b 100644
--- a/lib/librte_pmd_ring/rte_eth_ring.c
+++ b/lib/librte_pmd_ring/rte_eth_ring.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -252,6 +252,15 @@ static const struct eth_dev_ops ops = {
.mac_addr_add = eth_mac_addr_add,
};
+static struct eth_driver rte_ring_pmd = {
+ .pci_drv = {
+ .name = "rte_ring_pmd",
+ .drv_flags = RTE_PCI_DRV_DETACHABLE,
+ },
+};
+
+static struct rte_pci_id id_table;
+
int
rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
const unsigned nb_rx_queues,
@@ -263,8 +272,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
struct rte_pci_device *pci_dev = NULL;
struct pmd_internals *internals = NULL;
struct rte_eth_dev *eth_dev = NULL;
- struct eth_driver *eth_drv = NULL;
- struct rte_pci_id *id_table = NULL;
unsigned i;
@@ -288,10 +295,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
if (pci_dev == NULL)
goto error;
- id_table = rte_zmalloc_socket(name, sizeof(*id_table), 0, numa_node);
- if (id_table == NULL)
- goto error;
-
internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
if (internals == NULL)
goto error;
@@ -301,9 +304,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
if (eth_dev == NULL)
goto error;
- eth_drv = rte_zmalloc_socket(name, sizeof(*eth_drv), 0, numa_node);
- if (eth_drv == NULL)
- goto error;
/* now put it all together
* - store queue data in internals,
@@ -323,21 +323,22 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
internals->tx_ring_queues[i].rng = tx_queues[i];
}
- eth_drv->pci_drv.name = ring_ethdev_driver_name;
- eth_drv->pci_drv.id_table = id_table;
+ rte_ring_pmd.pci_drv.name = ring_ethdev_driver_name;
+ rte_ring_pmd.pci_drv.id_table = &id_table;
pci_dev->numa_node = numa_node;
- pci_dev->driver = ð_drv->pci_drv;
+ pci_dev->driver = &rte_ring_pmd.pci_drv;
data->dev_private = internals;
data->port_id = eth_dev->data->port_id;
+ memmove(data->name, eth_dev->data->name, sizeof(data->name));
data->nb_rx_queues = (uint16_t)nb_rx_queues;
data->nb_tx_queues = (uint16_t)nb_tx_queues;
data->dev_link = pmd_link;
data->mac_addrs = &internals->address;
eth_dev->data = data;
- eth_dev->driver = eth_drv;
+ eth_dev->driver = &rte_ring_pmd;
eth_dev->dev_ops = &ops;
eth_dev->pci_dev = pci_dev;
TAILQ_INIT(&(eth_dev->link_intr_cbs));
@@ -531,20 +532,34 @@ rte_pmd_ring_devinit(const char *name, const char *params)
RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name);
- if (params == NULL || params[0] == '\0')
- eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ if (params == NULL || params[0] == '\0') {
+ ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ if (ret == -1) {
+ RTE_LOG(INFO, PMD, "Attach to pmd_ring for %s\n", name);
+ ret = eth_dev_ring_create(name, rte_socket_id(),
+ DEV_ATTACH);
+ }
+ }
else {
kvlist = rte_kvargs_parse(params, valid_arguments);
if (!kvlist) {
RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
" rings-backed ethernet device\n");
- eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
- return 0;
+ ret = eth_dev_ring_create(name, rte_socket_id(),
+ DEV_CREATE);
+ if (ret == -1) {
+ RTE_LOG(INFO, PMD, "Attach to pmd_ring for %s\n",
+ name);
+ ret = eth_dev_ring_create(name, rte_socket_id(),
+ DEV_ATTACH);
+ }
+ return ret;
} else {
ret = rte_kvargs_count(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG);
- info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) +
- (sizeof(struct node_action_pair) * ret), 0);
+ info = rte_zmalloc("struct node_action_list",
+ sizeof(struct node_action_list) +
+ (sizeof(struct node_action_pair) * ret), 0);
if (!info)
goto out_free;
@@ -558,8 +573,17 @@ rte_pmd_ring_devinit(const char *name, const char *params)
goto out_free;
for (info->count = 0; info->count < info->total; info->count++) {
- eth_dev_ring_create(name, info->list[info->count].node,
+ ret = eth_dev_ring_create(name,
+ info->list[info->count].node,
info->list[info->count].action);
+ if ((ret == -1) &&
+ (info->list[info->count].action == DEV_CREATE)) {
+ RTE_LOG(INFO, PMD,
+ "Attach to pmd_ring for %s\n",
+ name);
+ ret = eth_dev_ring_create(name,
+ info->list[info->count].node, DEV_ATTACH);
+ }
}
}
}
@@ -570,10 +594,36 @@ out_free:
return ret;
}
+static int
+rte_pmd_ring_devuninit(const char *name)
+{
+ struct rte_eth_dev *eth_dev = NULL;
+
+ RTE_LOG(INFO, PMD, "Un-Initializing pmd_ring for %s\n", name);
+
+ if (name == NULL)
+ return -EINVAL;
+
+ /* find an ethdev entry */
+ eth_dev = rte_eth_dev_allocated(name);
+ if (eth_dev == NULL)
+ return -ENODEV;
+
+ eth_dev_stop(eth_dev);
+ rte_free(eth_dev->data->dev_private);
+ rte_free(eth_dev->data);
+ rte_free(eth_dev->pci_dev);
+
+ rte_eth_dev_release_port(eth_dev);
+ return 0;
+}
+
+
static struct rte_driver pmd_ring_drv = {
.name = "eth_ring",
.type = PMD_VDEV,
.init = rte_pmd_ring_devinit,
+ .uninit = rte_pmd_ring_devuninit,
};
PMD_REGISTER_DRIVER(pmd_ring_drv);
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH V2] librte_pmd_ring: changes to support PCI Port Hotplug
2015-05-05 14:36 ` [dpdk-dev] [RFC PATCH V2] librte_pmd_ring: changes to support " Bernard Iremonger
@ 2015-05-06 16:15 ` Bruce Richardson
0 siblings, 0 replies; 95+ messages in thread
From: Bruce Richardson @ 2015-05-06 16:15 UTC (permalink / raw)
To: Bernard Iremonger; +Cc: dev
On Tue, May 05, 2015 at 03:36:41PM +0100, Bernard Iremonger wrote:
> This patch depends on the Port Hotplug Framework.
> It implements the rte_dev_uninit_t() function for the ring pmd.
>
> Changes in V2:
>
> Fix crash in the rte_pmd_ring_devuninit() function.
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
This seems to work fine in testing with testpmd.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> lib/librte_pmd_ring/rte_eth_ring.c | 92 +++++++++++++++++++++++++++--------
> 1 files changed, 71 insertions(+), 21 deletions(-)
>
> diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c
> index 6832f01..6d32e6b 100644
> --- a/lib/librte_pmd_ring/rte_eth_ring.c
> +++ b/lib/librte_pmd_ring/rte_eth_ring.c
> @@ -1,7 +1,7 @@
> /*-
> * BSD LICENSE
> *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
> * All rights reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> @@ -252,6 +252,15 @@ static const struct eth_dev_ops ops = {
> .mac_addr_add = eth_mac_addr_add,
> };
>
> +static struct eth_driver rte_ring_pmd = {
> + .pci_drv = {
> + .name = "rte_ring_pmd",
> + .drv_flags = RTE_PCI_DRV_DETACHABLE,
> + },
> +};
> +
> +static struct rte_pci_id id_table;
> +
> int
> rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
> const unsigned nb_rx_queues,
> @@ -263,8 +272,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
> struct rte_pci_device *pci_dev = NULL;
> struct pmd_internals *internals = NULL;
> struct rte_eth_dev *eth_dev = NULL;
> - struct eth_driver *eth_drv = NULL;
> - struct rte_pci_id *id_table = NULL;
>
> unsigned i;
>
> @@ -288,10 +295,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
> if (pci_dev == NULL)
> goto error;
>
> - id_table = rte_zmalloc_socket(name, sizeof(*id_table), 0, numa_node);
> - if (id_table == NULL)
> - goto error;
> -
> internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
> if (internals == NULL)
> goto error;
> @@ -301,9 +304,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
> if (eth_dev == NULL)
> goto error;
>
> - eth_drv = rte_zmalloc_socket(name, sizeof(*eth_drv), 0, numa_node);
> - if (eth_drv == NULL)
> - goto error;
>
> /* now put it all together
> * - store queue data in internals,
> @@ -323,21 +323,22 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
> internals->tx_ring_queues[i].rng = tx_queues[i];
> }
>
> - eth_drv->pci_drv.name = ring_ethdev_driver_name;
> - eth_drv->pci_drv.id_table = id_table;
> + rte_ring_pmd.pci_drv.name = ring_ethdev_driver_name;
> + rte_ring_pmd.pci_drv.id_table = &id_table;
>
> pci_dev->numa_node = numa_node;
> - pci_dev->driver = ð_drv->pci_drv;
> + pci_dev->driver = &rte_ring_pmd.pci_drv;
>
> data->dev_private = internals;
> data->port_id = eth_dev->data->port_id;
> + memmove(data->name, eth_dev->data->name, sizeof(data->name));
> data->nb_rx_queues = (uint16_t)nb_rx_queues;
> data->nb_tx_queues = (uint16_t)nb_tx_queues;
> data->dev_link = pmd_link;
> data->mac_addrs = &internals->address;
>
> eth_dev->data = data;
> - eth_dev->driver = eth_drv;
> + eth_dev->driver = &rte_ring_pmd;
> eth_dev->dev_ops = &ops;
> eth_dev->pci_dev = pci_dev;
> TAILQ_INIT(&(eth_dev->link_intr_cbs));
> @@ -531,20 +532,34 @@ rte_pmd_ring_devinit(const char *name, const char *params)
>
> RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name);
>
> - if (params == NULL || params[0] == '\0')
> - eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
> + if (params == NULL || params[0] == '\0') {
> + ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
> + if (ret == -1) {
> + RTE_LOG(INFO, PMD, "Attach to pmd_ring for %s\n", name);
> + ret = eth_dev_ring_create(name, rte_socket_id(),
> + DEV_ATTACH);
> + }
> + }
> else {
> kvlist = rte_kvargs_parse(params, valid_arguments);
>
> if (!kvlist) {
> RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
> " rings-backed ethernet device\n");
> - eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
> - return 0;
> + ret = eth_dev_ring_create(name, rte_socket_id(),
> + DEV_CREATE);
> + if (ret == -1) {
> + RTE_LOG(INFO, PMD, "Attach to pmd_ring for %s\n",
> + name);
> + ret = eth_dev_ring_create(name, rte_socket_id(),
> + DEV_ATTACH);
> + }
> + return ret;
> } else {
> ret = rte_kvargs_count(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG);
> - info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) +
> - (sizeof(struct node_action_pair) * ret), 0);
> + info = rte_zmalloc("struct node_action_list",
> + sizeof(struct node_action_list) +
> + (sizeof(struct node_action_pair) * ret), 0);
> if (!info)
> goto out_free;
>
> @@ -558,8 +573,17 @@ rte_pmd_ring_devinit(const char *name, const char *params)
> goto out_free;
>
> for (info->count = 0; info->count < info->total; info->count++) {
> - eth_dev_ring_create(name, info->list[info->count].node,
> + ret = eth_dev_ring_create(name,
> + info->list[info->count].node,
> info->list[info->count].action);
> + if ((ret == -1) &&
> + (info->list[info->count].action == DEV_CREATE)) {
> + RTE_LOG(INFO, PMD,
> + "Attach to pmd_ring for %s\n",
> + name);
> + ret = eth_dev_ring_create(name,
> + info->list[info->count].node, DEV_ATTACH);
> + }
> }
> }
> }
> @@ -570,10 +594,36 @@ out_free:
> return ret;
> }
>
> +static int
> +rte_pmd_ring_devuninit(const char *name)
> +{
> + struct rte_eth_dev *eth_dev = NULL;
> +
> + RTE_LOG(INFO, PMD, "Un-Initializing pmd_ring for %s\n", name);
> +
> + if (name == NULL)
> + return -EINVAL;
> +
> + /* find an ethdev entry */
> + eth_dev = rte_eth_dev_allocated(name);
> + if (eth_dev == NULL)
> + return -ENODEV;
> +
> + eth_dev_stop(eth_dev);
> + rte_free(eth_dev->data->dev_private);
> + rte_free(eth_dev->data);
> + rte_free(eth_dev->pci_dev);
> +
> + rte_eth_dev_release_port(eth_dev);
> + return 0;
> +}
> +
> +
> static struct rte_driver pmd_ring_drv = {
> .name = "eth_ring",
> .type = PMD_VDEV,
> .init = rte_pmd_ring_devinit,
> + .uninit = rte_pmd_ring_devuninit,
> };
>
> PMD_REGISTER_DRIVER(pmd_ring_drv);
> --
> 1.7.4.1
>
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V2] librte_pmd_ixgbe: changes to support PCI Port Hotplug
[not found] <RFC PATCH>
` (9 preceding siblings ...)
2015-05-05 14:36 ` [dpdk-dev] [RFC PATCH V2] librte_pmd_ring: changes to support " Bernard Iremonger
@ 2015-05-06 10:22 ` Bernard Iremonger
2015-05-06 11:20 ` [dpdk-dev] [RFC PATCH V2] librte_pmd_e1000: igb and em1000 PCI Port Hotplug changes Bernard Iremonger
` (15 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-05-06 10:22 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_ixgbe_pmd and
rte_ixgbevf_pmd.
Changes in V2:
Added call to dev_close() in dev_uninit() functions.
Removed input parameter checks from dev_uninit() functions.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 82 +++++++++++++++++++++++++++++++++-
lib/librte_pmd_ixgbe/ixgbe_ethdev.h | 4 +-
lib/librte_pmd_ixgbe/ixgbe_pf.c | 25 ++++++++++-
3 files changed, 106 insertions(+), 5 deletions(-)
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 366aa45..18f403a 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -117,6 +117,7 @@
#define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / sizeof(hw_stats->qprc[0]))
static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev);
static int ixgbe_dev_configure(struct rte_eth_dev *dev);
static int ixgbe_dev_start(struct rte_eth_dev *dev);
static void ixgbe_dev_stop(struct rte_eth_dev *dev);
@@ -183,6 +184,7 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_conf
/* For Virtual Function support */
static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev);
static int ixgbevf_dev_configure(struct rte_eth_dev *dev);
static int ixgbevf_dev_start(struct rte_eth_dev *dev);
static void ixgbevf_dev_stop(struct rte_eth_dev *dev);
@@ -916,6 +918,46 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct ixgbe_hw *hw;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+ pci_dev = eth_dev->pci_dev;
+
+ if (hw->adapter_stopped == FALSE)
+ ixgbe_dev_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ /* Unlock any pending hardware semaphore */
+ ixgbe_swfw_lock_reset(hw);
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ ixgbe_dev_interrupt_handler, (void *)eth_dev);
+
+ /* uninitialize PF if max_vfs not zero */
+ ixgbe_pf_host_uninit(eth_dev);
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ rte_free(eth_dev->data->hash_mac_addrs);
+ eth_dev->data->hash_mac_addrs = NULL;
+
+ return 0;
+}
/*
* Negotiate mailbox API version with the PF.
@@ -1086,13 +1128,46 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+/*
+ * Virtual Function device uninit
+ */
+static int
+eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct ixgbe_hw *hw;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+
+ if (hw->adapter_stopped == FALSE)
+ ixgbevf_dev_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ /* Disable the interrupts for VF */
+ ixgbevf_intr_disable(hw);
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ return 0;
+}
+
static struct eth_driver rte_ixgbe_pmd = {
{
.name = "rte_ixgbe_pmd",
.id_table = pci_id_ixgbe_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_ixgbe_dev_init,
+ .eth_dev_uninit = eth_ixgbe_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
@@ -1103,9 +1178,10 @@ static struct eth_driver rte_ixgbevf_pmd = {
{
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_ixgbevf_dev_init,
+ .eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
index e45e727..68a8696 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -389,6 +389,8 @@ void ixgbe_vlan_hw_strip_disable_all(struct rte_eth_dev *dev);
void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev);
+void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev);
+
void ixgbe_pf_mbx_process(struct rte_eth_dev *eth_dev);
int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev);
diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c b/lib/librte_pmd_ixgbe/ixgbe_pf.c
index dbda9b5..2a1b061 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_pf.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -144,6 +144,29 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)
return;
}
+void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct ixgbe_vf_info **vfinfo;
+ uint16_t vf_num;
+
+ PMD_INIT_FUNC_TRACE();
+
+ vfinfo = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
+
+ RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = 0;
+
+ vf_num = dev_num_vf(eth_dev);
+ if (vf_num == 0)
+ return;
+
+ rte_free(*vfinfo);
+ *vfinfo = NULL;
+}
+
+
int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
{
uint32_t vtctl, fcrth;
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V2] librte_pmd_e1000: igb and em1000 PCI Port Hotplug changes
[not found] <RFC PATCH>
` (10 preceding siblings ...)
2015-05-06 10:22 ` [dpdk-dev] [RFC PATCH V2] librte_pmd_ixgbe: " Bernard Iremonger
@ 2015-05-06 11:20 ` Bernard Iremonger
2015-05-27 16:00 ` [dpdk-dev] [RFC PATCH V2 1/2] drivers/net/virtio: add support for PCI Port Hotplug Bernard Iremonger
` (14 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-05-06 11:20 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_em_pmd,
rte_igb_pmd and rte_igbvf_pmd.
Changes in V2:
Call dev_close() from dev_uninit() functions.
Remove input parameter checking from dev_unit() functions.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_pmd_e1000/e1000/e1000_hw.h | 3 +-
lib/librte_pmd_e1000/e1000_ethdev.h | 4 +-
lib/librte_pmd_e1000/em_ethdev.c | 42 +++++++++++++++++-
lib/librte_pmd_e1000/igb_ethdev.c | 79 +++++++++++++++++++++++++++++++-
lib/librte_pmd_e1000/igb_pf.c | 24 ++++++++++-
5 files changed, 144 insertions(+), 8 deletions(-)
diff --git a/lib/librte_pmd_e1000/e1000/e1000_hw.h b/lib/librte_pmd_e1000/e1000/e1000_hw.h
index 4dd92a3..60cd237 100644
--- a/lib/librte_pmd_e1000/e1000/e1000_hw.h
+++ b/lib/librte_pmd_e1000/e1000/e1000_hw.h
@@ -1,6 +1,6 @@
/*******************************************************************************
-Copyright (c) 2001-2014, Intel Corporation
+Copyright (c) 2001-2015, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -1005,6 +1005,7 @@ struct e1000_hw {
u16 vendor_id;
u8 revision_id;
+ bool adapter_stopped;
};
#include "e1000_82541.h"
diff --git a/lib/librte_pmd_e1000/e1000_ethdev.h b/lib/librte_pmd_e1000/e1000_ethdev.h
index c451faa..51720b9 100644
--- a/lib/librte_pmd_e1000/e1000_ethdev.h
+++ b/lib/librte_pmd_e1000/e1000_ethdev.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -298,6 +298,8 @@ void eth_igbvf_tx_init(struct rte_eth_dev *dev);
*/
void igb_pf_host_init(struct rte_eth_dev *eth_dev);
+void igb_pf_host_uninit(struct rte_eth_dev *eth_dev);
+
void igb_pf_mbx_process(struct rte_eth_dev *eth_dev);
int igb_pf_host_configure(struct rte_eth_dev *eth_dev);
diff --git a/lib/librte_pmd_e1000/em_ethdev.c b/lib/librte_pmd_e1000/em_ethdev.c
index da02988..fa94ee6 100644
--- a/lib/librte_pmd_e1000/em_ethdev.c
+++ b/lib/librte_pmd_e1000/em_ethdev.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -241,6 +241,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
hw->device_id = pci_dev->id.device_id;
+ hw->adapter_stopped = FALSE;
/* For ICH8 support we'll need to map the flash memory BAR */
@@ -280,13 +281,47 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)
return (0);
}
+static int
+eth_em_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct e1000_hw *hw;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ pci_dev = eth_dev->pci_dev;
+ hw = E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+
+ if (hw->adapter_stopped == FALSE)
+ eth_em_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ eth_em_interrupt_handler, (void *)eth_dev);
+
+ return 0;
+}
+
static struct eth_driver rte_em_pmd = {
{
.name = "rte_em_pmd",
.id_table = pci_id_em_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_em_dev_init,
+ .eth_dev_uninit = eth_em_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
@@ -565,6 +600,8 @@ eth_em_start(struct rte_eth_dev *dev)
}
}
+ hw->adapter_stopped = FALSE;
+
PMD_INIT_LOG(DEBUG, "<<");
return (0);
@@ -610,6 +647,7 @@ eth_em_close(struct rte_eth_dev *dev)
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
eth_em_stop(dev);
+ hw->adapter_stopped = TRUE;
e1000_phy_hw_reset(hw);
em_release_manageability(hw);
em_hw_control_release(hw);
diff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c
index 4415155..05a5500 100644
--- a/lib/librte_pmd_e1000/igb_ethdev.c
+++ b/lib/librte_pmd_e1000/igb_ethdev.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -564,6 +564,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
goto err_late;
}
hw->mac.get_link_status = 1;
+ hw->adapter_stopped = FALSE;
/* Indicate SOL/IDER usage */
if (e1000_check_reset_block(hw) < 0) {
@@ -608,6 +609,45 @@ err_late:
return (error);
}
+static int
+eth_igb_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct e1000_hw *hw;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ hw = E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+ pci_dev = eth_dev->pci_dev;
+
+ if (hw->adapter_stopped == FALSE)
+ eth_igb_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ /* Reset any pending lock */
+ igb_reset_swfw_lock(hw);
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ /* uninitialize PF if max_vfs not zero */
+ igb_pf_host_uninit(eth_dev);
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ eth_igb_interrupt_handler, (void *)eth_dev);
+
+ return 0;
+}
+
+
/*
* Virtual Function device init
*/
@@ -639,6 +679,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
hw->device_id = pci_dev->id.device_id;
hw->vendor_id = pci_dev->id.vendor_id;
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
+ hw->adapter_stopped = FALSE;
/* Initialize the shared code (base driver) */
diag = e1000_setup_init_funcs(hw, TRUE);
@@ -679,13 +720,39 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct e1000_hw *hw;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ hw = E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+ if (hw->adapter_stopped == FALSE)
+ igbvf_dev_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ return 0;
+}
+
static struct eth_driver rte_igb_pmd = {
{
.name = "rte_igb_pmd",
.id_table = pci_id_igb_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_igb_dev_init,
+ .eth_dev_uninit = eth_igb_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
@@ -696,9 +763,10 @@ static struct eth_driver rte_igbvf_pmd = {
{
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_igbvf_dev_init,
+ .eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
@@ -780,6 +848,7 @@ eth_igb_start(struct rte_eth_dev *dev)
PMD_INIT_LOG(ERR, "Unable to initialize the hardware");
return (-EIO);
}
+ hw->adapter_stopped = FALSE;
E1000_WRITE_REG(hw, E1000_VET, ETHER_TYPE_VLAN << 16 | ETHER_TYPE_VLAN);
@@ -989,6 +1058,8 @@ eth_igb_close(struct rte_eth_dev *dev)
struct rte_eth_link link;
eth_igb_stop(dev);
+ hw->adapter_stopped = TRUE;
+
e1000_phy_hw_reset(hw);
igb_release_manageability(hw);
igb_hw_control_release(hw);
@@ -2227,6 +2298,7 @@ igbvf_dev_start(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
hw->mac.ops.reset_hw(hw);
+ hw->adapter_stopped = FALSE;
/* Set all vfta */
igbvf_set_vfta_all(dev,1);
@@ -2270,6 +2342,7 @@ igbvf_dev_close(struct rte_eth_dev *dev)
e1000_reset_hw(hw);
igbvf_dev_stop(dev);
+ hw->adapter_stopped = TRUE;
}
static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on)
diff --git a/lib/librte_pmd_e1000/igb_pf.c b/lib/librte_pmd_e1000/igb_pf.c
index 2d49379..87fd812 100644
--- a/lib/librte_pmd_e1000/igb_pf.c
+++ b/lib/librte_pmd_e1000/igb_pf.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -127,6 +127,28 @@ void igb_pf_host_init(struct rte_eth_dev *eth_dev)
return;
}
+void igb_pf_host_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct e1000_vf_info **vfinfo;
+ uint16_t vf_num;
+
+ PMD_INIT_FUNC_TRACE();
+
+ vfinfo = E1000_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
+
+ RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = 0;
+
+ vf_num = dev_num_vf(eth_dev);
+ if (vf_num == 0)
+ return;
+
+ rte_free(*vfinfo);
+ *vfinfo = NULL;
+}
+
#define E1000_RAH_POOLSEL_SHIFT (18)
int igb_pf_host_configure(struct rte_eth_dev *eth_dev)
{
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V2 1/2] drivers/net/virtio: add support for PCI Port Hotplug
[not found] <RFC PATCH>
` (11 preceding siblings ...)
2015-05-06 11:20 ` [dpdk-dev] [RFC PATCH V2] librte_pmd_e1000: igb and em1000 PCI Port Hotplug changes Bernard Iremonger
@ 2015-05-27 16:00 ` Bernard Iremonger
2015-05-27 16:00 ` [dpdk-dev] [RFC PATCH V2 2/2] drivers/net/virtio: check vq parameter Bernard Iremonger
` (13 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-05-27 16:00 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit_t() function for virtio pmd.
Changes in V2:
Rebase to use new drivers directory.
Reuse memzones.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/virtio/virtio_ethdev.c | 83 +++++++++++++++++++++++++++++++++---
1 files changed, 76 insertions(+), 7 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index f74e413..106deb2 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,7 @@
#include <rte_pci.h>
#include <rte_ether.h>
#include <rte_common.h>
+#include <rte_errno.h>
#include <rte_memory.h>
#include <rte_eal.h>
@@ -63,6 +64,7 @@
static int eth_virtio_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev);
static int virtio_dev_configure(struct rte_eth_dev *dev);
static int virtio_dev_start(struct rte_eth_dev *dev);
static void virtio_dev_stop(struct rte_eth_dev *dev);
@@ -316,8 +318,12 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
mz = rte_memzone_reserve_aligned(vq_name, vq->vq_ring_size,
socket_id, 0, VIRTIO_PCI_VRING_ALIGN);
if (mz == NULL) {
- rte_free(vq);
- return -ENOMEM;
+ if (rte_errno == EEXIST)
+ mz = rte_memzone_lookup(vq_name);
+ if (mz == NULL) {
+ rte_free(vq);
+ return -ENOMEM;
+ }
}
/*
@@ -350,8 +356,13 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
vq_size * hw->vtnet_hdr_size,
socket_id, 0, RTE_CACHE_LINE_SIZE);
if (vq->virtio_net_hdr_mz == NULL) {
- rte_free(vq);
- return -ENOMEM;
+ if (rte_errno == EEXIST)
+ vq->virtio_net_hdr_mz =
+ rte_memzone_lookup(vq_name);
+ if (vq->virtio_net_hdr_mz == NULL) {
+ rte_free(vq);
+ return -ENOMEM;
+ }
}
vq->virtio_net_hdr_mem =
vq->virtio_net_hdr_mz->phys_addr;
@@ -364,8 +375,13 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
vq->virtio_net_hdr_mz = rte_memzone_reserve_aligned(vq_name,
PAGE_SIZE, socket_id, 0, RTE_CACHE_LINE_SIZE);
if (vq->virtio_net_hdr_mz == NULL) {
- rte_free(vq);
- return -ENOMEM;
+ if (rte_errno == EEXIST)
+ vq->virtio_net_hdr_mz =
+ rte_memzone_lookup(vq_name);
+ if (vq->virtio_net_hdr_mz == NULL) {
+ rte_free(vq);
+ return -ENOMEM;
+ }
}
vq->virtio_net_hdr_mem =
vq->virtio_net_hdr_mz->phys_addr;
@@ -1237,12 +1253,63 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct virtio_hw *hw = eth_dev->data->dev_private;
+ unsigned int i;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+ return -EPERM;
+
+ if (hw->started == 1) {
+ virtio_dev_stop(eth_dev);
+ virtio_dev_close(eth_dev);
+ }
+ pci_dev = eth_dev->pci_dev;
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+
+ rte_free(hw->cvq);
+ hw->cvq = NULL;
+
+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+ rte_free(eth_dev->data->rx_queues[i]);
+ eth_dev->data->rx_queues[i] = NULL;
+ }
+
+ for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
+ rte_free(eth_dev->data->tx_queues[i]);
+ eth_dev->data->tx_queues[i] = NULL;
+ }
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ /* reset interrupt callback */
+ if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)
+ rte_intr_callback_unregister(&pci_dev->intr_handle,
+ virtio_interrupt_handler,
+ eth_dev);
+
+ PMD_INIT_LOG(DEBUG, "dev_uninit completed");
+
+ return 0;
+}
+
static struct eth_driver rte_virtio_pmd = {
{
.name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
+ .drv_flags = RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_virtio_dev_init,
+ .eth_dev_uninit = eth_virtio_dev_uninit,
.dev_private_size = sizeof(struct virtio_hw),
};
@@ -1385,6 +1452,8 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)
"Before freeing rxq[%d] used and unused buf", i);
VIRTQUEUE_DUMP((struct virtqueue *)dev->data->rx_queues[i]);
+ PMD_INIT_LOG(DEBUG, "rx_queues[%d]=%p",
+ i, dev->data->rx_queues[i]);
while ((buf = (struct rte_mbuf *)virtqueue_detatch_unused(
dev->data->rx_queues[i])) != NULL) {
rte_pktmbuf_free(buf);
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V2 2/2] drivers/net/virtio: check vq parameter
[not found] <RFC PATCH>
` (12 preceding siblings ...)
2015-05-27 16:00 ` [dpdk-dev] [RFC PATCH V2 1/2] drivers/net/virtio: add support for PCI Port Hotplug Bernard Iremonger
@ 2015-05-27 16:00 ` Bernard Iremonger
2015-06-16 1:08 ` Ouyang, Changchun
2015-05-28 12:28 ` [dpdk-dev] [RFC PATCH V2] drivers/net/bonding: add support for PCI Port Hotplug Bernard Iremonger
` (12 subsequent siblings)
26 siblings, 1 reply; 95+ messages in thread
From: Bernard Iremonger @ 2015-05-27 16:00 UTC (permalink / raw)
To: dev
If vq is NULL, there is a segmentation fault.
Signed-off-by: Bernard <bernard.iremonger@intel.com>
---
drivers/net/virtio/virtqueue.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c
index 8a3005f..7f60e3e 100644
--- a/drivers/net/virtio/virtqueue.c
+++ b/drivers/net/virtio/virtqueue.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -60,11 +60,13 @@ virtqueue_detatch_unused(struct virtqueue *vq)
struct rte_mbuf *cookie;
int idx;
- for (idx = 0; idx < vq->vq_nentries; idx++) {
- if ((cookie = vq->vq_descx[idx].cookie) != NULL) {
- vq->vq_descx[idx].cookie = NULL;
- return cookie;
+ if (vq != NULL)
+ for (idx = 0; idx < vq->vq_nentries; idx++) {
+ cookie = vq->vq_descx[idx].cookie;
+ if (cookie != NULL) {
+ vq->vq_descx[idx].cookie = NULL;
+ return cookie;
+ }
}
- }
return NULL;
}
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V2] drivers/net/bonding: add support for PCI Port Hotplug
[not found] <RFC PATCH>
` (13 preceding siblings ...)
2015-05-27 16:00 ` [dpdk-dev] [RFC PATCH V2 2/2] drivers/net/virtio: check vq parameter Bernard Iremonger
@ 2015-05-28 12:28 ` Bernard Iremonger
2015-05-29 13:46 ` [dpdk-dev] [RFC PATCH V3] drivers/net/ring: changes to support " Bernard Iremonger
` (11 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-05-28 12:28 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the rte_dev_uninit_t() function for the link bonding pmd.
Changes in V2:
Rebased to use drivers/net/bonding dirctory
Free rx and tx queues following comments from Declan
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/bonding/rte_eth_bond.h | 13 ++++-
drivers/net/bonding/rte_eth_bond_api.c | 82 +++++++++++++++++++---------
drivers/net/bonding/rte_eth_bond_pmd.c | 23 +++++++-
drivers/net/bonding/rte_eth_bond_private.h | 7 ++-
4 files changed, 95 insertions(+), 30 deletions(-)
diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h
index d688fc3..8efbf07 100644
--- a/drivers/net/bonding/rte_eth_bond.h
+++ b/drivers/net/bonding/rte_eth_bond.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -131,6 +131,17 @@ int
rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id);
/**
+ * Free a bonded rte_eth_dev device
+ *
+ * @param name Name of the link bonding device.
+ *
+ * @return
+ * 0 on success, negative value otherwise
+ */
+int
+rte_eth_bond_free(const char *name);
+
+/**
* Add a rte_eth_dev device as a slave to the bonded device
*
* @param bonded_port_id Port ID of bonded device.
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index e91a623..04271aa 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -192,7 +192,15 @@ number_of_sockets(void)
return ++sockets;
}
-const char *driver_name = "Link Bonding PMD";
+const char driver_name[] = "rte_bond_pmd";
+static struct rte_pci_id pci_id_table;
+
+static struct eth_driver rte_bond_pmd = {
+ .pci_drv = {
+ .name = driver_name,
+ .drv_flags = RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_DETACHABLE,
+ },
+};
int
rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
@@ -200,9 +208,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
struct rte_pci_device *pci_dev = NULL;
struct bond_dev_private *internals = NULL;
struct rte_eth_dev *eth_dev = NULL;
- struct eth_driver *eth_drv = NULL;
struct rte_pci_driver *pci_drv = NULL;
- struct rte_pci_id *pci_id_table = NULL;
+
/* now do all data allocation - for eth_dev structure, dummy pci driver
* and internal (private) data
*/
@@ -224,26 +231,15 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
goto err;
}
- eth_drv = rte_zmalloc_socket(name, sizeof(*eth_drv), 0, socket_id);
- if (eth_drv == NULL) {
- RTE_BOND_LOG(ERR, "Unable to malloc eth_drv on socket");
- goto err;
- }
-
- pci_drv = ð_drv->pci_drv;
+ pci_drv = &rte_bond_pmd.pci_drv;
- pci_id_table = rte_zmalloc_socket(name, sizeof(*pci_id_table), 0, socket_id);
- if (pci_id_table == NULL) {
- RTE_BOND_LOG(ERR, "Unable to malloc pci_id_table on socket");
- goto err;
- }
- pci_id_table->device_id = PCI_ANY_ID;
- pci_id_table->subsystem_device_id = PCI_ANY_ID;
- pci_id_table->vendor_id = PCI_ANY_ID;
- pci_id_table->subsystem_vendor_id = PCI_ANY_ID;
+ memset(&pci_id_table, 0, sizeof(pci_id_table));
+ pci_id_table.device_id = PCI_ANY_ID;
+ pci_id_table.subsystem_device_id = PCI_ANY_ID;
+ pci_id_table.vendor_id = PCI_ANY_ID;
+ pci_id_table.subsystem_vendor_id = PCI_ANY_ID;
- pci_drv->id_table = pci_id_table;
- pci_drv->drv_flags = RTE_PCI_DRV_INTR_LSC;
+ pci_drv->id_table = &pci_id_table;
internals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id);
if (internals == NULL) {
@@ -261,7 +257,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
pci_dev->numa_node = socket_id;
pci_drv->name = driver_name;
- eth_dev->driver = eth_drv;
+ eth_dev->driver = &rte_bond_pmd;
eth_dev->data->dev_private = internals;
eth_dev->data->nb_rx_queues = (uint16_t)1;
eth_dev->data->nb_tx_queues = (uint16_t)1;
@@ -317,13 +313,49 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
err:
rte_free(pci_dev);
- rte_free(pci_id_table);
- rte_free(eth_drv);
rte_free(internals);
+ rte_free(eth_dev->data->mac_addrs);
return -1;
}
+int
+rte_eth_bond_free(const char *name)
+{
+ struct rte_eth_dev *eth_dev = NULL;
+ unsigned i;
+
+ /* now free all data allocation - for eth_dev structure,
+ * dummy pci driver and internal (private) data
+ */
+
+ /* find an ethdev entry */
+ eth_dev = rte_eth_dev_allocated(name);
+ if (eth_dev == NULL)
+ return -ENODEV;
+
+ if (eth_dev->data->dev_started == 1)
+ bond_ethdev_stop(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++)
+ rte_free(eth_dev->data->rx_queues[i]);
+
+ for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
+ rte_free(eth_dev->data->tx_queues[i]);
+
+ rte_free(eth_dev->pci_dev);
+ rte_free(eth_dev->data->dev_private);
+ rte_free(eth_dev->data->mac_addrs);
+
+ rte_eth_dev_release_port(eth_dev);
+
+ return 0;
+}
+
static int
__eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
{
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index c937e6b..45d5b89 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -1503,7 +1503,7 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev)
return 0;
}
-static void
+void
bond_ethdev_stop(struct rte_eth_dev *eth_dev)
{
struct bond_dev_private *internals = eth_dev->data->dev_private;
@@ -2038,6 +2038,24 @@ parse_error:
return -1;
}
+static int
+bond_uninit(const char *name)
+{
+ int ret;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ RTE_LOG(INFO, EAL, "Uninitializing pmd_bond for %s\n", name);
+
+ /* free link bonding eth device */
+ ret = rte_eth_bond_free(name);
+ if (ret < 0)
+ RTE_LOG(ERR, EAL, "Failed to free %s\n", name);
+
+ return ret;
+}
+
/* this part will resolve the slave portids after all the other pdev and vdev
* have been allocated */
static int
@@ -2264,6 +2282,7 @@ static struct rte_driver bond_drv = {
.name = "eth_bond",
.type = PMD_VDEV,
.init = bond_init,
+ .uninit = bond_uninit,
};
PMD_REGISTER_DRIVER(bond_drv);
diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h
index 45e5c65..7b00e94 100644
--- a/drivers/net/bonding/rte_eth_bond_private.h
+++ b/drivers/net/bonding/rte_eth_bond_private.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -62,7 +62,7 @@
extern const char *pmd_bond_init_valid_arguments[];
-extern const char *driver_name;
+extern const char driver_name[];
/** Port Queue Mapping Structure */
struct bond_rx_queue {
@@ -284,4 +284,7 @@ bond_tlb_enable(struct bond_dev_private *internals);
void
bond_tlb_activate_slave(struct bond_dev_private *internals);
+void
+bond_ethdev_stop(struct rte_eth_dev *eth_dev);
+
#endif
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V3] drivers/net/ring: changes to support PCI Port Hotplug
[not found] <RFC PATCH>
` (14 preceding siblings ...)
2015-05-28 12:28 ` [dpdk-dev] [RFC PATCH V2] drivers/net/bonding: add support for PCI Port Hotplug Bernard Iremonger
@ 2015-05-29 13:46 ` Bernard Iremonger
2015-06-03 15:21 ` Bruce Richardson
2015-06-02 10:18 ` [dpdk-dev] [RFC PATCH V3] ixgbe: " Bernard Iremonger
` (10 subsequent siblings)
26 siblings, 1 reply; 95+ messages in thread
From: Bernard Iremonger @ 2015-05-29 13:46 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the rte_dev_uninit_t() function for the ring pmd.
Changes in V3:
Rebase to use drivers/net/ring directory
Handle no parameters case
Changes in V2:
Fix crash in the rte_pmd_ring_devuninit() function.
Signed-off-by: Bernard <bernard.iremonger@intel.com>
---
drivers/net/ring/rte_eth_ring.c | 97 ++++++++++++++++++++++++++++++---------
1 files changed, 75 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 6832f01..1f160d8 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -252,6 +252,15 @@ static const struct eth_dev_ops ops = {
.mac_addr_add = eth_mac_addr_add,
};
+static struct eth_driver rte_ring_pmd = {
+ .pci_drv = {
+ .name = "rte_ring_pmd",
+ .drv_flags = RTE_PCI_DRV_DETACHABLE,
+ },
+};
+
+static struct rte_pci_id id_table;
+
int
rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
const unsigned nb_rx_queues,
@@ -263,8 +272,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
struct rte_pci_device *pci_dev = NULL;
struct pmd_internals *internals = NULL;
struct rte_eth_dev *eth_dev = NULL;
- struct eth_driver *eth_drv = NULL;
- struct rte_pci_id *id_table = NULL;
unsigned i;
@@ -288,10 +295,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
if (pci_dev == NULL)
goto error;
- id_table = rte_zmalloc_socket(name, sizeof(*id_table), 0, numa_node);
- if (id_table == NULL)
- goto error;
-
internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
if (internals == NULL)
goto error;
@@ -301,9 +304,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
if (eth_dev == NULL)
goto error;
- eth_drv = rte_zmalloc_socket(name, sizeof(*eth_drv), 0, numa_node);
- if (eth_drv == NULL)
- goto error;
/* now put it all together
* - store queue data in internals,
@@ -323,21 +323,22 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
internals->tx_ring_queues[i].rng = tx_queues[i];
}
- eth_drv->pci_drv.name = ring_ethdev_driver_name;
- eth_drv->pci_drv.id_table = id_table;
+ rte_ring_pmd.pci_drv.name = ring_ethdev_driver_name;
+ rte_ring_pmd.pci_drv.id_table = &id_table;
pci_dev->numa_node = numa_node;
- pci_dev->driver = ð_drv->pci_drv;
+ pci_dev->driver = &rte_ring_pmd.pci_drv;
data->dev_private = internals;
data->port_id = eth_dev->data->port_id;
+ memmove(data->name, eth_dev->data->name, sizeof(data->name));
data->nb_rx_queues = (uint16_t)nb_rx_queues;
data->nb_tx_queues = (uint16_t)nb_tx_queues;
data->dev_link = pmd_link;
data->mac_addrs = &internals->address;
eth_dev->data = data;
- eth_dev->driver = eth_drv;
+ eth_dev->driver = &rte_ring_pmd;
eth_dev->dev_ops = &ops;
eth_dev->pci_dev = pci_dev;
TAILQ_INIT(&(eth_dev->link_intr_cbs));
@@ -531,20 +532,37 @@ rte_pmd_ring_devinit(const char *name, const char *params)
RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name);
- if (params == NULL || params[0] == '\0')
- eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ if (params == NULL || params[0] == '\0') {
+ ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ if (ret == -1) {
+ RTE_LOG(INFO, PMD,
+ "Attach to pmd_ring for %s\n", name);
+ ret = eth_dev_ring_create(name, rte_socket_id(),
+ DEV_ATTACH);
+ }
+ }
else {
kvlist = rte_kvargs_parse(params, valid_arguments);
if (!kvlist) {
RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
" rings-backed ethernet device\n");
- eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
- return 0;
+ ret = eth_dev_ring_create(name, rte_socket_id(),
+ DEV_CREATE);
+ if (ret == -1) {
+ RTE_LOG(INFO, PMD,
+ "Attach to pmd_ring for %s\n",
+ name);
+ ret = eth_dev_ring_create(name, rte_socket_id(),
+ DEV_ATTACH);
+ }
+ return ret;
} else {
ret = rte_kvargs_count(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG);
- info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) +
- (sizeof(struct node_action_pair) * ret), 0);
+ info = rte_zmalloc("struct node_action_list",
+ sizeof(struct node_action_list) +
+ (sizeof(struct node_action_pair) * ret),
+ 0);
if (!info)
goto out_free;
@@ -558,8 +576,18 @@ rte_pmd_ring_devinit(const char *name, const char *params)
goto out_free;
for (info->count = 0; info->count < info->total; info->count++) {
- eth_dev_ring_create(name, info->list[info->count].node,
- info->list[info->count].action);
+ ret = eth_dev_ring_create(name,
+ info->list[info->count].node,
+ info->list[info->count].action);
+ if ((ret == -1) &&
+ (info->list[info->count].action == DEV_CREATE)) {
+ RTE_LOG(INFO, PMD,
+ "Attach to pmd_ring for %s\n",
+ name);
+ ret = eth_dev_ring_create(name,
+ info->list[info->count].node,
+ DEV_ATTACH);
+ }
}
}
}
@@ -570,10 +598,35 @@ out_free:
return ret;
}
+static int
+rte_pmd_ring_devuninit(const char *name)
+{
+ struct rte_eth_dev *eth_dev = NULL;
+
+ RTE_LOG(INFO, PMD, "Un-Initializing pmd_ring for %s\n", name);
+
+ if (name == NULL)
+ return -EINVAL;
+
+ /* find an ethdev entry */
+ eth_dev = rte_eth_dev_allocated(name);
+ if (eth_dev == NULL)
+ return -ENODEV;
+
+ eth_dev_stop(eth_dev);
+ rte_free(eth_dev->data->dev_private);
+ rte_free(eth_dev->data);
+ rte_free(eth_dev->pci_dev);
+
+ rte_eth_dev_release_port(eth_dev);
+ return 0;
+}
+
static struct rte_driver pmd_ring_drv = {
.name = "eth_ring",
.type = PMD_VDEV,
.init = rte_pmd_ring_devinit,
+ .uninit = rte_pmd_ring_devuninit,
};
PMD_REGISTER_DRIVER(pmd_ring_drv);
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH V3] drivers/net/ring: changes to support PCI Port Hotplug
2015-05-29 13:46 ` [dpdk-dev] [RFC PATCH V3] drivers/net/ring: changes to support " Bernard Iremonger
@ 2015-06-03 15:21 ` Bruce Richardson
0 siblings, 0 replies; 95+ messages in thread
From: Bruce Richardson @ 2015-06-03 15:21 UTC (permalink / raw)
To: Bernard Iremonger; +Cc: dev
On Fri, May 29, 2015 at 02:46:36PM +0100, Bernard Iremonger wrote:
> This patch depends on the Port Hotplug Framework.
> It implements the rte_dev_uninit_t() function for the ring pmd.
>
> Changes in V3:
> Rebase to use drivers/net/ring directory
> Handle no parameters case
>
> Changes in V2:
> Fix crash in the rte_pmd_ring_devuninit() function.
>
> Signed-off-by: Bernard <bernard.iremonger@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V3] ixgbe: changes to support PCI Port Hotplug
[not found] <RFC PATCH>
` (15 preceding siblings ...)
2015-05-29 13:46 ` [dpdk-dev] [RFC PATCH V3] drivers/net/ring: changes to support " Bernard Iremonger
@ 2015-06-02 10:18 ` Bernard Iremonger
2015-06-03 14:03 ` [dpdk-dev] [RFC PATCH V3] e1000: igb and em1000 PCI Port Hotplug changes Bernard Iremonger
` (9 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-02 10:18 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_ixgbe_pmd and
rte_ixgbevf_pmd.
Changes in V3:
Rebased to use drivers/net/ixgbe directory.
Changes in V2:
Added call to dev_close() in dev_uninit() functions.
Removed input parameter checks from dev_uninit() functions.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/ixgbe/ixgbe_ethdev.c | 79 +++++++++++++++++++++++++++++++++++++-
drivers/net/ixgbe/ixgbe_ethdev.h | 2 +
drivers/net/ixgbe/ixgbe_pf.c | 22 ++++++++++
3 files changed, 101 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 0d9f9b2..8b4483a 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -117,6 +117,7 @@
#define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / sizeof(hw_stats->qprc[0]))
static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev);
static int ixgbe_dev_configure(struct rte_eth_dev *dev);
static int ixgbe_dev_start(struct rte_eth_dev *dev);
static void ixgbe_dev_stop(struct rte_eth_dev *dev);
@@ -183,6 +184,7 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_conf
/* For Virtual Function support */
static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev);
static int ixgbevf_dev_configure(struct rte_eth_dev *dev);
static int ixgbevf_dev_start(struct rte_eth_dev *dev);
static void ixgbevf_dev_stop(struct rte_eth_dev *dev);
@@ -916,6 +918,46 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct ixgbe_hw *hw;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+ pci_dev = eth_dev->pci_dev;
+
+ if (hw->adapter_stopped == FALSE)
+ ixgbe_dev_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ /* Unlock any pending hardware semaphore */
+ ixgbe_swfw_lock_reset(hw);
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ ixgbe_dev_interrupt_handler, (void *)eth_dev);
+
+ /* uninitialize PF if max_vfs not zero */
+ ixgbe_pf_host_uninit(eth_dev);
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ rte_free(eth_dev->data->hash_mac_addrs);
+ eth_dev->data->hash_mac_addrs = NULL;
+
+ return 0;
+}
/*
* Negotiate mailbox API version with the PF.
@@ -1086,13 +1128,45 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+/* Virtual Function device uninit */
+
+static int
+eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct ixgbe_hw *hw;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+
+ if (hw->adapter_stopped == FALSE)
+ ixgbevf_dev_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ /* Disable the interrupts for VF */
+ ixgbevf_intr_disable(hw);
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ return 0;
+}
+
static struct eth_driver rte_ixgbe_pmd = {
{
.name = "rte_ixgbe_pmd",
.id_table = pci_id_ixgbe_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_ixgbe_dev_init,
+ .eth_dev_uninit = eth_ixgbe_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
@@ -1103,9 +1177,10 @@ static struct eth_driver rte_ixgbevf_pmd = {
{
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_ixgbevf_dev_init,
+ .eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 19237b8..710ee87 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -389,6 +389,8 @@ void ixgbe_vlan_hw_strip_disable_all(struct rte_eth_dev *dev);
void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev);
+void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev);
+
void ixgbe_pf_mbx_process(struct rte_eth_dev *eth_dev);
int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev);
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index caed137..fd1c4ca 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -144,6 +144,28 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)
return;
}
+void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct ixgbe_vf_info **vfinfo;
+ uint16_t vf_num;
+
+ PMD_INIT_FUNC_TRACE();
+
+ vfinfo = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
+
+ RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = 0;
+
+ vf_num = dev_num_vf(eth_dev);
+ if (vf_num == 0)
+ return;
+
+ rte_free(*vfinfo);
+ *vfinfo = NULL;
+}
+
int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
{
uint32_t vtctl, fcrth;
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V3] e1000: igb and em1000 PCI Port Hotplug changes
[not found] <RFC PATCH>
` (16 preceding siblings ...)
2015-06-02 10:18 ` [dpdk-dev] [RFC PATCH V3] ixgbe: " Bernard Iremonger
@ 2015-06-03 14:03 ` Bernard Iremonger
2015-06-04 16:24 ` [dpdk-dev] [RFC PATCH V2 1/4] i40e: changes to support PCI Port Hotplug Bernard Iremonger
` (8 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-03 14:03 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_em_pmd,
rte_igb_pmd and rte_igbvf_pmd.
Changes in V3:
Add igb_adapter_stopped and em_adapter_stopped booleans.
Release rx and tx queues
Changes in V2:
Call dev_close() from dev_uninit() functions.
Remove input parameter checking from dev_uninit() functions.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/e1000/e1000_ethdev.h | 4 +-
drivers/net/e1000/em_ethdev.c | 50 ++++++++++++++++++++++-
drivers/net/e1000/igb_ethdev.c | 85 +++++++++++++++++++++++++++++++++++++-
drivers/net/e1000/igb_pf.c | 22 ++++++++++
4 files changed, 157 insertions(+), 4 deletions(-)
diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index c451faa..3ce1a22 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -337,4 +337,6 @@ uint16_t eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);
+void igb_pf_host_uninit(struct rte_eth_dev *dev);
+
#endif /* _E1000_ETHDEV_H_ */
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index d28030e..db9b465 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -121,6 +121,7 @@ static void eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index);
#define EM_LINK_UPDATE_CHECK_INTERVAL 100 /* ms */
static enum e1000_fc_mode em_fc_setting = e1000_fc_full;
+static bool em_adapter_stopped;
/*
* The set of PCI devices this driver supports
@@ -241,6 +242,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
hw->device_id = pci_dev->id.device_id;
+ em_adapter_stopped = 0;
/* For ICH8 support we'll need to map the flash memory BAR */
@@ -280,13 +282,56 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)
return (0);
}
+static int
+eth_em_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+ unsigned i;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ pci_dev = eth_dev->pci_dev;
+
+ if (em_adapter_stopped == 0)
+ eth_em_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+ eth_em_rx_queue_release(eth_dev->data->rx_queues[i]);
+ eth_dev->data->rx_queues[i] = NULL;
+ }
+
+ for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
+ eth_em_tx_queue_release(eth_dev->data->tx_queues[i]);
+ eth_dev->data->tx_queues[i] = NULL;
+ }
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ eth_em_interrupt_handler, (void *)eth_dev);
+
+ return 0;
+}
+
static struct eth_driver rte_em_pmd = {
{
.name = "rte_em_pmd",
.id_table = pci_id_em_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_em_dev_init,
+ .eth_dev_uninit = eth_em_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
@@ -565,6 +610,8 @@ eth_em_start(struct rte_eth_dev *dev)
}
}
+ em_adapter_stopped = 0;
+
PMD_INIT_LOG(DEBUG, "<<");
return (0);
@@ -610,6 +657,7 @@ eth_em_close(struct rte_eth_dev *dev)
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
eth_em_stop(dev);
+ em_adapter_stopped = 1;
e1000_phy_hw_reset(hw);
em_release_manageability(hw);
em_hw_control_release(hw);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index e4b370d..fb130c7 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -212,6 +212,7 @@ static int eth_igb_filter_ctrl(struct rte_eth_dev *dev,
#define IGBVF_PMD_NAME "rte_igbvf_pmd" /* PMD name */
static enum e1000_fc_mode igb_fc_setting = e1000_fc_full;
+static bool igb_adapter_stopped;
/*
* The set of PCI devices this driver supports
@@ -564,6 +565,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
goto err_late;
}
hw->mac.get_link_status = 1;
+ igb_adapter_stopped = 0;
/* Indicate SOL/IDER usage */
if (e1000_check_reset_block(hw) < 0) {
@@ -608,6 +610,55 @@ err_late:
return (error);
}
+static int
+eth_igb_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct e1000_hw *hw;
+ unsigned i;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ hw = E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+ pci_dev = eth_dev->pci_dev;
+
+ if (igb_adapter_stopped == 0)
+ eth_igb_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+ eth_igb_rx_queue_release(eth_dev->data->rx_queues[i]);
+ eth_dev->data->rx_queues[i] = NULL;
+ }
+
+ for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
+ eth_igb_tx_queue_release(eth_dev->data->tx_queues[i]);
+ eth_dev->data->tx_queues[i] = NULL;
+ }
+
+ /* Reset any pending lock */
+ igb_reset_swfw_lock(hw);
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ /* uninitialize PF if max_vfs not zero */
+ igb_pf_host_uninit(eth_dev);
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ eth_igb_interrupt_handler, (void *)eth_dev);
+
+ return 0;
+}
+
/*
* Virtual Function device init
*/
@@ -639,6 +690,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
hw->device_id = pci_dev->id.device_id;
hw->vendor_id = pci_dev->id.vendor_id;
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
+ igb_adapter_stopped = 0;
/* Initialize the shared code (base driver) */
diag = e1000_setup_init_funcs(hw, TRUE);
@@ -679,13 +731,36 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ if (igb_adapter_stopped == 0)
+ igbvf_dev_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ return 0;
+}
+
static struct eth_driver rte_igb_pmd = {
{
.name = "rte_igb_pmd",
.id_table = pci_id_igb_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_igb_dev_init,
+ .eth_dev_uninit = eth_igb_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
@@ -696,9 +771,10 @@ static struct eth_driver rte_igbvf_pmd = {
{
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_igbvf_dev_init,
+ .eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
@@ -780,6 +856,7 @@ eth_igb_start(struct rte_eth_dev *dev)
PMD_INIT_LOG(ERR, "Unable to initialize the hardware");
return (-EIO);
}
+ igb_adapter_stopped = 0;
E1000_WRITE_REG(hw, E1000_VET, ETHER_TYPE_VLAN << 16 | ETHER_TYPE_VLAN);
@@ -989,6 +1066,8 @@ eth_igb_close(struct rte_eth_dev *dev)
struct rte_eth_link link;
eth_igb_stop(dev);
+ igb_adapter_stopped = 1;
+
e1000_phy_hw_reset(hw);
igb_release_manageability(hw);
igb_hw_control_release(hw);
@@ -2227,6 +2306,7 @@ igbvf_dev_start(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
hw->mac.ops.reset_hw(hw);
+ igb_adapter_stopped = 0;
/* Set all vfta */
igbvf_set_vfta_all(dev,1);
@@ -2270,6 +2350,7 @@ igbvf_dev_close(struct rte_eth_dev *dev)
e1000_reset_hw(hw);
igbvf_dev_stop(dev);
+ igb_adapter_stopped = 1;
}
static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on)
diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c
index 6a4d210..26c2960 100644
--- a/drivers/net/e1000/igb_pf.c
+++ b/drivers/net/e1000/igb_pf.c
@@ -127,6 +127,28 @@ void igb_pf_host_init(struct rte_eth_dev *eth_dev)
return;
}
+void igb_pf_host_uninit(struct rte_eth_dev *dev)
+{
+ struct e1000_vf_info **vfinfo;
+ uint16_t vf_num;
+
+ PMD_INIT_FUNC_TRACE();
+
+ vfinfo = E1000_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
+
+ RTE_ETH_DEV_SRIOV(dev).active = 0;
+ RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = 0;
+ RTE_ETH_DEV_SRIOV(dev).def_vmdq_idx = 0;
+ RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx = 0;
+
+ vf_num = dev_num_vf(dev);
+ if (vf_num == 0)
+ return;
+
+ rte_free(*vfinfo);
+ *vfinfo = NULL;
+}
+
#define E1000_RAH_POOLSEL_SHIFT (18)
int igb_pf_host_configure(struct rte_eth_dev *eth_dev)
{
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V2 1/4] i40e: changes to support PCI Port Hotplug
[not found] <RFC PATCH>
` (17 preceding siblings ...)
2015-06-03 14:03 ` [dpdk-dev] [RFC PATCH V3] e1000: igb and em1000 PCI Port Hotplug changes Bernard Iremonger
@ 2015-06-04 16:24 ` Bernard Iremonger
2015-06-24 8:03 ` Qiu, Michael
2015-06-04 16:25 ` [dpdk-dev] [RFC PATCH V2 2/4] i40e: release vmdq vsi's in dev_close Bernard Iremonger
` (7 subsequent siblings)
26 siblings, 1 reply; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-04 16:24 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_i40e_pmd and
rte_i40evf_pmd.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 79 ++++++++++++++++++++++++++++++++++++-
drivers/net/i40e/i40e_ethdev_vf.c | 45 ++++++++++++++++++++-
drivers/net/i40e/i40e_pf.c | 34 ++++++++++++++++
drivers/net/i40e/i40e_pf.h | 1 +
4 files changed, 157 insertions(+), 2 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index da6c0b5..7bf9532 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -107,6 +107,7 @@
(1UL << RTE_ETH_FLOW_L2_PAYLOAD))
static int eth_i40e_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_i40e_dev_uninit(struct rte_eth_dev *eth_dev);
static int i40e_dev_configure(struct rte_eth_dev *dev);
static int i40e_dev_start(struct rte_eth_dev *dev);
static void i40e_dev_stop(struct rte_eth_dev *dev);
@@ -268,9 +269,11 @@ static struct eth_driver rte_i40e_pmd = {
{
.name = "rte_i40e_pmd",
.id_table = pci_id_i40e_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_i40e_dev_init,
+ .eth_dev_uninit = eth_i40e_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
@@ -405,6 +408,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
hw->bus.device = pci_dev->addr.devid;
hw->bus.func = pci_dev->addr.function;
+ hw->adapter_stopped = 0;
/* Make sure all is clean before doing PF reset */
i40e_clear_hw(hw);
@@ -584,6 +588,76 @@ err_get_capabilities:
}
static int
+eth_i40e_dev_uninit(struct rte_eth_dev *dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct i40e_hw *hw;
+ struct i40e_filter_control_settings settings;
+ int ret;
+ uint8_t aq_fail = 0;
+ unsigned i;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
+
+ hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ pci_dev = dev->pci_dev;
+
+ if (hw->adapter_stopped == 0)
+ i40e_dev_close(dev);
+
+ dev->dev_ops = NULL;
+ dev->rx_pkt_burst = NULL;
+ dev->tx_pkt_burst = NULL;
+
+ /* Disable LLDP */
+ ret = i40e_aq_stop_lldp(hw, true, NULL);
+ if (ret != I40E_SUCCESS) /* Its failure can be ignored */
+ PMD_INIT_LOG(INFO, "Failed to stop lldp");
+
+ /* Clear PXE mode */
+ i40e_clear_pxe_mode(hw);
+
+ /* Unconfigure filter control */
+ memset(&settings, 0, sizeof(settings));
+ ret = i40e_set_filter_control(hw, &settings);
+ if (ret)
+ PMD_INIT_LOG(WARNING, "setup_pf_filter_control failed: %d",
+ ret);
+
+ /* Disable flow control */
+ hw->fc.requested_mode = I40E_FC_NONE;
+ i40e_set_fc(hw, &aq_fail, TRUE);
+
+ /* uninitialize pf host driver */
+ i40e_pf_host_uninit(dev);
+
+ for (i = 0; i < dev->data->nb_rx_queues; i++) {
+ i40e_dev_rx_queue_release(dev->data->rx_queues[i]);
+ dev->data->rx_queues[i] = NULL;
+ }
+
+ for (i = 0; i < dev->data->nb_tx_queues; i++) {
+ i40e_dev_tx_queue_release(dev->data->tx_queues[i]);
+ dev->data->tx_queues[i] = NULL;
+ }
+
+ rte_free(dev->data->mac_addrs);
+ dev->data->mac_addrs = NULL;
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+
+ /* register callback func to eal lib */
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ i40e_dev_interrupt_handler, (void *)dev);
+
+ return 0;
+}
+
+static int
i40e_dev_configure(struct rte_eth_dev *dev)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -858,6 +932,8 @@ i40e_dev_start(struct rte_eth_dev *dev)
struct i40e_vsi *main_vsi = pf->main_vsi;
int ret, i;
+ hw->adapter_stopped = 0;
+
if ((dev->data->dev_conf.link_duplex != ETH_LINK_AUTONEG_DUPLEX) &&
(dev->data->dev_conf.link_duplex != ETH_LINK_FULL_DUPLEX)) {
PMD_INIT_LOG(ERR, "Invalid link_duplex (%hu) for port %hhu",
@@ -965,6 +1041,7 @@ i40e_dev_close(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
i40e_dev_stop(dev);
+ hw->adapter_stopped = 1;
/* Disable interrupt */
i40e_pf_disable_irq0(hw);
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 9f92a2f..843ab9b 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1146,6 +1146,22 @@ err:
}
static int
+i40evf_uninit_vf(struct rte_eth_dev *dev)
+{
+ struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (hw->adapter_stopped == 0)
+ i40evf_dev_close(dev);
+ rte_free(vf->vf_res);
+ vf->vf_res = NULL;
+
+ return 0;
+}
+
+static int
i40evf_dev_init(struct rte_eth_dev *eth_dev)
{
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(\
@@ -1175,6 +1191,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
hw->bus.device = eth_dev->pci_dev->addr.devid;
hw->bus.func = eth_dev->pci_dev->addr.function;
hw->hw_addr = (void *)eth_dev->pci_dev->mem_resource[0].addr;
+ hw->adapter_stopped = 0;
if(i40evf_init_vf(eth_dev) != 0) {
PMD_INIT_LOG(ERR, "Init vf failed");
@@ -1195,6 +1212,28 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+i40evf_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ if (i40evf_uninit_vf(eth_dev) != 0) {
+ PMD_INIT_LOG(ERR, "i40evf_uninit_vf failed");
+ return -1;
+ }
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ return 0;
+}
/*
* virtual function driver struct
*/
@@ -1202,9 +1241,10 @@ static struct eth_driver rte_i40evf_pmd = {
{
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = i40evf_dev_init,
+ .eth_dev_uninit = i40evf_dev_uninit,
.dev_private_size = sizeof(struct i40e_vf),
};
@@ -1473,6 +1513,8 @@ i40evf_dev_start(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
+ hw->adapter_stopped = 0;
+
vf->max_pkt_len = dev->data->dev_conf.rxmode.max_rx_pkt_len;
if (dev->data->dev_conf.rxmode.jumbo_frame == 1) {
if (vf->max_pkt_len <= ETHER_MAX_LEN ||
@@ -1680,6 +1722,7 @@ i40evf_dev_close(struct rte_eth_dev *dev)
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
i40evf_dev_stop(dev);
+ hw->adapter_stopped = 1;
i40evf_reset_vf(hw);
i40e_shutdown_adminq(hw);
}
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index b89a1e2..95c960c 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -1061,3 +1061,37 @@ fail:
return ret;
}
+
+int
+i40e_pf_host_uninit(struct rte_eth_dev *dev)
+{
+ struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+ uint32_t val;
+
+ PMD_INIT_FUNC_TRACE();
+
+ /**
+ * return if SRIOV not enabled, VF number not configured or
+ * no queue assigned.
+ */
+ if ((!hw->func_caps.sr_iov_1_1) ||
+ (pf->vf_num == 0) ||
+ (pf->vf_nb_qps == 0))
+ return I40E_SUCCESS;
+
+ /* free memory to store VF structure */
+ rte_free(pf->vfs);
+ pf->vfs = NULL;
+
+ /* Disable irq0 for VFR event */
+ i40e_pf_disable_irq0(hw);
+
+ /* Disable VF link status interrupt */
+ val = I40E_READ_REG(hw, I40E_PFGEN_PORTMDIO_NUM);
+ val &= ~I40E_PFGEN_PORTMDIO_NUM_VFLINK_STAT_ENA_MASK;
+ I40E_WRITE_REG(hw, I40E_PFGEN_PORTMDIO_NUM, val);
+ I40E_WRITE_FLUSH(hw);
+
+ return I40E_SUCCESS;
+}
diff --git a/drivers/net/i40e/i40e_pf.h b/drivers/net/i40e/i40e_pf.h
index e08ba49..9c01829 100644
--- a/drivers/net/i40e/i40e_pf.h
+++ b/drivers/net/i40e/i40e_pf.h
@@ -123,5 +123,6 @@ void i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
__rte_unused uint32_t retval,
uint8_t *msg, uint16_t msglen);
int i40e_pf_host_init(struct rte_eth_dev *dev);
+int i40e_pf_host_uninit(struct rte_eth_dev *dev);
#endif /* _I40E_PF_H_ */
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH V2 1/4] i40e: changes to support PCI Port Hotplug
2015-06-04 16:24 ` [dpdk-dev] [RFC PATCH V2 1/4] i40e: changes to support PCI Port Hotplug Bernard Iremonger
@ 2015-06-24 8:03 ` Qiu, Michael
0 siblings, 0 replies; 95+ messages in thread
From: Qiu, Michael @ 2015-06-24 8:03 UTC (permalink / raw)
To: Iremonger, Bernard, dev
On 6/5/2015 12:26 AM, Bernard Iremonger wrote:
> This patch depends on the Port Hotplug Framework.
> It implements the eth_dev_uninit functions for rte_i40e_pmd and
> rte_i40evf_pmd.
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
Tested-by: Michael Qiu <michael.qiu@intel.com>
> drivers/net/i40e/i40e_ethdev.c | 79 ++++++++++++++++++++++++++++++++++++-
> drivers/net/i40e/i40e_ethdev_vf.c | 45 ++++++++++++++++++++-
> drivers/net/i40e/i40e_pf.c | 34 ++++++++++++++++
> drivers/net/i40e/i40e_pf.h | 1 +
> 4 files changed, 157 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index da6c0b5..7bf9532 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -107,6 +107,7 @@
> (1UL << RTE_ETH_FLOW_L2_PAYLOAD))
>
> static int eth_i40e_dev_init(struct rte_eth_dev *eth_dev);
> +static int eth_i40e_dev_uninit(struct rte_eth_dev *eth_dev);
> static int i40e_dev_configure(struct rte_eth_dev *dev);
> static int i40e_dev_start(struct rte_eth_dev *dev);
> static void i40e_dev_stop(struct rte_eth_dev *dev);
> @@ -268,9 +269,11 @@ static struct eth_driver rte_i40e_pmd = {
> {
> .name = "rte_i40e_pmd",
> .id_table = pci_id_i40e_map,
> - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
> + RTE_PCI_DRV_DETACHABLE,
> },
> .eth_dev_init = eth_i40e_dev_init,
> + .eth_dev_uninit = eth_i40e_dev_uninit,
> .dev_private_size = sizeof(struct i40e_adapter),
> };
>
> @@ -405,6 +408,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
> hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
> hw->bus.device = pci_dev->addr.devid;
> hw->bus.func = pci_dev->addr.function;
> + hw->adapter_stopped = 0;
>
> /* Make sure all is clean before doing PF reset */
> i40e_clear_hw(hw);
> @@ -584,6 +588,76 @@ err_get_capabilities:
> }
>
> static int
> +eth_i40e_dev_uninit(struct rte_eth_dev *dev)
> +{
> + struct rte_pci_device *pci_dev;
> + struct i40e_hw *hw;
> + struct i40e_filter_control_settings settings;
> + int ret;
> + uint8_t aq_fail = 0;
> + unsigned i;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> + return 0;
> +
> + hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + pci_dev = dev->pci_dev;
> +
> + if (hw->adapter_stopped == 0)
> + i40e_dev_close(dev);
> +
> + dev->dev_ops = NULL;
> + dev->rx_pkt_burst = NULL;
> + dev->tx_pkt_burst = NULL;
> +
> + /* Disable LLDP */
> + ret = i40e_aq_stop_lldp(hw, true, NULL);
> + if (ret != I40E_SUCCESS) /* Its failure can be ignored */
> + PMD_INIT_LOG(INFO, "Failed to stop lldp");
> +
> + /* Clear PXE mode */
> + i40e_clear_pxe_mode(hw);
> +
> + /* Unconfigure filter control */
> + memset(&settings, 0, sizeof(settings));
> + ret = i40e_set_filter_control(hw, &settings);
> + if (ret)
> + PMD_INIT_LOG(WARNING, "setup_pf_filter_control failed: %d",
> + ret);
> +
> + /* Disable flow control */
> + hw->fc.requested_mode = I40E_FC_NONE;
> + i40e_set_fc(hw, &aq_fail, TRUE);
> +
> + /* uninitialize pf host driver */
> + i40e_pf_host_uninit(dev);
> +
> + for (i = 0; i < dev->data->nb_rx_queues; i++) {
> + i40e_dev_rx_queue_release(dev->data->rx_queues[i]);
> + dev->data->rx_queues[i] = NULL;
> + }
> +
> + for (i = 0; i < dev->data->nb_tx_queues; i++) {
> + i40e_dev_tx_queue_release(dev->data->tx_queues[i]);
> + dev->data->tx_queues[i] = NULL;
> + }
> +
> + rte_free(dev->data->mac_addrs);
> + dev->data->mac_addrs = NULL;
> +
> + /* disable uio intr before callback unregister */
> + rte_intr_disable(&(pci_dev->intr_handle));
> +
> + /* register callback func to eal lib */
> + rte_intr_callback_unregister(&(pci_dev->intr_handle),
> + i40e_dev_interrupt_handler, (void *)dev);
> +
> + return 0;
> +}
> +
> +static int
> i40e_dev_configure(struct rte_eth_dev *dev)
> {
> struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> @@ -858,6 +932,8 @@ i40e_dev_start(struct rte_eth_dev *dev)
> struct i40e_vsi *main_vsi = pf->main_vsi;
> int ret, i;
>
> + hw->adapter_stopped = 0;
> +
> if ((dev->data->dev_conf.link_duplex != ETH_LINK_AUTONEG_DUPLEX) &&
> (dev->data->dev_conf.link_duplex != ETH_LINK_FULL_DUPLEX)) {
> PMD_INIT_LOG(ERR, "Invalid link_duplex (%hu) for port %hhu",
> @@ -965,6 +1041,7 @@ i40e_dev_close(struct rte_eth_dev *dev)
> PMD_INIT_FUNC_TRACE();
>
> i40e_dev_stop(dev);
> + hw->adapter_stopped = 1;
>
> /* Disable interrupt */
> i40e_pf_disable_irq0(hw);
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
> index 9f92a2f..843ab9b 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -1146,6 +1146,22 @@ err:
> }
>
> static int
> +i40evf_uninit_vf(struct rte_eth_dev *dev)
> +{
> + struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
> + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + if (hw->adapter_stopped == 0)
> + i40evf_dev_close(dev);
> + rte_free(vf->vf_res);
> + vf->vf_res = NULL;
> +
> + return 0;
> +}
> +
> +static int
> i40evf_dev_init(struct rte_eth_dev *eth_dev)
> {
> struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(\
> @@ -1175,6 +1191,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
> hw->bus.device = eth_dev->pci_dev->addr.devid;
> hw->bus.func = eth_dev->pci_dev->addr.function;
> hw->hw_addr = (void *)eth_dev->pci_dev->mem_resource[0].addr;
> + hw->adapter_stopped = 0;
>
> if(i40evf_init_vf(eth_dev) != 0) {
> PMD_INIT_LOG(ERR, "Init vf failed");
> @@ -1195,6 +1212,28 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
> return 0;
> }
>
> +static int
> +i40evf_dev_uninit(struct rte_eth_dev *eth_dev)
> +{
> + PMD_INIT_FUNC_TRACE();
> +
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> + return -EPERM;
> +
> + eth_dev->dev_ops = NULL;
> + eth_dev->rx_pkt_burst = NULL;
> + eth_dev->tx_pkt_burst = NULL;
> +
> + if (i40evf_uninit_vf(eth_dev) != 0) {
> + PMD_INIT_LOG(ERR, "i40evf_uninit_vf failed");
> + return -1;
> + }
> +
> + rte_free(eth_dev->data->mac_addrs);
> + eth_dev->data->mac_addrs = NULL;
> +
> + return 0;
> +}
> /*
> * virtual function driver struct
> */
> @@ -1202,9 +1241,10 @@ static struct eth_driver rte_i40evf_pmd = {
> {
> .name = "rte_i40evf_pmd",
> .id_table = pci_id_i40evf_map,
> - .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
> },
> .eth_dev_init = i40evf_dev_init,
> + .eth_dev_uninit = i40evf_dev_uninit,
> .dev_private_size = sizeof(struct i40e_vf),
> };
>
> @@ -1473,6 +1513,8 @@ i40evf_dev_start(struct rte_eth_dev *dev)
>
> PMD_INIT_FUNC_TRACE();
>
> + hw->adapter_stopped = 0;
> +
> vf->max_pkt_len = dev->data->dev_conf.rxmode.max_rx_pkt_len;
> if (dev->data->dev_conf.rxmode.jumbo_frame == 1) {
> if (vf->max_pkt_len <= ETHER_MAX_LEN ||
> @@ -1680,6 +1722,7 @@ i40evf_dev_close(struct rte_eth_dev *dev)
> struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>
> i40evf_dev_stop(dev);
> + hw->adapter_stopped = 1;
> i40evf_reset_vf(hw);
> i40e_shutdown_adminq(hw);
> }
> diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
> index b89a1e2..95c960c 100644
> --- a/drivers/net/i40e/i40e_pf.c
> +++ b/drivers/net/i40e/i40e_pf.c
> @@ -1061,3 +1061,37 @@ fail:
>
> return ret;
> }
> +
> +int
> +i40e_pf_host_uninit(struct rte_eth_dev *dev)
> +{
> + struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> + struct i40e_hw *hw = I40E_PF_TO_HW(pf);
> + uint32_t val;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + /**
> + * return if SRIOV not enabled, VF number not configured or
> + * no queue assigned.
> + */
> + if ((!hw->func_caps.sr_iov_1_1) ||
> + (pf->vf_num == 0) ||
> + (pf->vf_nb_qps == 0))
> + return I40E_SUCCESS;
> +
> + /* free memory to store VF structure */
> + rte_free(pf->vfs);
> + pf->vfs = NULL;
> +
> + /* Disable irq0 for VFR event */
> + i40e_pf_disable_irq0(hw);
> +
> + /* Disable VF link status interrupt */
> + val = I40E_READ_REG(hw, I40E_PFGEN_PORTMDIO_NUM);
> + val &= ~I40E_PFGEN_PORTMDIO_NUM_VFLINK_STAT_ENA_MASK;
> + I40E_WRITE_REG(hw, I40E_PFGEN_PORTMDIO_NUM, val);
> + I40E_WRITE_FLUSH(hw);
> +
> + return I40E_SUCCESS;
> +}
> diff --git a/drivers/net/i40e/i40e_pf.h b/drivers/net/i40e/i40e_pf.h
> index e08ba49..9c01829 100644
> --- a/drivers/net/i40e/i40e_pf.h
> +++ b/drivers/net/i40e/i40e_pf.h
> @@ -123,5 +123,6 @@ void i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
> __rte_unused uint32_t retval,
> uint8_t *msg, uint16_t msglen);
> int i40e_pf_host_init(struct rte_eth_dev *dev);
> +int i40e_pf_host_uninit(struct rte_eth_dev *dev);
>
> #endif /* _I40E_PF_H_ */
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V2 2/4] i40e: release vmdq vsi's in dev_close
[not found] <RFC PATCH>
` (18 preceding siblings ...)
2015-06-04 16:24 ` [dpdk-dev] [RFC PATCH V2 1/4] i40e: changes to support PCI Port Hotplug Bernard Iremonger
@ 2015-06-04 16:25 ` Bernard Iremonger
2015-06-04 16:25 ` [dpdk-dev] [RFC PATCH V2 3/4] i40e: increase ASQ_DELAY_MS to 100 in i40evf_wait_cmd_done() Bernard Iremonger
` (6 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-04 16:25 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7bf9532..55fee6b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1037,6 +1037,7 @@ i40e_dev_close(struct rte_eth_dev *dev)
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t reg;
+ int i;
PMD_INIT_FUNC_TRACE();
@@ -1054,6 +1055,14 @@ i40e_dev_close(struct rte_eth_dev *dev)
i40e_fdir_teardown(pf);
i40e_vsi_release(pf->main_vsi);
+ for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
+ i40e_vsi_release(pf->vmdq[i].vsi);
+ pf->vmdq[i].vsi = NULL;
+ }
+
+ rte_free(pf->vmdq);
+ pf->vmdq = NULL;
+
/* shutdown the adminq */
i40e_aq_queue_shutdown(hw, true);
i40e_shutdown_adminq(hw);
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V2 3/4] i40e: increase ASQ_DELAY_MS to 100 in i40evf_wait_cmd_done()
[not found] <RFC PATCH>
` (19 preceding siblings ...)
2015-06-04 16:25 ` [dpdk-dev] [RFC PATCH V2 2/4] i40e: release vmdq vsi's in dev_close Bernard Iremonger
@ 2015-06-04 16:25 ` Bernard Iremonger
2015-06-04 16:26 ` [dpdk-dev] [RFC PATCH V2 4/4] i40e: call _clear_cmd() when error occurs Bernard Iremonger
` (5 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-04 16:25 UTC (permalink / raw)
To: dev
Increase delay to avoid i40evf_read_pfmsg() failures.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 843ab9b..c1add33 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -299,7 +299,7 @@ i40evf_wait_cmd_done(struct rte_eth_dev *dev,
enum i40evf_aq_result ret;
#define MAX_TRY_TIMES 10
-#define ASQ_DELAY_MS 50
+#define ASQ_DELAY_MS 100
do {
/* Delay some time first */
rte_delay_ms(ASQ_DELAY_MS);
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V2 4/4] i40e: call _clear_cmd() when error occurs
[not found] <RFC PATCH>
` (20 preceding siblings ...)
2015-06-04 16:25 ` [dpdk-dev] [RFC PATCH V2 3/4] i40e: increase ASQ_DELAY_MS to 100 in i40evf_wait_cmd_done() Bernard Iremonger
@ 2015-06-04 16:26 ` Bernard Iremonger
2015-06-08 15:47 ` [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug Bernard Iremonger
` (4 subsequent siblings)
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-04 16:26 UTC (permalink / raw)
To: dev
_clear_cmd() was not being called in failure situations,
resulting in the next command also failing.
Fix several typos.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev_vf.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index c1add33..b783700 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -361,6 +361,7 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args)
args->in_args, args->in_args_size, NULL);
if (err) {
PMD_DRV_LOG(ERR, "fail to send cmd %d", args->ops);
+ _clear_cmd(vf);
return err;
}
@@ -368,8 +369,10 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args)
/* read message and it's expected one */
if (!err && args->ops == info.ops)
_clear_cmd(vf);
- else if (err)
+ else if (err) {
PMD_DRV_LOG(ERR, "Failed to read message from AdminQ");
+ _clear_cmd(vf);
+ }
else if (args->ops != info.ops)
PMD_DRV_LOG(ERR, "command mismatch, expect %u, get %u",
args->ops, info.ops);
@@ -794,7 +797,7 @@ i40evf_stop_queues(struct rte_eth_dev *dev)
/* Stop TX queues first */
for (i = 0; i < dev->data->nb_tx_queues; i++) {
if (i40evf_dev_tx_queue_stop(dev, i) != 0) {
- PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
+ PMD_DRV_LOG(ERR, "Fail to stop queue %u", i);
return -1;
}
}
@@ -802,7 +805,7 @@ i40evf_stop_queues(struct rte_eth_dev *dev)
/* Then stop RX queues */
for (i = 0; i < dev->data->nb_rx_queues; i++) {
if (i40evf_dev_rx_queue_stop(dev, i) != 0) {
- PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
+ PMD_DRV_LOG(ERR, "Fail to stop queue %u", i);
return -1;
}
}
@@ -1431,7 +1434,7 @@ i40evf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
err = i40evf_switch_queue(dev, FALSE, tx_queue_id, FALSE);
if (err) {
- PMD_DRV_LOG(ERR, "Failed to switch TX queue %u of",
+ PMD_DRV_LOG(ERR, "Failed to switch TX queue %u off",
tx_queue_id);
return err;
}
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug
[not found] <RFC PATCH>
` (21 preceding siblings ...)
2015-06-04 16:26 ` [dpdk-dev] [RFC PATCH V2 4/4] i40e: call _clear_cmd() when error occurs Bernard Iremonger
@ 2015-06-08 15:47 ` Bernard Iremonger
2015-06-15 22:31 ` Ananyev, Konstantin
` (3 more replies)
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 0/5] PCI Port Hotplug changes Bernard Iremonger
` (3 subsequent siblings)
26 siblings, 4 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-08 15:47 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_ixgbe_pmd and
rte_ixgbevf_pmd.
Changes in V4:
Release rx and tx queues in dev_uninit() functions.
Replace TRUE and FALSE with 1 and 0.
Changes in V3:
Rebased to use drivers/net/ixgbe directory.
Changes in V2:
Added call to dev_close() in dev_uninit() functions.
Removed input parameter checks from dev_uninit() functions.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/ixgbe/ixgbe_ethdev.c | 107 ++++++++++++++++++++++++++++++++++++--
drivers/net/ixgbe/ixgbe_ethdev.h | 2 +
drivers/net/ixgbe/ixgbe_pf.c | 22 ++++++++
3 files changed, 126 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 0d9f9b2..7f9d286 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -117,6 +117,7 @@
#define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / sizeof(hw_stats->qprc[0]))
static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev);
static int ixgbe_dev_configure(struct rte_eth_dev *dev);
static int ixgbe_dev_start(struct rte_eth_dev *dev);
static void ixgbe_dev_stop(struct rte_eth_dev *dev);
@@ -183,6 +184,7 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_conf
/* For Virtual Function support */
static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev);
static int ixgbevf_dev_configure(struct rte_eth_dev *dev);
static int ixgbevf_dev_start(struct rte_eth_dev *dev);
static void ixgbevf_dev_stop(struct rte_eth_dev *dev);
@@ -916,6 +918,57 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct ixgbe_hw *hw;
+ unsigned i;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+ pci_dev = eth_dev->pci_dev;
+
+ if (hw->adapter_stopped == 0)
+ ixgbe_dev_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ /* Unlock any pending hardware semaphore */
+ ixgbe_swfw_lock_reset(hw);
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ ixgbe_dev_interrupt_handler, (void *)eth_dev);
+
+ /* uninitialize PF if max_vfs not zero */
+ ixgbe_pf_host_uninit(eth_dev);
+
+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+ ixgbe_dev_rx_queue_release(eth_dev->data->rx_queues[i]);
+ eth_dev->data->rx_queues[i] = NULL;
+ }
+
+ for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
+ ixgbe_dev_tx_queue_release(eth_dev->data->tx_queues[i]);
+ eth_dev->data->tx_queues[i] = NULL;
+ }
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ rte_free(eth_dev->data->hash_mac_addrs);
+ eth_dev->data->hash_mac_addrs = NULL;
+
+ return 0;
+}
/*
* Negotiate mailbox API version with the PF.
@@ -1086,13 +1139,56 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+/* Virtual Function device uninit */
+
+static int
+eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct ixgbe_hw *hw;
+ unsigned i;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+
+ if (hw->adapter_stopped == 0)
+ ixgbevf_dev_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ /* Disable the interrupts for VF */
+ ixgbevf_intr_disable(hw);
+
+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+ ixgbe_dev_rx_queue_release(eth_dev->data->rx_queues[i]);
+ eth_dev->data->rx_queues[i] = NULL;
+ }
+
+ for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
+ ixgbe_dev_tx_queue_release(eth_dev->data->tx_queues[i]);
+ eth_dev->data->tx_queues[i] = NULL;
+ }
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ return 0;
+}
+
static struct eth_driver rte_ixgbe_pmd = {
{
.name = "rte_ixgbe_pmd",
.id_table = pci_id_ixgbe_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_ixgbe_dev_init,
+ .eth_dev_uninit = eth_ixgbe_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
@@ -1103,9 +1199,10 @@ static struct eth_driver rte_ixgbevf_pmd = {
{
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_ixgbevf_dev_init,
+ .eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
@@ -1475,7 +1572,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
}
/* stop adapter */
- hw->adapter_stopped = FALSE;
+ hw->adapter_stopped = 0;
ixgbe_stop_adapter(hw);
/* reinitialize adapter
@@ -1628,7 +1725,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
/* reset the NIC */
ixgbe_pf_reset_hw(hw);
- hw->adapter_stopped = FALSE;
+ hw->adapter_stopped = 0;
/* stop adapter */
ixgbe_stop_adapter(hw);
@@ -3015,7 +3112,7 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
- hw->adapter_stopped = TRUE;
+ hw->adapter_stopped = 1;
ixgbe_stop_adapter(hw);
/*
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 19237b8..710ee87 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -389,6 +389,8 @@ void ixgbe_vlan_hw_strip_disable_all(struct rte_eth_dev *dev);
void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev);
+void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev);
+
void ixgbe_pf_mbx_process(struct rte_eth_dev *eth_dev);
int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev);
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index caed137..fd1c4ca 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -144,6 +144,28 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)
return;
}
+void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct ixgbe_vf_info **vfinfo;
+ uint16_t vf_num;
+
+ PMD_INIT_FUNC_TRACE();
+
+ vfinfo = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
+
+ RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = 0;
+ RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = 0;
+
+ vf_num = dev_num_vf(eth_dev);
+ if (vf_num == 0)
+ return;
+
+ rte_free(*vfinfo);
+ *vfinfo = NULL;
+}
+
int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
{
uint32_t vtctl, fcrth;
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug
2015-06-08 15:47 ` [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug Bernard Iremonger
@ 2015-06-15 22:31 ` Ananyev, Konstantin
2015-06-17 6:11 ` Zhang, Helin
` (2 subsequent siblings)
3 siblings, 0 replies; 95+ messages in thread
From: Ananyev, Konstantin @ 2015-06-15 22:31 UTC (permalink / raw)
To: Iremonger, Bernard, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard Iremonger
> Sent: Monday, June 08, 2015 4:48 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug
>
> This patch depends on the Port Hotplug Framework.
> It implements the eth_dev_uninit functions for rte_ixgbe_pmd and
> rte_ixgbevf_pmd.
>
> Changes in V4:
> Release rx and tx queues in dev_uninit() functions.
> Replace TRUE and FALSE with 1 and 0.
>
> Changes in V3:
> Rebased to use drivers/net/ixgbe directory.
>
> Changes in V2:
> Added call to dev_close() in dev_uninit() functions.
> Removed input parameter checks from dev_uninit() functions.
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
> drivers/net/ixgbe/ixgbe_ethdev.c | 107 ++++++++++++++++++++++++++++++++++++--
> drivers/net/ixgbe/ixgbe_ethdev.h | 2 +
> drivers/net/ixgbe/ixgbe_pf.c | 22 ++++++++
> 3 files changed, 126 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 0d9f9b2..7f9d286 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -117,6 +117,7 @@
> #define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / sizeof(hw_stats->qprc[0]))
>
> static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev);
> +static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev);
> static int ixgbe_dev_configure(struct rte_eth_dev *dev);
> static int ixgbe_dev_start(struct rte_eth_dev *dev);
> static void ixgbe_dev_stop(struct rte_eth_dev *dev);
> @@ -183,6 +184,7 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_conf
>
> /* For Virtual Function support */
> static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev);
> +static int eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev);
> static int ixgbevf_dev_configure(struct rte_eth_dev *dev);
> static int ixgbevf_dev_start(struct rte_eth_dev *dev);
> static void ixgbevf_dev_stop(struct rte_eth_dev *dev);
> @@ -916,6 +918,57 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
> return 0;
> }
>
> +static int
> +eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)
> +{
> + struct rte_pci_device *pci_dev;
> + struct ixgbe_hw *hw;
> + unsigned i;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> + return -EPERM;
> +
> + hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
> + pci_dev = eth_dev->pci_dev;
> +
> + if (hw->adapter_stopped == 0)
> + ixgbe_dev_close(eth_dev);
> +
> + eth_dev->dev_ops = NULL;
> + eth_dev->rx_pkt_burst = NULL;
> + eth_dev->tx_pkt_burst = NULL;
> +
> + /* Unlock any pending hardware semaphore */
> + ixgbe_swfw_lock_reset(hw);
> +
> + /* disable uio intr before callback unregister */
> + rte_intr_disable(&(pci_dev->intr_handle));
> + rte_intr_callback_unregister(&(pci_dev->intr_handle),
> + ixgbe_dev_interrupt_handler, (void *)eth_dev);
> +
> + /* uninitialize PF if max_vfs not zero */
> + ixgbe_pf_host_uninit(eth_dev);
> +
> + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
> + ixgbe_dev_rx_queue_release(eth_dev->data->rx_queues[i]);
> + eth_dev->data->rx_queues[i] = NULL;
> + }
> +
> + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
> + ixgbe_dev_tx_queue_release(eth_dev->data->tx_queues[i]);
> + eth_dev->data->tx_queues[i] = NULL;
> + }
> +
> + rte_free(eth_dev->data->mac_addrs);
> + eth_dev->data->mac_addrs = NULL;
> +
> + rte_free(eth_dev->data->hash_mac_addrs);
> + eth_dev->data->hash_mac_addrs = NULL;
> +
> + return 0;
> +}
>
> /*
> * Negotiate mailbox API version with the PF.
> @@ -1086,13 +1139,56 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
> return 0;
> }
>
> +/* Virtual Function device uninit */
> +
> +static int
> +eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
> +{
> + struct ixgbe_hw *hw;
> + unsigned i;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> + return -EPERM;
> +
> + hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
> +
> + if (hw->adapter_stopped == 0)
> + ixgbevf_dev_close(eth_dev);
> +
> + eth_dev->dev_ops = NULL;
> + eth_dev->rx_pkt_burst = NULL;
> + eth_dev->tx_pkt_burst = NULL;
> +
> + /* Disable the interrupts for VF */
> + ixgbevf_intr_disable(hw);
> +
> + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
> + ixgbe_dev_rx_queue_release(eth_dev->data->rx_queues[i]);
> + eth_dev->data->rx_queues[i] = NULL;
> + }
> +
> + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
> + ixgbe_dev_tx_queue_release(eth_dev->data->tx_queues[i]);
> + eth_dev->data->tx_queues[i] = NULL;
> + }
> +
> + rte_free(eth_dev->data->mac_addrs);
> + eth_dev->data->mac_addrs = NULL;
> +
> + return 0;
> +}
> +
> static struct eth_driver rte_ixgbe_pmd = {
> {
> .name = "rte_ixgbe_pmd",
> .id_table = pci_id_ixgbe_map,
> - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
> + RTE_PCI_DRV_DETACHABLE,
> },
> .eth_dev_init = eth_ixgbe_dev_init,
> + .eth_dev_uninit = eth_ixgbe_dev_uninit,
> .dev_private_size = sizeof(struct ixgbe_adapter),
> };
>
> @@ -1103,9 +1199,10 @@ static struct eth_driver rte_ixgbevf_pmd = {
> {
> .name = "rte_ixgbevf_pmd",
> .id_table = pci_id_ixgbevf_map,
> - .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
> },
> .eth_dev_init = eth_ixgbevf_dev_init,
> + .eth_dev_uninit = eth_ixgbevf_dev_uninit,
> .dev_private_size = sizeof(struct ixgbe_adapter),
> };
>
> @@ -1475,7 +1572,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
> }
>
> /* stop adapter */
> - hw->adapter_stopped = FALSE;
> + hw->adapter_stopped = 0;
> ixgbe_stop_adapter(hw);
>
> /* reinitialize adapter
> @@ -1628,7 +1725,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
>
> /* reset the NIC */
> ixgbe_pf_reset_hw(hw);
> - hw->adapter_stopped = FALSE;
> + hw->adapter_stopped = 0;
>
> /* stop adapter */
> ixgbe_stop_adapter(hw);
> @@ -3015,7 +3112,7 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev)
>
> PMD_INIT_FUNC_TRACE();
>
> - hw->adapter_stopped = TRUE;
> + hw->adapter_stopped = 1;
> ixgbe_stop_adapter(hw);
>
> /*
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
> index 19237b8..710ee87 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> @@ -389,6 +389,8 @@ void ixgbe_vlan_hw_strip_disable_all(struct rte_eth_dev *dev);
>
> void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev);
>
> +void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev);
> +
> void ixgbe_pf_mbx_process(struct rte_eth_dev *eth_dev);
>
> int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev);
> diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
> index caed137..fd1c4ca 100644
> --- a/drivers/net/ixgbe/ixgbe_pf.c
> +++ b/drivers/net/ixgbe/ixgbe_pf.c
> @@ -144,6 +144,28 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)
> return;
> }
>
> +void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
> +{
> + struct ixgbe_vf_info **vfinfo;
> + uint16_t vf_num;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + vfinfo = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
> +
> + RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
> + RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 0;
> + RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = 0;
> + RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = 0;
> +
> + vf_num = dev_num_vf(eth_dev);
> + if (vf_num == 0)
> + return;
> +
> + rte_free(*vfinfo);
> + *vfinfo = NULL;
> +}
> +
> int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
> {
> uint32_t vtctl, fcrth;
> --
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug
2015-06-08 15:47 ` [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug Bernard Iremonger
2015-06-15 22:31 ` Ananyev, Konstantin
@ 2015-06-17 6:11 ` Zhang, Helin
2015-06-24 7:45 ` Qiu, Michael
2015-06-24 7:46 ` Qiu, Michael
3 siblings, 0 replies; 95+ messages in thread
From: Zhang, Helin @ 2015-06-17 6:11 UTC (permalink / raw)
To: Iremonger, Bernard; +Cc: dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard Iremonger
> Sent: Monday, June 8, 2015 11:48 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug
>
> This patch depends on the Port Hotplug Framework.
> It implements the eth_dev_uninit functions for rte_ixgbe_pmd and
> rte_ixgbevf_pmd.
>
> Changes in V4:
> Release rx and tx queues in dev_uninit() functions.
> Replace TRUE and FALSE with 1 and 0.
>
> Changes in V3:
> Rebased to use drivers/net/ixgbe directory.
>
> Changes in V2:
> Added call to dev_close() in dev_uninit() functions.
> Removed input parameter checks from dev_uninit() functions.
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
> ---
> drivers/net/ixgbe/ixgbe_ethdev.c | 107
> ++++++++++++++++++++++++++++++++++++--
> drivers/net/ixgbe/ixgbe_ethdev.h | 2 +
> drivers/net/ixgbe/ixgbe_pf.c | 22 ++++++++
> 3 files changed, 126 insertions(+), 5 deletions(-)
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug
2015-06-08 15:47 ` [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug Bernard Iremonger
2015-06-15 22:31 ` Ananyev, Konstantin
2015-06-17 6:11 ` Zhang, Helin
@ 2015-06-24 7:45 ` Qiu, Michael
2015-06-24 7:46 ` Qiu, Michael
3 siblings, 0 replies; 95+ messages in thread
From: Qiu, Michael @ 2015-06-24 7:45 UTC (permalink / raw)
To: Iremonger, Bernard, dev
On 6/9/2015 12:01 AM, Bernard Iremonger wrote:
> This patch depends on the Port Hotplug Framework.
> It implements the eth_dev_uninit functions for rte_ixgbe_pmd and
> rte_ixgbevf_pmd.
>
> Changes in V4:
> Release rx and tx queues in dev_uninit() functions.
> Replace TRUE and FALSE with 1 and 0.
>
> Changes in V3:
> Rebased to use drivers/net/ixgbe directory.
>
> Changes in V2:
> Added call to dev_close() in dev_uninit() functions.
> Removed input parameter checks from dev_uninit() functions.
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
> ---
> drivers/net/ixgbe/ixgbe_ethdev.c | 107 ++++++++++++++++++++++++++++++++++++--
> drivers/net/ixgbe/ixgbe_ethdev.h | 2 +
> drivers/net/ixgbe/ixgbe_pf.c | 22 ++++++++
> 3 files changed, 126 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 0d9f9b2..7f9d286 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -117,6 +117,7 @@
> #define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / sizeof(hw_stats->qprc[0]))
>
> static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev);
> +static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev);
> static int ixgbe_dev_configure(struct rte_eth_dev *dev);
> static int ixgbe_dev_start(struct rte_eth_dev *dev);
> static void ixgbe_dev_stop(struct rte_eth_dev *dev);
> @@ -183,6 +184,7 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_conf
>
> /* For Virtual Function support */
> static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev);
> +static int eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev);
> static int ixgbevf_dev_configure(struct rte_eth_dev *dev);
> static int ixgbevf_dev_start(struct rte_eth_dev *dev);
> static void ixgbevf_dev_stop(struct rte_eth_dev *dev);
> @@ -916,6 +918,57 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
> return 0;
> }
>
> +static int
> +eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)
> +{
> + struct rte_pci_device *pci_dev;
> + struct ixgbe_hw *hw;
> + unsigned i;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> + return -EPERM;
> +
> + hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
> + pci_dev = eth_dev->pci_dev;
> +
> + if (hw->adapter_stopped == 0)
> + ixgbe_dev_close(eth_dev);
> +
> + eth_dev->dev_ops = NULL;
> + eth_dev->rx_pkt_burst = NULL;
> + eth_dev->tx_pkt_burst = NULL;
> +
> + /* Unlock any pending hardware semaphore */
> + ixgbe_swfw_lock_reset(hw);
> +
> + /* disable uio intr before callback unregister */
> + rte_intr_disable(&(pci_dev->intr_handle));
> + rte_intr_callback_unregister(&(pci_dev->intr_handle),
> + ixgbe_dev_interrupt_handler, (void *)eth_dev);
> +
> + /* uninitialize PF if max_vfs not zero */
> + ixgbe_pf_host_uninit(eth_dev);
> +
> + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
> + ixgbe_dev_rx_queue_release(eth_dev->data->rx_queues[i]);
> + eth_dev->data->rx_queues[i] = NULL;
> + }
> +
> + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
> + ixgbe_dev_tx_queue_release(eth_dev->data->tx_queues[i]);
> + eth_dev->data->tx_queues[i] = NULL;
> + }
> +
> + rte_free(eth_dev->data->mac_addrs);
> + eth_dev->data->mac_addrs = NULL;
> +
> + rte_free(eth_dev->data->hash_mac_addrs);
> + eth_dev->data->hash_mac_addrs = NULL;
> +
> + return 0;
> +}
>
> /*
> * Negotiate mailbox API version with the PF.
> @@ -1086,13 +1139,56 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
> return 0;
> }
>
> +/* Virtual Function device uninit */
> +
> +static int
> +eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
> +{
> + struct ixgbe_hw *hw;
> + unsigned i;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> + return -EPERM;
> +
> + hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
> +
> + if (hw->adapter_stopped == 0)
> + ixgbevf_dev_close(eth_dev);
> +
> + eth_dev->dev_ops = NULL;
> + eth_dev->rx_pkt_burst = NULL;
> + eth_dev->tx_pkt_burst = NULL;
> +
> + /* Disable the interrupts for VF */
> + ixgbevf_intr_disable(hw);
> +
> + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
> + ixgbe_dev_rx_queue_release(eth_dev->data->rx_queues[i]);
> + eth_dev->data->rx_queues[i] = NULL;
> + }
> +
> + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
> + ixgbe_dev_tx_queue_release(eth_dev->data->tx_queues[i]);
> + eth_dev->data->tx_queues[i] = NULL;
> + }
> +
> + rte_free(eth_dev->data->mac_addrs);
> + eth_dev->data->mac_addrs = NULL;
> +
> + return 0;
> +}
> +
> static struct eth_driver rte_ixgbe_pmd = {
> {
> .name = "rte_ixgbe_pmd",
> .id_table = pci_id_ixgbe_map,
> - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
> + RTE_PCI_DRV_DETACHABLE,
> },
> .eth_dev_init = eth_ixgbe_dev_init,
> + .eth_dev_uninit = eth_ixgbe_dev_uninit,
> .dev_private_size = sizeof(struct ixgbe_adapter),
> };
>
> @@ -1103,9 +1199,10 @@ static struct eth_driver rte_ixgbevf_pmd = {
> {
> .name = "rte_ixgbevf_pmd",
> .id_table = pci_id_ixgbevf_map,
> - .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
> },
> .eth_dev_init = eth_ixgbevf_dev_init,
> + .eth_dev_uninit = eth_ixgbevf_dev_uninit,
> .dev_private_size = sizeof(struct ixgbe_adapter),
> };
>
> @@ -1475,7 +1572,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
> }
>
> /* stop adapter */
> - hw->adapter_stopped = FALSE;
> + hw->adapter_stopped = 0;
> ixgbe_stop_adapter(hw);
>
> /* reinitialize adapter
> @@ -1628,7 +1725,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
>
> /* reset the NIC */
> ixgbe_pf_reset_hw(hw);
> - hw->adapter_stopped = FALSE;
> + hw->adapter_stopped = 0;
>
> /* stop adapter */
> ixgbe_stop_adapter(hw);
> @@ -3015,7 +3112,7 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev)
>
> PMD_INIT_FUNC_TRACE();
>
> - hw->adapter_stopped = TRUE;
> + hw->adapter_stopped = 1;
> ixgbe_stop_adapter(hw);
>
> /*
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
> index 19237b8..710ee87 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> @@ -389,6 +389,8 @@ void ixgbe_vlan_hw_strip_disable_all(struct rte_eth_dev *dev);
>
> void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev);
>
> +void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev);
> +
> void ixgbe_pf_mbx_process(struct rte_eth_dev *eth_dev);
>
> int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev);
> diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
> index caed137..fd1c4ca 100644
> --- a/drivers/net/ixgbe/ixgbe_pf.c
> +++ b/drivers/net/ixgbe/ixgbe_pf.c
> @@ -144,6 +144,28 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)
> return;
> }
>
> +void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
> +{
> + struct ixgbe_vf_info **vfinfo;
> + uint16_t vf_num;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + vfinfo = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
> +
> + RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
> + RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 0;
> + RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = 0;
> + RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = 0;
> +
> + vf_num = dev_num_vf(eth_dev);
> + if (vf_num == 0)
> + return;
> +
> + rte_free(*vfinfo);
> + *vfinfo = NULL;
> +}
> +
> int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
> {
> uint32_t vtctl, fcrth;
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug
2015-06-08 15:47 ` [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug Bernard Iremonger
` (2 preceding siblings ...)
2015-06-24 7:45 ` Qiu, Michael
@ 2015-06-24 7:46 ` Qiu, Michael
3 siblings, 0 replies; 95+ messages in thread
From: Qiu, Michael @ 2015-06-24 7:46 UTC (permalink / raw)
To: Iremonger, Bernard, dev
On 6/9/2015 12:01 AM, Bernard Iremonger wrote:
> This patch depends on the Port Hotplug Framework.
> It implements the eth_dev_uninit functions for rte_ixgbe_pmd and
> rte_ixgbevf_pmd.
>
> Changes in V4:
> Release rx and tx queues in dev_uninit() functions.
> Replace TRUE and FALSE with 1 and 0.
>
> Changes in V3:
> Rebased to use drivers/net/ixgbe directory.
>
> Changes in V2:
> Added call to dev_close() in dev_uninit() functions.
> Removed input parameter checks from dev_uninit() functions.
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Tested-by: Michael Qiu <michael.qiu@intel.com>
> ---
> drivers/net/ixgbe/ixgbe_ethdev.c | 107 ++++++++++++++++++++++++++++++++++++--
> drivers/net/ixgbe/ixgbe_ethdev.h | 2 +
> drivers/net/ixgbe/ixgbe_pf.c | 22 ++++++++
> 3 files changed, 126 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 0d9f9b2..7f9d286 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -117,6 +117,7 @@
> #define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / sizeof(hw_stats->qprc[0]))
>
> static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev);
> +static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev);
> static int ixgbe_dev_configure(struct rte_eth_dev *dev);
> static int ixgbe_dev_start(struct rte_eth_dev *dev);
> static void ixgbe_dev_stop(struct rte_eth_dev *dev);
> @@ -183,6 +184,7 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_conf
>
> /* For Virtual Function support */
> static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev);
> +static int eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev);
> static int ixgbevf_dev_configure(struct rte_eth_dev *dev);
> static int ixgbevf_dev_start(struct rte_eth_dev *dev);
> static void ixgbevf_dev_stop(struct rte_eth_dev *dev);
> @@ -916,6 +918,57 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
> return 0;
> }
>
> +static int
> +eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)
> +{
> + struct rte_pci_device *pci_dev;
> + struct ixgbe_hw *hw;
> + unsigned i;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> + return -EPERM;
> +
> + hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
> + pci_dev = eth_dev->pci_dev;
> +
> + if (hw->adapter_stopped == 0)
> + ixgbe_dev_close(eth_dev);
> +
> + eth_dev->dev_ops = NULL;
> + eth_dev->rx_pkt_burst = NULL;
> + eth_dev->tx_pkt_burst = NULL;
> +
> + /* Unlock any pending hardware semaphore */
> + ixgbe_swfw_lock_reset(hw);
> +
> + /* disable uio intr before callback unregister */
> + rte_intr_disable(&(pci_dev->intr_handle));
> + rte_intr_callback_unregister(&(pci_dev->intr_handle),
> + ixgbe_dev_interrupt_handler, (void *)eth_dev);
> +
> + /* uninitialize PF if max_vfs not zero */
> + ixgbe_pf_host_uninit(eth_dev);
> +
> + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
> + ixgbe_dev_rx_queue_release(eth_dev->data->rx_queues[i]);
> + eth_dev->data->rx_queues[i] = NULL;
> + }
> +
> + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
> + ixgbe_dev_tx_queue_release(eth_dev->data->tx_queues[i]);
> + eth_dev->data->tx_queues[i] = NULL;
> + }
> +
> + rte_free(eth_dev->data->mac_addrs);
> + eth_dev->data->mac_addrs = NULL;
> +
> + rte_free(eth_dev->data->hash_mac_addrs);
> + eth_dev->data->hash_mac_addrs = NULL;
> +
> + return 0;
> +}
>
> /*
> * Negotiate mailbox API version with the PF.
> @@ -1086,13 +1139,56 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
> return 0;
> }
>
> +/* Virtual Function device uninit */
> +
> +static int
> +eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
> +{
> + struct ixgbe_hw *hw;
> + unsigned i;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> + return -EPERM;
> +
> + hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
> +
> + if (hw->adapter_stopped == 0)
> + ixgbevf_dev_close(eth_dev);
> +
> + eth_dev->dev_ops = NULL;
> + eth_dev->rx_pkt_burst = NULL;
> + eth_dev->tx_pkt_burst = NULL;
> +
> + /* Disable the interrupts for VF */
> + ixgbevf_intr_disable(hw);
> +
> + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
> + ixgbe_dev_rx_queue_release(eth_dev->data->rx_queues[i]);
> + eth_dev->data->rx_queues[i] = NULL;
> + }
> +
> + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
> + ixgbe_dev_tx_queue_release(eth_dev->data->tx_queues[i]);
> + eth_dev->data->tx_queues[i] = NULL;
> + }
> +
> + rte_free(eth_dev->data->mac_addrs);
> + eth_dev->data->mac_addrs = NULL;
> +
> + return 0;
> +}
> +
> static struct eth_driver rte_ixgbe_pmd = {
> {
> .name = "rte_ixgbe_pmd",
> .id_table = pci_id_ixgbe_map,
> - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
> + RTE_PCI_DRV_DETACHABLE,
> },
> .eth_dev_init = eth_ixgbe_dev_init,
> + .eth_dev_uninit = eth_ixgbe_dev_uninit,
> .dev_private_size = sizeof(struct ixgbe_adapter),
> };
>
> @@ -1103,9 +1199,10 @@ static struct eth_driver rte_ixgbevf_pmd = {
> {
> .name = "rte_ixgbevf_pmd",
> .id_table = pci_id_ixgbevf_map,
> - .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
> },
> .eth_dev_init = eth_ixgbevf_dev_init,
> + .eth_dev_uninit = eth_ixgbevf_dev_uninit,
> .dev_private_size = sizeof(struct ixgbe_adapter),
> };
>
> @@ -1475,7 +1572,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
> }
>
> /* stop adapter */
> - hw->adapter_stopped = FALSE;
> + hw->adapter_stopped = 0;
> ixgbe_stop_adapter(hw);
>
> /* reinitialize adapter
> @@ -1628,7 +1725,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
>
> /* reset the NIC */
> ixgbe_pf_reset_hw(hw);
> - hw->adapter_stopped = FALSE;
> + hw->adapter_stopped = 0;
>
> /* stop adapter */
> ixgbe_stop_adapter(hw);
> @@ -3015,7 +3112,7 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev)
>
> PMD_INIT_FUNC_TRACE();
>
> - hw->adapter_stopped = TRUE;
> + hw->adapter_stopped = 1;
> ixgbe_stop_adapter(hw);
>
> /*
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
> index 19237b8..710ee87 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> @@ -389,6 +389,8 @@ void ixgbe_vlan_hw_strip_disable_all(struct rte_eth_dev *dev);
>
> void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev);
>
> +void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev);
> +
> void ixgbe_pf_mbx_process(struct rte_eth_dev *eth_dev);
>
> int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev);
> diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
> index caed137..fd1c4ca 100644
> --- a/drivers/net/ixgbe/ixgbe_pf.c
> +++ b/drivers/net/ixgbe/ixgbe_pf.c
> @@ -144,6 +144,28 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)
> return;
> }
>
> +void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
> +{
> + struct ixgbe_vf_info **vfinfo;
> + uint16_t vf_num;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + vfinfo = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
> +
> + RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
> + RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 0;
> + RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = 0;
> + RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = 0;
> +
> + vf_num = dev_num_vf(eth_dev);
> + if (vf_num == 0)
> + return;
> +
> + rte_free(*vfinfo);
> + *vfinfo = NULL;
> +}
> +
> int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
> {
> uint32_t vtctl, fcrth;
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V3 0/5] PCI Port Hotplug changes
[not found] <RFC PATCH>
` (22 preceding siblings ...)
2015-06-08 15:47 ` [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug Bernard Iremonger
@ 2015-06-10 8:27 ` Bernard Iremonger
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 1/5] i40e: changes to support PCI Port Hotplug Bernard Iremonger
` (4 more replies)
2015-06-10 12:09 ` [dpdk-dev] [RFC PATCH V4] e1000: igb and em1000 PCI Port Hotplug changes Bernard Iremonger
` (2 subsequent siblings)
26 siblings, 5 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-10 8:27 UTC (permalink / raw)
To: dev
This patch set depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_i40e_pmd and
rte_i40evf_pmd.
It also includes fixes for several issues encountered.
Bernard Iremonger (5):
i40e: changes to support PCI Port Hotplug
i40e: release vmdq vsi's in dev_close
i40e: increase ASQ_DELAY_MS to 100 in i40evf_wait_cmd_done()
i40e: call _clear_cmd() when error occurs
i40e: clear queues in i40evf_dev_stop
drivers/net/i40e/i40e_ethdev.c | 88 ++++++++++++++++++++++++++++++++++++-
drivers/net/i40e/i40e_ethdev_vf.c | 71 +++++++++++++++++++++++++++---
drivers/net/i40e/i40e_pf.c | 34 ++++++++++++++
drivers/net/i40e/i40e_pf.h | 1 +
4 files changed, 187 insertions(+), 7 deletions(-)
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V3 1/5] i40e: changes to support PCI Port Hotplug
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 0/5] PCI Port Hotplug changes Bernard Iremonger
@ 2015-06-10 8:27 ` Bernard Iremonger
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 2/5] i40e: release vmdq vsi's in dev_close Bernard Iremonger
` (3 subsequent siblings)
4 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-10 8:27 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_i40e_pmd and
rte_i40evf_pmd.
Changes in V3:
Release rx and tx queues in vf uninit function.
Rebase to use latest i40e code.
Changes in V2:
Rebase to use drivers/net/i40e directory.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 79 ++++++++++++++++++++++++++++++++++++-
drivers/net/i40e/i40e_ethdev_vf.c | 57 ++++++++++++++++++++++++++-
drivers/net/i40e/i40e_pf.c | 34 ++++++++++++++++
drivers/net/i40e/i40e_pf.h | 1 +
4 files changed, 169 insertions(+), 2 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index da6c0b5..7bf9532 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -107,6 +107,7 @@
(1UL << RTE_ETH_FLOW_L2_PAYLOAD))
static int eth_i40e_dev_init(struct rte_eth_dev *eth_dev);
+static int eth_i40e_dev_uninit(struct rte_eth_dev *eth_dev);
static int i40e_dev_configure(struct rte_eth_dev *dev);
static int i40e_dev_start(struct rte_eth_dev *dev);
static void i40e_dev_stop(struct rte_eth_dev *dev);
@@ -268,9 +269,11 @@ static struct eth_driver rte_i40e_pmd = {
{
.name = "rte_i40e_pmd",
.id_table = pci_id_i40e_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_i40e_dev_init,
+ .eth_dev_uninit = eth_i40e_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
@@ -405,6 +408,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
hw->bus.device = pci_dev->addr.devid;
hw->bus.func = pci_dev->addr.function;
+ hw->adapter_stopped = 0;
/* Make sure all is clean before doing PF reset */
i40e_clear_hw(hw);
@@ -584,6 +588,76 @@ err_get_capabilities:
}
static int
+eth_i40e_dev_uninit(struct rte_eth_dev *dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct i40e_hw *hw;
+ struct i40e_filter_control_settings settings;
+ int ret;
+ uint8_t aq_fail = 0;
+ unsigned i;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
+
+ hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ pci_dev = dev->pci_dev;
+
+ if (hw->adapter_stopped == 0)
+ i40e_dev_close(dev);
+
+ dev->dev_ops = NULL;
+ dev->rx_pkt_burst = NULL;
+ dev->tx_pkt_burst = NULL;
+
+ /* Disable LLDP */
+ ret = i40e_aq_stop_lldp(hw, true, NULL);
+ if (ret != I40E_SUCCESS) /* Its failure can be ignored */
+ PMD_INIT_LOG(INFO, "Failed to stop lldp");
+
+ /* Clear PXE mode */
+ i40e_clear_pxe_mode(hw);
+
+ /* Unconfigure filter control */
+ memset(&settings, 0, sizeof(settings));
+ ret = i40e_set_filter_control(hw, &settings);
+ if (ret)
+ PMD_INIT_LOG(WARNING, "setup_pf_filter_control failed: %d",
+ ret);
+
+ /* Disable flow control */
+ hw->fc.requested_mode = I40E_FC_NONE;
+ i40e_set_fc(hw, &aq_fail, TRUE);
+
+ /* uninitialize pf host driver */
+ i40e_pf_host_uninit(dev);
+
+ for (i = 0; i < dev->data->nb_rx_queues; i++) {
+ i40e_dev_rx_queue_release(dev->data->rx_queues[i]);
+ dev->data->rx_queues[i] = NULL;
+ }
+
+ for (i = 0; i < dev->data->nb_tx_queues; i++) {
+ i40e_dev_tx_queue_release(dev->data->tx_queues[i]);
+ dev->data->tx_queues[i] = NULL;
+ }
+
+ rte_free(dev->data->mac_addrs);
+ dev->data->mac_addrs = NULL;
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+
+ /* register callback func to eal lib */
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ i40e_dev_interrupt_handler, (void *)dev);
+
+ return 0;
+}
+
+static int
i40e_dev_configure(struct rte_eth_dev *dev)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -858,6 +932,8 @@ i40e_dev_start(struct rte_eth_dev *dev)
struct i40e_vsi *main_vsi = pf->main_vsi;
int ret, i;
+ hw->adapter_stopped = 0;
+
if ((dev->data->dev_conf.link_duplex != ETH_LINK_AUTONEG_DUPLEX) &&
(dev->data->dev_conf.link_duplex != ETH_LINK_FULL_DUPLEX)) {
PMD_INIT_LOG(ERR, "Invalid link_duplex (%hu) for port %hhu",
@@ -965,6 +1041,7 @@ i40e_dev_close(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
i40e_dev_stop(dev);
+ hw->adapter_stopped = 1;
/* Disable interrupt */
i40e_pf_disable_irq0(hw);
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 4f4404e..71740dc 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1146,6 +1146,22 @@ err:
}
static int
+i40evf_uninit_vf(struct rte_eth_dev *dev)
+{
+ struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (hw->adapter_stopped == 0)
+ i40evf_dev_close(dev);
+ rte_free(vf->vf_res);
+ vf->vf_res = NULL;
+
+ return 0;
+}
+
+static int
i40evf_dev_init(struct rte_eth_dev *eth_dev)
{
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(\
@@ -1175,6 +1191,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
hw->bus.device = eth_dev->pci_dev->addr.devid;
hw->bus.func = eth_dev->pci_dev->addr.function;
hw->hw_addr = (void *)eth_dev->pci_dev->mem_resource[0].addr;
+ hw->adapter_stopped = 0;
if(i40evf_init_vf(eth_dev) != 0) {
PMD_INIT_LOG(ERR, "Init vf failed");
@@ -1195,6 +1212,40 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+i40evf_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ unsigned i;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ if (i40evf_uninit_vf(eth_dev) != 0) {
+ PMD_INIT_LOG(ERR, "i40evf_uninit_vf failed");
+ return -1;
+ }
+
+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+ i40e_dev_rx_queue_release(eth_dev->data->rx_queues[i]);
+ eth_dev->data->rx_queues[i] = NULL;
+ }
+
+ for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
+ i40e_dev_tx_queue_release(eth_dev->data->tx_queues[i]);
+ eth_dev->data->tx_queues[i] = NULL;
+ }
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ return 0;
+}
/*
* virtual function driver struct
*/
@@ -1202,9 +1253,10 @@ static struct eth_driver rte_i40evf_pmd = {
{
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = i40evf_dev_init,
+ .eth_dev_uninit = i40evf_dev_uninit,
.dev_private_size = sizeof(struct i40e_vf),
};
@@ -1524,6 +1576,8 @@ i40evf_dev_start(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
+ hw->adapter_stopped = 0;
+
vf->max_pkt_len = dev->data->dev_conf.rxmode.max_rx_pkt_len;
vf->num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues,
dev->data->nb_tx_queues);
@@ -1709,6 +1763,7 @@ i40evf_dev_close(struct rte_eth_dev *dev)
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
i40evf_dev_stop(dev);
+ hw->adapter_stopped = 1;
i40evf_reset_vf(hw);
i40e_shutdown_adminq(hw);
}
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index b89a1e2..95c960c 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -1061,3 +1061,37 @@ fail:
return ret;
}
+
+int
+i40e_pf_host_uninit(struct rte_eth_dev *dev)
+{
+ struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+ uint32_t val;
+
+ PMD_INIT_FUNC_TRACE();
+
+ /**
+ * return if SRIOV not enabled, VF number not configured or
+ * no queue assigned.
+ */
+ if ((!hw->func_caps.sr_iov_1_1) ||
+ (pf->vf_num == 0) ||
+ (pf->vf_nb_qps == 0))
+ return I40E_SUCCESS;
+
+ /* free memory to store VF structure */
+ rte_free(pf->vfs);
+ pf->vfs = NULL;
+
+ /* Disable irq0 for VFR event */
+ i40e_pf_disable_irq0(hw);
+
+ /* Disable VF link status interrupt */
+ val = I40E_READ_REG(hw, I40E_PFGEN_PORTMDIO_NUM);
+ val &= ~I40E_PFGEN_PORTMDIO_NUM_VFLINK_STAT_ENA_MASK;
+ I40E_WRITE_REG(hw, I40E_PFGEN_PORTMDIO_NUM, val);
+ I40E_WRITE_FLUSH(hw);
+
+ return I40E_SUCCESS;
+}
diff --git a/drivers/net/i40e/i40e_pf.h b/drivers/net/i40e/i40e_pf.h
index e08ba49..9c01829 100644
--- a/drivers/net/i40e/i40e_pf.h
+++ b/drivers/net/i40e/i40e_pf.h
@@ -123,5 +123,6 @@ void i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
__rte_unused uint32_t retval,
uint8_t *msg, uint16_t msglen);
int i40e_pf_host_init(struct rte_eth_dev *dev);
+int i40e_pf_host_uninit(struct rte_eth_dev *dev);
#endif /* _I40E_PF_H_ */
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V3 2/5] i40e: release vmdq vsi's in dev_close
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 0/5] PCI Port Hotplug changes Bernard Iremonger
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 1/5] i40e: changes to support PCI Port Hotplug Bernard Iremonger
@ 2015-06-10 8:27 ` Bernard Iremonger
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 3/5] i40e: increase ASQ_DELAY_MS to 100 in i40evf_wait_cmd_done() Bernard Iremonger
` (2 subsequent siblings)
4 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-10 8:27 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7bf9532..55fee6b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1037,6 +1037,7 @@ i40e_dev_close(struct rte_eth_dev *dev)
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t reg;
+ int i;
PMD_INIT_FUNC_TRACE();
@@ -1054,6 +1055,14 @@ i40e_dev_close(struct rte_eth_dev *dev)
i40e_fdir_teardown(pf);
i40e_vsi_release(pf->main_vsi);
+ for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
+ i40e_vsi_release(pf->vmdq[i].vsi);
+ pf->vmdq[i].vsi = NULL;
+ }
+
+ rte_free(pf->vmdq);
+ pf->vmdq = NULL;
+
/* shutdown the adminq */
i40e_aq_queue_shutdown(hw, true);
i40e_shutdown_adminq(hw);
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V3 3/5] i40e: increase ASQ_DELAY_MS to 100 in i40evf_wait_cmd_done()
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 0/5] PCI Port Hotplug changes Bernard Iremonger
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 1/5] i40e: changes to support PCI Port Hotplug Bernard Iremonger
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 2/5] i40e: release vmdq vsi's in dev_close Bernard Iremonger
@ 2015-06-10 8:27 ` Bernard Iremonger
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 4/5] i40e: call _clear_cmd() when error occurs Bernard Iremonger
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 5/5] i40e: clear queues in i40evf_dev_stop Bernard Iremonger
4 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-10 8:27 UTC (permalink / raw)
To: dev
Increase delay to avoid i40evf_read_pfmsg() failures.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 71740dc..3f29498 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -299,7 +299,7 @@ i40evf_wait_cmd_done(struct rte_eth_dev *dev,
enum i40evf_aq_result ret;
#define MAX_TRY_TIMES 10
-#define ASQ_DELAY_MS 50
+#define ASQ_DELAY_MS 100
do {
/* Delay some time first */
rte_delay_ms(ASQ_DELAY_MS);
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V3 4/5] i40e: call _clear_cmd() when error occurs
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 0/5] PCI Port Hotplug changes Bernard Iremonger
` (2 preceding siblings ...)
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 3/5] i40e: increase ASQ_DELAY_MS to 100 in i40evf_wait_cmd_done() Bernard Iremonger
@ 2015-06-10 8:27 ` Bernard Iremonger
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 5/5] i40e: clear queues in i40evf_dev_stop Bernard Iremonger
4 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-10 8:27 UTC (permalink / raw)
To: dev
_clear_cmd() was not being called in failure situations,
resulting in the next command also failing.
Fix several typos.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev_vf.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 3f29498..f5af186 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -361,6 +361,7 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args)
args->in_args, args->in_args_size, NULL);
if (err) {
PMD_DRV_LOG(ERR, "fail to send cmd %d", args->ops);
+ _clear_cmd(vf);
return err;
}
@@ -368,8 +369,10 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args)
/* read message and it's expected one */
if (!err && args->ops == info.ops)
_clear_cmd(vf);
- else if (err)
+ else if (err) {
PMD_DRV_LOG(ERR, "Failed to read message from AdminQ");
+ _clear_cmd(vf);
+ }
else if (args->ops != info.ops)
PMD_DRV_LOG(ERR, "command mismatch, expect %u, get %u",
args->ops, info.ops);
@@ -794,7 +797,7 @@ i40evf_stop_queues(struct rte_eth_dev *dev)
/* Stop TX queues first */
for (i = 0; i < dev->data->nb_tx_queues; i++) {
if (i40evf_dev_tx_queue_stop(dev, i) != 0) {
- PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
+ PMD_DRV_LOG(ERR, "Fail to stop queue %u", i);
return -1;
}
}
@@ -802,7 +805,7 @@ i40evf_stop_queues(struct rte_eth_dev *dev)
/* Then stop RX queues */
for (i = 0; i < dev->data->nb_rx_queues; i++) {
if (i40evf_dev_rx_queue_stop(dev, i) != 0) {
- PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
+ PMD_DRV_LOG(ERR, "Fail to stop queue %u", i);
return -1;
}
}
@@ -1443,7 +1446,7 @@ i40evf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
err = i40evf_switch_queue(dev, FALSE, tx_queue_id, FALSE);
if (err) {
- PMD_DRV_LOG(ERR, "Failed to switch TX queue %u of",
+ PMD_DRV_LOG(ERR, "Failed to switch TX queue %u off",
tx_queue_id);
return err;
}
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V3 5/5] i40e: clear queues in i40evf_dev_stop
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 0/5] PCI Port Hotplug changes Bernard Iremonger
` (3 preceding siblings ...)
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 4/5] i40e: call _clear_cmd() when error occurs Bernard Iremonger
@ 2015-06-10 8:27 ` Bernard Iremonger
4 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-10 8:27 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev_vf.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index f5af186..a921b5b 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1632,6 +1632,7 @@ i40evf_dev_stop(struct rte_eth_dev *dev)
i40evf_disable_queues_intr(hw);
i40evf_stop_queues(dev);
+ i40e_dev_clear_queues(dev);
}
static int
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH V4] e1000: igb and em1000 PCI Port Hotplug changes
[not found] <RFC PATCH>
` (23 preceding siblings ...)
2015-06-10 8:27 ` [dpdk-dev] [RFC PATCH V3 0/5] PCI Port Hotplug changes Bernard Iremonger
@ 2015-06-10 12:09 ` Bernard Iremonger
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
26 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-06-10 12:09 UTC (permalink / raw)
To: dev
This patch depends on the Port Hotplug Framework.
It implements the eth_dev_uninit functions for rte_em_pmd,
rte_igb_pmd and rte_igbvf_pmd.
Changes in V4:
Release rx and tx queues in eth_igbvf_dev_uninit.
Changes in V3:
Add igb_adapter_stopped and em_adapter_stopped booleans.
Release rx and tx queues in eth_igb_dev_uninit.
Changes in V2:
Call dev_close() from dev_uninit() functions.
Remove input parameter checking from dev_uninit() functions.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/e1000/e1000_ethdev.h | 4 +-
drivers/net/e1000/em_ethdev.c | 50 +++++++++++++++++++-
drivers/net/e1000/igb_ethdev.c | 97 +++++++++++++++++++++++++++++++++++++-
drivers/net/e1000/igb_pf.c | 22 +++++++++
4 files changed, 169 insertions(+), 4 deletions(-)
diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index c451faa..3ce1a22 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -337,4 +337,6 @@ uint16_t eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);
+void igb_pf_host_uninit(struct rte_eth_dev *dev);
+
#endif /* _E1000_ETHDEV_H_ */
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index d28030e..db9b465 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -121,6 +121,7 @@ static void eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index);
#define EM_LINK_UPDATE_CHECK_INTERVAL 100 /* ms */
static enum e1000_fc_mode em_fc_setting = e1000_fc_full;
+static bool em_adapter_stopped;
/*
* The set of PCI devices this driver supports
@@ -241,6 +242,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
hw->device_id = pci_dev->id.device_id;
+ em_adapter_stopped = 0;
/* For ICH8 support we'll need to map the flash memory BAR */
@@ -280,13 +282,56 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)
return (0);
}
+static int
+eth_em_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+ unsigned i;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ pci_dev = eth_dev->pci_dev;
+
+ if (em_adapter_stopped == 0)
+ eth_em_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+ eth_em_rx_queue_release(eth_dev->data->rx_queues[i]);
+ eth_dev->data->rx_queues[i] = NULL;
+ }
+
+ for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
+ eth_em_tx_queue_release(eth_dev->data->tx_queues[i]);
+ eth_dev->data->tx_queues[i] = NULL;
+ }
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ eth_em_interrupt_handler, (void *)eth_dev);
+
+ return 0;
+}
+
static struct eth_driver rte_em_pmd = {
{
.name = "rte_em_pmd",
.id_table = pci_id_em_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_em_dev_init,
+ .eth_dev_uninit = eth_em_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
@@ -565,6 +610,8 @@ eth_em_start(struct rte_eth_dev *dev)
}
}
+ em_adapter_stopped = 0;
+
PMD_INIT_LOG(DEBUG, "<<");
return (0);
@@ -610,6 +657,7 @@ eth_em_close(struct rte_eth_dev *dev)
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
eth_em_stop(dev);
+ em_adapter_stopped = 1;
e1000_phy_hw_reset(hw);
em_release_manageability(hw);
em_hw_control_release(hw);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index e4b370d..1e6c000 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -212,6 +212,7 @@ static int eth_igb_filter_ctrl(struct rte_eth_dev *dev,
#define IGBVF_PMD_NAME "rte_igbvf_pmd" /* PMD name */
static enum e1000_fc_mode igb_fc_setting = e1000_fc_full;
+static bool igb_adapter_stopped;
/*
* The set of PCI devices this driver supports
@@ -564,6 +565,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
goto err_late;
}
hw->mac.get_link_status = 1;
+ igb_adapter_stopped = 0;
/* Indicate SOL/IDER usage */
if (e1000_check_reset_block(hw) < 0) {
@@ -608,6 +610,55 @@ err_late:
return (error);
}
+static int
+eth_igb_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct rte_pci_device *pci_dev;
+ struct e1000_hw *hw;
+ unsigned i;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ hw = E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+ pci_dev = eth_dev->pci_dev;
+
+ if (igb_adapter_stopped == 0)
+ eth_igb_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+ eth_igb_rx_queue_release(eth_dev->data->rx_queues[i]);
+ eth_dev->data->rx_queues[i] = NULL;
+ }
+
+ for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
+ eth_igb_tx_queue_release(eth_dev->data->tx_queues[i]);
+ eth_dev->data->tx_queues[i] = NULL;
+ }
+
+ /* Reset any pending lock */
+ igb_reset_swfw_lock(hw);
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ /* uninitialize PF if max_vfs not zero */
+ igb_pf_host_uninit(eth_dev);
+
+ /* disable uio intr before callback unregister */
+ rte_intr_disable(&(pci_dev->intr_handle));
+ rte_intr_callback_unregister(&(pci_dev->intr_handle),
+ eth_igb_interrupt_handler, (void *)eth_dev);
+
+ return 0;
+}
+
/*
* Virtual Function device init
*/
@@ -639,6 +690,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
hw->device_id = pci_dev->id.device_id;
hw->vendor_id = pci_dev->id.vendor_id;
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
+ igb_adapter_stopped = 0;
/* Initialize the shared code (base driver) */
diag = e1000_setup_init_funcs(hw, TRUE);
@@ -679,13 +731,48 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ unsigned i;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -EPERM;
+
+ if (igb_adapter_stopped == 0)
+ igbvf_dev_close(eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+ eth_igb_rx_queue_release(eth_dev->data->rx_queues[i]);
+ eth_dev->data->rx_queues[i] = NULL;
+ }
+
+ for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
+ eth_igb_tx_queue_release(eth_dev->data->tx_queues[i]);
+ eth_dev->data->tx_queues[i] = NULL;
+ }
+
+ rte_free(eth_dev->data->mac_addrs);
+ eth_dev->data->mac_addrs = NULL;
+
+ return 0;
+}
+
static struct eth_driver rte_igb_pmd = {
{
.name = "rte_igb_pmd",
.id_table = pci_id_igb_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_igb_dev_init,
+ .eth_dev_uninit = eth_igb_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
@@ -696,9 +783,10 @@ static struct eth_driver rte_igbvf_pmd = {
{
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
},
.eth_dev_init = eth_igbvf_dev_init,
+ .eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
@@ -780,6 +868,7 @@ eth_igb_start(struct rte_eth_dev *dev)
PMD_INIT_LOG(ERR, "Unable to initialize the hardware");
return (-EIO);
}
+ igb_adapter_stopped = 0;
E1000_WRITE_REG(hw, E1000_VET, ETHER_TYPE_VLAN << 16 | ETHER_TYPE_VLAN);
@@ -989,6 +1078,8 @@ eth_igb_close(struct rte_eth_dev *dev)
struct rte_eth_link link;
eth_igb_stop(dev);
+ igb_adapter_stopped = 1;
+
e1000_phy_hw_reset(hw);
igb_release_manageability(hw);
igb_hw_control_release(hw);
@@ -2227,6 +2318,7 @@ igbvf_dev_start(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
hw->mac.ops.reset_hw(hw);
+ igb_adapter_stopped = 0;
/* Set all vfta */
igbvf_set_vfta_all(dev,1);
@@ -2270,6 +2362,7 @@ igbvf_dev_close(struct rte_eth_dev *dev)
e1000_reset_hw(hw);
igbvf_dev_stop(dev);
+ igb_adapter_stopped = 1;
}
static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on)
diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c
index 6a4d210..26c2960 100644
--- a/drivers/net/e1000/igb_pf.c
+++ b/drivers/net/e1000/igb_pf.c
@@ -127,6 +127,28 @@ void igb_pf_host_init(struct rte_eth_dev *eth_dev)
return;
}
+void igb_pf_host_uninit(struct rte_eth_dev *dev)
+{
+ struct e1000_vf_info **vfinfo;
+ uint16_t vf_num;
+
+ PMD_INIT_FUNC_TRACE();
+
+ vfinfo = E1000_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
+
+ RTE_ETH_DEV_SRIOV(dev).active = 0;
+ RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = 0;
+ RTE_ETH_DEV_SRIOV(dev).def_vmdq_idx = 0;
+ RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx = 0;
+
+ vf_num = dev_num_vf(dev);
+ if (vf_num == 0)
+ return;
+
+ rte_free(*vfinfo);
+ *vfinfo = NULL;
+}
+
#define E1000_RAH_POOLSEL_SHIFT (18)
int igb_pf_host_configure(struct rte_eth_dev *eth_dev)
{
--
1.7.4.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
[not found] <RFC PATCH>
` (24 preceding siblings ...)
2015-06-10 12:09 ` [dpdk-dev] [RFC PATCH V4] e1000: igb and em1000 PCI Port Hotplug changes Bernard Iremonger
@ 2015-08-27 15:40 ` Bernard Iremonger
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data Bernard Iremonger
` (6 more replies)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
26 siblings, 7 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-08-27 15:40 UTC (permalink / raw)
To: dev
There is a dummy pci driver in the vdev PMD's at present.
This RFC proposes to remove the pci driver from the vdev PMD's.
Changes have been made to librte_ether to handle vdevs which do not have a pci driver.
The pdev PMD's should work as before with the changes to librte_ether
The vdev PMD's which still have a pci driver should work as before with the librte_ether changes.
The following vdev PMD's have had the pci driver removed
bonding PMD
null PMD
pcap PMD
ring PMD
Bernard Iremonger (6):
librte_ether: add fields from rte_pci_driver to rte_eth_dev and
rte_eth_dev_data.
librte_ether: handle RTE_ETH_DEV_INTR_LSC for vdevs
null: remove pci device driver
ring: remove pci device driver
bonding: remove pci device driver
pcap: remove pci device driver
drivers/net/bonding/rte_eth_bond_alb.c | 2 +-
drivers/net/bonding/rte_eth_bond_api.c | 49 ++++++++--------------------------
drivers/net/bonding/rte_eth_bond_pmd.c | 22 ++++++++++-----
drivers/net/null/rte_eth_null.c | 28 +++++--------------
drivers/net/pcap/rte_eth_pcap.c | 31 +++++++--------------
drivers/net/ring/rte_eth_ring.c | 35 +++++-------------------
lib/librte_ether/rte_ethdev.c | 34 ++++++++++++++++-------
lib/librte_ether/rte_ethdev.h | 10 ++++++-
8 files changed, 83 insertions(+), 128 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs Bernard Iremonger
@ 2015-08-27 15:40 ` Bernard Iremonger
2015-08-31 14:07 ` Thomas Monjalon
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 2/6] librte_ether: handle RTE_ETH_DEV_INTR_LSC for vdevs Bernard Iremonger
` (5 subsequent siblings)
6 siblings, 1 reply; 95+ messages in thread
From: Bernard Iremonger @ 2015-08-27 15:40 UTC (permalink / raw)
To: dev
add dev_flags to rte_eth_dev, add macros for dev_flags.
add numa_node to rte_eth_dev_data.
use dev_type to distinguish between vdev's and pdev's.
remove unused RTE_ETH_DEV_MAX.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_ether/rte_ethdev.c | 19 +++++++++++++++----
lib/librte_ether/rte_ethdev.h | 8 +++++++-
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 6b2400c..64e5a20 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -260,6 +260,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
eth_dev->dev_type = type;
+ eth_dev->dev_flags = 0;
nb_ports++;
return eth_dev;
}
@@ -424,7 +425,10 @@ rte_eth_dev_socket_id(uint8_t port_id)
{
if (!rte_eth_dev_is_valid_port(port_id))
return -1;
- return rte_eth_devices[port_id].pci_dev->numa_node;
+ if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI)
+ return rte_eth_devices[port_id].pci_dev->numa_node;
+ else
+ return rte_eth_devices[port_id].data->numa_node;
}
uint8_t
@@ -504,6 +508,7 @@ static int
rte_eth_dev_is_detachable(uint8_t port_id)
{
uint32_t drv_flags;
+ uint32_t dev_flags;
if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
@@ -520,10 +525,14 @@ rte_eth_dev_is_detachable(uint8_t port_id)
default:
return -ENOTSUP;
}
+ drv_flags = rte_eth_devices[port_id].driver->pci_drv.drv_flags;
+ return !(drv_flags & RTE_PCI_DRV_DETACHABLE);
+ } else if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_VIRTUAL) {
+ dev_flags = rte_eth_devices[port_id].dev_flags;
+ return !(dev_flags & RTE_ETH_DEV_DETACHABLE);
}
- drv_flags = rte_eth_devices[port_id].driver->pci_drv.drv_flags;
- return !(drv_flags & RTE_PCI_DRV_DETACHABLE);
+ return -ENOTSUP;
}
/* attach the new physical device, then store port_id of the device */
@@ -1795,8 +1804,10 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
dev_info->pci_dev = dev->pci_dev;
- if (dev->driver)
+ if (dev->dev_type == RTE_ETH_DEV_PCI)
dev_info->driver_name = dev->driver->pci_drv.name;
+ else
+ dev_info->driver_name = dev->data->name;
}
void
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 544afe0..a0a648f 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1553,7 +1553,6 @@ enum rte_eth_dev_type {
RTE_ETH_DEV_PCI,
/**< Physical function and Virtual function of PCI devices */
RTE_ETH_DEV_VIRTUAL, /**< non hardware device */
- RTE_ETH_DEV_MAX /**< max value of this enum */
};
/**
@@ -1587,8 +1586,14 @@ struct rte_eth_dev {
struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
uint8_t attached; /**< Flag indicating the port is attached */
enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
+ uint32_t dev_flags; /**< Flags controlling handling of device. */
};
+/** Device supports link state interrupt */
+#define RTE_ETH_DEV_INTR_LSC 0x0008
+/** Device supports detaching capability */
+#define RTE_ETH_DEV_DETACHABLE 0x0010
+
struct rte_eth_dev_sriov {
uint8_t active; /**< SRIOV is active with 16, 32 or 64 pools */
uint8_t nb_q_per_pool; /**< rx queue number per pool */
@@ -1639,6 +1644,7 @@ struct rte_eth_dev_data {
all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */
lro : 1; /**< RX LRO is ON(1) / OFF(0) */
+ int numa_node;
};
/**
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data Bernard Iremonger
@ 2015-08-31 14:07 ` Thomas Monjalon
2015-09-01 11:38 ` Iremonger, Bernard
0 siblings, 1 reply; 95+ messages in thread
From: Thomas Monjalon @ 2015-08-31 14:07 UTC (permalink / raw)
To: Bernard Iremonger; +Cc: dev
2015-08-27 16:40, Bernard Iremonger:
> add dev_flags to rte_eth_dev, add macros for dev_flags.
> add numa_node to rte_eth_dev_data.
> use dev_type to distinguish between vdev's and pdev's.
> remove unused RTE_ETH_DEV_MAX.
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
[...]
> @@ -424,7 +425,10 @@ rte_eth_dev_socket_id(uint8_t port_id)
> {
> if (!rte_eth_dev_is_valid_port(port_id))
> return -1;
> - return rte_eth_devices[port_id].pci_dev->numa_node;
> + if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI)
> + return rte_eth_devices[port_id].pci_dev->numa_node;
> + else
> + return rte_eth_devices[port_id].data->numa_node;
Clearly not the way to go.
We should remove the special cases (PCI, PDEV, VDEV) instead of adding
more checks.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.
2015-08-31 14:07 ` Thomas Monjalon
@ 2015-09-01 11:38 ` Iremonger, Bernard
2015-09-01 12:03 ` Bruce Richardson
2015-09-01 12:37 ` Ananyev, Konstantin
0 siblings, 2 replies; 95+ messages in thread
From: Iremonger, Bernard @ 2015-09-01 11:38 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
Hi THomas,
<snip>
> > @@ -424,7 +425,10 @@ rte_eth_dev_socket_id(uint8_t port_id) {
> > if (!rte_eth_dev_is_valid_port(port_id))
> > return -1;
> > - return rte_eth_devices[port_id].pci_dev->numa_node;
> > + if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI)
> > + return rte_eth_devices[port_id].pci_dev->numa_node;
> > + else
> > + return rte_eth_devices[port_id].data->numa_node;
>
> Clearly not the way to go.
> We should remove the special cases (PCI, PDEV, VDEV) instead of adding
> more checks.
The dev_type field is not new, just using it now to distinguish between PCI and non PCI devices.
I have moved some of the RTE_PCI_DRV flags to a new dev_flags field in struct rte_eth_dev{},
These flags are independent of the driver type (PCI or non PCI).
Do you have view on this new dev_flags field and macros?
Regards,
Bernard.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.
2015-09-01 11:38 ` Iremonger, Bernard
@ 2015-09-01 12:03 ` Bruce Richardson
2015-09-01 12:37 ` Ananyev, Konstantin
1 sibling, 0 replies; 95+ messages in thread
From: Bruce Richardson @ 2015-09-01 12:03 UTC (permalink / raw)
To: Iremonger, Bernard; +Cc: dev
On Tue, Sep 01, 2015 at 11:38:31AM +0000, Iremonger, Bernard wrote:
> Hi THomas,
>
> <snip>
>
> > > @@ -424,7 +425,10 @@ rte_eth_dev_socket_id(uint8_t port_id) {
> > > if (!rte_eth_dev_is_valid_port(port_id))
> > > return -1;
> > > - return rte_eth_devices[port_id].pci_dev->numa_node;
> > > + if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI)
> > > + return rte_eth_devices[port_id].pci_dev->numa_node;
> > > + else
> > > + return rte_eth_devices[port_id].data->numa_node;
> >
> > Clearly not the way to go.
> > We should remove the special cases (PCI, PDEV, VDEV) instead of adding
> > more checks.
>
> The dev_type field is not new, just using it now to distinguish between PCI and non PCI devices.
>
> I have moved some of the RTE_PCI_DRV flags to a new dev_flags field in struct rte_eth_dev{},
> These flags are independent of the driver type (PCI or non PCI).
> Do you have view on this new dev_flags field and macros?
>
> Regards,
>
> Bernard.
>
Just to give my 2c.
The branch in the snippet above should not exist. Each PMD should set the data
numa_node and the flags fields appropriately at initialization, either directly
or by copying in the relevant data from the interface specific structure e.g. pci.
The ethdev should never need to check the device type here, it should always just
read data->numa_node.
/Bruce
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.
2015-09-01 11:38 ` Iremonger, Bernard
2015-09-01 12:03 ` Bruce Richardson
@ 2015-09-01 12:37 ` Ananyev, Konstantin
2015-09-01 12:43 ` Richardson, Bruce
1 sibling, 1 reply; 95+ messages in thread
From: Ananyev, Konstantin @ 2015-09-01 12:37 UTC (permalink / raw)
To: Iremonger, Bernard, Thomas Monjalon; +Cc: dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Iremonger, Bernard
> Sent: Tuesday, September 01, 2015 12:39 PM
> To: Thomas Monjalon
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.
>
> Hi THomas,
>
> <snip>
>
> > > @@ -424,7 +425,10 @@ rte_eth_dev_socket_id(uint8_t port_id) {
> > > if (!rte_eth_dev_is_valid_port(port_id))
> > > return -1;
> > > - return rte_eth_devices[port_id].pci_dev->numa_node;
> > > + if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI)
> > > + return rte_eth_devices[port_id].pci_dev->numa_node;
> > > + else
> > > + return rte_eth_devices[port_id].data->numa_node;
> >
> > Clearly not the way to go.
> > We should remove the special cases (PCI, PDEV, VDEV) instead of adding
> > more checks.
>
> The dev_type field is not new, just using it now to distinguish between PCI and non PCI devices.
>
> I have moved some of the RTE_PCI_DRV flags to a new dev_flags field in struct rte_eth_dev{},
> These flags are independent of the driver type (PCI or non PCI).
> Do you have view on this new dev_flags field and macros?
What looks strange here to me, I that we now we duplicate some fields here?
Let say for PCI devices numa_node would be precent in pci_dev and in data, right?
If there are some fields that are common for all device types (PCI, VDEV, etc) why not to create
some unified structure for them that would be used by all device types and remove subsequent fields from pci_dev?
Or alternatively create a union of structs (one struct per device type)?
Then, as was pointed before, we wouldn't these branches by device_type at all.
Konstantin
>
> Regards,
>
> Bernard.
>
>
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.
2015-09-01 12:37 ` Ananyev, Konstantin
@ 2015-09-01 12:43 ` Richardson, Bruce
0 siblings, 0 replies; 95+ messages in thread
From: Richardson, Bruce @ 2015-09-01 12:43 UTC (permalink / raw)
To: Ananyev, Konstantin, Iremonger, Bernard, Thomas Monjalon; +Cc: dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ananyev, Konstantin
> Sent: Tuesday, September 1, 2015 1:37 PM
> To: Iremonger, Bernard; Thomas Monjalon
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from
> rte_pci_driver to rte_eth_dev and rte_eth_dev_data.
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Iremonger,
> > Bernard
> > Sent: Tuesday, September 01, 2015 12:39 PM
> > To: Thomas Monjalon
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from
> rte_pci_driver to rte_eth_dev and rte_eth_dev_data.
> >
> > Hi THomas,
> >
> > <snip>
> >
> > > > @@ -424,7 +425,10 @@ rte_eth_dev_socket_id(uint8_t port_id) {
> > > > if (!rte_eth_dev_is_valid_port(port_id))
> > > > return -1;
> > > > - return rte_eth_devices[port_id].pci_dev->numa_node;
> > > > + if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI)
> > > > + return rte_eth_devices[port_id].pci_dev->numa_node;
> > > > + else
> > > > + return rte_eth_devices[port_id].data->numa_node;
> > >
> > > Clearly not the way to go.
> > > We should remove the special cases (PCI, PDEV, VDEV) instead of
> > > adding more checks.
> >
> > The dev_type field is not new, just using it now to distinguish between
> PCI and non PCI devices.
> >
> > I have moved some of the RTE_PCI_DRV flags to a new dev_flags field in
> > struct rte_eth_dev{}, These flags are independent of the driver type
> (PCI or non PCI).
> > Do you have view on this new dev_flags field and macros?
>
> What looks strange here to me, I that we now we duplicate some fields
> here?
> Let say for PCI devices numa_node would be precent in pci_dev and in data,
> right?
> If there are some fields that are common for all device types (PCI, VDEV,
> etc) why not to create some unified structure for them that would be used
> by all device types and remove subsequent fields from pci_dev?
> Or alternatively create a union of structs (one struct per device type)?
> Then, as was pointed before, we wouldn't these branches by device_type at
> all.
> Konstantin
>
I wouldn't worry so much about the duplicated data, so long as the ethdev APIs only
have to look for the data in a single place when necessary. [Some data may be naturally
present in the pci_dev structure, for instance, and then be copied by the driver into
the common ethdev structure. If however, that copy and duplication can be avoided,
great!]
/Bruce
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 2/6] librte_ether: handle RTE_ETH_DEV_INTR_LSC for vdevs
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs Bernard Iremonger
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data Bernard Iremonger
@ 2015-08-27 15:40 ` Bernard Iremonger
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 3/6] null: remove pci device driver Bernard Iremonger
` (4 subsequent siblings)
6 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-08-27 15:40 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_ether/rte_ethdev.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 64e5a20..65d552a 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1153,12 +1153,18 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
* device supports it.
*/
if (dev_conf->intr_conf.lsc == 1) {
- const struct rte_pci_driver *pci_drv = &dev->driver->pci_drv;
+ if (dev->dev_type == RTE_ETH_DEV_PCI) {
+ const struct rte_pci_driver *pci_drv = &dev->driver->pci_drv;
- if (!(pci_drv->drv_flags & RTE_PCI_DRV_INTR_LSC)) {
- PMD_DEBUG_TRACE("driver %s does not support lsc\n",
- pci_drv->name);
- return -EINVAL;
+ if (!(pci_drv->drv_flags & RTE_PCI_DRV_INTR_LSC)) {
+ PMD_DEBUG_TRACE("driver %s does not support lsc\n",
+ pci_drv->name);
+ return -EINVAL;
+ }
+ } else if (!(dev->dev_flags & RTE_ETH_DEV_INTR_LSC)) {
+ PMD_DEBUG_TRACE("driver %s does not support lsc\n",
+ dev->data->name);
+ return -EINVAL;
}
}
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 3/6] null: remove pci device driver
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs Bernard Iremonger
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data Bernard Iremonger
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 2/6] librte_ether: handle RTE_ETH_DEV_INTR_LSC for vdevs Bernard Iremonger
@ 2015-08-27 15:40 ` Bernard Iremonger
2015-08-31 14:11 ` Thomas Monjalon
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 4/6] ring: " Bernard Iremonger
` (3 subsequent siblings)
6 siblings, 1 reply; 95+ messages in thread
From: Bernard Iremonger @ 2015-08-27 15:40 UTC (permalink / raw)
To: dev
remove rte_null_pmd and pci_dev.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/null/rte_eth_null.c | 28 +++++++---------------------
1 file changed, 7 insertions(+), 21 deletions(-)
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index e244595..7436dee 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -2,6 +2,7 @@
* BSD LICENSE
*
* Copyright (C) IGEL Co.,Ltd.
+ * Copyright(c) 2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -340,13 +341,6 @@ eth_stats_reset(struct rte_eth_dev *dev)
}
}
-static struct eth_driver rte_null_pmd = {
- .pci_drv = {
- .name = "rte_null_pmd",
- .drv_flags = RTE_PCI_DRV_DETACHABLE,
- },
-};
-
static void
eth_queue_release(void *q)
{
@@ -386,7 +380,6 @@ eth_dev_null_create(const char *name,
const unsigned nb_rx_queues = 1;
const unsigned nb_tx_queues = 1;
struct rte_eth_dev_data *data = NULL;
- struct rte_pci_device *pci_dev = NULL;
struct pmd_internals *internals = NULL;
struct rte_eth_dev *eth_dev = NULL;
@@ -403,10 +396,6 @@ eth_dev_null_create(const char *name,
if (data == NULL)
goto error;
- pci_dev = rte_zmalloc_socket(name, sizeof(*pci_dev), 0, numa_node);
- if (pci_dev == NULL)
- goto error;
-
internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
if (internals == NULL)
goto error;
@@ -418,8 +407,7 @@ eth_dev_null_create(const char *name,
/* now put it all together
* - store queue data in internals,
- * - store numa_node info in pci_driver
- * - point eth_dev_data to internals and pci_driver
+ * - point eth_dev_data to internals
* - and point eth_dev structure to new eth_dev_data structure
*/
/* NOTE: we'll replace the data element, of originally allocated eth_dev
@@ -431,8 +419,7 @@ eth_dev_null_create(const char *name,
internals->packet_copy = packet_copy;
internals->numa_node = numa_node;
- pci_dev->numa_node = numa_node;
-
+ data->numa_node = numa_node;
data->dev_private = internals;
data->port_id = eth_dev->data->port_id;
data->nb_rx_queues = (uint16_t)nb_rx_queues;
@@ -443,8 +430,9 @@ eth_dev_null_create(const char *name,
eth_dev->data = data;
eth_dev->dev_ops = &ops;
- eth_dev->pci_dev = pci_dev;
- eth_dev->driver = &rte_null_pmd;
+ eth_dev->pci_dev = NULL;
+ eth_dev->driver = NULL;
+ eth_dev->dev_flags = RTE_ETH_DEV_DETACHABLE;
/* finally assign rx and tx ops */
if (packet_copy) {
@@ -459,7 +447,6 @@ eth_dev_null_create(const char *name,
error:
rte_free(data);
- rte_free(pci_dev);
rte_free(internals);
return -1;
@@ -562,14 +549,13 @@ rte_pmd_null_devuninit(const char *name)
RTE_LOG(INFO, PMD, "Closing null ethdev on numa socket %u\n",
rte_socket_id());
- /* reserve an ethdev entry */
+ /* find the ethdev entry */
eth_dev = rte_eth_dev_allocated(name);
if (eth_dev == NULL)
return -1;
rte_free(eth_dev->data->dev_private);
rte_free(eth_dev->data);
- rte_free(eth_dev->pci_dev);
rte_eth_dev_release_port(eth_dev);
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 3/6] null: remove pci device driver
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 3/6] null: remove pci device driver Bernard Iremonger
@ 2015-08-31 14:11 ` Thomas Monjalon
2015-08-31 16:05 ` Iremonger, Bernard
0 siblings, 1 reply; 95+ messages in thread
From: Thomas Monjalon @ 2015-08-31 14:11 UTC (permalink / raw)
To: Bernard Iremonger; +Cc: dev
2015-08-27 16:40, Bernard Iremonger:
> remove rte_null_pmd and pci_dev.
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
[...]
> - eth_dev->pci_dev = pci_dev;
> - eth_dev->driver = &rte_null_pmd;
> + eth_dev->pci_dev = NULL;
Simple comment:
Why a driver should reset a PCI field if it does not care about PCI?
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 3/6] null: remove pci device driver
2015-08-31 14:11 ` Thomas Monjalon
@ 2015-08-31 16:05 ` Iremonger, Bernard
0 siblings, 0 replies; 95+ messages in thread
From: Iremonger, Bernard @ 2015-08-31 16:05 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Monday, August 31, 2015 3:11 PM
> To: Iremonger, Bernard
> Cc: dev@dpdk.org; david.marchand@6wind.com
> Subject: Re: [RFC PATCH 3/6] null: remove pci device driver
>
> 2015-08-27 16:40, Bernard Iremonger:
> > remove rte_null_pmd and pci_dev.
> >
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> [...]
> > - eth_dev->pci_dev = pci_dev;
> > - eth_dev->driver = &rte_null_pmd;
> > + eth_dev->pci_dev = NULL;
>
> Simple comment:
> Why a driver should reset a PCI field if it does not care about PCI?
Setting the pci_dev field to NULL, was needed in an earlier internal revision of the patch set.
This line is no longer needed and can be removed.
The dev_type field of struct rte_eth_dev{} is now used instead in rte_ethdev.c.
Regards,
Bernard.
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 4/6] ring: remove pci device driver
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs Bernard Iremonger
` (2 preceding siblings ...)
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 3/6] null: remove pci device driver Bernard Iremonger
@ 2015-08-27 15:40 ` Bernard Iremonger
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 5/6] bonding: " Bernard Iremonger
` (2 subsequent siblings)
6 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-08-27 15:40 UTC (permalink / raw)
To: dev
remove rte_ring_pmd and pci_dev.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/ring/rte_eth_ring.c | 35 ++++++-----------------------------
1 file changed, 6 insertions(+), 29 deletions(-)
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 6fd3d0a..111814e 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -44,8 +44,6 @@
#define ETH_RING_ACTION_CREATE "CREATE"
#define ETH_RING_ACTION_ATTACH "ATTACH"
-static const char *ring_ethdev_driver_name = "Ring PMD";
-
static const char *valid_arguments[] = {
ETH_RING_NUMA_NODE_ACTION_ARG,
NULL
@@ -252,15 +250,6 @@ static const struct eth_dev_ops ops = {
.mac_addr_add = eth_mac_addr_add,
};
-static struct eth_driver rte_ring_pmd = {
- .pci_drv = {
- .name = "rte_ring_pmd",
- .drv_flags = RTE_PCI_DRV_DETACHABLE,
- },
-};
-
-static struct rte_pci_id id_table;
-
int
rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
const unsigned nb_rx_queues,
@@ -269,7 +258,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
const unsigned numa_node)
{
struct rte_eth_dev_data *data = NULL;
- struct rte_pci_device *pci_dev = NULL;
struct pmd_internals *internals = NULL;
struct rte_eth_dev *eth_dev = NULL;
@@ -291,10 +279,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
if (data == NULL)
goto error;
- pci_dev = rte_zmalloc_socket(name, sizeof(*pci_dev), 0, numa_node);
- if (pci_dev == NULL)
- goto error;
-
internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
if (internals == NULL)
goto error;
@@ -304,11 +288,10 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
if (eth_dev == NULL)
goto error;
-
/* now put it all together
* - store queue data in internals,
- * - store numa_node info in pci_driver
- * - point eth_dev_data to internals and pci_driver
+ * - store numa_node info in eth_dev_data
+ * - point eth_dev_data to internals
* - and point eth_dev structure to new eth_dev_data structure
*/
/* NOTE: we'll replace the data element, of originally allocated eth_dev
@@ -323,12 +306,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
internals->tx_ring_queues[i].rng = tx_queues[i];
}
- rte_ring_pmd.pci_drv.name = ring_ethdev_driver_name;
- rte_ring_pmd.pci_drv.id_table = &id_table;
-
- pci_dev->numa_node = numa_node;
- pci_dev->driver = &rte_ring_pmd.pci_drv;
-
data->dev_private = internals;
data->port_id = eth_dev->data->port_id;
memmove(data->name, eth_dev->data->name, sizeof(data->name));
@@ -336,11 +313,13 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
data->nb_tx_queues = (uint16_t)nb_tx_queues;
data->dev_link = pmd_link;
data->mac_addrs = &internals->address;
+ data->numa_node = numa_node;
eth_dev->data = data;
- eth_dev->driver = &rte_ring_pmd;
+ eth_dev->driver = NULL;
eth_dev->dev_ops = &ops;
- eth_dev->pci_dev = pci_dev;
+ eth_dev->pci_dev = NULL;
+ eth_dev->dev_flags = RTE_ETH_DEV_DETACHABLE;
TAILQ_INIT(&(eth_dev->link_intr_cbs));
/* finally assign rx and tx ops */
@@ -351,7 +330,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
error:
rte_free(data);
- rte_free(pci_dev);
rte_free(internals);
return -1;
@@ -617,7 +595,6 @@ rte_pmd_ring_devuninit(const char *name)
eth_dev_stop(eth_dev);
rte_free(eth_dev->data->dev_private);
rte_free(eth_dev->data);
- rte_free(eth_dev->pci_dev);
rte_eth_dev_release_port(eth_dev);
return 0;
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 5/6] bonding: remove pci device driver
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs Bernard Iremonger
` (3 preceding siblings ...)
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 4/6] ring: " Bernard Iremonger
@ 2015-08-27 15:40 ` Bernard Iremonger
2015-08-27 17:48 ` Stephen Hemminger
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 6/6] pcap: " Bernard Iremonger
2015-08-27 17:43 ` [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs John W. Linville
6 siblings, 1 reply; 95+ messages in thread
From: Bernard Iremonger @ 2015-08-27 15:40 UTC (permalink / raw)
To: dev
remove pci_dev, pci_drv, rte_bond_pmd and pci_id_table.
handle numa_node for vdevs
handle RTE_ETH_DEV_INTR_LSC for vdevs
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/bonding/rte_eth_bond_alb.c | 2 +-
drivers/net/bonding/rte_eth_bond_api.c | 51 ++++++++--------------------------
drivers/net/bonding/rte_eth_bond_pmd.c | 22 ++++++++++-----
lib/librte_ether/rte_ethdev.h | 2 ++
4 files changed, 30 insertions(+), 47 deletions(-)
diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c
index 6df318e..3157543 100644
--- a/drivers/net/bonding/rte_eth_bond_alb.c
+++ b/drivers/net/bonding/rte_eth_bond_alb.c
@@ -65,7 +65,7 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev)
uint16_t data_size;
char mem_name[RTE_ETH_NAME_MAX_LEN];
- int socket_id = bond_dev->pci_dev->numa_node;
+ int socket_id = bond_dev->data->numa_node;
/* Fill hash table with initial values */
memset(hash_table, 0, sizeof(struct client_data) * ALB_HASH_TABLE_SIZE);
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 0681d1a..b866bf3 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -48,11 +48,14 @@ int
valid_bonded_ethdev(const struct rte_eth_dev *eth_dev)
{
/* Check valid pointer */
- if (eth_dev->driver->pci_drv.name == NULL)
+ if (!eth_dev)
return -1;
- /* return 0 if driver name matches */
- return eth_dev->driver->pci_drv.name != pmd_bond_driver_name;
+ /* return 0 if bonded device */
+ if (eth_dev->dev_flags & RTE_ETH_DEV_BONDED)
+ return 0;
+ else
+ return 1;
}
int
@@ -72,7 +75,7 @@ valid_slave_port_id(uint8_t port_id)
return -1;
/* Verify that port_id refers to a non bonded port */
- if (!valid_bonded_ethdev(&rte_eth_devices[port_id]))
+ if (valid_bonded_ethdev(&rte_eth_devices[port_id]) == 0)
return -1;
return 0;
@@ -163,30 +166,11 @@ number_of_sockets(void)
return ++sockets;
}
-const char pmd_bond_driver_name[] = "rte_bond_pmd";
-
-static struct rte_pci_id pci_id_table = {
- .device_id = PCI_ANY_ID,
- .subsystem_device_id = PCI_ANY_ID,
- .vendor_id = PCI_ANY_ID,
- .subsystem_vendor_id = PCI_ANY_ID,
-};
-
-static struct eth_driver rte_bond_pmd = {
- .pci_drv = {
- .name = pmd_bond_driver_name,
- .drv_flags = RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_DETACHABLE,
- .id_table = &pci_id_table,
- },
-};
-
int
rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
{
- struct rte_pci_device *pci_dev = NULL;
struct bond_dev_private *internals = NULL;
struct rte_eth_dev *eth_dev = NULL;
- struct rte_pci_driver *pci_drv = NULL;
/* now do all data allocation - for eth_dev structure, dummy pci driver
* and internal (private) data
@@ -203,14 +187,6 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
goto err;
}
- pci_dev = rte_zmalloc_socket(name, sizeof(*pci_dev), 0, socket_id);
- if (pci_dev == NULL) {
- RTE_BOND_LOG(ERR, "Unable to malloc pci dev on socket");
- goto err;
- }
-
- pci_drv = &rte_bond_pmd.pci_drv;
-
internals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id);
if (internals == NULL) {
RTE_BOND_LOG(ERR, "Unable to malloc internals on socket");
@@ -224,14 +200,10 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
goto err;
}
- pci_dev->numa_node = socket_id;
- pci_drv->name = pmd_bond_driver_name;
- pci_dev->driver = pci_drv;
-
- eth_dev->driver = &rte_bond_pmd;
eth_dev->data->dev_private = internals;
eth_dev->data->nb_rx_queues = (uint16_t)1;
eth_dev->data->nb_tx_queues = (uint16_t)1;
+ eth_dev->data->numa_node = socket_id;
TAILQ_INIT(&(eth_dev->link_intr_cbs));
@@ -250,7 +222,10 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
eth_dev->data->all_multicast = 0;
eth_dev->dev_ops = &default_dev_ops;
- eth_dev->pci_dev = pci_dev;
+ eth_dev->pci_dev = NULL;
+ eth_dev->driver = NULL;
+ eth_dev->dev_flags = RTE_ETH_DEV_INTR_LSC |
+ RTE_ETH_DEV_DETACHABLE | RTE_ETH_DEV_BONDED;
rte_spinlock_init(&internals->lock);
@@ -287,7 +262,6 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
return eth_dev->data->port_id;
err:
- rte_free(pci_dev);
rte_free(internals);
if (eth_dev != NULL) {
rte_free(eth_dev->data->mac_addrs);
@@ -319,7 +293,6 @@ rte_eth_bond_free(const char *name)
eth_dev->rx_pkt_burst = NULL;
eth_dev->tx_pkt_burst = NULL;
- rte_free(eth_dev->pci_dev);
rte_free(eth_dev->data->dev_private);
rte_free(eth_dev->data->mac_addrs);
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 5cc6372..387d370 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1307,8 +1307,12 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
rte_eth_dev_stop(slave_eth_dev->data->port_id);
/* Enable interrupts on slave device if supported */
- if (slave_eth_dev->driver->pci_drv.drv_flags & RTE_PCI_DRV_INTR_LSC)
- slave_eth_dev->data->dev_conf.intr_conf.lsc = 1;
+ if (slave_eth_dev->dev_type == RTE_ETH_DEV_PCI) {
+ if (slave_eth_dev->driver->pci_drv.drv_flags & RTE_PCI_DRV_INTR_LSC)
+ slave_eth_dev->data->dev_conf.intr_conf.lsc = 1;
+ } else if (slave_eth_dev->dev_flags & RTE_ETH_DEV_INTR_LSC)
+ slave_eth_dev->data->dev_conf.intr_conf.lsc = 1;
+
/* Configure device */
errval = rte_eth_dev_configure(slave_eth_dev->data->port_id,
@@ -1362,8 +1366,12 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
}
/* If lsc interrupt is set, check initial slave's link status */
- if (slave_eth_dev->driver->pci_drv.drv_flags & RTE_PCI_DRV_INTR_LSC)
- bond_ethdev_lsc_event_callback(slave_eth_dev->data->port_id,
+ if (slave_eth_dev->dev_type == RTE_ETH_DEV_PCI) {
+ if (slave_eth_dev->driver->pci_drv.drv_flags & RTE_PCI_DRV_INTR_LSC)
+ bond_ethdev_lsc_event_callback(slave_eth_dev->data->port_id,
+ RTE_ETH_EVENT_INTR_LSC, &bonded_eth_dev->data->port_id);
+ } else if (slave_eth_dev->dev_flags & RTE_ETH_DEV_INTR_LSC)
+ bond_ethdev_lsc_event_callback(slave_eth_dev->data->port_id,
RTE_ETH_EVENT_INTR_LSC, &bonded_eth_dev->data->port_id);
return 0;
@@ -1592,7 +1600,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->max_tx_queues = (uint16_t)512;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = dev->pci_dev;
+ dev_info->pci_dev = NULL;
dev_info->rx_offload_capa = internals->rx_offload_capa;
dev_info->tx_offload_capa = internals->tx_offload_capa;
@@ -1605,7 +1613,7 @@ bond_ethdev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
{
struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)
rte_zmalloc_socket(NULL, sizeof(struct bond_rx_queue),
- 0, dev->pci_dev->numa_node);
+ 0, dev->data->numa_node);
if (bd_rx_q == NULL)
return -1;
@@ -1629,7 +1637,7 @@ bond_ethdev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
{
struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)
rte_zmalloc_socket(NULL, sizeof(struct bond_tx_queue),
- 0, dev->pci_dev->numa_node);
+ 0, dev->data->numa_node);
if (bd_tx_q == NULL)
return -1;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index a0a648f..6804bd3 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1593,6 +1593,8 @@ struct rte_eth_dev {
#define RTE_ETH_DEV_INTR_LSC 0x0008
/** Device supports detaching capability */
#define RTE_ETH_DEV_DETACHABLE 0x0010
+/** Device is a bonded device */
+#define RTE_ETH_DEV_BONDED 0x0020
struct rte_eth_dev_sriov {
uint8_t active; /**< SRIOV is active with 16, 32 or 64 pools */
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 5/6] bonding: remove pci device driver
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 5/6] bonding: " Bernard Iremonger
@ 2015-08-27 17:48 ` Stephen Hemminger
2015-08-28 8:32 ` Iremonger, Bernard
0 siblings, 1 reply; 95+ messages in thread
From: Stephen Hemminger @ 2015-08-27 17:48 UTC (permalink / raw)
To: Bernard Iremonger; +Cc: dev
On Thu, 27 Aug 2015 16:40:40 +0100
Bernard Iremonger <bernard.iremonger@intel.com> wrote:
> remove pci_dev, pci_drv, rte_bond_pmd and pci_id_table.
> handle numa_node for vdevs
> handle RTE_ETH_DEV_INTR_LSC for vdevs
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Since Hyper-V driver does not use pci, we just went through exercise
of putting necessary API calls in rte_ethdev and having bonding use
that.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 5/6] bonding: remove pci device driver
2015-08-27 17:48 ` Stephen Hemminger
@ 2015-08-28 8:32 ` Iremonger, Bernard
2015-08-28 15:57 ` Stephen Hemminger
0 siblings, 1 reply; 95+ messages in thread
From: Iremonger, Bernard @ 2015-08-28 8:32 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
Hi Stephen,
> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Thursday, August 27, 2015 6:48 PM
> To: Iremonger, Bernard
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC PATCH 5/6] bonding: remove pci device driver
>
> On Thu, 27 Aug 2015 16:40:40 +0100
> Bernard Iremonger <bernard.iremonger@intel.com> wrote:
>
> > remove pci_dev, pci_drv, rte_bond_pmd and pci_id_table.
> > handle numa_node for vdevs
> > handle RTE_ETH_DEV_INTR_LSC for vdevs
> >
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
>
> Since Hyper-V driver does not use pci, we just went through exercise of
> putting necessary API calls in rte_ethdev and having bonding use that.
Have your ethdev patches been applied yet, if not could you send me the link in patchwork.
Regards,
Bernard.
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 6/6] pcap: remove pci device driver
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs Bernard Iremonger
` (4 preceding siblings ...)
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 5/6] bonding: " Bernard Iremonger
@ 2015-08-27 15:40 ` Bernard Iremonger
2015-08-27 17:43 ` [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs John W. Linville
6 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-08-27 15:40 UTC (permalink / raw)
To: dev
remove rte_pcap_pmd and pci_dev.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/pcap/rte_eth_pcap.c | 31 +++++++++----------------------
1 file changed, 9 insertions(+), 22 deletions(-)
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index f2e4634..1bd0a22 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* Copyright(c) 2014 6WIND S.A.
* All rights reserved.
*
@@ -617,13 +617,6 @@ static const struct eth_dev_ops ops = {
.stats_reset = eth_stats_reset,
};
-static struct eth_driver rte_pcap_pmd = {
- .pci_drv = {
- .name = "rte_pcap_pmd",
- .drv_flags = RTE_PCI_DRV_DETACHABLE,
- },
-};
-
/*
* Function handler that opens the pcap file for reading a stores a
* reference of it for use it later on.
@@ -806,7 +799,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
struct rte_kvargs *kvlist)
{
struct rte_eth_dev_data *data = NULL;
- struct rte_pci_device *pci_dev = NULL;
+
unsigned k_idx;
struct rte_kvargs_pair *pair = NULL;
@@ -819,17 +812,13 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
RTE_LOG(INFO, PMD,
"Creating pcap-backed ethdev on numa socket %u\n", numa_node);
- /* now do all data allocation - for eth_dev structure, dummy pci driver
+ /* now do all data allocation - for eth_dev structure
* and internal (private) data
*/
data = rte_zmalloc_socket(name, sizeof(*data), 0, numa_node);
if (data == NULL)
goto error;
- pci_dev = rte_zmalloc_socket(name, sizeof(*pci_dev), 0, numa_node);
- if (pci_dev == NULL)
- goto error;
-
*internals = rte_zmalloc_socket(name, sizeof(**internals), 0, numa_node);
if (*internals == NULL)
goto error;
@@ -845,8 +834,8 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
/* now put it all together
* - store queue data in internals,
- * - store numa_node info in pci_driver
- * - point eth_dev_data to internals and pci_driver
+ * - store numa_node info in eth_dev_data
+ * - point eth_dev_data to internals
* - and point eth_dev structure to new eth_dev_data structure
*/
/* NOTE: we'll replace the data element, of originally allocated eth_dev
@@ -860,8 +849,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
else
(*internals)->if_index = if_nametoindex(pair->value);
- pci_dev->numa_node = numa_node;
-
+ data->numa_node = numa_node;
data->dev_private = *internals;
data->port_id = (*eth_dev)->data->port_id;
snprintf(data->name, sizeof(data->name), "%s", (*eth_dev)->data->name);
@@ -874,14 +862,14 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
(*eth_dev)->data = data;
(*eth_dev)->dev_ops = &ops;
- (*eth_dev)->pci_dev = pci_dev;
- (*eth_dev)->driver = &rte_pcap_pmd;
+ (*eth_dev)->pci_dev = NULL;
+ (*eth_dev)->driver = NULL;
+ (*eth_dev)->dev_flags = RTE_ETH_DEV_DETACHABLE;
return 0;
error:
rte_free(data);
- rte_free(pci_dev);
rte_free(*internals);
return -1;
@@ -1096,7 +1084,6 @@ rte_pmd_pcap_devuninit(const char *name)
rte_free(eth_dev->data->dev_private);
rte_free(eth_dev->data);
- rte_free(eth_dev->pci_dev);
rte_eth_dev_release_port(eth_dev);
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs Bernard Iremonger
` (5 preceding siblings ...)
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 6/6] pcap: " Bernard Iremonger
@ 2015-08-27 17:43 ` John W. Linville
2015-08-28 8:15 ` Iremonger, Bernard
6 siblings, 1 reply; 95+ messages in thread
From: John W. Linville @ 2015-08-27 17:43 UTC (permalink / raw)
To: Bernard Iremonger; +Cc: dev
On Thu, Aug 27, 2015 at 04:40:35PM +0100, Bernard Iremonger wrote:
> There is a dummy pci driver in the vdev PMD's at present.
> This RFC proposes to remove the pci driver from the vdev PMD's.
> Changes have been made to librte_ether to handle vdevs which do not have a pci driver.
>
> The pdev PMD's should work as before with the changes to librte_ether
> The vdev PMD's which still have a pci driver should work as before with the librte_ether changes.
>
> The following vdev PMD's have had the pci driver removed
>
> bonding PMD
> null PMD
> pcap PMD
> ring PMD
Any reason there is no patch for the af_packet driver?
John
> Bernard Iremonger (6):
> librte_ether: add fields from rte_pci_driver to rte_eth_dev and
> rte_eth_dev_data.
> librte_ether: handle RTE_ETH_DEV_INTR_LSC for vdevs
> null: remove pci device driver
> ring: remove pci device driver
> bonding: remove pci device driver
> pcap: remove pci device driver
>
> drivers/net/bonding/rte_eth_bond_alb.c | 2 +-
> drivers/net/bonding/rte_eth_bond_api.c | 49 ++++++++--------------------------
> drivers/net/bonding/rte_eth_bond_pmd.c | 22 ++++++++++-----
> drivers/net/null/rte_eth_null.c | 28 +++++--------------
> drivers/net/pcap/rte_eth_pcap.c | 31 +++++++--------------
> drivers/net/ring/rte_eth_ring.c | 35 +++++-------------------
> lib/librte_ether/rte_ethdev.c | 34 ++++++++++++++++-------
> lib/librte_ether/rte_ethdev.h | 10 ++++++-
> 8 files changed, 83 insertions(+), 128 deletions(-)
>
> --
> 1.9.1
>
>
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-08-27 17:43 ` [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs John W. Linville
@ 2015-08-28 8:15 ` Iremonger, Bernard
2015-08-28 10:32 ` Neil Horman
2015-08-28 17:51 ` John W. Linville
0 siblings, 2 replies; 95+ messages in thread
From: Iremonger, Bernard @ 2015-08-28 8:15 UTC (permalink / raw)
To: John W. Linville; +Cc: dev
Hi John,
> -----Original Message-----
> From: John W. Linville [mailto:linville@tuxdriver.com]
> Sent: Thursday, August 27, 2015 6:44 PM
> To: Iremonger, Bernard
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
>
> On Thu, Aug 27, 2015 at 04:40:35PM +0100, Bernard Iremonger wrote:
> > There is a dummy pci driver in the vdev PMD's at present.
> > This RFC proposes to remove the pci driver from the vdev PMD's.
> > Changes have been made to librte_ether to handle vdevs which do not
> have a pci driver.
> >
> > The pdev PMD's should work as before with the changes to librte_ether
> > The vdev PMD's which still have a pci driver should work as before with the
> librte_ether changes.
> >
> > The following vdev PMD's have had the pci driver removed
> >
> > bonding PMD
> > null PMD
> > pcap PMD
> > ring PMD
>
> Any reason there is no patch for the af_packet driver?
>
> John
I have just modified the Intel vdev PMD's.
It would be best if the owners of the non Intel vdev's submitted patches for their drivers.
Regards,
Bernard.
<snip>
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-08-28 8:15 ` Iremonger, Bernard
@ 2015-08-28 10:32 ` Neil Horman
2015-08-28 19:48 ` Wiles, Keith
2015-08-28 17:51 ` John W. Linville
1 sibling, 1 reply; 95+ messages in thread
From: Neil Horman @ 2015-08-28 10:32 UTC (permalink / raw)
To: Iremonger, Bernard; +Cc: dev
On Fri, Aug 28, 2015 at 08:15:47AM +0000, Iremonger, Bernard wrote:
> Hi John,
>
> > -----Original Message-----
> > From: John W. Linville [mailto:linville@tuxdriver.com]
> > Sent: Thursday, August 27, 2015 6:44 PM
> > To: Iremonger, Bernard
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
> >
> > On Thu, Aug 27, 2015 at 04:40:35PM +0100, Bernard Iremonger wrote:
> > > There is a dummy pci driver in the vdev PMD's at present.
> > > This RFC proposes to remove the pci driver from the vdev PMD's.
> > > Changes have been made to librte_ether to handle vdevs which do not
> > have a pci driver.
> > >
> > > The pdev PMD's should work as before with the changes to librte_ether
> > > The vdev PMD's which still have a pci driver should work as before with the
> > librte_ether changes.
> > >
> > > The following vdev PMD's have had the pci driver removed
> > >
> > > bonding PMD
> > > null PMD
> > > pcap PMD
> > > ring PMD
> >
> > Any reason there is no patch for the af_packet driver?
> >
> > John
>
> I have just modified the Intel vdev PMD's.
> It would be best if the owners of the non Intel vdev's submitted patches for their drivers.
>
I disagree. Its ok given that this is an RFC patch I suppose, but if you intend
to actually propose this change for review, you need to modify all affected
drivers in a single commit. Asking individual driver maintainers to submit
patches to not access a struct element that is removed in a separate patch will
by definition cause FTBFS errors. All references to the structure member being
removed must also be eliminated in the same or a prior commit, preferably the
former.
Neil
> Regards,
>
> Bernard.
>
> <snip>
>
>
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-08-28 10:32 ` Neil Horman
@ 2015-08-28 19:48 ` Wiles, Keith
2015-08-31 11:21 ` Iremonger, Bernard
0 siblings, 1 reply; 95+ messages in thread
From: Wiles, Keith @ 2015-08-28 19:48 UTC (permalink / raw)
To: Neil Horman, Iremonger, Bernard; +Cc: dev
On 8/28/15, 5:32 AM, "dev on behalf of Neil Horman" <dev-bounces@dpdk.org
on behalf of nhorman@tuxdriver.com> wrote:
>On Fri, Aug 28, 2015 at 08:15:47AM +0000, Iremonger, Bernard wrote:
>> Hi John,
>>
>> > -----Original Message-----
>> > From: John W. Linville [mailto:linville@tuxdriver.com]
>> > Sent: Thursday, August 27, 2015 6:44 PM
>> > To: Iremonger, Bernard
>> > Cc: dev@dpdk.org
>> > Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
>> >
>> > On Thu, Aug 27, 2015 at 04:40:35PM +0100, Bernard Iremonger wrote:
>> > > There is a dummy pci driver in the vdev PMD's at present.
>> > > This RFC proposes to remove the pci driver from the vdev PMD's.
>> > > Changes have been made to librte_ether to handle vdevs which do not
>> > have a pci driver.
>> > >
>> > > The pdev PMD's should work as before with the changes to
>>librte_ether
>> > > The vdev PMD's which still have a pci driver should work as before
>>with the
>> > librte_ether changes.
>> > >
>> > > The following vdev PMD's have had the pci driver removed
>> > >
>> > > bonding PMD
>> > > null PMD
>> > > pcap PMD
>> > > ring PMD
>> >
>> > Any reason there is no patch for the af_packet driver?
>> >
>> > John
>>
>> I have just modified the Intel vdev PMD's.
>> It would be best if the owners of the non Intel vdev's submitted
>>patches for their drivers.
>>
>I disagree. Its ok given that this is an RFC patch I suppose, but if you
>intend
>to actually propose this change for review, you need to modify all
>affected
>drivers in a single commit. Asking individual driver maintainers to
>submit
>patches to not access a struct element that is removed in a separate
>patch will
>by definition cause FTBFS errors. All references to the structure member
>being
>removed must also be eliminated in the same or a prior commit, preferably
>the
>former.
+1, if you introduce a chance that effects other places in the
code/drivers then you must also make the changes to those parts as well.
It really should not be an option IMO.
>
>Neil
>
>> Regards,
>>
>> Bernard.
>>
>> <snip>
>>
>>
>
‹
Regards,
++Keith
Intel Corporation
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-08-28 19:48 ` Wiles, Keith
@ 2015-08-31 11:21 ` Iremonger, Bernard
2015-08-31 12:41 ` Neil Horman
0 siblings, 1 reply; 95+ messages in thread
From: Iremonger, Bernard @ 2015-08-31 11:21 UTC (permalink / raw)
To: Wiles, Keith, Neil Horman; +Cc: dev
Hi Keith, Neil,
<snip>
> >> > On Thu, Aug 27, 2015 at 04:40:35PM +0100, Bernard Iremonger wrote:
> >> > > There is a dummy pci driver in the vdev PMD's at present.
> >> > > This RFC proposes to remove the pci driver from the vdev PMD's.
> >> > > Changes have been made to librte_ether to handle vdevs which do
> >> > > not
> >> > have a pci driver.
> >> > >
> >> > > The pdev PMD's should work as before with the changes to
> >>librte_ether
> >> > > The vdev PMD's which still have a pci driver should work as
> >> > > before
> >>with the
> >> > librte_ether changes.
> >> > >
> >> > > The following vdev PMD's have had the pci driver removed
> >> > >
> >> > > bonding PMD
> >> > > null PMD
> >> > > pcap PMD
> >> > > ring PMD
> >> >
> >> > Any reason there is no patch for the af_packet driver?
> >> >
> >> > John
> >>
> >> I have just modified the Intel vdev PMD's.
> >> It would be best if the owners of the non Intel vdev's submitted
> >>patches for their drivers.
> >>
> >I disagree. Its ok given that this is an RFC patch I suppose, but if
> >you intend to actually propose this change for review, you need to
> >modify all affected drivers in a single commit. Asking individual
> >driver maintainers to submit patches to not access a struct element
> >that is removed in a separate patch will by definition cause FTBFS
> >errors. All references to the structure member being removed must also
> >be eliminated in the same or a prior commit, preferably the former.
>
> +1, if you introduce a chance that effects other places in the
> code/drivers then you must also make the changes to those parts as well.
> It really should not be an option IMO.
> >
> >Neil
< snip >
> Regards,
> ++Keith
> Intel Corporation
>
>
Firstly no struct element has been removed from struct rte_eth_dev {} in the eth_dev patch.
A dev_flags element has been added to struct rte_eth_dev{}
A numa_node element has been added to struct rte_eth_dev_data{}.
Unmodified VDEV's and PDEV's will not be aware of these new elements and will be unaffected by the eth_dev changes.
Regards,
Bernard.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-08-31 11:21 ` Iremonger, Bernard
@ 2015-08-31 12:41 ` Neil Horman
0 siblings, 0 replies; 95+ messages in thread
From: Neil Horman @ 2015-08-31 12:41 UTC (permalink / raw)
To: Iremonger, Bernard; +Cc: dev
On Mon, Aug 31, 2015 at 11:21:46AM +0000, Iremonger, Bernard wrote:
> Hi Keith, Neil,
>
> <snip>
>
> > >> > On Thu, Aug 27, 2015 at 04:40:35PM +0100, Bernard Iremonger wrote:
> > >> > > There is a dummy pci driver in the vdev PMD's at present.
> > >> > > This RFC proposes to remove the pci driver from the vdev PMD's.
> > >> > > Changes have been made to librte_ether to handle vdevs which do
> > >> > > not
> > >> > have a pci driver.
> > >> > >
> > >> > > The pdev PMD's should work as before with the changes to
> > >>librte_ether
> > >> > > The vdev PMD's which still have a pci driver should work as
> > >> > > before
> > >>with the
> > >> > librte_ether changes.
> > >> > >
> > >> > > The following vdev PMD's have had the pci driver removed
> > >> > >
> > >> > > bonding PMD
> > >> > > null PMD
> > >> > > pcap PMD
> > >> > > ring PMD
> > >> >
> > >> > Any reason there is no patch for the af_packet driver?
> > >> >
> > >> > John
> > >>
> > >> I have just modified the Intel vdev PMD's.
> > >> It would be best if the owners of the non Intel vdev's submitted
> > >>patches for their drivers.
> > >>
> > >I disagree. Its ok given that this is an RFC patch I suppose, but if
> > >you intend to actually propose this change for review, you need to
> > >modify all affected drivers in a single commit. Asking individual
> > >driver maintainers to submit patches to not access a struct element
> > >that is removed in a separate patch will by definition cause FTBFS
> > >errors. All references to the structure member being removed must also
> > >be eliminated in the same or a prior commit, preferably the former.
> >
> > +1, if you introduce a chance that effects other places in the
> > code/drivers then you must also make the changes to those parts as well.
> > It really should not be an option IMO.
> > >
> > >Neil
>
> < snip >
>
> > Regards,
> > ++Keith
> > Intel Corporation
> >
> >
> Firstly no struct element has been removed from struct rte_eth_dev {} in the eth_dev patch.
> A dev_flags element has been added to struct rte_eth_dev{}
> A numa_node element has been added to struct rte_eth_dev_data{}.
> Unmodified VDEV's and PDEV's will not be aware of these new elements and will be unaffected by the eth_dev changes.
>
Then NAK to the entire series, as it doesn't address this:
http://dpdk.org/ml/archives/dev/2015-July/022107.html
If that was your intent. The desire that Thomas had was to refactor the bus
code so that a drivers bus type was independent of the devices it registered.
This really just makes filling out the pci driver struct optional (which likely
becomes very messy down the road). I think what's being sought is something
like this:
1) remove the pci driver field from the ethdev struct, perhaps replacing it with
a union pointer to all the bus type structures supported (though I don't think
thats required)
2) modify the driver init routine so that each driver module can register with
whatever bus type it supports.
3) add a per-bus-instance init routine (akin to the probe routine in the linux
and bsd driver models) called once for each instance of that device type found
on a given bus. This routine allocates and registers an ethernet device
(optionally associating the bus type with the device using the pointer suggested
in (1)
There are other ways to do this of course, this is just a suggestion. The point
being, the goal is to remove the explicit relationship of a ethdev to a pci
device, as that relationship is clearly not guaranteed. Doing so allows us to
remove the need to determine bus type at init time, which would be a big
benefit.
Regards
Neil
> Regards,
>
> Bernard.
>
>
>
>
>
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-08-28 8:15 ` Iremonger, Bernard
2015-08-28 10:32 ` Neil Horman
@ 2015-08-28 17:51 ` John W. Linville
2015-08-31 10:23 ` Iremonger, Bernard
1 sibling, 1 reply; 95+ messages in thread
From: John W. Linville @ 2015-08-28 17:51 UTC (permalink / raw)
To: Iremonger, Bernard; +Cc: dev
On Fri, Aug 28, 2015 at 08:15:47AM +0000, Iremonger, Bernard wrote:
> Hi John,
>
> > -----Original Message-----
> > From: John W. Linville [mailto:linville@tuxdriver.com]
> > Sent: Thursday, August 27, 2015 6:44 PM
> > To: Iremonger, Bernard
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
> >
> > On Thu, Aug 27, 2015 at 04:40:35PM +0100, Bernard Iremonger wrote:
> > > There is a dummy pci driver in the vdev PMD's at present.
> > > This RFC proposes to remove the pci driver from the vdev PMD's.
> > > Changes have been made to librte_ether to handle vdevs which do not
> > have a pci driver.
> > >
> > > The pdev PMD's should work as before with the changes to librte_ether
> > > The vdev PMD's which still have a pci driver should work as before with the
> > librte_ether changes.
> > >
> > > The following vdev PMD's have had the pci driver removed
> > >
> > > bonding PMD
> > > null PMD
> > > pcap PMD
> > > ring PMD
> >
> > Any reason there is no patch for the af_packet driver?
> >
> > John
>
> I have just modified the Intel vdev PMD's.
> It would be best if the owners of the non Intel vdev's submitted patches for their drivers.
What constitutes an "Intel vdev PMD"? I thought these were all part
of the DPDK project? It seems odd to me for you to pick and choose
like this.
What is the overall purpose of this RFC? What benefit accrues to
those vdev PMDs that implement this change? What penalty is imposed
on those that do not change?
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-08-28 17:51 ` John W. Linville
@ 2015-08-31 10:23 ` Iremonger, Bernard
2015-08-31 12:59 ` Neil Horman
0 siblings, 1 reply; 95+ messages in thread
From: Iremonger, Bernard @ 2015-08-31 10:23 UTC (permalink / raw)
To: John W. Linville; +Cc: dev
Hi John,
> -----Original Message-----
> From: John W. Linville [mailto:linville@tuxdriver.com]
> Sent: Friday, August 28, 2015 6:52 PM
> To: Iremonger, Bernard
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
>
> On Fri, Aug 28, 2015 at 08:15:47AM +0000, Iremonger, Bernard wrote:
> > Hi John,
> >
> > > -----Original Message-----
> > > From: John W. Linville [mailto:linville@tuxdriver.com]
> > > Sent: Thursday, August 27, 2015 6:44 PM
> > > To: Iremonger, Bernard
> > > Cc: dev@dpdk.org
> > > Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
> > >
> > > On Thu, Aug 27, 2015 at 04:40:35PM +0100, Bernard Iremonger wrote:
> > > > There is a dummy pci driver in the vdev PMD's at present.
> > > > This RFC proposes to remove the pci driver from the vdev PMD's.
> > > > Changes have been made to librte_ether to handle vdevs which do
> > > > not
> > > have a pci driver.
> > > >
> > > > The pdev PMD's should work as before with the changes to
> > > > librte_ether The vdev PMD's which still have a pci driver should
> > > > work as before with the
> > > librte_ether changes.
> > > >
> > > > The following vdev PMD's have had the pci driver removed
> > > >
> > > > bonding PMD
> > > > null PMD
> > > > pcap PMD
> > > > ring PMD
> > >
> > > Any reason there is no patch for the af_packet driver?
> > >
> > > John
> >
> > I have just modified the Intel vdev PMD's.
> > It would be best if the owners of the non Intel vdev's submitted patches
> for their drivers.
>
> What constitutes an "Intel vdev PMD"? I thought these were all part of the
> DPDK project? It seems odd to me for you to pick and choose like this.
I should probably have written vdev PMD's contributed by Intel.
I am not familiar with the other vdev PMD's and thought it best that they should be modified by their owners/maintainers if required.
>
> What is the overall purpose of this RFC?
The purpose of this RFC is to remove the need for a PCI device driver from Vdev's that that do not use a PCI driver. Removing the PCI driver is implemented in the ethdev changes. I have modified some of the Vdev's to verify that the ethdev changes work.
> What benefit accrues to those vdev
> PMDs that implement this change? What penalty is imposed on those that
> do not change?
6Wind have decided that only cleanup patches will be allowed in future for Vdevs that have a dummy PCI driver. Any change in functionality for these Vdevs will not be allowed.
Please see email below from 6Wind
http://dpdk.org/ml/archives/dev/2015-July/022107.html
>
> John
> --
> John W. Linville Someday the world will need a hero, and you
> linville@tuxdriver.com might be all we have. Be ready.
Regards,
Bernard.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-08-31 10:23 ` Iremonger, Bernard
@ 2015-08-31 12:59 ` Neil Horman
2015-08-31 14:22 ` Thomas Monjalon
0 siblings, 1 reply; 95+ messages in thread
From: Neil Horman @ 2015-08-31 12:59 UTC (permalink / raw)
To: Iremonger, Bernard; +Cc: dev
On Mon, Aug 31, 2015 at 10:23:33AM +0000, Iremonger, Bernard wrote:
> Hi John,
>
> > -----Original Message-----
> > From: John W. Linville [mailto:linville@tuxdriver.com]
> > Sent: Friday, August 28, 2015 6:52 PM
> > To: Iremonger, Bernard
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
> >
> > On Fri, Aug 28, 2015 at 08:15:47AM +0000, Iremonger, Bernard wrote:
> > > Hi John,
> > >
> > > > -----Original Message-----
> > > > From: John W. Linville [mailto:linville@tuxdriver.com]
> > > > Sent: Thursday, August 27, 2015 6:44 PM
> > > > To: Iremonger, Bernard
> > > > Cc: dev@dpdk.org
> > > > Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
> > > >
> > > > On Thu, Aug 27, 2015 at 04:40:35PM +0100, Bernard Iremonger wrote:
> > > > > There is a dummy pci driver in the vdev PMD's at present.
> > > > > This RFC proposes to remove the pci driver from the vdev PMD's.
> > > > > Changes have been made to librte_ether to handle vdevs which do
> > > > > not
> > > > have a pci driver.
> > > > >
> > > > > The pdev PMD's should work as before with the changes to
> > > > > librte_ether The vdev PMD's which still have a pci driver should
> > > > > work as before with the
> > > > librte_ether changes.
> > > > >
> > > > > The following vdev PMD's have had the pci driver removed
> > > > >
> > > > > bonding PMD
> > > > > null PMD
> > > > > pcap PMD
> > > > > ring PMD
> > > >
> > > > Any reason there is no patch for the af_packet driver?
> > > >
> > > > John
> > >
> > > I have just modified the Intel vdev PMD's.
> > > It would be best if the owners of the non Intel vdev's submitted patches
> > for their drivers.
> >
> > What constitutes an "Intel vdev PMD"? I thought these were all part of the
> > DPDK project? It seems odd to me for you to pick and choose like this.
>
> I should probably have written vdev PMD's contributed by Intel.
> I am not familiar with the other vdev PMD's and thought it best that they should be modified by their owners/maintainers if required.
>
These are fairly rote changes, familiarity isn't really needed here, just a
willingness to do some minor testing. The right approach is to make the changes
to all the drivers, and cc their authors on the patch set so that they can
review it.
> >
> > What is the overall purpose of this RFC?
>
> The purpose of this RFC is to remove the need for a PCI device driver from Vdev's that that do not use a PCI driver. Removing the PCI driver is implemented in the ethdev changes. I have modified some of the Vdev's to verify that the ethdev changes work.
>
You didn't remove the relationship of the ethdev to the pci driver though, which
is really the problem, An ethdev may reside on any number of bus types
(pci/usb/vmbus/virt/none). This patch series just papers over the fact that an
ethdev is implicitly a pci device by making the assignment of its pci_dev
pointer optional. Whats really needed is a way to associate an ethdev with an
arbitrary bus
> > What benefit accrues to those vdev
> > PMDs that implement this change? What penalty is imposed on those that
> > do not change?
>
> 6Wind have decided that only cleanup patches will be allowed in future for Vdevs that have a dummy PCI driver. Any change in functionality for these Vdevs will not be allowed.
> Please see email below from 6Wind
>
> http://dpdk.org/ml/archives/dev/2015-July/022107.html
>
I think you misread that. I think all Thomas is asking for (correct me if I'm
wrong Thomas), is for someone to start refactoring the ethdev registration code
so that we can have a single init path without the need for wierd typing and
differentiation at init time. He's not going to stop accepting bug fixes for
existing drivers just because it uses the existing initalization infrastructure.
I would even go so far as to say new drivers will be accepted for as long as the
existing init path exists as it does. We just need to start thinking about how
to make bus registration independent of ethernet device registration, and while
your patch series sort of eliminates some of that, its really not a proper
refactoring of the sort I think Thomas is asking for
Regards
Neil
> >
> > John
> > --
> > John W. Linville Someday the world will need a hero, and you
> > linville@tuxdriver.com might be all we have. Be ready.
>
> Regards,
>
> Bernard.
>
>
>
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-08-31 12:59 ` Neil Horman
@ 2015-08-31 14:22 ` Thomas Monjalon
2015-09-01 13:38 ` Iremonger, Bernard
0 siblings, 1 reply; 95+ messages in thread
From: Thomas Monjalon @ 2015-08-31 14:22 UTC (permalink / raw)
To: Neil Horman, Iremonger, Bernard; +Cc: dev
2015-08-31 08:59, Neil Horman:
> On Mon, Aug 31, 2015 at 10:23:33AM +0000, Iremonger, Bernard wrote:
> > The purpose of this RFC is to remove the need for a PCI device driver
> > from Vdev's that that do not use a PCI driver. Removing the PCI driver
> > is implemented in the ethdev changes. I have modified some of the Vdev's
> > to verify that the ethdev changes work.
> >
> You didn't remove the relationship of the ethdev to the pci driver though, which
> is really the problem, An ethdev may reside on any number of bus types
> (pci/usb/vmbus/virt/none). This patch series just papers over the fact that an
> ethdev is implicitly a pci device by making the assignment of its pci_dev
> pointer optional. Whats really needed is a way to associate an ethdev with an
> arbitrary bus
>
> > > What benefit accrues to those vdev
> > > PMDs that implement this change? What penalty is imposed on those that
> > > do not change?
> >
> > 6Wind have decided that only cleanup patches will be allowed in future
Not a 6WIND decision. This is a community project.
I gave my opinion regarding maintenance of the code.
I may be wrong but after discussions with others and recent comments, it seems
well justified.
> > for Vdevs that have a dummy PCI driver. Any change in functionality for
> > these Vdevs will not be allowed.
> > Please see email below from 6Wind
> >
> > http://dpdk.org/ml/archives/dev/2015-July/022107.html
> >
> I think you misread that. I think all Thomas is asking for (correct me if I'm
> wrong Thomas), is for someone to start refactoring the ethdev registration code
> so that we can have a single init path without the need for wierd typing and
> differentiation at init time. He's not going to stop accepting bug fixes for
> existing drivers just because it uses the existing initalization infrastructure.
Yes. Such cleanup can be enforced by rejecting new features on top of these
workarounds. But driver fixes will be accepted.
> I would even go so far as to say new drivers will be accepted for as long as the
> existing init path exists as it does. We just need to start thinking about how
> to make bus registration independent of ethernet device registration, and while
> your patch series sort of eliminates some of that, its really not a proper
> refactoring of the sort I think Thomas is asking for
Yes
The sooner will be the better :)
Thanks for taking care of this issue.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-08-31 14:22 ` Thomas Monjalon
@ 2015-09-01 13:38 ` Iremonger, Bernard
2015-09-01 19:18 ` Neil Horman
0 siblings, 1 reply; 95+ messages in thread
From: Iremonger, Bernard @ 2015-09-01 13:38 UTC (permalink / raw)
To: Thomas Monjalon, Neil Horman; +Cc: dev
Hi Neil, Thomas,
<snip>
> > You didn't remove the relationship of the ethdev to the pci driver
> > though, which is really the problem, An ethdev may reside on any
> > number of bus types (pci/usb/vmbus/virt/none).
<snip>
> > Whats really needed is a way to associate an ethdev with an arbitrary bus
<snip>
> > > Please see email below from 6Wind
> > >
> > > http://dpdk.org/ml/archives/dev/2015-July/022107.html
> > >
> > I think you misread that. I think all Thomas is asking for (correct
> > me if I'm wrong Thomas), is for someone to start refactoring the
> > ethdev registration code so that we can have a single init path
> > without the need for wierd typing and differentiation at init time.
<snip >
> > We just need to
> > start thinking about how to make bus registration independent of
> > ethernet device registration, and while your patch series sort of
> > eliminates some of that, its really not a proper refactoring of the
> > sort I think Thomas is asking for.
I am just trying to distill what the actual requirement is from the above discussion.
(1) Remove relationship of the ethdev to the pci driver.
(2) Refactor ethdev registration code so that there is a single init path.
(3) Make bus registration independent of ethdev registration.
(4) Change all (17) PMD's to use the modified structures.
The rte_eal_driver_registration() code is in librte_eal, untouched as yet by this patch set.
The rte_eth_driver_registration() code is in librte_ether.
Should the pci fields be removed from the struct rte_eth_dev{} and struct eth_driver{},
and put somewhere else or replaced with a union of bus types and drivers?
Regards,
Bernard.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-09-01 13:38 ` Iremonger, Bernard
@ 2015-09-01 19:18 ` Neil Horman
2015-09-03 14:02 ` Iremonger, Bernard
0 siblings, 1 reply; 95+ messages in thread
From: Neil Horman @ 2015-09-01 19:18 UTC (permalink / raw)
To: Iremonger, Bernard; +Cc: dev
On Tue, Sep 01, 2015 at 01:38:02PM +0000, Iremonger, Bernard wrote:
> Hi Neil, Thomas,
>
> <snip>
>
> > > You didn't remove the relationship of the ethdev to the pci driver
> > > though, which is really the problem, An ethdev may reside on any
> > > number of bus types (pci/usb/vmbus/virt/none).
>
> <snip>
>
> > > Whats really needed is a way to associate an ethdev with an arbitrary bus
>
> <snip>
>
> > > > Please see email below from 6Wind
> > > >
> > > > http://dpdk.org/ml/archives/dev/2015-July/022107.html
> > > >
> > > I think you misread that. I think all Thomas is asking for (correct
> > > me if I'm wrong Thomas), is for someone to start refactoring the
> > > ethdev registration code so that we can have a single init path
> > > without the need for wierd typing and differentiation at init time.
>
> <snip >
>
> > > We just need to
> > > start thinking about how to make bus registration independent of
> > > ethernet device registration, and while your patch series sort of
> > > eliminates some of that, its really not a proper refactoring of the
> > > sort I think Thomas is asking for.
>
> I am just trying to distill what the actual requirement is from the above discussion.
>
> (1) Remove relationship of the ethdev to the pci driver.
Correct
> (2) Refactor ethdev registration code so that there is a single init path.
Correct (or mostly correct, in rereading my initial post, there may be some
ambiguitiy here)
> (3) Make bus registration independent of ethdev registration.
Correct
> (4) Change all (17) PMD's to use the modified structures.
>
Correct (I assume the 17 number is accurate here)
> The rte_eal_driver_registration() code is in librte_eal, untouched as yet by this patch set.
>
Correct, the code that registers an init function is a single path, which is
great. However, that path requires that you specify a device type (in this case
PMD_PDEV or PMD_VDEV to differentiate pci vs virtual devices (it uses this for
ordering of initalization in rte_eal_dev_init, which is a hack). What would be
preferred would be if the structure that was registered via that macro only held
a name and an init routine to initalize the driver itself. Inside that init
routine, the driver would then be responsible for registering with the
appropriate bus type (virtual/pci/usb/whatever). A secondary function would be
registered as part of that process (akin to the linux/bsd probe() method) which
was called once for each instance of the device found on that bus.
> The rte_eth_driver_registration() code is in librte_ether.
> Should the pci fields be removed from the struct rte_eth_dev{} and struct eth_driver{},
IMO, yes, they should, as the driver can store pointers to those devices in
their private per-device data area. That said, there may be value in including
a union of all bus types in the ethdev itself, if there are higher layer
functions that need to be aware of a given ethdevs bus type
> and put somewhere else or replaced with a union of bus types and drivers?
>
> Regards,
>
> Bernard.
>
>
>
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-09-01 19:18 ` Neil Horman
@ 2015-09-03 14:02 ` Iremonger, Bernard
2015-09-07 9:22 ` Zende, Amruta S
0 siblings, 1 reply; 95+ messages in thread
From: Iremonger, Bernard @ 2015-09-03 14:02 UTC (permalink / raw)
To: Thomas Monjalon, Neil Horman; +Cc: dev
Hi Neil, Thomas,
> > <snip>
> >
> > > > You didn't remove the relationship of the ethdev to the pci driver
> > > > though, which is really the problem, An ethdev may reside on any
> > > > number of bus types (pci/usb/vmbus/virt/none).
> >
> > <snip>
> >
> > > > Whats really needed is a way to associate an ethdev with an
> > > > arbitrary bus
> >
> > <snip>
> >
> > > > > Please see email below from 6Wind
> > > > >
> > > > > http://dpdk.org/ml/archives/dev/2015-July/022107.html
> > > > >
> > > > I think you misread that. I think all Thomas is asking for
> > > > (correct me if I'm wrong Thomas), is for someone to start
> > > > refactoring the ethdev registration code so that we can have a
> > > > single init path without the need for wierd typing and differentiation at
> init time.
> >
> > <snip >
> >
> > > > We just need to
> > > > start thinking about how to make bus registration independent of
> > > > ethernet device registration, and while your patch series sort of
> > > > eliminates some of that, its really not a proper refactoring of
> > > > the sort I think Thomas is asking for.
> >
> > I am just trying to distill what the actual requirement is from the above
> discussion.
> >
> > (1) Remove relationship of the ethdev to the pci driver.
> Correct
I plan to continue work on the RFC to address this.
>
> > (2) Refactor ethdev registration code so that there is a single init path.
> Correct (or mostly correct, in rereading my initial post, there may be some
> ambiguitiy here)
>
> > (3) Make bus registration independent of ethdev registration.
> Correct
>
> > (4) Change all (17) PMD's to use the modified structures.
> >
> Correct (I assume the 17 number is accurate here)
There are 17 PMD directories some of which have multiple PMD's.
The total number of PMD's is 23 at present.
> > The rte_eal_driver_registration() code is in librte_eal, untouched as yet by
> this patch set.
> >
> Correct, the code that registers an init function is a single path, which is great.
> However, that path requires that you specify a device type (in this case
> PMD_PDEV or PMD_VDEV to differentiate pci vs virtual devices (it uses this
> for ordering of initalization in rte_eal_dev_init, which is a hack). What would
> be preferred would be if the structure that was registered via that macro
> only held a name and an init routine to initalize the driver itself. Inside that
> init routine, the driver would then be responsible for registering with the
> appropriate bus type (virtual/pci/usb/whatever). A secondary function
> would be registered as part of that process (akin to the linux/bsd probe()
> method) which was called once for each instance of the device found on that
> bus.
>
I will send a second RFC to address the eal driver registration code issues in librte_eal.
> > The rte_eth_driver_registration() code is in librte_ether.
> > Should the pci fields be removed from the struct rte_eth_dev{} and
> > struct eth_driver{},
> IMO, yes, they should, as the driver can store pointers to those devices in
> their private per-device data area. That said, there may be value in including
> a union of all bus types in the ethdev itself, if there are higher layer functions
> that need to be aware of a given ethdevs bus type
I plan to park the issue of multiple bus types for now.
More consensus is needed on the best way forward.
>
> > and put somewhere else or replaced with a union of bus types and
> drivers?
Regards,
Bernard.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
2015-09-03 14:02 ` Iremonger, Bernard
@ 2015-09-07 9:22 ` Zende, Amruta S
0 siblings, 0 replies; 95+ messages in thread
From: Zende, Amruta S @ 2015-09-07 9:22 UTC (permalink / raw)
To: Iremonger, Bernard, Thomas Monjalon, Neil Horman; +Cc: dev
Certain functions like "rte_eth_dev_socket_id" assume the device to be a PCI device and access pointers like rte_eth_devices[port_id].pci_dev->numa_node.
Any such assumptions and dependencies should also be removed.
Thanks & regards,
Amruta Zende
+91-20-4305-2969
-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Iremonger, Bernard
Sent: Thursday, September 3, 2015 7:33 PM
To: Thomas Monjalon; Neil Horman
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs
Hi Neil, Thomas,
> > <snip>
> >
> > > > You didn't remove the relationship of the ethdev to the pci
> > > > driver though, which is really the problem, An ethdev may reside
> > > > on any number of bus types (pci/usb/vmbus/virt/none).
> >
> > <snip>
> >
> > > > Whats really needed is a way to associate an ethdev with an
> > > > arbitrary bus
> >
> > <snip>
> >
> > > > > Please see email below from 6Wind
> > > > >
> > > > > http://dpdk.org/ml/archives/dev/2015-July/022107.html
> > > > >
> > > > I think you misread that. I think all Thomas is asking for
> > > > (correct me if I'm wrong Thomas), is for someone to start
> > > > refactoring the ethdev registration code so that we can have a
> > > > single init path without the need for wierd typing and
> > > > differentiation at
> init time.
> >
> > <snip >
> >
> > > > We just need to
> > > > start thinking about how to make bus registration independent of
> > > > ethernet device registration, and while your patch series sort
> > > > of eliminates some of that, its really not a proper refactoring
> > > > of the sort I think Thomas is asking for.
> >
> > I am just trying to distill what the actual requirement is from the
> > above
> discussion.
> >
> > (1) Remove relationship of the ethdev to the pci driver.
> Correct
I plan to continue work on the RFC to address this.
>
> > (2) Refactor ethdev registration code so that there is a single init path.
> Correct (or mostly correct, in rereading my initial post, there may be
> some ambiguitiy here)
>
> > (3) Make bus registration independent of ethdev registration.
> Correct
>
> > (4) Change all (17) PMD's to use the modified structures.
> >
> Correct (I assume the 17 number is accurate here)
There are 17 PMD directories some of which have multiple PMD's.
The total number of PMD's is 23 at present.
> > The rte_eal_driver_registration() code is in librte_eal, untouched
> > as yet by
> this patch set.
> >
> Correct, the code that registers an init function is a single path, which is great.
> However, that path requires that you specify a device type (in this
> case PMD_PDEV or PMD_VDEV to differentiate pci vs virtual devices (it
> uses this for ordering of initalization in rte_eal_dev_init, which is
> a hack). What would be preferred would be if the structure that was
> registered via that macro only held a name and an init routine to
> initalize the driver itself. Inside that init routine, the driver
> would then be responsible for registering with the appropriate bus
> type (virtual/pci/usb/whatever). A secondary function would be
> registered as part of that process (akin to the linux/bsd probe()
> method) which was called once for each instance of the device found on
> that bus.
>
I will send a second RFC to address the eal driver registration code issues in librte_eal.
> > The rte_eth_driver_registration() code is in librte_ether.
> > Should the pci fields be removed from the struct rte_eth_dev{} and
> > struct eth_driver{},
> IMO, yes, they should, as the driver can store pointers to those
> devices in their private per-device data area. That said, there may
> be value in including a union of all bus types in the ethdev itself,
> if there are higher layer functions that need to be aware of a given
> ethdevs bus type
I plan to park the issue of multiple bus types for now.
More consensus is needed on the best way forward.
>
> > and put somewhere else or replaced with a union of bus types and
> drivers?
Regards,
Bernard.
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code
[not found] <RFC PATCH>
` (25 preceding siblings ...)
2015-08-27 15:40 ` [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 01/18] librte_eal: remove type field from rte_driver structure Bernard Iremonger
` (18 more replies)
26 siblings, 19 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
At present the eal driver registration code is more complicated than it
needs to be.
This RFC proposes to simplify the eal driver registration code.
Remove the type field from the eal driver structure.
Refactor the eal driver registration code to use the name
field in the eal driver structure instead of the type field.
Modify all PMD's to use the modified eal driver structure.
Initialise the name field in the eal driver structure
in some PMD's where it is not initialised at present.
Bernard Iremonger (18):
librte_eal: remove type field from rte_driver structure.
af_packet: remove type field from rte_driver structure
bnx2x: remove type field and initialise name field in rte_driver
structure
bonding: remove type field from rte_driver structure
cxgbe: remove type field from rte_driver structure
e1000: remove type field and initialise name field in rte_driver
structures
enic: remove type field and initialise name field in rte_driver
structure
fm10k: remove type field and initialise name field in rte_driver
structure
i40e: remove type field and initialise name field in rte_driver
structures
ixgbe: remove type field and initialise name field in rte_driver
structure
mlx4: remove type field from rte_driver structure
mpipe: remove type field and update name in rte_driver structure
null: remove type field from rte_driver structure
pcap: remove type field from rte_driver structure
ring: remove type field from rte_driver structure
virtio_ethdev: remove type field and initialise name field in
rte_driver structure
vmxnet3: remove type field and initialise name field in rte_driver
structure
xenvirt: remove type field from rte_driver structure
drivers/net/af_packet/rte_eth_af_packet.c | 5 ++---
drivers/net/bnx2x/bnx2x_ethdev.c | 5 +++--
drivers/net/bonding/rte_eth_bond_pmd.c | 3 +--
drivers/net/cxgbe/cxgbe_ethdev.c | 4 ++--
drivers/net/e1000/em_ethdev.c | 2 +-
drivers/net/e1000/igb_ethdev.c | 4 ++--
drivers/net/enic/enic_ethdev.c | 3 ++-
drivers/net/fm10k/fm10k_ethdev.c | 2 +-
drivers/net/i40e/i40e_ethdev.c | 2 +-
drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
drivers/net/mlx4/mlx4.c | 4 ++--
drivers/net/mpipe/mpipe_tilegx.c | 7 +++----
drivers/net/null/rte_eth_null.c | 3 +--
drivers/net/pcap/rte_eth_pcap.c | 3 +--
drivers/net/ring/rte_eth_ring.c | 3 +--
drivers/net/virtio/virtio_ethdev.c | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 5 ++---
lib/librte_eal/common/eal_common_dev.c | 22 +++++++++++++---------
lib/librte_eal/common/include/rte_dev.h | 11 +----------
21 files changed, 44 insertions(+), 54 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 01/18] librte_eal: remove type field from rte_driver structure.
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 13:08 ` Thomas Monjalon
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 02/18] af_packet: " Bernard Iremonger
` (17 subsequent siblings)
18 siblings, 1 reply; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_eal/common/eal_common_dev.c | 22 +++++++++++++---------
lib/librte_eal/common/include/rte_dev.h | 11 +----------
2 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 4089d66..ccfbb8c 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* Copyright(c) 2014 6WIND S.A.
* All rights reserved.
*
@@ -72,8 +72,6 @@ rte_eal_vdev_init(const char *name, const char *args)
return -EINVAL;
TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_VDEV)
- continue;
/*
* search a driver prefix in virtual device name.
@@ -117,10 +115,18 @@ rte_eal_dev_init(void)
/* Once the vdevs are initalized, start calling all the pdev drivers */
TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_PDEV)
- continue;
- /* PDEV drivers don't get passed any parameters */
- driver->init(NULL, NULL);
+
+ /* PCI drivers don't get passed any parameters */
+ /*
+ * Search a virtual driver prefix in device name.
+ * It should not be found for PCI devices.
+ * Use strncmp to compare.
+ */
+
+ if ((driver->name) &&
+ (strncmp(driver->name, "eth_", strlen("eth_")) != 0)) {
+ driver->init(NULL, NULL);
+ }
}
return 0;
}
@@ -134,8 +140,6 @@ rte_eal_vdev_uninit(const char *name)
return -EINVAL;
TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_VDEV)
- continue;
/*
* search a driver prefix in virtual device name.
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index f601d21..6253185 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -62,20 +62,11 @@ typedef int (rte_dev_init_t)(const char *name, const char *args);
typedef int (rte_dev_uninit_t)(const char *name);
/**
- * Driver type enumeration
- */
-enum pmd_type {
- PMD_VDEV = 0,
- PMD_PDEV = 1,
-};
-
-/**
* A structure describing a device driver.
*/
struct rte_driver {
TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
- enum pmd_type type; /**< PMD Driver type */
- const char *name; /**< Driver name. */
+ const char *name; /**< Driver name. */
rte_dev_init_t *init; /**< Device init. function. */
rte_dev_uninit_t *uninit; /**< Device uninit. function. */
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 01/18] librte_eal: remove type field from rte_driver structure.
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 01/18] librte_eal: remove type field from rte_driver structure Bernard Iremonger
@ 2015-09-04 13:08 ` Thomas Monjalon
0 siblings, 0 replies; 95+ messages in thread
From: Thomas Monjalon @ 2015-09-04 13:08 UTC (permalink / raw)
To: Bernard Iremonger; +Cc: dev
2015-09-04 12:01, Bernard Iremonger:
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
There is no explanation in this patch.
> - if (driver->type != PMD_PDEV)
> - continue;
> - /* PDEV drivers don't get passed any parameters */
> - driver->init(NULL, NULL);
> +
> + /* PCI drivers don't get passed any parameters */
> + /*
> + * Search a virtual driver prefix in device name.
> + * It should not be found for PCI devices.
> + * Use strncmp to compare.
> + */
> +
> + if ((driver->name) &&
> + (strncmp(driver->name, "eth_", strlen("eth_")) != 0)) {
> + driver->init(NULL, NULL);
> + }
You don't need to submit a full patchset with changes in every drivers
for a RFC. Having just this patch is enough to have an opinion.
Here it is a nack.
We need to have a common init path instead of the current VDEV/PDEV branches.
And instead of "pmd_type", a bus information would be more meaningful.
So just replacing a type by a magical string is worst.
Please don't try to fix wrong problems and focus on your goal.
We had some discussions about possible PCI EAL refactoring but
it probably needs to be done step by step with a clear cleaning motivation
at each step. I think other people involved in EAL will have other ideas.
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 02/18] af_packet: remove type field from rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 01/18] librte_eal: remove type field from rte_driver structure Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 03/18] bnx2x: remove type field and initialise name field in " Bernard Iremonger
` (16 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/af_packet/rte_eth_af_packet.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index bdd9628..0ce6540 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -5,7 +5,7 @@
*
* Originally based upon librte_pmd_pcap code:
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* Copyright(c) 2014 6WIND S.A.
* All rights reserved.
*
@@ -839,8 +839,7 @@ exit:
}
static struct rte_driver pmd_af_packet_drv = {
- .name = "eth_af_packet",
- .type = PMD_VDEV,
+ .name = "eth_af_packet", /* Virtual device */
.init = rte_pmd_af_packet_devinit,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 03/18] bnx2x: remove type field and initialise name field in rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 01/18] librte_eal: remove type field from rte_driver structure Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 02/18] af_packet: " Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:26 ` Harish Patil
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 04/18] bonding: remove type field from " Bernard Iremonger
` (15 subsequent siblings)
18 siblings, 1 reply; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/bnx2x/bnx2x_ethdev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 09b5920..b25ca21 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
+ * Copyright(c) 2015 Intel Corporation.
*
* All rights reserved.
*/
@@ -529,12 +530,12 @@ static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *param
}
static struct rte_driver rte_bnx2x_driver = {
- .type = PMD_PDEV,
+ .name = "rte_bnx2x_driver", /* PCI device */
.init = rte_bnx2x_pmd_init,
};
static struct rte_driver rte_bnx2xvf_driver = {
- .type = PMD_PDEV,
+ .name = "rte_bnx2xvf_driver", /* PCI device */
.init = rte_bnx2xvf_pmd_init,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 03/18] bnx2x: remove type field and initialise name field in rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 03/18] bnx2x: remove type field and initialise name field in " Bernard Iremonger
@ 2015-09-04 11:26 ` Harish Patil
0 siblings, 0 replies; 95+ messages in thread
From: Harish Patil @ 2015-09-04 11:26 UTC (permalink / raw)
To: Bernard Iremonger, dev
>
>Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
>---
> drivers/net/bnx2x/bnx2x_ethdev.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c
>b/drivers/net/bnx2x/bnx2x_ethdev.c
>index 09b5920..b25ca21 100644
>--- a/drivers/net/bnx2x/bnx2x_ethdev.c
>+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
>@@ -1,5 +1,6 @@
> /*
> * Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
>+ * Copyright(c) 2015 Intel Corporation.
> *
> * All rights reserved.
> */
>@@ -529,12 +530,12 @@ static int rte_bnx2xvf_pmd_init(const char *name
>__rte_unused, const char *param
> }
>
> static struct rte_driver rte_bnx2x_driver = {
>- .type = PMD_PDEV,
>+ .name = "rte_bnx2x_driver", /* PCI device */
> .init = rte_bnx2x_pmd_init,
> };
>
> static struct rte_driver rte_bnx2xvf_driver = {
>- .type = PMD_PDEV,
>+ .name = "rte_bnx2xvf_driver", /* PCI device */
> .init = rte_bnx2xvf_pmd_init,
> };
>
>--
>1.9.1
>
>
Acked-by: Harish Patil <harish.patil@qlogic.com>
Thanks,
Harish
________________________________
This message and any attached documents contain information from the sending company or its parent company(s), subsidiaries, divisions or branch offices that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 04/18] bonding: remove type field from rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (2 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 03/18] bnx2x: remove type field and initialise name field in " Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 05/18] cxgbe: " Bernard Iremonger
` (14 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/bonding/rte_eth_bond_pmd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 5cc6372..0e222b2 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2302,8 +2302,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
}
static struct rte_driver bond_drv = {
- .name = "eth_bond",
- .type = PMD_VDEV,
+ .name = "eth_bond", /* Virtual device */
.init = bond_init,
.uninit = bond_uninit,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 05/18] cxgbe: remove type field from rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (3 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 04/18] bonding: remove type field from " Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 06/18] e1000: remove type field and initialise name field in rte_driver structures Bernard Iremonger
` (13 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/cxgbe/cxgbe_ethdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 478051a..5831ab7 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -2,6 +2,7 @@
* BSD LICENSE
*
* Copyright(c) 2014-2015 Chelsio Communications.
+ * Copyright(c) 2015 Intel Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -794,8 +795,7 @@ static int rte_cxgbe_pmd_init(const char *name __rte_unused,
}
static struct rte_driver rte_cxgbe_driver = {
- .name = "cxgbe_driver",
- .type = PMD_PDEV,
+ .name = "cxgbe_driver", /* PCI device */
.init = rte_cxgbe_pmd_init,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 06/18] e1000: remove type field and initialise name field in rte_driver structures
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (4 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 05/18] cxgbe: " Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 07/18] enic: remove type field and initialise name field in rte_driver structure Bernard Iremonger
` (12 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/e1000/em_ethdev.c | 2 +-
drivers/net/e1000/igb_ethdev.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 912f5dd..70c5a78 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1586,7 +1586,7 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
}
struct rte_driver em_pmd_drv = {
- .type = PMD_PDEV,
+ .name = "em_pmd_drv", /* PCI device */
.init = rte_em_pmd_init,
};
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index c7e6d55..f2c675a 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -4135,12 +4135,12 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev,
}
static struct rte_driver pmd_igb_drv = {
- .type = PMD_PDEV,
+ .name = "pmd_igb_drv", /* PCI device */
.init = rte_igb_pmd_init,
};
static struct rte_driver pmd_igbvf_drv = {
- .type = PMD_PDEV,
+ .name = "pmd_igbvf_drv", /* PCI device */
.init = rte_igbvf_pmd_init,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 07/18] enic: remove type field and initialise name field in rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (5 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 06/18] e1000: remove type field and initialise name field in rte_driver structures Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 08/18] fm10k: " Bernard Iremonger
` (11 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/enic/enic_ethdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 8280cea..af2c57e 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -3,6 +3,7 @@
* Copyright 2007 Nuova Systems, Inc. All rights reserved.
*
* Copyright (c) 2014, Cisco Systems, Inc.
+ * Copyright(c) 2015 Intel Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -633,7 +634,7 @@ rte_enic_pmd_init(const char *name __rte_unused,
}
static struct rte_driver rte_enic_driver = {
- .type = PMD_PDEV,
+ .name = "rte_enic_driver", /* PCI device */
.init = rte_enic_pmd_init,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 08/18] fm10k: remove type field and initialise name field in rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (6 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 07/18] enic: remove type field and initialise name field in rte_driver structure Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 09/18] i40e: remove type field and initialise name field in rte_driver structures Bernard Iremonger
` (10 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/fm10k/fm10k_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index a69c990..bda5a81 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2312,7 +2312,7 @@ rte_pmd_fm10k_init(__rte_unused const char *name,
}
static struct rte_driver rte_fm10k_driver = {
- .type = PMD_PDEV,
+ .name = "rte_fm10k_driver", /* PCI device */
.init = rte_pmd_fm10k_init,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 09/18] i40e: remove type field and initialise name field in rte_driver structures
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (7 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 08/18] fm10k: " Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 10/18] ixgbe: remove type field and initialise name field in rte_driver structure Bernard Iremonger
` (9 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 2 +-
drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 40b0526..2d0551c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -347,7 +347,7 @@ rte_i40e_pmd_init(const char *name __rte_unused,
}
static struct rte_driver rte_i40e_driver = {
- .type = PMD_PDEV,
+ .name = "rte_i40e_driver", /* PCI device */
.init = rte_i40e_pmd_init,
};
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index b694400..fe44966 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1268,7 +1268,7 @@ rte_i40evf_pmd_init(const char *name __rte_unused,
}
static struct rte_driver rte_i40evf_driver = {
- .type = PMD_PDEV,
+ .name = "rte_i40evf_driver", /* PCI device */
.init = rte_i40evf_pmd_init,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 10/18] ixgbe: remove type field and initialise name field in rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (8 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 09/18] i40e: remove type field and initialise name field in rte_driver structures Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 11/18] mlx4: remove type field from " Bernard Iremonger
` (8 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index b8ee1e9..d59d4b5 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5514,12 +5514,12 @@ ixgbe_set_eeprom(struct rte_eth_dev *dev,
}
static struct rte_driver rte_ixgbe_driver = {
- .type = PMD_PDEV,
+ .name = "rte_ixgbe_driver", /* PCI device */
.init = rte_ixgbe_pmd_init,
};
static struct rte_driver rte_ixgbevf_driver = {
- .type = PMD_PDEV,
+ .name = "rte_ixgbevf_driver", /* PCI device */
.init = rte_ixgbevf_pmd_init,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 11/18] mlx4: remove type field from rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (9 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 10/18] ixgbe: remove type field and initialise name field in rte_driver structure Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 12/18] mpipe: remove type field and update name in " Bernard Iremonger
` (7 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/mlx4/mlx4.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index fa3cb7e..532307d 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -3,6 +3,7 @@
*
* Copyright 2012-2015 6WIND S.A.
* Copyright 2012 Mellanox.
+ * Copyright 2015 Intel.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -5107,8 +5108,7 @@ rte_mlx4_pmd_init(const char *name, const char *args)
}
static struct rte_driver rte_mlx4_driver = {
- .type = PMD_PDEV,
- .name = MLX4_DRIVER_NAME,
+ .name = MLX4_DRIVER_NAME, /* PCI device */
.init = rte_mlx4_pmd_init,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 12/18] mpipe: remove type field and update name in rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (10 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 11/18] mlx4: remove type field from " Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 13/18] null: remove type field from " Bernard Iremonger
` (6 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/mpipe/mpipe_tilegx.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 743feef..9454d4e 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -2,6 +2,7 @@
* BSD LICENSE
*
* Copyright(c) 2015 EZchip Semiconductor Ltd. All rights reserved.
+ * Copyright(c) 2015 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -1602,14 +1603,12 @@ rte_pmd_mpipe_devinit(const char *ifname,
}
static struct rte_driver pmd_mpipe_xgbe_drv = {
- .name = "xgbe",
- .type = PMD_VDEV,
+ .name = "eth_xgbe", /* Virtual device */
.init = rte_pmd_mpipe_devinit,
};
static struct rte_driver pmd_mpipe_gbe_drv = {
- .name = "gbe",
- .type = PMD_VDEV,
+ .name = "eth_gbe", /* Virtual device */
.init = rte_pmd_mpipe_devinit,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 13/18] null: remove type field from rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (11 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 12/18] mpipe: remove type field and update name in " Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 14/18] pcap: " Bernard Iremonger
` (5 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/null/rte_eth_null.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index e244595..5f9871c 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -577,8 +577,7 @@ rte_pmd_null_devuninit(const char *name)
}
static struct rte_driver pmd_null_drv = {
- .name = "eth_null",
- .type = PMD_VDEV,
+ .name = "eth_null", /* Virtual device */
.init = rte_pmd_null_devinit,
.uninit = rte_pmd_null_devuninit,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 14/18] pcap: remove type field from rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (12 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 13/18] null: remove type field from " Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 15/18] ring: " Bernard Iremonger
` (4 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/pcap/rte_eth_pcap.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index f2e4634..fd38894 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1104,8 +1104,7 @@ rte_pmd_pcap_devuninit(const char *name)
}
static struct rte_driver pmd_pcap_drv = {
- .name = "eth_pcap",
- .type = PMD_VDEV,
+ .name = "eth_pcap", /* Virtual device */
.init = rte_pmd_pcap_devinit,
.uninit = rte_pmd_pcap_devuninit,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 15/18] ring: remove type field from rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (13 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 14/18] pcap: " Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 16/18] virtio_ethdev: remove type field and initialise name field in " Bernard Iremonger
` (3 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/ring/rte_eth_ring.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 6fd3d0a..cbb3dc7 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -624,8 +624,7 @@ rte_pmd_ring_devuninit(const char *name)
}
static struct rte_driver pmd_ring_drv = {
- .name = "eth_ring",
- .type = PMD_VDEV,
+ .name = "eth_ring", /* Virtual device */
.init = rte_pmd_ring_devinit,
.uninit = rte_pmd_ring_devuninit,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 16/18] virtio_ethdev: remove type field and initialise name field in rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (14 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 15/18] ring: " Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 17/18] vmxnet3: " Bernard Iremonger
` (2 subsequent siblings)
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/virtio/virtio_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 465d3cd..a19935b 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1570,7 +1570,7 @@ __rte_unused uint8_t is_rx)
}
static struct rte_driver rte_virtio_driver = {
- .type = PMD_PDEV,
+ .name = "rte_virtio_driver", /* PCI device */
.init = rte_virtio_pmd_init,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 17/18] vmxnet3: remove type field and initialise name field in rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (15 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 16/18] virtio_ethdev: remove type field and initialise name field in " Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 18/18] xenvirt: remove type field from " Bernard Iremonger
2015-09-04 11:18 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bruce Richardson
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index a70be5c..04fff43 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -884,7 +884,7 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
#endif
static struct rte_driver rte_vmxnet3_driver = {
- .type = PMD_PDEV,
+ .name = "rte_vmxnet3_driver", /* PCI device */
.init = rte_vmxnet3_pmd_init,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* [dpdk-dev] [RFC PATCH 18/18] xenvirt: remove type field from rte_driver structure
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (16 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 17/18] vmxnet3: " Bernard Iremonger
@ 2015-09-04 11:01 ` Bernard Iremonger
2015-09-04 11:18 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bruce Richardson
18 siblings, 0 replies; 95+ messages in thread
From: Bernard Iremonger @ 2015-09-04 11:01 UTC (permalink / raw)
To: dev
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/xenvirt/rte_eth_xenvirt.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 73e8bce..4ce1730 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -706,8 +706,7 @@ rte_pmd_xenvirt_devinit(const char *name, const char *params)
}
static struct rte_driver pmd_xenvirt_drv = {
- .name = "eth_xenvirt",
- .type = PMD_VDEV,
+ .name = "eth_xenvirt", /* Virtual device */
.init = rte_pmd_xenvirt_devinit,
};
--
1.9.1
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bernard Iremonger
` (17 preceding siblings ...)
2015-09-04 11:01 ` [dpdk-dev] [RFC PATCH 18/18] xenvirt: remove type field from " Bernard Iremonger
@ 2015-09-04 11:18 ` Bruce Richardson
2015-09-04 12:46 ` Iremonger, Bernard
18 siblings, 1 reply; 95+ messages in thread
From: Bruce Richardson @ 2015-09-04 11:18 UTC (permalink / raw)
To: Bernard Iremonger; +Cc: dev
On Fri, Sep 04, 2015 at 12:01:36PM +0100, Bernard Iremonger wrote:
> At present the eal driver registration code is more complicated than it
> needs to be.
>
> This RFC proposes to simplify the eal driver registration code.
>
> Remove the type field from the eal driver structure.
> Refactor the eal driver registration code to use the name
> field in the eal driver structure instead of the type field.
>
> Modify all PMD's to use the modified eal driver structure.
> Initialise the name field in the eal driver structure
> in some PMD's where it is not initialised at present.
>
>
Hi,
I don't think I like this approach very much. It seems very brittle to remove
the explicit type field and starting to rely on the drivers putting a prefix
in the name instead i.e. implicit typing.
What is the major concern with marking drivers as virtual or physical? My thinking
is that we should keep the type field, just perhaps change PDEV to be more
descriptive in identifying the type of physical device, e.g. DEV_PCI.
Regards,
/Bruce
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code
2015-09-04 11:18 ` [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code Bruce Richardson
@ 2015-09-04 12:46 ` Iremonger, Bernard
2015-09-04 12:53 ` Bruce Richardson
0 siblings, 1 reply; 95+ messages in thread
From: Iremonger, Bernard @ 2015-09-04 12:46 UTC (permalink / raw)
To: Richardson, Bruce; +Cc: dev
Hi Bruce,
<snip>
> Subject: Re: [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration
> code
>
> On Fri, Sep 04, 2015 at 12:01:36PM +0100, Bernard Iremonger wrote:
> > At present the eal driver registration code is more complicated than
> > it needs to be.
> >
> > This RFC proposes to simplify the eal driver registration code.
> >
> > Remove the type field from the eal driver structure.
> > Refactor the eal driver registration code to use the name field in the
> > eal driver structure instead of the type field.
> >
> > Modify all PMD's to use the modified eal driver structure.
> > Initialise the name field in the eal driver structure in some PMD's
> > where it is not initialised at present.
> >
> >
> Hi,
>
> I don't think I like this approach very much. It seems very brittle to remove
> the explicit type field and starting to rely on the drivers putting a prefix in the
> name instead i.e. implicit typing.
>
> What is the major concern with marking drivers as virtual or physical? My
> thinking is that we should keep the type field, just perhaps change PDEV to
> be more descriptive in identifying the type of physical device, e.g. DEV_PCI.
>
> Regards,
> /Bruce
The eth_ prefix is already required for vdev's for example:
testpmd -c f -n 4 --vdev='eth_pcap0,iface=eth0'
testpmd -c f -n 4 --vdev=eth_ring0
The eth_ prefix should not be used for pdev's.
Keeping the type field and name field is duplicating information
Regards,
Bernard.
^ permalink raw reply [flat|nested] 95+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration code
2015-09-04 12:46 ` Iremonger, Bernard
@ 2015-09-04 12:53 ` Bruce Richardson
0 siblings, 0 replies; 95+ messages in thread
From: Bruce Richardson @ 2015-09-04 12:53 UTC (permalink / raw)
To: Iremonger, Bernard; +Cc: dev
On Fri, Sep 04, 2015 at 01:46:11PM +0100, Iremonger, Bernard wrote:
> Hi Bruce,
> <snip>
> > Subject: Re: [dpdk-dev] [RFC PATCH 00/18] refactor eal driver registration
> > code
> >
> > On Fri, Sep 04, 2015 at 12:01:36PM +0100, Bernard Iremonger wrote:
> > > At present the eal driver registration code is more complicated than
> > > it needs to be.
> > >
> > > This RFC proposes to simplify the eal driver registration code.
> > >
> > > Remove the type field from the eal driver structure.
> > > Refactor the eal driver registration code to use the name field in the
> > > eal driver structure instead of the type field.
> > >
> > > Modify all PMD's to use the modified eal driver structure.
> > > Initialise the name field in the eal driver structure in some PMD's
> > > where it is not initialised at present.
> > >
> > >
> > Hi,
> >
> > I don't think I like this approach very much. It seems very brittle to remove
> > the explicit type field and starting to rely on the drivers putting a prefix in the
> > name instead i.e. implicit typing.
> >
> > What is the major concern with marking drivers as virtual or physical? My
> > thinking is that we should keep the type field, just perhaps change PDEV to
> > be more descriptive in identifying the type of physical device, e.g. DEV_PCI.
> >
> > Regards,
> > /Bruce
>
> The eth_ prefix is already required for vdev's for example:
> testpmd -c f -n 4 --vdev='eth_pcap0,iface=eth0'
> testpmd -c f -n 4 --vdev=eth_ring0
>
> The eth_ prefix should not be used for pdev's.
>
> Keeping the type field and name field is duplicating information
>
> Regards,
>
> Bernard.
Hi Bernard,
It's duplicating information until such a time as we decide to relax the restriction
on having vdev's starting with "eth" or we want to have a driver for a physical
nic starting with "eth". :-)
Overall, I'm not seeing the need for this particular patchset right now. I think
your previous patchset - removing the need for a pci_dev structure on vdevs - as
being the more important change for cleaning up our code.
Regards,
/Bruce
^ permalink raw reply [flat|nested] 95+ messages in thread