From 682e47137a819304420cf6153b1ee827ce1531a8 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 7 Jan 2025 00:45:41 +0000 Subject: [PATCH] ether2114x: fix automatic media detection We used to reject media info if FD was not specified in plan9.ini. Instead, initialize fd override to -1 which makes us use it if the infoblock tells us to and provide a "HD" option to force half-duplex mode. This makes the media detection work on hyper-v. --- sys/src/9/pc/ether2114x.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/src/9/pc/ether2114x.c b/sys/src/9/pc/ether2114x.c index f3967a5c4..9e41a5f9c 100644 --- a/sys/src/9/pc/ether2114x.c +++ b/sys/src/9/pc/ether2114x.c @@ -1623,7 +1623,7 @@ srom(Ctlr* ctlr) } } - ctlr->fd = 0; + ctlr->fd = -1; ctlr->medium = -1; return 0; @@ -1776,13 +1776,15 @@ reset(Ether* ether) * (no MII) or the autonegotiation fails. */ for(i = 0; i < ether->nopt; i++){ + if(cistrcmp(ether->opt[i], "HD") == 0){ + ctlr->fd = 0; + continue; + } if(cistrcmp(ether->opt[i], "FD") == 0){ ctlr->fd = 1; continue; } for(x = 0; x < nelem(mediatable); x++){ - debug("compare <%s> <%s>\n", mediatable[x], - ether->opt[i]); if(cistrcmp(mediatable[x], ether->opt[i])) continue; ctlr->medium = x; @@ -1803,6 +1805,7 @@ reset(Ether* ether) } ether->mbps = media(ether, 1); + ether->link = ether->mbps != 0; /* * Initialise descriptor rings, ethernet address.