Re: re(4) reads the pci-e max packet size wrongly

2015-02-19 Thread Jan Stary
On Feb 19 10:01:22, j...@insec.sh wrote:
 On Wed, Feb 18, 2015 at 11:23:15AM +1000, David Gwynne wrote:
  it looks like it reads the DCSR register and then keeps everything
  except the MPS field.
  
  this might cause it to erronously consider the mps to be much bigger
  than 2048, which in turn could prevent it from setting it correctly.
  
  i dont actually have one of these chips. can someone give it a spin?
 
 nothing broke on my 8168D and 8168E running -current with this, for
 what it's worth.

Nothing broke on my 8168G.

re0 at pci2 dev 0 function 0 Realtek 8168 rev 0x0c: RTL8168G/8111G (0x4c00), 
msi, address e0:3f:49:6f:f3:1c
rgephy0 at re0 phy 7: RTL8251 PHY, rev. 0

Jan



Re: re(4) reads the pci-e max packet size wrongly

2015-02-18 Thread Jim Smith
On Wed, Feb 18, 2015 at 11:23:15AM +1000, David Gwynne wrote:
 it looks like it reads the DCSR register and then keeps everything
 except the MPS field.
 
 this might cause it to erronously consider the mps to be much bigger
 than 2048, which in turn could prevent it from setting it correctly.
 
 i dont actually have one of these chips. can someone give it a spin?

nothing broke on my 8168D and 8168E running -current with this, for
what it's worth.

 Index: if_re_pci.c
 ===
 RCS file: /cvs/src/sys/dev/pci/if_re_pci.c,v
 retrieving revision 1.45
 diff -u -p -r1.45 if_re_pci.c
 --- if_re_pci.c   26 Jan 2015 09:58:47 -  1.45
 +++ if_re_pci.c   18 Feb 2015 01:12:22 -
 @@ -182,7 +182,7 @@ re_pci_attach(struct device *parent, str
   /* Set PCIe maximum read request size to 2048. */
   reg = pci_conf_read(pa-pa_pc, pa-pa_tag,
   sc-rl_expcap + PCI_PCIE_DCSR);
 - reg = (reg  ~PCI_PCIE_DCSR_MPS);
 + reg = PCI_PCIE_DCSR_MPS;
   reg = 12;
   rrs = (1  (reg + 7));
   if (rrs  2048) {
 



re(4) reads the pci-e max packet size wrongly

2015-02-17 Thread David Gwynne
it looks like it reads the DCSR register and then keeps everything
except the MPS field.

this might cause it to erronously consider the mps to be much bigger
than 2048, which in turn could prevent it from setting it correctly.

i dont actually have one of these chips. can someone give it a spin?

Index: if_re_pci.c
===
RCS file: /cvs/src/sys/dev/pci/if_re_pci.c,v
retrieving revision 1.45
diff -u -p -r1.45 if_re_pci.c
--- if_re_pci.c 26 Jan 2015 09:58:47 -  1.45
+++ if_re_pci.c 18 Feb 2015 01:12:22 -
@@ -182,7 +182,7 @@ re_pci_attach(struct device *parent, str
/* Set PCIe maximum read request size to 2048. */
reg = pci_conf_read(pa-pa_pc, pa-pa_tag,
sc-rl_expcap + PCI_PCIE_DCSR);
-   reg = (reg  ~PCI_PCIE_DCSR_MPS);
+   reg = PCI_PCIE_DCSR_MPS;
reg = 12;
rrs = (1  (reg + 7));
if (rrs  2048) {