<div dir="ltr"><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 29 Jul 2024 at 23:13, Dmitry Kozlyuk <<a href="mailto:dmitry.kozliuk@gmail.com" target="_blank">dmitry.kozliuk@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">2024-07-29 22:18 (UTC+0530), Prashant Upadhyaya:<br>
> Hi,<br>
> <br>
> I have 4 ethernet interfaces available as PCI devices.<br>
> The PCI addresses are known.<br>
> When I start my DPDK application, it starts up properly and assigns the<br>
> port numbers to them as 0, 1, 2, 3 expectedly.<br>
> <br>
> However, is there a way I can force that a particular PCI address should be<br>
> identified as port 0 by DPDK, another one as port 1 and so forth ?<br>
> Does passing the arguments like -a <address1> -a <address2> to rte_eal_init<br>
> ensure that, or is there any other way, or is there no way ?<br>
> <br>
> I am on 24.03<br>
> <br>
> Regards<br>
> -Prashant<br>
<br>
Hi,<br>
<br>
Why do you need specific port numbers assigned to devices?<br>
<br>
If you're going to use devices for different purposes,<br>
you'd better have an application-level configuration<br>
to specify PCI addresses to use for each purpose.<br>
Iterate devices to match the address and find the port number.<br>
<br>
It is also possible to disable automatic probing with "-a 0:0.0",<br>
then to use rte_dev_probe() + rte_dev_event_callback_register()<br>
to add devices and to get their port numbers.<br>
However, this API, strictly speaking, does not guarantee<br>
that the numbers will be assigned sequentially.<br>
One advantage of using hot-plug is that you can build devargs<br>
from within the application (or from configuration).<br>
<br>
Refer to "rte_dev.h" in any case.<br>
Multiple "-a" don't work the way you've described.<br></blockquote><div><br></div><div><br></div><div>Thanks Dmitry. Ok, so if I have the port number with me, and I know it corresponds to a PCI device, how do I find out the PCI address of this device corresponding to this port number. I believe I can do rte_eth_dev_info_get to get the struct rte_eth_dev_info and from there the rte_device, but what after that ? I saw some references to RTE_DEV_TO_PCI but that macro isn't available for compilation after DPDK is installed as it is an internal header file and thus not a macro for application usage and wouldn't compile at application level.</div><div><br></div><div>Regards</div><div>-Prashant</div><div> </div></div></div>
</div>