From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wj0-f196.google.com (mail-wj0-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 11CE05398 for ; Tue, 10 Jan 2017 17:11:16 +0100 (CET) Received: by mail-wj0-f196.google.com with SMTP id kp2so88004608wjc.0 for ; Tue, 10 Jan 2017 08:11:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=VeM9MzwJ/vygTUYHhuEgYd0Y8V4ELyRbC/ZqTdxkE04=; b=HjUH372Q4bj/WAiI+1v6F3qpGEoWvMW1ygKao6mPF50oN242n8hJBvdNCNpg3vT5XU t3d36lLqkAtrrk75zrsMVNPPC0BQp4Alkn//b6plraSI+UdAyBAnz4MWy6J7e2xJuP/O 062oh0Y0mPtP9dOw1yQeVP5JqaC4GGjobf36juyYMZXb8oxSlyoJLhMv5cwNUc6ii3ym e07ahBUNE+Y93m3G5TyJ54dKIk0Jy1fm9gj4ASR3DpO1iFYPUkbsKJuT/XaZ4RFLyGH0 +NfKHqLoJETb7xNnQtK9G8XIxL2lBzZZo0r9EoprK7ltl5Z0ckFWqg6OgJEPY3XiEN1s RfBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=VeM9MzwJ/vygTUYHhuEgYd0Y8V4ELyRbC/ZqTdxkE04=; b=QNds8fu/MohUtBLChM5Kw1FC7b6EK+9xZFbk6uNKb1zRkQYM2vBCsd/SVnsRY9NQEZ QrFU34XFJja/y3RgoZXdmnMvbVYQ+SbMneQ9AJhtQJ49rBtj28dMpgv0/uiiV5vfMJr8 /iOGRcZjM3RtlVw1NlzkwuUVo89cpb0fP3qElplQb01y3th+Qnsxq91GHAijAI0RvFsR sPMO9i9QvTD2OwuGz1thZjnSEjO46/TUqSBIRwvNOgxk/8FJnk3u2MLJ/4US9IwEn95W CFBbyWn+mZhNRORlasQS8WmFG4gdmhL6z7Z9Ee/BCYEb9URou3pahuXFOpAflhtLDC2b D9Cg== X-Gm-Message-State: AIkVDXLulSeg1rM159N3jM6Pm7ef9Psdyc5yf8cI7dnGBs9FMNMgcbnJq1PBT8X8F01+me6Ncc0YyP2oZSY5fA== X-Received: by 10.195.30.165 with SMTP id kf5mr2216612wjd.41.1484064675991; Tue, 10 Jan 2017 08:11:15 -0800 (PST) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.63.83 with HTTP; Tue, 10 Jan 2017 08:11:15 -0800 (PST) In-Reply-To: <20170107181756.1944-8-sthemmin@microsoft.com> References: <20170107181756.1944-1-sthemmin@microsoft.com> <20170107181756.1944-8-sthemmin@microsoft.com> From: Jan Blunck Date: Tue, 10 Jan 2017 17:11:15 +0100 X-Google-Sender-Auth: 3cwGDorZXqnhNo8eArpv71G6FMI Message-ID: To: Stephen Hemminger Cc: dev@dpdk.org, Stephen Hemminger Content-Type: text/plain; charset=UTF-8 Subject: Re: [dpdk-dev] [PATCH 7/8] ethdev: break ethernet driver and pci_driver connection X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2017 16:11:17 -0000 On Sat, Jan 7, 2017 at 7:17 PM, Stephen Hemminger wrote: > There are multiple buses and device types now. Therefore it no longer > makes sense that PCI driver information is part of the Ethernet driver > structure. The Ethernet driver itself doesn't over alot of value from an abstraction point of view. Its questionable if there ever will be an Ethernet driver that is able to operate on different types of low-level devices. The virtual devices are anyway able to operate without an Ethernet driver structure. Most of that functionality should get moved either into the bus abstraction or the low-level device probe function. > > This patch removes pci_driver from eth_driver and introduces a > new combined structure for use in all existing PMD's. The rationale > is that although all existing PCI drivers are Ethernet drivers, > it make sense that future projects may want to support PCI devices > that are not Ethernet. > > It also removes the requirement that driver is first element in > PCI driver structure. > > Signed-off-by: Stephen Hemminger > --- > app/test/virtual_pmd.c | 22 ++++++++--------- > drivers/net/bnx2x/bnx2x_ethdev.c | 16 ++++++++----- > drivers/net/bnxt/bnxt_ethdev.c | 22 +++++++++-------- > drivers/net/cxgbe/cxgbe_ethdev.c | 8 ++++--- > drivers/net/e1000/em_ethdev.c | 10 ++++---- > drivers/net/e1000/igb_ethdev.c | 20 +++++++++------- > drivers/net/ena/ena_ethdev.c | 8 ++++--- > drivers/net/enic/enic_ethdev.c | 8 ++++--- > drivers/net/fm10k/fm10k_ethdev.c | 10 ++++---- > drivers/net/i40e/i40e_ethdev.c | 10 ++++---- > drivers/net/i40e/i40e_ethdev_vf.c | 10 ++++---- > drivers/net/ixgbe/ixgbe_ethdev.c | 20 +++++++++------- > drivers/net/mlx4/mlx4.c | 8 ++++--- > drivers/net/mlx5/mlx5.c | 8 ++++--- > drivers/net/nfp/nfp_net.c | 8 ++++--- > drivers/net/qede/qede_ethdev.c | 42 +++++++++++++++++---------------- > drivers/net/szedata2/rte_eth_szedata2.c | 10 ++++---- > drivers/net/thunderx/nicvf_ethdev.c | 8 ++++--- > drivers/net/virtio/virtio_ethdev.c | 10 ++++---- > drivers/net/vmxnet3/vmxnet3_ethdev.c | 10 ++++---- > lib/librte_ether/rte_ethdev.c | 9 +++---- > lib/librte_ether/rte_ethdev.h | 18 +++++++++----- > 22 files changed, 172 insertions(+), 123 deletions(-) > > diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c > index 6e4dcd8f..e7f56527 100644 > --- a/app/test/virtual_pmd.c > +++ b/app/test/virtual_pmd.c > @@ -533,7 +533,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, > struct rte_pci_device *pci_dev = NULL; > struct rte_eth_dev *eth_dev = NULL; > struct eth_driver *eth_drv = NULL; > - struct rte_pci_driver *pci_drv = NULL; > + struct rte_pci_eth_driver *pci_eth_drv = NULL; > struct rte_pci_id *id_table = NULL; > struct virtual_ethdev_private *dev_private = NULL; > char name_buf[RTE_RING_NAMESIZE]; > @@ -554,8 +554,8 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, > if (eth_drv == NULL) > goto err; > > - pci_drv = rte_zmalloc_socket(name, sizeof(*pci_drv), 0, socket_id); > - if (pci_drv == NULL) > + pci_eth_drv = rte_zmalloc_socket(name, sizeof(*pci_eth_drv), 0, socket_id); > + if (pci_eth_drv == NULL) > goto err; > > id_table = rte_zmalloc_socket(name, sizeof(*id_table), 0, socket_id); > @@ -585,17 +585,15 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, > goto err; > > pci_dev->device.numa_node = socket_id; > - pci_drv->driver.name = virtual_ethdev_driver_name; > - pci_drv->id_table = id_table; > + pci_eth_drv->pci_drv.driver.name = virtual_ethdev_driver_name; > + pci_eth_drv->pci_drv.id_table = id_table; > > if (isr_support) > - pci_drv->drv_flags |= RTE_PCI_DRV_INTR_LSC; > + pci_eth_drv->pci_drv.drv_flags |= RTE_PCI_DRV_INTR_LSC; > else > - pci_drv->drv_flags &= ~RTE_PCI_DRV_INTR_LSC; > + pci_eth_drv->pci_drv.drv_flags &= ~RTE_PCI_DRV_INTR_LSC; > > - > - eth_drv->pci_drv = (struct rte_pci_driver)(*pci_drv); > - eth_dev->driver = eth_drv; > + eth_dev->driver = &pci_eth_drv->eth_drv; > > eth_dev->data->nb_rx_queues = (uint16_t)1; > eth_dev->data->nb_tx_queues = (uint16_t)1; > @@ -622,7 +620,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, > dev_private->dev_ops = virtual_ethdev_default_dev_ops; > eth_dev->dev_ops = &dev_private->dev_ops; > > - pci_dev->device.driver = ð_drv->pci_drv.driver; > + pci_dev->device.driver = &pci_eth_drv->pci_drv.driver; > eth_dev->device = &pci_dev->device; > > eth_dev->rx_pkt_burst = virtual_ethdev_rx_burst_success; > @@ -632,7 +630,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, > > err: > rte_free(pci_dev); > - rte_free(pci_drv); > + rte_free(pci_eth_drv); > rte_free(eth_drv); > rte_free(id_table); > rte_free(dev_private); > diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c > index 7140118f..ef704d72 100644 > --- a/drivers/net/bnx2x/bnx2x_ethdev.c > +++ b/drivers/net/bnx2x/bnx2x_ethdev.c > @@ -618,29 +618,33 @@ eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev) > return bnx2x_common_dev_init(eth_dev, 1); > } > > -static struct eth_driver rte_bnx2x_pmd = { > +static struct rte_pci_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, > }, > - .eth_dev_init = eth_bnx2x_dev_init, > - .dev_private_size = sizeof(struct bnx2x_softc), > + eth_drv = { > + .eth_dev_init = eth_bnx2x_dev_init, > + .dev_private_size = sizeof(struct bnx2x_softc), > + }, > }; > > /* > * virtual function driver struct > */ > -static struct eth_driver rte_bnx2xvf_pmd = { > +static struct rte_pci_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, > }, > - .eth_dev_init = eth_bnx2xvf_dev_init, > - .dev_private_size = sizeof(struct bnx2x_softc), > + eth_drv = { > + .eth_dev_init = eth_bnx2xvf_dev_init, > + .dev_private_size = sizeof(struct bnx2x_softc), > + }, > }; > > RTE_PMD_REGISTER_PCI(net_bnx2x, rte_bnx2x_pmd.pci_drv); > diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c > index 7518b6b7..9017825b 100644 > --- a/drivers/net/bnxt/bnxt_ethdev.c > +++ b/drivers/net/bnxt/bnxt_ethdev.c > @@ -1164,17 +1164,19 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) { > return rc; > } > > -static struct eth_driver bnxt_rte_pmd = { > +static struct rte_pci_eth_driver bnxt_rte_pmd = { > .pci_drv = { > - .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 > - }, > - .eth_dev_init = bnxt_dev_init, > - .eth_dev_uninit = bnxt_dev_uninit, > - .dev_private_size = sizeof(struct bnxt), > + .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 > + }, > + .eth_drv = { > + .eth_dev_init = bnxt_dev_init, > + .eth_dev_uninit = bnxt_dev_uninit, > + .dev_private_size = sizeof(struct bnxt), > + }, > }; > > RTE_PMD_REGISTER_PCI(net_bnxt, bnxt_rte_pmd.pci_drv); > diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c > index 64345e37..ccf93904 100644 > --- a/drivers/net/cxgbe/cxgbe_ethdev.c > +++ b/drivers/net/cxgbe/cxgbe_ethdev.c > @@ -1039,15 +1039,17 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev) > return err; > } > > -static struct eth_driver rte_cxgbe_pmd = { > +static struct rte_pci_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, > }, > - .eth_dev_init = eth_cxgbe_dev_init, > - .dev_private_size = sizeof(struct port_info), > + .eth_drv = { > + .eth_dev_init = eth_cxgbe_dev_init, > + .dev_private_size = sizeof(struct port_info), > + }, > }; > > RTE_PMD_REGISTER_PCI(net_cxgbe, rte_cxgbe_pmd.pci_drv); > diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c > index 5f6e66dd..5b87d729 100644 > --- a/drivers/net/e1000/em_ethdev.c > +++ b/drivers/net/e1000/em_ethdev.c > @@ -389,7 +389,7 @@ eth_em_dev_uninit(struct rte_eth_dev *eth_dev) > return 0; > } > > -static struct eth_driver rte_em_pmd = { > +static struct rte_pci_eth_driver rte_em_pmd = { > .pci_drv = { > .id_table = pci_id_em_map, > .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | > @@ -397,9 +397,11 @@ static struct eth_driver rte_em_pmd = { > .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, > - .dev_private_size = sizeof(struct e1000_adapter), > + .eth_drv = { > + .eth_dev_init = eth_em_dev_init, > + .eth_dev_uninit = eth_em_dev_uninit, > + .dev_private_size = sizeof(struct e1000_adapter), > + }, > }; > > static int > diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c > index 2bb57f54..4a2d3b3f 100644 > --- a/drivers/net/e1000/igb_ethdev.c > +++ b/drivers/net/e1000/igb_ethdev.c > @@ -1082,7 +1082,7 @@ eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev) > return 0; > } > > -static struct eth_driver rte_igb_pmd = { > +static struct rte_pci_eth_driver rte_igb_pmd = { > .pci_drv = { > .id_table = pci_id_igb_map, > .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | > @@ -1090,24 +1090,28 @@ static struct eth_driver rte_igb_pmd = { > .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, > - .dev_private_size = sizeof(struct e1000_adapter), > + .eth_drv = { > + .eth_dev_init = eth_igb_dev_init, > + .eth_dev_uninit = eth_igb_dev_uninit, > + .dev_private_size = sizeof(struct e1000_adapter), > + }, > }; > > /* > * virtual function driver struct > */ > -static struct eth_driver rte_igbvf_pmd = { > +static struct rte_pci_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, > }, > - .eth_dev_init = eth_igbvf_dev_init, > - .eth_dev_uninit = eth_igbvf_dev_uninit, > - .dev_private_size = sizeof(struct e1000_adapter), > + .eth_drv = { > + .eth_dev_init = eth_igbvf_dev_init, > + .eth_dev_uninit = eth_igbvf_dev_uninit, > + .dev_private_size = sizeof(struct e1000_adapter), > + }, > }; > > static void > diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c > index e99bf299..d6406fa1 100644 > --- a/drivers/net/ena/ena_ethdev.c > +++ b/drivers/net/ena/ena_ethdev.c > @@ -1756,15 +1756,17 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, > return sent_idx; > } > > -static struct eth_driver rte_ena_pmd = { > +static struct rte_pci_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, > }, > - .eth_dev_init = eth_ena_dev_init, > - .dev_private_size = sizeof(struct ena_adapter), > + .eth_drv = { > + .eth_dev_init = eth_ena_dev_init, > + .dev_private_size = sizeof(struct ena_adapter), > + }, > }; > > RTE_PMD_REGISTER_PCI(net_ena, rte_ena_pmd.pci_drv); > diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c > index e5ceb98e..b47975d1 100644 > --- a/drivers/net/enic/enic_ethdev.c > +++ b/drivers/net/enic/enic_ethdev.c > @@ -633,15 +633,17 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev) > return enic_probe(enic); > } > > -static struct eth_driver rte_enic_pmd = { > +static struct rte_pci_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, > }, > - .eth_dev_init = eth_enicpmd_dev_init, > - .dev_private_size = sizeof(struct enic), > + .eth_drv = { > + .eth_dev_init = eth_enicpmd_dev_init, > + .dev_private_size = sizeof(struct enic), > + }, > }; > > RTE_PMD_REGISTER_PCI(net_enic, rte_enic_pmd.pci_drv); > diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c > index d8353e9d..4dea1fd6 100644 > --- a/drivers/net/fm10k/fm10k_ethdev.c > +++ b/drivers/net/fm10k/fm10k_ethdev.c > @@ -3077,7 +3077,7 @@ static const struct rte_pci_id pci_id_fm10k_map[] = { > { .vendor_id = 0, /* sentinel */ }, > }; > > -static struct eth_driver rte_pmd_fm10k = { > +static struct rte_pci_eth_driver rte_pmd_fm10k = { > .pci_drv = { > .id_table = pci_id_fm10k_map, > .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | > @@ -3085,9 +3085,11 @@ static struct eth_driver rte_pmd_fm10k = { > .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, > - .dev_private_size = sizeof(struct fm10k_adapter), > + .eth_drv = { > + .eth_dev_init = eth_fm10k_dev_init, > + .eth_dev_uninit = eth_fm10k_dev_uninit, > + .dev_private_size = sizeof(struct fm10k_adapter), > + }, > }; > > RTE_PMD_REGISTER_PCI(net_fm10k, rte_pmd_fm10k.pci_drv); > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c > index 0eb4c990..8b4c6079 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -668,7 +668,7 @@ static const struct rte_i40e_xstats_name_off rte_i40e_txq_prio_strings[] = { > #define I40E_NB_TXQ_PRIO_XSTATS (sizeof(rte_i40e_txq_prio_strings) / \ > sizeof(rte_i40e_txq_prio_strings[0])) > > -static struct eth_driver rte_i40e_pmd = { > +static struct rte_pci_eth_driver rte_i40e_pmd = { > .pci_drv = { > .id_table = pci_id_i40e_map, > .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | > @@ -676,9 +676,11 @@ static struct eth_driver rte_i40e_pmd = { > .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, > - .dev_private_size = sizeof(struct i40e_adapter), > + .eth_drv = { > + .eth_dev_init = eth_i40e_dev_init, > + .eth_dev_uninit = eth_i40e_dev_uninit, > + .dev_private_size = sizeof(struct i40e_adapter), > + }, > }; > > static inline int > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c > index 0dc0af52..6dbcc88c 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -1526,16 +1526,18 @@ i40evf_dev_uninit(struct rte_eth_dev *eth_dev) > /* > * virtual function driver struct > */ > -static struct eth_driver rte_i40evf_pmd = { > +static struct rte_pci_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, > }, > - .eth_dev_init = i40evf_dev_init, > - .eth_dev_uninit = i40evf_dev_uninit, > - .dev_private_size = sizeof(struct i40e_adapter), > + .eth_drv = { > + .eth_dev_init = i40evf_dev_init, > + .eth_dev_uninit = i40evf_dev_uninit, > + .dev_private_size = sizeof(struct i40e_adapter), > + }, > }; > > RTE_PMD_REGISTER_PCI(net_i40e_vf, rte_i40evf_pmd.pci_drv); > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c > index 060772d4..6fdf227e 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -1563,7 +1563,7 @@ eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev) > return 0; > } > > -static struct eth_driver rte_ixgbe_pmd = { > +static struct rte_pci_eth_driver rte_ixgbe_pmd = { > .pci_drv = { > .id_table = pci_id_ixgbe_map, > .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | > @@ -1571,24 +1571,28 @@ static struct eth_driver rte_ixgbe_pmd = { > .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, > - .dev_private_size = sizeof(struct ixgbe_adapter), > + .eth_drv = { > + .eth_dev_init = eth_ixgbe_dev_init, > + .eth_dev_uninit = eth_ixgbe_dev_uninit, > + .dev_private_size = sizeof(struct ixgbe_adapter), > + }, > }; > > /* > * virtual function driver struct > */ > -static struct eth_driver rte_ixgbevf_pmd = { > +static struct rte_pci_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, > }, > - .eth_dev_init = eth_ixgbevf_dev_init, > - .eth_dev_uninit = eth_ixgbevf_dev_uninit, > - .dev_private_size = sizeof(struct ixgbe_adapter), > + .eth_drv = { > + .eth_dev_init = eth_ixgbevf_dev_init, > + .eth_dev_uninit = eth_ixgbevf_dev_uninit, > + .dev_private_size = sizeof(struct ixgbe_adapter), > + }, > }; > > static int > diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c > index eb06f56a..7b184019 100644 > --- a/drivers/net/mlx4/mlx4.c > +++ b/drivers/net/mlx4/mlx4.c > @@ -5524,7 +5524,7 @@ priv_dev_interrupt_handler_install(struct priv *priv, struct rte_eth_dev *dev) > } > } > > -static struct eth_driver mlx4_driver; > +static struct rte_pci_eth_driver mlx4_driver; > > /** > * DPDK callback to register a PCI device. > @@ -5903,7 +5903,7 @@ static const struct rte_pci_id mlx4_pci_id_map[] = { > } > }; > > -static struct eth_driver mlx4_driver = { > +static struct rte_pci_eth_driver mlx4_driver = { > .pci_drv = { > .driver = { > .name = MLX4_DRIVER_NAME > @@ -5912,7 +5912,9 @@ static struct eth_driver mlx4_driver = { > .probe = mlx4_pci_probe, > .drv_flags = RTE_PCI_DRV_INTR_LSC, > }, > - .dev_private_size = sizeof(struct priv) > + .eth_drv = { > + .dev_private_size = sizeof(struct priv), > + }, > }; > > /** > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index b97b6d16..efc0430c 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -338,7 +338,7 @@ mlx5_args(struct priv *priv, struct rte_devargs *devargs) > return 0; > } > > -static struct eth_driver mlx5_driver; > +static struct rte_pci_eth_driver mlx5_driver; > > /** > * DPDK callback to register a PCI device. > @@ -723,7 +723,7 @@ static const struct rte_pci_id mlx5_pci_id_map[] = { > } > }; > > -static struct eth_driver mlx5_driver = { > +static struct rte_pci_eth_driver mlx5_driver = { > .pci_drv = { > .driver = { > .name = MLX5_DRIVER_NAME > @@ -732,7 +732,9 @@ static struct eth_driver mlx5_driver = { > .probe = mlx5_pci_probe, > .drv_flags = RTE_PCI_DRV_INTR_LSC, > }, > - .dev_private_size = sizeof(struct priv) > + .eth_drv = { > + .dev_private_size = sizeof(struct priv), > + }, > }; > > /** > diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c > index 970b5c84..f5c6634f 100644 > --- a/drivers/net/nfp/nfp_net.c > +++ b/drivers/net/nfp/nfp_net.c > @@ -2470,7 +2470,7 @@ static struct rte_pci_id pci_id_nfp_net_map[] = { > }, > }; > > -static struct eth_driver rte_nfp_net_pmd = { > +static struct rte_pci_eth_driver rte_nfp_net_pmd = { > .pci_drv = { > .id_table = pci_id_nfp_net_map, > .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | > @@ -2478,8 +2478,10 @@ static struct eth_driver rte_nfp_net_pmd = { > .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), > + .eth_drv = { > + .eth_dev_init = nfp_net_init, > + .dev_private_size = sizeof(struct nfp_net_adapter), > + }, > }; > > RTE_PMD_REGISTER_PCI(net_nfp, rte_nfp_net_pmd.pci_drv); > diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c > index edc5b43b..13d76a6d 100644 > --- a/drivers/net/qede/qede_ethdev.c > +++ b/drivers/net/qede/qede_ethdev.c > @@ -1643,30 +1643,32 @@ static struct rte_pci_id pci_id_qede_map[] = { > {.vendor_id = 0,} > }; > > -static struct eth_driver rte_qedevf_pmd = { > +static struct rte_pci_eth_driver rte_qedevf_pmd = { > .pci_drv = { > - .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, > - }, > - .eth_dev_init = qedevf_eth_dev_init, > - .eth_dev_uninit = qedevf_eth_dev_uninit, > - .dev_private_size = sizeof(struct qede_dev), > + .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, > + }, > + .eth_drv = { > + .eth_dev_init = qedevf_eth_dev_init, > + .eth_dev_uninit = qedevf_eth_dev_uninit, > + .dev_private_size = sizeof(struct qede_dev), > + }, > }; > > -static struct eth_driver rte_qede_pmd = { > +static struct rte_pci_eth_driver rte_qede_pmd = { > .pci_drv = { > - .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, > - }, > - .eth_dev_init = qede_eth_dev_init, > - .eth_dev_uninit = qede_eth_dev_uninit, > - .dev_private_size = sizeof(struct qede_dev), > + .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, > + }, > + .eth_drv = { > + .eth_dev_init = qede_eth_dev_init, > + .eth_dev_uninit = qede_eth_dev_uninit, > + .dev_private_size = sizeof(struct qede_dev), > + }, > }; > > RTE_PMD_REGISTER_PCI(net_qede, rte_qede_pmd.pci_drv); > diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c > index fe7a6b3b..b9054671 100644 > --- a/drivers/net/szedata2/rte_eth_szedata2.c > +++ b/drivers/net/szedata2/rte_eth_szedata2.c > @@ -1587,15 +1587,17 @@ static const struct rte_pci_id rte_szedata2_pci_id_table[] = { > } > }; > > -static struct eth_driver szedata2_eth_driver = { > +static struct rte_pci_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, > }, > - .eth_dev_init = rte_szedata2_eth_dev_init, > - .eth_dev_uninit = rte_szedata2_eth_dev_uninit, > - .dev_private_size = sizeof(struct pmd_internals), > + .eth_drv = { > + .eth_dev_init = rte_szedata2_eth_dev_init, > + .eth_dev_uninit = rte_szedata2_eth_dev_uninit, > + .dev_private_size = sizeof(struct pmd_internals), > + }, > }; > > RTE_PMD_REGISTER_PCI(RTE_SZEDATA2_DRIVER_NAME, szedata2_eth_driver.pci_drv); > diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c > index 10603197..f13fad90 100644 > --- a/drivers/net/thunderx/nicvf_ethdev.c > +++ b/drivers/net/thunderx/nicvf_ethdev.c > @@ -2111,15 +2111,17 @@ static const struct rte_pci_id pci_id_nicvf_map[] = { > }, > }; > > -static struct eth_driver rte_nicvf_pmd = { > +static struct rte_pci_eth_driver rte_nicvf_pmd = { > .pci_drv = { > .id_table = pci_id_nicvf_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, > }, > - .eth_dev_init = nicvf_eth_dev_init, > - .dev_private_size = sizeof(struct nicvf), > + .eth_drv = { > + .eth_dev_init = nicvf_eth_dev_init, > + .dev_private_size = sizeof(struct nicvf), > + }, > }; > > RTE_PMD_REGISTER_PCI(net_thunderx, rte_nicvf_pmd.pci_drv); > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > index 54ea7d77..e6f241ad 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -1377,7 +1377,7 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev) > return 0; > } > > -static struct eth_driver rte_virtio_pmd = { > +static struct rte_pci_eth_driver rte_virtio_pmd = { > .pci_drv = { > .driver = { > .name = "net_virtio", > @@ -1387,9 +1387,11 @@ static struct eth_driver rte_virtio_pmd = { > .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, > - .dev_private_size = sizeof(struct virtio_hw), > + .eth_drv = { > + .eth_dev_init = eth_virtio_dev_init, > + .eth_dev_uninit = eth_virtio_dev_uninit, > + .dev_private_size = sizeof(struct virtio_hw), > + }, > }; > > RTE_INIT(rte_virtio_pmd_init); > diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c > index 54533ca5..cb9221e6 100644 > --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c > +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c > @@ -337,16 +337,18 @@ eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev) > return 0; > } > > -static struct eth_driver rte_vmxnet3_pmd = { > +static struct rte_pci_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, > }, > - .eth_dev_init = eth_vmxnet3_dev_init, > - .eth_dev_uninit = eth_vmxnet3_dev_uninit, > - .dev_private_size = sizeof(struct vmxnet3_hw), > + .eth_drv = { > + .eth_dev_init = eth_vmxnet3_dev_init, > + .eth_dev_uninit = eth_vmxnet3_dev_uninit, > + .dev_private_size = sizeof(struct vmxnet3_hw), > + }, > }; > > static int > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index 9dea1f15..7c212096 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -239,13 +239,14 @@ int > rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, > struct rte_pci_device *pci_dev) > { > - struct eth_driver *eth_drv; > + const struct rte_pci_eth_driver *pci_eth_drv; > + const struct eth_driver *eth_drv; > struct rte_eth_dev *eth_dev; > char ethdev_name[RTE_ETH_NAME_MAX_LEN]; > - > int diag; > > - eth_drv = (struct eth_driver *)pci_drv; > + pci_eth_drv = container_of(pci_drv, struct rte_pci_eth_driver, pci_drv); > + eth_drv = &pci_eth_drv->eth_drv; > > rte_eal_pci_device_name(&pci_dev->addr, ethdev_name, > sizeof(ethdev_name)); > @@ -263,7 +264,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, > } > eth_dev->device = &pci_dev->device; > eth_dev->intr_handle = &pci_dev->intr_handle; > - eth_dev->driver = eth_drv; > + eth_dev->driver = &pci_eth_drv->eth_drv; > > /* Invoke PMD device initialization function */ > diag = (*eth_drv->eth_dev_init)(eth_dev); > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > index b4168830..1a62a322 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -1884,25 +1884,31 @@ typedef int (*eth_dev_uninit_t)(struct rte_eth_dev *eth_dev); > * @internal > * The structure associated with a PMD Ethernet driver. > * > - * Each Ethernet driver acts as a PCI driver and is represented by a generic > + * Each Ethernet driver acts is represented by a generic > * *eth_driver* structure that holds: > * > - * - An *rte_pci_driver* structure (which must be the first field). > + * - The *eth_dev_init* function invoked for each matching device. > * > - * - The *eth_dev_init* function invoked for each matching PCI device. > - * > - * - The *eth_dev_uninit* function invoked for each matching PCI device. > + * - The *eth_dev_uninit* function invoked for each matching device. > * > * - The size of the private data to allocate for each matching device. > */ > struct eth_driver { > - struct rte_pci_driver pci_drv; /**< The PMD is also a PCI driver. */ > eth_dev_init_t eth_dev_init; /**< Device init function. */ > eth_dev_uninit_t eth_dev_uninit; /**< Device uninit function. */ > unsigned int dev_private_size; /**< Size of device private data. */ > }; > > /** > + * @internal > + * The structure associated with a PMD PCI Ethernet driver. > + */ > +struct rte_pci_eth_driver { > + struct rte_pci_driver pci_drv; /**< Underlying PCI driver. */ > + struct eth_driver eth_drv; /**< Ethernet driver. */ > +}; > + > +/** > * Convert a numerical speed in Mbps to a bitmap flag that can be used in > * the bitmap link_speeds of the struct rte_eth_conf > * > -- > 2.11.0 >