Subject: Re: [PATCH net-next] bnx2x: Add Nic partitioning mode (57712 devices)

From: Dimitris Michailidis <[email-masked]>
Date: Mon, 20 Dec 2010 11:44:51 -0800

Matt Domsch wrote:
>> You can have several interfaces with same device link and different dev_id. 
>>  While the current driver doesn't do it you could also have several 
>> interfaces with different device links but same dev_id (NPAR situation, 
>> notice again that dev_ids are not per PCI function), or interfaces with 
>> different device and dev_id, or even interfaces with same device and dev_id.
> 
> What is the scope of dev_id then?  It's not per PCI device like I
> thought.

I don't think it could be that way because for these cards you can't 
statically tell which ports are controlled by a PCI function.  So knowing 
that an interface is say port 0 of a function would help little.

> It sounds like it's per card, but how can I know the card
> boundary?

Yes, it's per card and covers the PFs and VFs of the card.

> If I have 2 cards driven by cxgb4 in the system, each with say 4
> ports.  I could see a minimum of 8 PCI devices (fine), but the dev_id
> values would be?  0,1,2,3; 0,1,2,3 ?

Correct.

> How can I tell that these are
> two different cards, with two different sets of dev_id values, rather
> than one card with 4 ports, 8 (NPAR or SR-IOV) interfaces, with each 2
> interfaces mapping to the same port?

Doesn't the information in /sys/devices distinguish them?  For example, 
something like

/sys/devices/pci0000:00/0000:00:07.0/0000:04:00.0/net/eth2/dev_id == 0
/sys/devices/pci0000:00/0000:00:07.0/0000:04:00.1/net/eth3/dev_id == 0
/sys/devices/pci0000:00/0000:00:07.0/0000:04:01.0/net/eth5/dev_id == 0
/sys/devices/pci0000:00/0000:00:1c.0/0000:05:00.0/net/eth4/dev_id == 0

tells me there are two cards, one has eth4 on port 0, the other has eth2, 
eth3, and eth5 on its port 0 with eth5 being on a VF.

> dev_id is not system-wide unique.  It's not even slot unique best as I
> can tell.  If I had a PCI slot extender, with 2 PCI slots, and I put
> two of the above cards in, I would see 0,1,2,3; 0,1,2,3.  To be fair,
> my naming scheme doesn't really account for such an extender, though
> currently it would go pci<slot>#<12345678>.

Can you give an example of what /sys/devices looks like in the case you're 
considering?