• T
    PCI: Add pcie_bandwidth_available() to compute bandwidth available to device · 6db79a88
    Tal Gilboa 提交于
    Add pcie_bandwidth_available() to compute the bandwidth available to a
    device.  This may be limited by the device itself or by a slower upstream
    link leading to the device.
    
    The available bandwidth at each link along the path is computed as:
    
      link_width * link_speed * (1 - encoding_overhead)
    
    2.5 and 5.0 GT/s links use 8b/10b encoding, which reduces the raw bandwidth
    available by 20%; 8.0 GT/s and faster links use 128b/130b encoding, which
    reduces it by about 1.5%.
    
    The result is in Mb/s, i.e., megabits/second, of raw bandwidth.
    
    Also return the device with the slowest link and the speed and width of
    that link.
    Signed-off-by: NTal Gilboa <talgi@mellanox.com>
    [bhelgaas: changelog, leave pcie_get_minimum_link() alone for now, return
    bw directly, use pci_upstream_bridge(), check "next_bw <= bw" to find
    uppermost limiting device, return speed/width of the limiting device]
    Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
    6db79a88
pci.c 151.9 KB