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 B69BD45700; Wed, 31 Jul 2024 12:07:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BACA042789; Wed, 31 Jul 2024 12:06:54 +0200 (CEST) Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by mails.dpdk.org (Postfix) with ESMTP id 973CC40668 for ; Wed, 31 Jul 2024 11:55:59 +0200 (CEST) Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5a309d1a788so7525731a12.3 for ; Wed, 31 Jul 2024 02:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722419759; x=1723024559; 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=q3pxVVmo3bGTJThfUDr3HHMCT5YccGJVEV91gO7wuOE=; b=UaYVbopRvQR4udM9/A7nzzcvmn4nU29kWVbM0nd0ibGIqkhFHEtRkcAVx1pmvzL4+L qlZfG3gfHpeYXSOjuawHnqu8z80Di6xBHpjmuQV+c3B3jUDs2CoMk3n7gCl27UjChMe6 dM7V7kB5qydvH4VQqdZSe7X3o6bpWWy/WFgWlQbIRW58gXQa6Zmcj761wknnXw7VRlDs OtyMgPwNbBCHuJ5M3anBNGSEyphXqfpz8LjgY9bM82tk1gT/y/MPVOfUoc/TjI057d0J S8FP9pf+ktBT32kJo4U0GS1UuvvdCtE9zDPDJZ75E2o4qapJUY5SXgvPRaZ8PI4luyTb 3RRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722419759; x=1723024559; 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=q3pxVVmo3bGTJThfUDr3HHMCT5YccGJVEV91gO7wuOE=; b=glRFdSxgNmcZK46lGWh8RUZje71p4s98OKC/WNg1Y3xt2AQDEVtjmtYJo5uulsYI1A BN+ceK9yU3e0czCsTsE7MNlsW17IJnrchU8m16+wlcqEMuGFmE76n1VvzuIBmEjos5QX InH3p9YVlgHOMPVInVQZ/rnEtGuW7I7452FRKGDCxHYmV13QSvVm9NxxT+lQNCN8IJqF ZxPiBKtUxs/ZFb+lzsZ9EkHxF3FULT670iSDOIbmCfk+IRVI2VRhwPh6b4TNHWdtvk6c uNDopdL8e6PcWFvb9YQnw1AcHYJw+S9/D2dX4qm7+JypxPTqDsQ6QEbYb9bzkNni75ro Eq3Q== X-Forwarded-Encrypted: i=1; AJvYcCUdZvaIgfmXYTVoXye4NqXwdWnoxRxtztVE00jHmNSLRHBp8sbpn6kjeZEGGd/eeffo8Bu6XSWx5lVGeAw= X-Gm-Message-State: AOJu0YzI2FUvzucT6jx++V0ZlxAopryd7tel7P5KyE2RsIQmdl+kSHh6 DzkQDiEjRO2zbOrnfBJJphazvZl9dCQwZ4/AzYOFh0N3odYYxG3Z1r2+TEZSdkLMUBMEl0pGJ0L gj1FhBLM2p4teoFncAYHkQCDHIIQ= X-Google-Smtp-Source: AGHT+IGjQxBOpGeqfpyzparokjEAuyhfqsRjQ8DoMcV+6gVNkNwNEu59e5oiie9jPpFU6eby8o3k9k/VB+GVK67YE4A= X-Received: by 2002:a05:6402:5210:b0:5a2:8bf2:92c6 with SMTP id 4fb4d7f45d1cf-5b02119042cmr10092674a12.21.1722419758821; Wed, 31 Jul 2024 02:55:58 -0700 (PDT) MIME-Version: 1.0 References: <20240729204329.58b888fe@sovereign> In-Reply-To: From: Prashant Upadhyaya Date: Wed, 31 Jul 2024 15:25:45 +0530 Message-ID: Subject: Re: Regarding port numbers assigned by DPDK for PCI devices To: Bruce Richardson Cc: Dmitry Kozlyuk , dev@dpdk.org Content-Type: multipart/alternative; boundary="000000000000e0f86d061e8819e0" 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 --000000000000e0f86d061e8819e0 Content-Type: text/plain; charset="UTF-8" On Tue, 30 Jul 2024 at 13:45, Bruce Richardson wrote: > On Tue, Jul 30, 2024 at 11:06:56AM +0530, Prashant Upadhyaya wrote: > > On Mon, 29 Jul 2024 at 23:13, Dmitry Kozlyuk > > <[1]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 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 > > > The PCI device id is used as the device name in that case so rte_dev_name > should get you what you want. > > I'd also +1 the suggestion of having your app hotplug in the devices > post-init, if you want specific devices to have specific ids. Although it > is not guaranteed, DPDK does currently assign the ids sequentially. I've > used this approach myself in the past in some test apps where I wanted > ports in a particular sequence. > > /Bruce > Thanks Bruce, makes sense. Regards -Prashant --000000000000e0f86d061e8819e0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, 30 Jul 2024 at 13:45, Bruce R= ichardson <bruce.richardso= n@intel.com> wrote:
On Tue, Jul 30, 2024 at 11:06:56AM +0530, Prashant Upadhyaya wro= te:
>=C2=A0 =C2=A0 On Mon, 29 Jul 2024 at 23:13, Dmitry Kozlyuk
>=C2=A0 =C2=A0 <[1]dmitry.kozliuk@gmail.com> wrote:
>
>=C2=A0 =C2=A0 =C2=A0 2024-07-29 22:18 (UTC+0530), Prashant Upadhyaya: >=C2=A0 =C2=A0 =C2=A0 > Hi,
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 > I have 4 ethernet interfaces available as PCI= devices.
>=C2=A0 =C2=A0 =C2=A0 > The PCI addresses are known.
>=C2=A0 =C2=A0 =C2=A0 > When I start my DPDK application, it starts u= p properly and
>=C2=A0 =C2=A0 =C2=A0 assigns the
>=C2=A0 =C2=A0 =C2=A0 > port numbers to them as 0, 1, 2, 3 expectedly= .
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 > However, is there a way I can force that a pa= rticular PCI address
>=C2=A0 =C2=A0 =C2=A0 should be
>=C2=A0 =C2=A0 =C2=A0 > identified as port 0 by DPDK, another one as = port 1 and so forth ?
>=C2=A0 =C2=A0 =C2=A0 > Does passing the arguments like -a <addres= s1> -a <address2> to
>=C2=A0 =C2=A0 =C2=A0 rte_eal_init
>=C2=A0 =C2=A0 =C2=A0 > ensure that, or is there any other way, or is= there no way ?
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 > I am on 24.03
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 > Regards
>=C2=A0 =C2=A0 =C2=A0 > -Prashant
>=C2=A0 =C2=A0 =C2=A0 Hi,
>=C2=A0 =C2=A0 =C2=A0 Why do you need specific port numbers assigned to = devices?
>=C2=A0 =C2=A0 =C2=A0 If you're going to use devices for different p= urposes,
>=C2=A0 =C2=A0 =C2=A0 you'd better have an application-level configu= ration
>=C2=A0 =C2=A0 =C2=A0 to specify PCI addresses to use for each purpose.<= br> >=C2=A0 =C2=A0 =C2=A0 Iterate devices to match the address and find the = port number.
>=C2=A0 =C2=A0 =C2=A0 It is also possible to disable automatic probing w= ith "-a 0:0.0",
>=C2=A0 =C2=A0 =C2=A0 then to use rte_dev_probe() + rte_dev_event_callba= ck_register()
>=C2=A0 =C2=A0 =C2=A0 to add devices and to get their port numbers.
>=C2=A0 =C2=A0 =C2=A0 However, this API, strictly speaking, does not gua= rantee
>=C2=A0 =C2=A0 =C2=A0 that the numbers will be assigned sequentially. >=C2=A0 =C2=A0 =C2=A0 One advantage of using hot-plug is that you can bu= ild devargs
>=C2=A0 =C2=A0 =C2=A0 from within the application (or from configuration= ).
>=C2=A0 =C2=A0 =C2=A0 Refer to "rte_dev.h" in any case.
>=C2=A0 =C2=A0 =C2=A0 Multiple "-a" don't work the way you= 've described.
>
>=C2=A0 =C2=A0 Thanks Dmitry. Ok, so if I have the port number with me, = and I know it
>=C2=A0 =C2=A0 corresponds to a PCI device, how do I find out the PCI ad= dress of this
>=C2=A0 =C2=A0 device corresponding to this port number. I believe I can=
>=C2=A0 =C2=A0 do rte_eth_dev_info_get to get the struct rte_eth_dev_inf= o and from
>=C2=A0 =C2=A0 there the rte_device, but what after that ? I saw some re= ferences
>=C2=A0 =C2=A0 to RTE_DEV_TO_PCI but that macro isn't available for = compilation after
>=C2=A0 =C2=A0 DPDK is installed as it is an internal header file and th= us not a macro
>=C2=A0 =C2=A0 for application usage and wouldn't compile at applica= tion level.
>=C2=A0 =C2=A0 Regards
>=C2=A0 =C2=A0 -Prashant
>
The PCI device id is used as the device name in that case so rte_dev_name should get you what you want.

I'd also +1 the suggestion of having your app hotplug in the devices post-init, if you want specific devices to have specific ids. Although it is not guaranteed, DPDK does currently assign the ids sequentially. I'v= e
used this approach myself in the past in some test apps where I wanted
ports in a particular sequence.

/Bruce

Thanks Bruce, makes sense.
=

Regards
-Prashant
=C2=A0
--000000000000e0f86d061e8819e0--