Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 270325
b: refs/heads/master
c: a1c473a
h: refs/heads/master
i:
  270323: fa7d504
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Jesse Barnes committed Oct 27, 2011
1 parent ac6e3a0 commit 3472773
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 62f392ea5b5f87b641e16e61a4cedda21ef7341f
refs/heads/master: a1c473aa11e61bc871be16279c9bf976acf22504
18 changes: 16 additions & 2 deletions trunk/drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -3202,15 +3202,29 @@ int pcie_set_readrq(struct pci_dev *dev, int rq)
if (rq < 128 || rq > 4096 || !is_power_of_2(rq))
goto out;

v = (ffs(rq) - 8) << 12;

cap = pci_pcie_cap(dev);
if (!cap)
goto out;

err = pci_read_config_word(dev, cap + PCI_EXP_DEVCTL, &ctl);
if (err)
goto out;
/*
* If using the "performance" PCIe config, we clamp the
* read rq size to the max packet size to prevent the
* host bridge generating requests larger than we can
* cope with
*/
if (pcie_bus_config == PCIE_BUS_PERFORMANCE) {
int mps = pcie_get_mps(dev);

if (mps < 0)
return mps;
if (mps < rq)
rq = mps;
}

v = (ffs(rq) - 8) << 12;

if ((ctl & PCI_EXP_DEVCTL_READRQ) != v) {
ctl &= ~PCI_EXP_DEVCTL_READRQ;
Expand Down

0 comments on commit 3472773

Please sign in to comment.