DPDK usage discussions
 help / color / Atom feed
* [dpdk-users] RTE_REGISTER_BUS
@ 2019-11-25 14:43 Gadre Nayan
  2019-11-25 15:25 ` Gaëtan Rivet
  0 siblings, 1 reply; 4+ messages in thread
From: Gadre Nayan @ 2019-11-25 14:43 UTC (permalink / raw)
  To: users

Hi,

I am trying to understand RTE_REGISTER_BUS for PCI Bus.

1. Load uio, igb_uio, bind the NIC with igb_uio.
2. load the application.

Step 1, is mostly about registering Drivers with the PCI bus.
I am looking at when does RTE_REGISTER_BUS get called in this process.

Thanks
Nayan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-users] RTE_REGISTER_BUS
  2019-11-25 14:43 [dpdk-users] RTE_REGISTER_BUS Gadre Nayan
@ 2019-11-25 15:25 ` Gaëtan Rivet
  2019-11-26  3:45   ` Gadre Nayan
  0 siblings, 1 reply; 4+ messages in thread
From: Gaëtan Rivet @ 2019-11-25 15:25 UTC (permalink / raw)
  To: Gadre Nayan; +Cc: users

On Mon, Nov 25, 2019 at 08:13:00PM +0530, Gadre Nayan wrote:
> Hi,
> 
> I am trying to understand RTE_REGISTER_BUS for PCI Bus.
> 
> 1. Load uio, igb_uio, bind the NIC with igb_uio.
> 2. load the application.
> 
> Step 1, is mostly about registering Drivers with the PCI bus.
> I am looking at when does RTE_REGISTER_BUS get called in this process.
> 
> Thanks
> Nayan

Hello,

RTE_REGISTER_ functions all uses RTE_INIT_PRIO(n) macro.
This macro will only add the GCC attribute __attribute__((constructor(n), used))
to the symbole defined with RTE_INIT_PRIO() (attribute supported by all
major compiler).

This attribute adds the related function to the .init section of the
generated ELF. This section is executed before the main() of the
program.

This allows libraries to define init and cleanup code that is executed
automatically when linking against the lib.

-- 
Gaëtan Rivet
6WIND

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-users] RTE_REGISTER_BUS
  2019-11-25 15:25 ` Gaëtan Rivet
@ 2019-11-26  3:45   ` Gadre Nayan
  2019-11-26  9:40     ` Gaëtan Rivet
  0 siblings, 1 reply; 4+ messages in thread
From: Gadre Nayan @ 2019-11-26  3:45 UTC (permalink / raw)
  To: Gaëtan Rivet; +Cc: users

Hi,

Thanks Rivet.
I was checking the testpmd application to test if my PMD is registered
on the PCI device list.
With the softnic pmd, rte_eal_init calls vdev_scan()

But when I run testpmd with options: ./testpmd -l 0-3 -n 4 -- i
it again calls vdev_scan().
Also only virtual device drivers are getting registered through
rte_vdev_register.

I was expecting it to register rte_pci_register then call
rte_pci_scan() and then subsequently rte_pci_probe()

Does testpmd work with PCI devices or only Vdevs.
I am trying to write my own PMD for a NIC on my laptop from Realtek.

Thanks
Nayan

On Mon, Nov 25, 2019 at 8:55 PM Gaëtan Rivet <gaetan.rivet@6wind.com> wrote:
>
> On Mon, Nov 25, 2019 at 08:13:00PM +0530, Gadre Nayan wrote:
> > Hi,
> >
> > I am trying to understand RTE_REGISTER_BUS for PCI Bus.
> >
> > 1. Load uio, igb_uio, bind the NIC with igb_uio.
> > 2. load the application.
> >
> > Step 1, is mostly about registering Drivers with the PCI bus.
> > I am looking at when does RTE_REGISTER_BUS get called in this process.
> >
> > Thanks
> > Nayan
>
> Hello,
>
> RTE_REGISTER_ functions all uses RTE_INIT_PRIO(n) macro.
> This macro will only add the GCC attribute __attribute__((constructor(n), used))
> to the symbole defined with RTE_INIT_PRIO() (attribute supported by all
> major compiler).
>
> This attribute adds the related function to the .init section of the
> generated ELF. This section is executed before the main() of the
> program.
>
> This allows libraries to define init and cleanup code that is executed
> automatically when linking against the lib.
>
> --
> Gaėtan Rivet
> 6WIND

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-users] RTE_REGISTER_BUS
  2019-11-26  3:45   ` Gadre Nayan
@ 2019-11-26  9:40     ` Gaëtan Rivet
  0 siblings, 0 replies; 4+ messages in thread
From: Gaëtan Rivet @ 2019-11-26  9:40 UTC (permalink / raw)
  To: Gadre Nayan; +Cc: users

testpmd works with all DPDK devices, PCI included.

Use GDB and break on businitfn_pci, main. Check that the PCI register
function is called, and then the state of the bus list. You can also
break on rte_bus_scan().

If you don't see the PCI bus anywhere, a possible explanation is that
the bus is disabled in your build/.config file.

Gaëtan

On Tue, Nov 26, 2019 at 09:15:42AM +0530, Gadre Nayan wrote:
> Hi,
> 
> Thanks Rivet.
> I was checking the testpmd application to test if my PMD is registered
> on the PCI device list.
> With the softnic pmd, rte_eal_init calls vdev_scan()
> 
> But when I run testpmd with options: ./testpmd -l 0-3 -n 4 -- i
> it again calls vdev_scan().
> Also only virtual device drivers are getting registered through
> rte_vdev_register.
> 
> I was expecting it to register rte_pci_register then call
> rte_pci_scan() and then subsequently rte_pci_probe()
> 
> Does testpmd work with PCI devices or only Vdevs.
> I am trying to write my own PMD for a NIC on my laptop from Realtek.
> 
> Thanks
> Nayan
> 
> On Mon, Nov 25, 2019 at 8:55 PM Gaëtan Rivet <gaetan.rivet@6wind.com> wrote:
> >
> > On Mon, Nov 25, 2019 at 08:13:00PM +0530, Gadre Nayan wrote:
> > > Hi,
> > >
> > > I am trying to understand RTE_REGISTER_BUS for PCI Bus.
> > >
> > > 1. Load uio, igb_uio, bind the NIC with igb_uio.
> > > 2. load the application.
> > >
> > > Step 1, is mostly about registering Drivers with the PCI bus.
> > > I am looking at when does RTE_REGISTER_BUS get called in this process.
> > >
> > > Thanks
> > > Nayan
> >
> > Hello,
> >
> > RTE_REGISTER_ functions all uses RTE_INIT_PRIO(n) macro.
> > This macro will only add the GCC attribute __attribute__((constructor(n), used))
> > to the symbole defined with RTE_INIT_PRIO() (attribute supported by all
> > major compiler).
> >
> > This attribute adds the related function to the .init section of the
> > generated ELF. This section is executed before the main() of the
> > program.
> >
> > This allows libraries to define init and cleanup code that is executed
> > automatically when linking against the lib.
> >
> > --
> > Gaėtan Rivet
> > 6WIND

-- 
Gaëtan Rivet
6WIND

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-25 14:43 [dpdk-users] RTE_REGISTER_BUS Gadre Nayan
2019-11-25 15:25 ` Gaëtan Rivet
2019-11-26  3:45   ` Gadre Nayan
2019-11-26  9:40     ` Gaëtan Rivet

DPDK usage discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/users/0 users/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 users users/ http://inbox.dpdk.org/users \
		users@dpdk.org
	public-inbox-index users


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.users


AGPL code for this site: git clone https://public-inbox.org/ public-inbox