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.
This commit is contained in:
cinap_lenrek 2025-01-07 00:45:41 +00:00
parent 3ff88ede01
commit 682e47137a

View file

@ -1623,7 +1623,7 @@ srom(Ctlr* ctlr)
} }
} }
ctlr->fd = 0; ctlr->fd = -1;
ctlr->medium = -1; ctlr->medium = -1;
return 0; return 0;
@ -1776,13 +1776,15 @@ reset(Ether* ether)
* (no MII) or the autonegotiation fails. * (no MII) or the autonegotiation fails.
*/ */
for(i = 0; i < ether->nopt; i++){ 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){ if(cistrcmp(ether->opt[i], "FD") == 0){
ctlr->fd = 1; ctlr->fd = 1;
continue; continue;
} }
for(x = 0; x < nelem(mediatable); x++){ for(x = 0; x < nelem(mediatable); x++){
debug("compare <%s> <%s>\n", mediatable[x],
ether->opt[i]);
if(cistrcmp(mediatable[x], ether->opt[i])) if(cistrcmp(mediatable[x], ether->opt[i]))
continue; continue;
ctlr->medium = x; ctlr->medium = x;
@ -1803,6 +1805,7 @@ reset(Ether* ether)
} }
ether->mbps = media(ether, 1); ether->mbps = media(ether, 1);
ether->link = ether->mbps != 0;
/* /*
* Initialise descriptor rings, ethernet address. * Initialise descriptor rings, ethernet address.