On my laptop, starting at reboot and until I have inserted an ethernet 
cable, em(4) leaves its if_link_state as LINK_STATE_UNKNOWN.  This 
causes problems for me because when trunk(4) is setup to use em(4) as 
the master port, it will not failover to the secondary port until 
if_link_state changes to LINK_STATE_DOWN, i.e. until an ethernet cable 
has been inserted and removed once.

Is this intentional?  Below is a patch that seems to fix the problem for 
me, but it's just a guess on my part.  Better solutions welcome.

Thanks.

Index: sys/dev/pci/if_em.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_em.c,v
retrieving revision 1.137
diff -p -u -r1.137 if_em.c
--- sys/dev/pci/if_em.c 8 Jul 2006 04:34:34 -0000       1.137
+++ sys/dev/pci/if_em.c 9 Jul 2006 06:58:47 -0000
@@ -1276,7 +1276,7 @@ em_update_link_status(struct em_softc *s
        struct ifnet *ifp = &sc->interface_data.ac_if;
 
        if (E1000_READ_REG(&sc->hw, STATUS) & E1000_STATUS_LU) {
-               if (sc->link_active == 0) {
+               if (ifp->if_link_state != LINK_STATE_UP) {
                        em_get_speed_and_duplex(&sc->hw,
                                                &sc->link_speed,
                                                &sc->link_duplex);
@@ -1296,7 +1296,7 @@ em_update_link_status(struct em_softc *s
                        if_link_state_change(ifp);
                }
        } else {
-               if (sc->link_active == 1) {
+               if (ifp->if_link_state != LINK_STATE_DOWN) {
                        ifp->if_baudrate = sc->link_speed = 0;
                        sc->link_duplex = 0;
                        sc->link_active = 0;

Reply via email to