linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Ran Shalit <ranshalit@gmail.com>
Cc: Alex Williamson <alex.williamson@redhat.com>, linux-pci@vger.kernel.org
Subject: Re: Q: Relation between lanes to devices and to BARs
Date: Thu, 11 Feb 2016 21:20:26 -0600	[thread overview]
Message-ID: <20160212032026.GA28057@localhost> (raw)
In-Reply-To: <CAJ2oMh+8pAP3AwF+jBt4rMJ2VhuehSCGHNw7-2VwSeRyV759BA@mail.gmail.com>

On Thu, Feb 11, 2016 at 05:22:15PM +0200, Ran Shalit wrote:
> If I may please ask one more on this issue.
> You have made it clear the terms lanes & device in relation to
> PCI/PCI-e device driver.
> What about port ? Is there any relation between port to lane/device or
> is there no relation between these terms.

In Linux, PCIe Ports (Root Ports, Switch Upstream Ports, or Switch
Downstream Ports) are treated as devices.  There is a struct pci_dev
for each Port.  A Switch contains at least two Ports (an Upstream Port
and one or more Downstream Ports), and there is a pci_dev for each of
them.

There is no connection between the number of lanes and the number of
pci_dev structs.  The Linux PCI core doesn't do anything with the
number of lanes.  My understanding is that the devices on either end
of a Link normally negotiate the link width (number of lanes) between
themselves automatically, without software intervention.

> For example, can it be 1 device with 2 lanes and 8 ports for example ?

"1 device with 8 ports" is a phrase that would make sense in the PCIe
spec, where you could be talking about a Switch with one Upstream Port
and seven Downstream Ports.

But in the Linux kernel, since we treat each PCI/PCIe *function* as an
independent device, this looks like 8 devices.  There will be 8
pci_dev structs, one for each port.

The "2 lanes" part is irrelevant.  The number of lanes makes no
difference as far as how many pci_dev structs we have.

Bjorn

      reply	other threads:[~2016-02-12  3:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-31  7:15 Q: Relation between lanes to devices and to BARs Ran Shalit
2016-02-01  4:14 ` Alex Williamson
2016-02-01 18:41   ` Ran Shalit
2016-02-01 20:54     ` Bjorn Helgaas
2016-02-11 15:22       ` Ran Shalit
2016-02-12  3:20         ` Bjorn Helgaas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160212032026.GA28057@localhost \
    --to=helgaas@kernel.org \
    --cc=alex.williamson@redhat.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=ranshalit@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).