diff mbox

[dpdk-dev,07/13] pci: replace probe and remove handlers with rte_driver

Message ID 1480846288-2517-8-git-send-email-shreyansh.jain@nxp.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show

Checks

Context Check Description
checkpatch/checkpatch success coding style OK

Commit Message

Shreyansh Jain Dec. 4, 2016, 10:11 a.m. UTC
rte_pci_driver probe/remove callback are replaced with the rte_driver
based probe/remove. This patch changes all the PCI drivers which reference
rte_pci_driver->probe/remove.

rte_pci_driver continues to have probe/remove callback which would be used
once eth_driver is removed in later patches.

Only changes to PCI are done. VDEV changes require a different
model because of arguments being passed to vdev->probe/remove.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/net/bnx2x/bnx2x_ethdev.c        | 12 ++++++++----
 drivers/net/bnxt/bnxt_ethdev.c          |  6 ++++--
 drivers/net/cxgbe/cxgbe_ethdev.c        |  6 ++++--
 drivers/net/e1000/em_ethdev.c           |  6 ++++--
 drivers/net/e1000/igb_ethdev.c          | 12 ++++++++----
 drivers/net/ena/ena_ethdev.c            |  6 ++++--
 drivers/net/enic/enic_ethdev.c          |  6 ++++--
 drivers/net/fm10k/fm10k_ethdev.c        |  6 ++++--
 drivers/net/i40e/i40e_ethdev.c          |  6 ++++--
 drivers/net/i40e/i40e_ethdev_vf.c       |  6 ++++--
 drivers/net/ixgbe/ixgbe_ethdev.c        | 12 ++++++++----
 drivers/net/mlx4/mlx4.c                 |  6 ++++--
 drivers/net/mlx5/mlx5.c                 |  4 +++-
 drivers/net/nfp/nfp_net.c               |  6 ++++--
 drivers/net/qede/qede_ethdev.c          | 16 ++++++++++------
 drivers/net/szedata2/rte_eth_szedata2.c |  6 ++++--
 drivers/net/virtio/virtio_ethdev.c      |  4 ++--
 drivers/net/vmxnet3/vmxnet3_ethdev.c    |  6 ++++--
 lib/librte_eal/common/eal_common_pci.c  | 10 ++++++++--
 lib/librte_eal/common/include/rte_dev.h | 12 ++++++++++++
 lib/librte_ether/rte_ethdev.c           | 16 ++++++++++++----
 lib/librte_ether/rte_ethdev.h           |  6 +++---
 22 files changed, 122 insertions(+), 54 deletions(-)

Comments

Ferruh Yigit Dec. 8, 2016, 5:50 p.m. UTC | #1
Hi Shreyansh,

On 12/4/2016 10:11 AM, Shreyansh Jain wrote:
> rte_pci_driver probe/remove callback are replaced with the rte_driver
> based probe/remove. This patch changes all the PCI drivers which reference
> rte_pci_driver->probe/remove.
> 
> rte_pci_driver continues to have probe/remove callback which would be used
> once eth_driver is removed in later patches.
> 
> Only changes to PCI are done. VDEV changes require a different
> model because of arguments being passed to vdev->probe/remove.
> 
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
>  drivers/net/bnx2x/bnx2x_ethdev.c        | 12 ++++++++----
>  drivers/net/bnxt/bnxt_ethdev.c          |  6 ++++--
>  drivers/net/cxgbe/cxgbe_ethdev.c        |  6 ++++--
>  drivers/net/e1000/em_ethdev.c           |  6 ++++--
>  drivers/net/e1000/igb_ethdev.c          | 12 ++++++++----
>  drivers/net/ena/ena_ethdev.c            |  6 ++++--
>  drivers/net/enic/enic_ethdev.c          |  6 ++++--
>  drivers/net/fm10k/fm10k_ethdev.c        |  6 ++++--
>  drivers/net/i40e/i40e_ethdev.c          |  6 ++++--
>  drivers/net/i40e/i40e_ethdev_vf.c       |  6 ++++--
>  drivers/net/ixgbe/ixgbe_ethdev.c        | 12 ++++++++----
>  drivers/net/mlx4/mlx4.c                 |  6 ++++--

Generating compile error:
.../net/mlx4/mlx4.c:5913:13: error: subobject initialization overrides
initialization of other fields within its enclosing subobject
[-Werror,-Winitializer-overrides]
                .driver = {
                          ^
.../net/mlx4/mlx4.c:5909:13: note: previous initialization is here
                .driver = {
                          ^


>  drivers/net/mlx5/mlx5.c                 |  4 +++-

.../net/mlx5/mlx5.c:736:13: error: subobject initialization overrides
initialization of other fields within its enclosing subobject
[-Werror,-Winitializer-overrides]
                .driver = {
                          ^
.../net/mlx5/mlx5.c:732:13: note: previous initialization is here
                .driver = {
                          ^


>  drivers/net/nfp/nfp_net.c               |  6 ++++--
>  drivers/net/qede/qede_ethdev.c          | 16 ++++++++++------
>  drivers/net/szedata2/rte_eth_szedata2.c |  6 ++++--
>  drivers/net/virtio/virtio_ethdev.c      |  4 ++--
>  drivers/net/vmxnet3/vmxnet3_ethdev.c    |  6 ++++--

Following drivers seems missing:
drivers/net/thunderx/nicvf_ethdev.c

Also new added drivers/net/sfc/sfc_ethdev.c, but since sfc is not merged
to main branch yet, perhaps fix may wait your patches to be applied first.

>  lib/librte_eal/common/eal_common_pci.c  | 10 ++++++++--
>  lib/librte_eal/common/include/rte_dev.h | 12 ++++++++++++
>  lib/librte_ether/rte_ethdev.c           | 16 ++++++++++++----
>  lib/librte_ether/rte_ethdev.h           |  6 +++---
>  22 files changed, 122 insertions(+), 54 deletions(-)
> 

Also getting following with mlx5:

In file included from
.../x86_64-native-linuxapp-gcc/include/rte_mbuf.h:57:0,
                 from .../x86_64-native-linuxapp-gcc/include/rte_ether.h:52,
                 from .../drivers/net/mlx5/mlx5_trigger.c:38:
/usr/include/infiniband/verbs.h: In function ‘verbs_get_device’:
.../x86_64-native-linuxapp-gcc/include/rte_common.h:350:40: error:
initialization discards ‘const’ qualifier from pointer target type
[-Werror=discarded-qualifiers]
    typeof(((type *)0)->member) *_ptr = (ptr); \


<...>
Shreyansh Jain Dec. 9, 2016, 4:59 a.m. UTC | #2
Hello Ferruh,

As always, thanks for your checks.

> -----Original Message-----
> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> Sent: Thursday, December 08, 2016 11:21 PM
> To: Shreyansh Jain <shreyansh.jain@nxp.com>; dev@dpdk.org
> Cc: thomas.monjalon@6wind.com; david.marchand@6wind.com; Adrien Mazarguil
> <adrien.mazarguil@6wind.com>
> Subject: Re: [dpdk-dev] [PATCH 07/13] pci: replace probe and remove handlers
> with rte_driver
> 
> Hi Shreyansh,
> 
> On 12/4/2016 10:11 AM, Shreyansh Jain wrote:
> > rte_pci_driver probe/remove callback are replaced with the rte_driver
> > based probe/remove. This patch changes all the PCI drivers which reference
> > rte_pci_driver->probe/remove.
> >
> > rte_pci_driver continues to have probe/remove callback which would be used
> > once eth_driver is removed in later patches.
> >
> > Only changes to PCI are done. VDEV changes require a different
> > model because of arguments being passed to vdev->probe/remove.
> >
> > Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> > ---
> >  drivers/net/bnx2x/bnx2x_ethdev.c        | 12 ++++++++----
> >  drivers/net/bnxt/bnxt_ethdev.c          |  6 ++++--
> >  drivers/net/cxgbe/cxgbe_ethdev.c        |  6 ++++--
> >  drivers/net/e1000/em_ethdev.c           |  6 ++++--
> >  drivers/net/e1000/igb_ethdev.c          | 12 ++++++++----
> >  drivers/net/ena/ena_ethdev.c            |  6 ++++--
> >  drivers/net/enic/enic_ethdev.c          |  6 ++++--
> >  drivers/net/fm10k/fm10k_ethdev.c        |  6 ++++--
> >  drivers/net/i40e/i40e_ethdev.c          |  6 ++++--
> >  drivers/net/i40e/i40e_ethdev_vf.c       |  6 ++++--
> >  drivers/net/ixgbe/ixgbe_ethdev.c        | 12 ++++++++----
> >  drivers/net/mlx4/mlx4.c                 |  6 ++++--
> 
> Generating compile error:
> .../net/mlx4/mlx4.c:5913:13: error: subobject initialization overrides
> initialization of other fields within its enclosing subobject
> [-Werror,-Winitializer-overrides]
>                 .driver = {
>                           ^
> .../net/mlx4/mlx4.c:5909:13: note: previous initialization is here
>                 .driver = {
>                           ^
> 
> 
> >  drivers/net/mlx5/mlx5.c                 |  4 +++-
> 
> .../net/mlx5/mlx5.c:736:13: error: subobject initialization overrides
> initialization of other fields within its enclosing subobject
> [-Werror,-Winitializer-overrides]
>                 .driver = {
>                           ^
> .../net/mlx5/mlx5.c:732:13: note: previous initialization is here
>                 .driver = {
>                           ^
> 

Yes, David Marchand also highlighted this another comment. Somehow I messed up the MLX changes. And just like the last time, I forgot to change my environment configuration to enable it before sending the patches.
 

> 
> >  drivers/net/nfp/nfp_net.c               |  6 ++++--
> >  drivers/net/qede/qede_ethdev.c          | 16 ++++++++++------
> >  drivers/net/szedata2/rte_eth_szedata2.c |  6 ++++--
> >  drivers/net/virtio/virtio_ethdev.c      |  4 ++--
> >  drivers/net/vmxnet3/vmxnet3_ethdev.c    |  6 ++++--
> 
> Following drivers seems missing:
> drivers/net/thunderx/nicvf_ethdev.c

I will fix this as well in v2. 

> 
> Also new added drivers/net/sfc/sfc_ethdev.c, but since sfc is not merged
> to main branch yet, perhaps fix may wait your patches to be applied first.
> 
> >  lib/librte_eal/common/eal_common_pci.c  | 10 ++++++++--
> >  lib/librte_eal/common/include/rte_dev.h | 12 ++++++++++++
> >  lib/librte_ether/rte_ethdev.c           | 16 ++++++++++++----
> >  lib/librte_ether/rte_ethdev.h           |  6 +++---
> >  22 files changed, 122 insertions(+), 54 deletions(-)
> >
> 
> Also getting following with mlx5:
> 
> In file included from
> .../x86_64-native-linuxapp-gcc/include/rte_mbuf.h:57:0,
>                  from .../x86_64-native-linuxapp-gcc/include/rte_ether.h:52,
>                  from .../drivers/net/mlx5/mlx5_trigger.c:38:
> /usr/include/infiniband/verbs.h: In function 'verbs_get_device':
> .../x86_64-native-linuxapp-gcc/include/rte_common.h:350:40: error:
> initialization discards 'const' qualifier from pointer target type
> [-Werror=discarded-qualifiers]
>     typeof(((type *)0)->member) *_ptr = (ptr); \
> 
> 
> <...>

I will check MLX* again.
Thanks for your inputs.

-
Shreyansh
diff mbox

Patch

diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 0eae433..6b5f906 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -620,8 +620,10 @@  static struct eth_driver rte_bnx2x_pmd = {
 	.pci_drv = {
 		.id_table = pci_id_bnx2x_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = eth_bnx2x_dev_init,
 	.dev_private_size = sizeof(struct bnx2x_softc),
@@ -634,8 +636,10 @@  static struct eth_driver rte_bnx2xvf_pmd = {
 	.pci_drv = {
 		.id_table = pci_id_bnx2xvf_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = eth_bnx2xvf_dev_init,
 	.dev_private_size = sizeof(struct bnx2x_softc),
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 035fe07..70dccf6 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1163,8 +1163,10 @@  static struct eth_driver bnxt_rte_pmd = {
 		    .id_table = bnxt_pci_id_map,
 		    .drv_flags = RTE_PCI_DRV_NEED_MAPPING |
 			    RTE_PCI_DRV_DETACHABLE | RTE_PCI_DRV_INTR_LSC,
-		    .probe = rte_eth_dev_pci_probe,
-		    .remove = rte_eth_dev_pci_remove
+			.driver = {
+			    .probe = rte_eth_dev_pci_probe,
+			    .remove = rte_eth_dev_pci_remove
+			},
 		    },
 	.eth_dev_init = bnxt_dev_init,
 	.eth_dev_uninit = bnxt_dev_uninit,
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index b7f28eb..334e462 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1041,8 +1041,10 @@  static struct eth_driver rte_cxgbe_pmd = {
 	.pci_drv = {
 		.id_table = cxgb4_pci_tbl,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = eth_cxgbe_dev_init,
 	.dev_private_size = sizeof(struct port_info),
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index aee3d34..34c4b31 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -394,8 +394,10 @@  static struct eth_driver rte_em_pmd = {
 		.id_table = pci_id_em_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
 			RTE_PCI_DRV_DETACHABLE,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = eth_em_dev_init,
 	.eth_dev_uninit = eth_em_dev_uninit,
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 2fddf0c..ae75b7e 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1081,8 +1081,10 @@  static struct eth_driver rte_igb_pmd = {
 		.id_table = pci_id_igb_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
 			RTE_PCI_DRV_DETACHABLE,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = eth_igb_dev_init,
 	.eth_dev_uninit = eth_igb_dev_uninit,
@@ -1096,8 +1098,10 @@  static struct eth_driver rte_igbvf_pmd = {
 	.pci_drv = {
 		.id_table = pci_id_igbvf_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = eth_igbvf_dev_init,
 	.eth_dev_uninit = eth_igbvf_dev_uninit,
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index ab9a178..8825585 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1707,8 +1707,10 @@  static struct eth_driver rte_ena_pmd = {
 	.pci_drv = {
 		.id_table = pci_id_ena_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = eth_ena_dev_init,
 	.dev_private_size = sizeof(struct ena_adapter),
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 2b154ec..1ed951f 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -636,8 +636,10 @@  static struct eth_driver rte_enic_pmd = {
 	.pci_drv = {
 		.id_table = pci_id_enic_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = eth_enicpmd_dev_init,
 	.dev_private_size = sizeof(struct enic),
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 923690c..53a8e33 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3064,8 +3064,10 @@  static struct eth_driver rte_pmd_fm10k = {
 		.id_table = pci_id_fm10k_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
 			RTE_PCI_DRV_DETACHABLE,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = eth_fm10k_dev_init,
 	.eth_dev_uninit = eth_fm10k_dev_uninit,
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 67778ba..7c08095 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -673,8 +673,10 @@  static struct eth_driver rte_i40e_pmd = {
 		.id_table = pci_id_i40e_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
 			RTE_PCI_DRV_DETACHABLE,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = eth_i40e_dev_init,
 	.eth_dev_uninit = eth_i40e_dev_uninit,
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index aa306d6..cbff0da 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1529,8 +1529,10 @@  static struct eth_driver rte_i40evf_pmd = {
 	.pci_drv = {
 		.id_table = pci_id_i40evf_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = i40evf_dev_init,
 	.eth_dev_uninit = i40evf_dev_uninit,
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index edc9b22..4b99ca1 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1567,8 +1567,10 @@  static struct eth_driver rte_ixgbe_pmd = {
 		.id_table = pci_id_ixgbe_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
 			RTE_PCI_DRV_DETACHABLE,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = eth_ixgbe_dev_init,
 	.eth_dev_uninit = eth_ixgbe_dev_uninit,
@@ -1582,8 +1584,10 @@  static struct eth_driver rte_ixgbevf_pmd = {
 	.pci_drv = {
 		.id_table = pci_id_ixgbevf_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = eth_ixgbevf_dev_init,
 	.eth_dev_uninit = eth_ixgbevf_dev_uninit,
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index da61a85..b3f72d9 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5910,8 +5910,10 @@  static struct eth_driver mlx4_driver = {
 			.name = MLX4_DRIVER_NAME
 		},
 		.id_table = mlx4_pci_id_map,
-		.probe = mlx4_pci_probe,
-		.drv_flags = RTE_PCI_DRV_INTR_LSC,
+		.driver = {
+			.probe = mlx4_pci_probe,
+			.drv_flags = RTE_PCI_DRV_INTR_LSC,
+		},
 	},
 	.dev_private_size = sizeof(struct priv)
 };
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 90cc35e..fa34724 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -733,7 +733,9 @@  static struct eth_driver mlx5_driver = {
 			.name = MLX5_DRIVER_NAME
 		},
 		.id_table = mlx5_pci_id_map,
-		.probe = mlx5_pci_probe,
+		.driver = {
+			.probe = mlx5_pci_probe,
+		},
 		.drv_flags = RTE_PCI_DRV_INTR_LSC,
 	},
 	.dev_private_size = sizeof(struct priv)
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index c6b1587..ffcc1b5 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2472,8 +2472,10 @@  static struct eth_driver rte_nfp_net_pmd = {
 		.id_table = pci_id_nfp_net_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
 			     RTE_PCI_DRV_DETACHABLE,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = nfp_net_init,
 	.dev_private_size = sizeof(struct nfp_net_adapter),
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index d106dd0..b8ad392 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1645,9 +1645,11 @@  static struct eth_driver rte_qedevf_pmd = {
 		    .id_table = pci_id_qedevf_map,
 		    .drv_flags =
 		    RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
-		    .probe = rte_eth_dev_pci_probe,
-		    .remove = rte_eth_dev_pci_remove,
-		   },
+		    .driver = {
+				.probe = rte_eth_dev_pci_probe,
+				.remove = rte_eth_dev_pci_remove,
+			},
+		},
 	.eth_dev_init = qedevf_eth_dev_init,
 	.eth_dev_uninit = qedevf_eth_dev_uninit,
 	.dev_private_size = sizeof(struct qede_dev),
@@ -1658,9 +1660,11 @@  static struct eth_driver rte_qede_pmd = {
 		    .id_table = pci_id_qede_map,
 		    .drv_flags =
 		    RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
-		    .probe = rte_eth_dev_pci_probe,
-		    .remove = rte_eth_dev_pci_remove,
-		   },
+		    .driver = {
+			    .probe = rte_eth_dev_pci_probe,
+			    .remove = rte_eth_dev_pci_remove,
+			},
+		},
 	.eth_dev_init = qede_eth_dev_init,
 	.eth_dev_uninit = qede_eth_dev_uninit,
 	.dev_private_size = sizeof(struct qede_dev),
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index f3cd52d..d08da9d 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1573,8 +1573,10 @@  static const struct rte_pci_id rte_szedata2_pci_id_table[] = {
 static struct eth_driver szedata2_eth_driver = {
 	.pci_drv = {
 		.id_table = rte_szedata2_pci_id_table,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init     = rte_szedata2_eth_dev_init,
 	.eth_dev_uninit   = rte_szedata2_eth_dev_uninit,
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 079fd6c..b7bec8f 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1377,11 +1377,11 @@  static struct eth_driver rte_virtio_pmd = {
 	.pci_drv = {
 		.driver = {
 			.name = "net_virtio",
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
 		},
 		.id_table = pci_id_virtio_map,
 		.drv_flags = RTE_PCI_DRV_DETACHABLE,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
 	},
 	.eth_dev_init = eth_virtio_dev_init,
 	.eth_dev_uninit = eth_virtio_dev_uninit,
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 8bb13e5..52993de 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -337,8 +337,10 @@  static struct eth_driver rte_vmxnet3_pmd = {
 	.pci_drv = {
 		.id_table = pci_id_vmxnet3_map,
 		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
+		.driver = {
+			.probe = rte_eth_dev_pci_probe,
+			.remove = rte_eth_dev_pci_remove,
+		},
 	},
 	.eth_dev_init = eth_vmxnet3_dev_init,
 	.eth_dev_uninit = eth_vmxnet3_dev_uninit,
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 6bff675..3082b1a 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -161,6 +161,8 @@  rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
 {
 	int ret;
 	const struct rte_pci_id *id_table;
+	struct rte_driver *driver;
+	struct rte_device *device;
 
 	for (id_table = dr->id_table; id_table->vendor_id != 0; id_table++) {
 
@@ -212,9 +214,11 @@  rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
 
 		/* reference driver structure */
 		dev->driver = dr;
+		driver = &dr->driver;
+		device = &dev->device;
 
 		/* call the driver probe() function */
-		ret = dr->probe(dr, dev);
+		ret = driver->probe(driver, device);
 		if (ret)
 			dev->driver = NULL;
 
@@ -232,6 +236,7 @@  static int
 rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
 		struct rte_pci_device *dev)
 {
+	struct rte_driver *driver = NULL;
 	const struct rte_pci_id *id_table;
 
 	if ((dr == NULL) || (dev == NULL))
@@ -262,7 +267,8 @@  rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
 		RTE_LOG(DEBUG, EAL, "  remove driver: %x:%x %s\n", dev->id.vendor_id,
 				dev->id.device_id, dr->driver.name);
 
-		if (dr->remove && (dr->remove(dev) < 0))
+		driver = &(dr->driver);
+		if (driver->remove && (driver->remove(&(dev->device)) < 0))
 			return -1;	/* negative value is an error */
 
 		/* clear driver structure */
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 4004f9a..7d2ab16 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -145,6 +145,16 @@  void rte_eal_device_insert(struct rte_device *dev);
 void rte_eal_device_remove(struct rte_device *dev);
 
 /**
+ * Initialisation function for the driver called during probing.
+ */
+typedef int (driver_probe_t)(struct rte_driver *, struct rte_device *);
+
+/**
+ * Uninitialisation function for the driver called during hotplugging.
+ */
+typedef int (driver_remove_t)(struct rte_device *);
+
+/**
  * A structure describing a device driver.
  */
 struct rte_driver {
@@ -152,6 +162,8 @@  struct rte_driver {
 	struct rte_bus *bus;           /**< Bus serviced by this driver */
 	const char *name;                   /**< Driver name. */
 	const char *alias;              /**< Driver alias. */
+	driver_probe_t *probe;         /**< Probe the device */
+	driver_remove_t *remove;       /**< Remove/hotplugging the device */
 };
 
 /**
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index fde8112..164d348 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -232,15 +232,20 @@  rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
 }
 
 int
-rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
-		      struct rte_pci_device *pci_dev)
+rte_eth_dev_pci_probe(struct rte_driver *drv,
+		      struct rte_device *dev)
 {
 	struct eth_driver    *eth_drv;
 	struct rte_eth_dev *eth_dev;
+	struct rte_pci_driver *pci_drv;
+	struct rte_pci_device *pci_dev;
 	char ethdev_name[RTE_ETH_NAME_MAX_LEN];
 
 	int diag;
 
+	pci_drv = container_of(drv, struct rte_pci_driver, driver);
+	pci_dev = container_of(dev, struct rte_pci_device, device);
+
 	eth_drv = (struct eth_driver *)pci_drv;
 
 	rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
@@ -285,16 +290,19 @@  rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
 }
 
 int
-rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
+rte_eth_dev_pci_remove(struct rte_device *dev)
 {
 	const struct eth_driver *eth_drv;
 	struct rte_eth_dev *eth_dev;
+	struct rte_pci_device *pci_dev;
 	char ethdev_name[RTE_ETH_NAME_MAX_LEN];
 	int ret;
 
-	if (pci_dev == NULL)
+	if (dev == NULL)
 		return -EINVAL;
 
+	pci_dev = container_of(dev, struct rte_pci_device, device);
+
 	rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
 			sizeof(ethdev_name));
 
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 9678179..3c45a1f 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4369,15 +4369,15 @@  rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
  * Wrapper for use by pci drivers as a .probe function to attach to a ethdev
  * interface.
  */
-int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
-			  struct rte_pci_device *pci_dev);
+int rte_eth_dev_pci_probe(struct rte_driver *drv,
+			  struct rte_device *dev);
 
 /**
  * @internal
  * Wrapper for use by pci drivers as a .remove function to detach a ethdev
  * interface.
  */
-int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+int rte_eth_dev_pci_remove(struct rte_device *dev);
 
 #ifdef __cplusplus
 }