ref: 92aa75e879f9089ed8af8552ba399a243d6bbda0
parent: ca8ca008f4ab7074971a35e08de9a46cb9b5d5ab
author: cinap_lenrek <[email protected]>
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){