* [dpdk-dev] [ethdev] Multiple devices with single PCI
@ 2014-08-28 10:54 이근홍
2014-08-28 12:42 ` David Marchand
0 siblings, 1 reply; 3+ messages in thread
From: 이근홍 @ 2014-08-28 10:54 UTC (permalink / raw)
To: dev
Hello.
I found that DPDK has an abstraction for having multiple devices with
single PCI.
(RTE_PCI_DRV_MULTIPLE flag)
However, their is a naming collision while registering multiple devices.
Here is my possible solution.
Best regards.
Keunhong.
=====================================================
commit b4fb08c42584283a7c5fbb251ab23f0e2b5f099e
Author: leeopop <dlrmsghd@gmail.com> 2014-07-24 22:28:12
Committer: leeopop <dlrmsghd@gmail.com> 2014-07-24 22:28:12
Parent: bcc733c4780a007f56564277a79309c427367cc2 (ethdev: fix build of
named allocation debug)
Branches: master, github/master
multiple dev support
------------------------ lib/librte_ether/rte_ethdev.c
------------------------
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index fd1010a..06dda6b 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -204,8 +204,12 @@
eth_drv = (struct eth_driver *)pci_drv;
/* Create unique Ethernet device name using PCI address */
- snprintf(ethdev_name, RTE_ETH_NAME_MAX_LEN, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function);
+ if(pci_drv->drv_flags & RTE_PCI_DRV_MULTIPLE)
+ snprintf(ethdev_name, RTE_ETH_NAME_MAX_LEN, "%d:%d.%d-%d",
+ pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function, nb_ports);
+ else
+ snprintf(ethdev_name, RTE_ETH_NAME_MAX_LEN, "%d:%d.%d",
+ pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function);
eth_dev = rte_eth_dev_allocate(ethdev_name);
if (eth_dev == NULL)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [ethdev] Multiple devices with single PCI
2014-08-28 10:54 [dpdk-dev] [ethdev] Multiple devices with single PCI 이근홍
@ 2014-08-28 12:42 ` David Marchand
2014-08-28 12:46 ` Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2014-08-28 12:42 UTC (permalink / raw)
To: 이근홍; +Cc: dev
Hello,
On Thu, Aug 28, 2014 at 12:54 PM, 이근홍 <dlrmsghd@gmail.com> wrote:
> I found that DPDK has an abstraction for having multiple devices with
> single PCI.
> (RTE_PCI_DRV_MULTIPLE flag)
> However, their is a naming collision while registering multiple devices.
> Here is my possible solution.
>
- Actually, I think this flag could just disappear.
It had been added at a time when ethdev objects could only be created
through eth_drivers.
Right now, a pci driver can create ethdev objects using
rte_eth_dev_allocate(thenameyouwant).
So I would rather propose you convert your driver from a eth_driver to a
pci_driver.
It is not that hard, you only need to allocate your own private structure
and ensure the mandatory fields are filled.
You can look at rte_eth_dev_init() to see what is needed.
- Thomas, RTE_PCI_DRV_MULTIPLE deprecation for 1.8.x ?
--
David Marchand
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [ethdev] Multiple devices with single PCI
2014-08-28 12:42 ` David Marchand
@ 2014-08-28 12:46 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2014-08-28 12:46 UTC (permalink / raw)
To: David Marchand; +Cc: dev
2014-08-28 14:42, David Marchand:
> - Thomas, RTE_PCI_DRV_MULTIPLE deprecation for 1.8.x ?
Yes, but I don't know how to deprecate a flag.
It could be a simple removal.
--
Thomas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-28 12:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-28 10:54 [dpdk-dev] [ethdev] Multiple devices with single PCI 이근홍
2014-08-28 12:42 ` David Marchand
2014-08-28 12:46 ` Thomas Monjalon
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).