Sync usage with man page.
[netbsd-mini2440.git] / sys / dev / mii / mii_ethersubr.c
blobc98607cb27e8d660dfc1c98c84c5a0f09ff53b88
1 #include <sys/param.h>
2 #include <sys/systm.h>
3 #include <sys/kernel.h>
4 #include <sys/errno.h>
5 #include <sys/device.h>
7 #include <net/if.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>
15 int
16 ether_mediachange(struct ifnet *ifp)
18 struct ethercom *ec = (struct ethercom *)ifp;
19 int rc;
21 KASSERT(ec->ec_mii != NULL);
23 if ((ifp->if_flags & IFF_UP) == 0)
24 return 0;
25 if ((rc = mii_mediachg(ec->ec_mii)) == ENXIO)
26 return 0;
27 return rc;
30 void
31 ether_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
33 struct ethercom *ec = (struct ethercom *)ifp;
34 struct mii_data *mii;
36 KASSERT(ec->ec_mii != NULL);
38 #ifdef notyet
39 if ((ifp->if_flags & IFF_RUNNING) == 0) {
40 ifmr->ifm_active = IFM_ETHER | IFM_NONE;
41 ifmr->ifm_status = 0;
42 return;
44 #endif
46 mii = ec->ec_mii;
48 mii_pollstat(mii);
49 ifmr->ifm_active = mii->mii_media_active;
50 ifmr->ifm_status = mii->mii_media_status;