ref: e921399c4f3c2da33164706c1b172571a3dd3153
parent: d0040dcc84066c2acc7b9a006c1f865c02ee77ea
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Jun 30 13:16:11 EDT 2016
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.
--- a/sys/src/9/pc/ether8169.c
+++ b/sys/src/9/pc/ether8169.c
@@ -830,15 +830,12 @@
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){--
⑨