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 4B70545700; Wed, 31 Jul 2024 12:06:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7121642E8F; Wed, 31 Jul 2024 12:06:53 +0200 (CEST) Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by mails.dpdk.org (Postfix) with ESMTP id CB4D440668 for ; Wed, 31 Jul 2024 11:55:09 +0200 (CEST) Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-59f9f59b827so8227784a12.1 for ; Wed, 31 Jul 2024 02:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722419709; x=1723024509; 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=OhegvmyPLS+oOvMbaGjZN0h7bQgpP3T4y6R+DbFwygI=; b=B/eYKeh22J5M/6uCo5gAThqiKxrUTDIId2WdWP04Gxu92C8ab7fW1d2V/aAJAhnNGc vcN1VOieLq7SkogeBc8B6uYXUsrVPZfRVPSnWCfUWLCIcH4gwQsy61oIbnrqQfJkPCgl k9tMEX6pE4MDfGrcqN5pPksFfNq73TuQMDxp0g5llSTFhJvlrJx0xYkwbUEOLqc6Hhux vtUgp20eEZjM681Dv75D52JECKN93cvSSwGIejwdjoqWzB1slF0wkAE3dTPAbna1CfRO gD622ceDjiu5zle0G+84fwVbvBt1JmCXWadInyYILEvnCwoZHGHRsiOdDYnYVEB5GCV7 9qBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722419709; x=1723024509; 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=OhegvmyPLS+oOvMbaGjZN0h7bQgpP3T4y6R+DbFwygI=; b=b4v7nX0xOtGRSv0AHhbwjbRuVKYu8MEsnzzY9NbCBLklUS4KNBy7jl6OoPABZ3TTqI uiTB68iaUBFqpSYuTzf5enCD2iPT6Slml1Z6Y66U9FyRDtcHsAhEaMH0E8mrslf4TfkM 1/XJtsI1GTPNvNle798+b5dWAxakhQ135ZGuib9izkt/6s2A/MqVjdjKiBPKQGC5t9Ok geZmpECyFm0rGMt5vZSd1r9AvgPBwEuDwT1l9QBs6e6cr4PoqQNs7CpWKhiMYL3D//Po 4QLRrZQsRwn9yo/mx5DugdlVmaGM6mZvuT5F7RdU4UQLQsgt2X4BCg62OLUqqqCm5bE6 L7gg== X-Forwarded-Encrypted: i=1; AJvYcCVA4CWncSY0BkQsAKSKwPA+/EuXK7MeAHXzGIEYH8NSmYhzFhWKaoXcEyO/UgMzyRpUoMuqLsed/QiYtGs= X-Gm-Message-State: AOJu0YzgqjQb3hFyHGTUVVFxM1jJ2gDeuP8FR2pMDTpthF2CejlMgsqs Oa31bgPo2wsJ5vtWJEFKydpeG7k8LAl1JPMZ/usdD0Zswt/NBnUj8boAFK3FfPQUpdYv3pzN4YC g3U+zsNhxFdFvWJWg2cg/MPRZjio= X-Google-Smtp-Source: AGHT+IGl/iqtgJt94Fn/HCeGhQWPnuL0tY2hRdrFOuwAID5TX8KLVYOR81iZJ7j6LYjnoqJrZG2kqPE22uTW4gKzs4Y= X-Received: by 2002:a50:c316:0:b0:5a0:e62c:61bd with SMTP id 4fb4d7f45d1cf-5b0232818f2mr8589512a12.29.1722419709082; Wed, 31 Jul 2024 02:55:09 -0700 (PDT) MIME-Version: 1.0 References: <20240729204329.58b888fe@sovereign> In-Reply-To: From: Prashant Upadhyaya Date: Wed, 31 Jul 2024 15:24:55 +0530 Message-ID: Subject: Re: Regarding port numbers assigned by DPDK for PCI devices To: Ferruh Yigit Cc: Dmitry Kozlyuk , dev@dpdk.org Content-Type: multipart/alternative; boundary="000000000000ea05cf061e8816f5" 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 --000000000000ea05cf061e8816f5 Content-Type: text/plain; charset="UTF-8" On Wed, 31 Jul 2024 at 14:35, Ferruh Yigit wrote: > On 7/30/2024 6:36 AM, Prashant Upadhyaya wrote: > > > > > > > > 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. > > > > > > Hi Prashant, > > For PCI bus, most of the times ethdev device name is PCI ID, so you can > use 'rte_eth_dev_get_name_by_port(port_id, name)' API to get PCI ID for > port. > > But there are cases this is not true, like single PCI ID creates > multiple ethdev etc... for this case, PCI ID can be get from device name: > rte_eth_dev_info_get(port_id, *dev_info) > name = rte_dev_name(dev_info->device) > > > Thanks Ferruh, this was helpful. Regards -Prashant --000000000000ea05cf061e8816f5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, 31 Jul 2024 at 14:35, Ferruh = Yigit <ferruh.yigit@amd.com&= gt; wrote:
On 7/= 30/2024 6:36 AM, Prashant Upadhyaya wrote:
>
>
>
> On Mon, 29 Jul 2024 at 23:13, Dmitry Kozlyuk <dmitry.kozliuk@gmail.com
> <mailto:dmitry.kozliuk@gmail.com>> wrote:
>
>=C2=A0 =C2=A0 =C2=A02024-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 up= properly and
>=C2=A0 =C2=A0 =C2=A0assigns 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 par= ticular PCI address
>=C2=A0 =C2=A0 =C2=A0should be
>=C2=A0 =C2=A0 =C2=A0> identified as port 0 by DPDK, another one as p= ort 1 and so forth ?
>=C2=A0 =C2=A0 =C2=A0> Does passing the arguments like -a <address= 1> -a <address2> to
>=C2=A0 =C2=A0 =C2=A0rte_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=A0Hi,
>
>=C2=A0 =C2=A0 =C2=A0Why do you need specific port numbers assigned to d= evices?
>
>=C2=A0 =C2=A0 =C2=A0If you're going to use devices for different pu= rposes,
>=C2=A0 =C2=A0 =C2=A0you'd better have an application-level configur= ation
>=C2=A0 =C2=A0 =C2=A0to specify PCI addresses to use for each purpose. >=C2=A0 =C2=A0 =C2=A0Iterate devices to match the address and find the p= ort number.
>
>=C2=A0 =C2=A0 =C2=A0It is also possible to disable automatic probing wi= th "-a 0:0.0",
>=C2=A0 =C2=A0 =C2=A0then to use rte_dev_probe() + rte_dev_event_callbac= k_register()
>=C2=A0 =C2=A0 =C2=A0to add devices and to get their port numbers.
>=C2=A0 =C2=A0 =C2=A0However, this API, strictly speaking, does not guar= antee
>=C2=A0 =C2=A0 =C2=A0that the numbers will be assigned sequentially.
>=C2=A0 =C2=A0 =C2=A0One advantage of using hot-plug is that you can bui= ld devargs
>=C2=A0 =C2=A0 =C2=A0from within the application (or from configuration)= .
>
>=C2=A0 =C2=A0 =C2=A0Refer to "rte_dev.h" in any case.
>=C2=A0 =C2=A0 =C2=A0Multiple "-a" don't work the way you&= #39;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=C2=A0rte_eth_dev_info_get to get the=C2=A0struct rte_eth_dev_info a= nd from
> there the rte_device, but what after that ? I saw some references
> to=C2=A0RTE_DEV_TO_PCI but that macro isn't available for compilat= ion after
> DPDK is installed as it is an internal header file and thus not a macr= o
> for application usage and wouldn't compile at application level. >
>

Hi Prashant,

For PCI bus, most of the times ethdev device name is PCI ID, so you can
use 'rte_eth_dev_get_name_by_port(port_id, name)' API to get PCI ID= for
port.

But there are cases this is not true, like single PCI ID creates
multiple ethdev etc... for this case, PCI ID can be get from device name: rte_eth_dev_info_get(port_id, *dev_info)
name =3D rte_dev_name(dev_info->device)



Thanks Ferruh, this was helpful.

Regards
-Prashant

--000000000000ea05cf061e8816f5--