Message ID | 1376833298-7321-1-git-send-email-lekensteyn@gmail.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
Peter Wu <lekensteyn@gmail.com> : [...] > check"[1]. I do not have sis190 hardware, but since that is based on > this r8169 driver, would it make sense to apply this patch to sis190 > too? Yes for the _REGS_SIZE part. Nobody proved that the memcpy_fromio split is needed or even useful with a sis19x.
From: Peter Wu <lekensteyn@gmail.com> Date: Sun, 18 Aug 2013 15:41:38 +0200 > For some reason, my PCIe RTL8111E onboard NIC on a GA-Z68X-UD3H-B3 > motherboard reads as FFs when reading from MMIO with a block size > larger than 7. Therefore change to reading blocks of four bytes. > > Ben Hutchings noted that the buffer is large enough to hold all > registers, so now all registers are read. Since regs->len is not used > anymore, drop the superfluous range check as well. (ethtool would > already ensure that regs->len <= R8169_REGS_SIZE). > > Signed-off-by: Peter Wu <lekensteyn@gmail.com> > --- > Hi, > > This partly obsoletes "r8169,sis190: remove unnecessary length > check"[1]. I do not have sis190 hardware, but since that is based on > this r8169 driver, would it make sense to apply this patch to sis190 > too? You're going to have to respin this since I applied the length check removal patch already. Thanks. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index b5eb419..c0c9e14 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -1897,12 +1897,13 @@ static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) { struct rtl8169_private *tp = netdev_priv(dev); - - if (regs->len > R8169_REGS_SIZE) - regs->len = R8169_REGS_SIZE; + u32 __iomem *data = tp->mmio_addr; + u32 *dw = p; + int i; rtl_lock_work(tp); - memcpy_fromio(p, tp->mmio_addr, regs->len); + for (i = 0; i < R8169_REGS_SIZE; i += 4) + memcpy_fromio(dw++, data++, 4); rtl_unlock_work(tp); }
For some reason, my PCIe RTL8111E onboard NIC on a GA-Z68X-UD3H-B3 motherboard reads as FFs when reading from MMIO with a block size larger than 7. Therefore change to reading blocks of four bytes. Ben Hutchings noted that the buffer is large enough to hold all registers, so now all registers are read. Since regs->len is not used anymore, drop the superfluous range check as well. (ethtool would already ensure that regs->len <= R8169_REGS_SIZE). Signed-off-by: Peter Wu <lekensteyn@gmail.com> --- Hi, This partly obsoletes "r8169,sis190: remove unnecessary length check"[1]. I do not have sis190 hardware, but since that is based on this r8169 driver, would it make sense to apply this patch to sis190 too? Regards, Peter [1]: http://www.spinics.net/lists/netdev/msg246824.html --- drivers/net/ethernet/realtek/r8169.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)