From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 572F2456EF; Tue, 30 Jul 2024 07:50:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 132A940657; Tue, 30 Jul 2024 07:50:08 +0200 (CEST) Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by mails.dpdk.org (Postfix) with ESMTP id 10B92402BB for ; Tue, 30 Jul 2024 07:37:11 +0200 (CEST) Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5a156556fb4so6527767a12.3 for ; Mon, 29 Jul 2024 22:37:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722317830; x=1722922630; darn=dpdk.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=R3Rak6vvd6jnm+dBYd7FIqwYjPcZOSCTsTNR7PXjqns=; b=TIWt/zptYytmcFZee1CiKl6t5juvzpdWcwl7se1z5MDi3n+47QjqUWZg7wD4yVlDd8 utBy7yo6rP7JdVaag9kws+wDTjV/2Xt0t7noid+fiOVHDPYG/mXDw7VbPiVWUlGSJfIt j7EL9soPyA6iZtyQMMswRJI8vb0MIHWB9I14SBzYW8jb/F/JkaunlEdxcUz2DBa+f4S1 Eh+B/ZBKomPtKqOFDalRYh8xhnrECNWH8+B9qAJl+Dfx9BdxisxBZijZRiHTRCSrUim8 Y+Ynf83fGCwiT4xCn4qnxKiVa/Myu7IsRq+1lGrB8mht0t4BQTVaTizL3Z/Blq7MOpRa 4ncA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722317830; x=1722922630; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=R3Rak6vvd6jnm+dBYd7FIqwYjPcZOSCTsTNR7PXjqns=; b=gJnr/zI1iwl4T1N4y8So/7Jze6Gyg8em/s9OdnlXBFrRekb3WFexiqf36+iKxMvrr1 sqDgtrWmR049npU8F3C/flA9JBdRYp9NkgTK6gXDJGlMRoqPIcM/rr65O9ff8lb/CKIn IJCLIkL+dd2uobXqKH1S9Rs2hy7fjun9IhayYNPK/cA4Nq+DgUQsnTW3I1Mo2D55QFwC fME+8LOC/vNO5UnYxhuPbTJATVisX2M2axQIHXJEbJSkD0I7f1/I7tn67tLBMSRWp01J ZdpSD4XlHKxyISc0606dPW4U1hPtn+EUWN/frNNFDrAImn1K8qhu7mEp5H3/ftAPaso2 Pohw== X-Gm-Message-State: AOJu0Yz/hygDg4pRMstOiArPihXEdD3rstkgbPlyUEqSCcFZtPc+PKeH jvRoEWroCMwt6dh5QFXjtwLUqzWMKpNtvP9MYqxkO94zVyKn6CLoYF0rm3yDJhjZjzN/XP9VDvQ /AHYHptfUEGGUAFpnSk3ZCrr7RGM= X-Google-Smtp-Source: AGHT+IG3+uQ5/V9WfA4VNpvcECIjH2cdCazQA3LBaoFsmbCxLOMwlPS3JDJxRyKElD/SUtBqF3ybG6kRXg23bo0Kre4= X-Received: by 2002:a50:9356:0:b0:5a3:2af5:c722 with SMTP id 4fb4d7f45d1cf-5b0208c46d7mr5476951a12.13.1722317830222; Mon, 29 Jul 2024 22:37:10 -0700 (PDT) MIME-Version: 1.0 References: <20240729204329.58b888fe@sovereign> In-Reply-To: <20240729204329.58b888fe@sovereign> From: Prashant Upadhyaya Date: Tue, 30 Jul 2024 11:06:56 +0530 Message-ID: Subject: Re: Regarding port numbers assigned by DPDK for PCI devices To: Dmitry Kozlyuk Cc: dev@dpdk.org Content-Type: multipart/alternative; boundary="00000000000075f87b061e705e7e" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --00000000000075f87b061e705e7e Content-Type: text/plain; charset="UTF-8" On Mon, 29 Jul 2024 at 23:13, Dmitry Kozlyuk wrote: > 2024-07-29 22:18 (UTC+0530), Prashant Upadhyaya: > > Hi, > > > > I have 4 ethernet interfaces available as PCI devices. > > The PCI addresses are known. > > When I start my DPDK application, it starts up properly and assigns the > > port numbers to them as 0, 1, 2, 3 expectedly. > > > > However, is there a way I can force that a particular PCI address should > be > > identified as port 0 by DPDK, another one as port 1 and so forth ? > > Does passing the arguments like -a -a to > rte_eal_init > > ensure that, or is there any other way, or is there no way ? > > > > I am on 24.03 > > > > Regards > > -Prashant > > Hi, > > Why do you need specific port numbers assigned to devices? > > If you're going to use devices for different purposes, > you'd better have an application-level configuration > to specify PCI addresses to use for each purpose. > Iterate devices to match the address and find the port number. > > It is also possible to disable automatic probing with "-a 0:0.0", > then to use rte_dev_probe() + rte_dev_event_callback_register() > to add devices and to get their port numbers. > However, this API, strictly speaking, does not guarantee > that the numbers will be assigned sequentially. > One advantage of using hot-plug is that you can build devargs > from within the application (or from configuration). > > Refer to "rte_dev.h" in any case. > Multiple "-a" don't work the way you've described. > 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. Regards -Prashant --00000000000075f87b061e705e7e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable



On Mon, 29 Jul 2024 at 23:13, Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>= wrote:
2024-07-= 29 22:18 (UTC+0530), Prashant Upadhyaya:
> Hi,
>
> I have 4 ethernet interfaces available as PCI devices.
> The PCI addresses are known.
> When I start my DPDK application, it starts up properly and assigns th= e
> port numbers to them as 0, 1, 2, 3 expectedly.
>
> However, is there a way I can force that a particular PCI address shou= ld be
> identified as port 0 by DPDK, another one as port 1 and so forth ?
> Does passing the arguments like -a <address1> -a <address2>= ; to rte_eal_init
> ensure that, or is there any other way, or is there no way ?
>
> I am on 24.03
>
> Regards
> -Prashant

Hi,

Why do you need specific port numbers assigned to devices?

If you're going to use devices for different purposes,
you'd better have an application-level configuration
to specify PCI addresses to use for each purpose.
Iterate devices to match the address and find the port number.

It is also possible to disable automatic probing with "-a 0:0.0",=
then to use rte_dev_probe() + rte_dev_event_callback_register()
to add devices and to get their port numbers.
However, this API, strictly speaking, does not guarantee
that the numbers will be assigned sequentially.
One advantage of using hot-plug is that you can build devargs
from within the application (or from configuration).

Refer to "rte_dev.h" in any case.
Multiple "-a" don't work the way you've described.


Thanks Dmitry. Ok, so if I hav= e the port number with me, and I know it corresponds to a PCI device, how d= o I find out the PCI address of this device corresponding to this port numb= er. I believe I can do=C2=A0rte_eth_dev_info_get to get the=C2=A0struct rte= _eth_dev_info and from there the rte_device, but what after that ? I saw so= me references to=C2=A0RTE_DEV_TO_PCI but that macro isn't available for= compilation after DPDK is installed as it is an internal header file and t= hus not a macro for application usage and wouldn't compile at applicati= on level.

Regards
-Prashant
= =C2=A0
--00000000000075f87b061e705e7e--