3 #include <sys/kernel.h>
5 #include <sys/device.h>
8 #include <net/if_types.h>
10 #include <net/if_ether.h>
11 #include <net/if_media.h>
12 #include <dev/mii/mii.h>
13 #include <dev/mii/miivar.h>
16 ether_mediachange(struct ifnet
*ifp
)
18 struct ethercom
*ec
= (struct ethercom
*)ifp
;
21 KASSERT(ec
->ec_mii
!= NULL
);
23 if ((ifp
->if_flags
& IFF_UP
) == 0)
25 if ((rc
= mii_mediachg(ec
->ec_mii
)) == ENXIO
)
31 ether_mediastatus(struct ifnet
*ifp
, struct ifmediareq
*ifmr
)
33 struct ethercom
*ec
= (struct ethercom
*)ifp
;
36 KASSERT(ec
->ec_mii
!= NULL
);
39 if ((ifp
->if_flags
& IFF_RUNNING
) == 0) {
40 ifmr
->ifm_active
= IFM_ETHER
| IFM_NONE
;
49 ifmr
->ifm_active
= mii
->mii_media_active
;
50 ifmr
->ifm_status
= mii
->mii_media_status
;