On 25/07/17(Tue) 18:07, Alexander Bluhm wrote: > Hi, > > The LINK_STATE_IS_UP() macro considers LINK_STATE_UNKNOWN as up. > So the em driver never gets out of that state. The change was in > sys/net/if.h > > revision 1.123 > date: 2011/07/03 17:41:50; author: claudio; state: Exp; lines: +3 -2; > LINK_STATE_IS_UP() should consider LINK_STATE_UNKNOWN as an up state. > This is now possible because carp no longer uses LINK_STATE_UNKNOWN > for a state that is considered down. This will simplify a lot of code. > OK mpf@ mcbride@ henning@ > > I have checked ix(4), bge(4), myx(4). They compare the new value > with the old. em(4) should do the same. > > ok?
Great this bug has finally been found! That mean we should be able to use rtisvalid(9) in netinet/ip_output.c without breaking naddy@'s setup. ok mpi@ > Index: dev/pci/if_em.c > =================================================================== > RCS file: /data/mirror/openbsd/cvs/src/sys/dev/pci/if_em.c,v > retrieving revision 1.335 > diff -u -p -r1.335 if_em.c > --- dev/pci/if_em.c 19 Mar 2017 11:09:26 -0000 1.335 > +++ dev/pci/if_em.c 25 Jul 2017 15:37:31 -0000 > @@ -1458,6 +1458,7 @@ void > em_update_link_status(struct em_softc *sc) > { > struct ifnet *ifp = &sc->sc_ac.ac_if; > + u_char link_state; > > if (E1000_READ_REG(&sc->hw, STATUS) & E1000_STATUS_LU) { > if (sc->link_active == 0) { > @@ -1480,11 +1481,10 @@ em_update_link_status(struct em_softc *s > sc->smartspeed = 0; > ifp->if_baudrate = IF_Mbps(sc->link_speed); > } > - if (!LINK_STATE_IS_UP(ifp->if_link_state)) { > - if (sc->link_duplex == FULL_DUPLEX) > - ifp->if_link_state = LINK_STATE_FULL_DUPLEX; > - else > - ifp->if_link_state = LINK_STATE_HALF_DUPLEX; > + link_state = (sc->link_duplex == FULL_DUPLEX) ? > + LINK_STATE_FULL_DUPLEX : LINK_STATE_HALF_DUPLEX; > + if (ifp->if_link_state != link_state) { > + ifp->if_link_state = link_state; > if_link_state_change(ifp); > } > } else { >