From 92aa75e879f9089ed8af8552ba399a243d6bbda0 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Thu, 30 Jun 2016 17:16:11 +0200 Subject: ether8169: fix wrong mbps setting (from qu7uux) the first time rtl8169link is called (from rtl8169pnp), the link isn't up, so setting edev->mbps based on Phystatus register is skipped. edev->mbps is then still set at the default 100, and that ends up being what devether uses. this is why some rtl8169 cards are misprinted as 100Mbps in kmesg. later, after rtl8169link is called again from rtl8169interrupt, the link is up and edev->mbps is set to the correct value (as shown by e.g. /net/ether0/stats). so instead, set speed regardless of link status. --- sys/src/9/pc/ether8169.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'sys/src/9/pc') diff --git a/sys/src/9/pc/ether8169.c b/sys/src/9/pc/ether8169.c index 2752406ac..9d962b267 100644 --- a/sys/src/9/pc/ether8169.c +++ b/sys/src/9/pc/ether8169.c @@ -830,15 +830,12 @@ rtl8169link(Ether* edev) ctlr = edev->ctlr; + r = csr8r(ctlr, Phystatus); /* * Maybe the link changed - do we care very much? * Could stall transmits if no link, maybe? */ - if(!((r = csr8r(ctlr, Phystatus)) & Linksts)){ - edev->link = 0; - return; - } - edev->link = 1; + edev->link = (r & Linksts) != 0; limit = 256*1024; if(r & Speed10){ -- cgit v1.2.3