From: <krytarowski@caviumnetworks.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 1/2] ethdev: Allow to overload pci_drv.devinit and pci_drv.devuninit
Date: Tue, 2 Feb 2016 15:27:18 +0100 [thread overview]
Message-ID: <1454423239-16382-1-git-send-email-krytarowski@caviumnetworks.com> (raw)
From: Kamil Rytarowski <Kamil.Rytarowski@caviumnetworks.com>
This change enables drivers needing custom pci (de)initialization functions
through the standard callback overloading.
For example:
/*
* virtual function driver struct
*/
static struct eth_driver rte_DRIVER_pmd = {
{
.name = "rte_DRIVER_pmd",
.id_table = pci_id_DRIVER_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.devinit = DRIVER_pci_devinit,
},
.eth_dev_init = eth_DRIVER_dev_init,
.dev_private_size = sizeof(struct DRIVER),
};
Use-case is as follows: NIC offers several pci virtual functions, while
one of them is to be treated as port, we need to configure the rest in a
specific way for particular device for full interface (port) functionality.
Signed-off-by: Kamil Rytarowski <Kamil.Rytarowski@caviumnetworks.com>
---
lib/librte_ether/rte_ethdev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 756b234..ac4aeab 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -351,8 +351,10 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.devinit = rte_eth_dev_init;
- eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
+ if (!eth_drv->pci_drv.devinit)
+ eth_drv->pci_drv.devinit = rte_eth_dev_init;
+ if (!eth_drv->pci_drv.devuninit)
+ eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
rte_eal_pci_register(ð_drv->pci_drv);
}
--
1.9.1
next reply other threads:[~2016-02-02 14:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 14:27 krytarowski [this message]
2016-02-02 14:27 ` [dpdk-dev] [PATCH 2/2] ethdev: Export rte_eth_dev_create_unique_device_name() to public API krytarowski
2016-02-11 16:56 ` Panu Matilainen
2016-02-11 17:15 ` David Marchand
2016-02-03 8:47 ` [dpdk-dev] [PATCH 1/2] ethdev: Allow to overload pci_drv.devinit and pci_drv.devuninit David Marchand
2016-02-03 11:39 ` Kamil Rytarowski
2016-02-03 14:08 ` David Marchand
2016-02-03 15:49 ` Kamil Rytarowski
2016-02-03 15:59 ` Kamil Rytarowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454423239-16382-1-git-send-email-krytarowski@caviumnetworks.com \
--to=krytarowski@caviumnetworks.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).