blob: c98607cb27e8d660dfc1c98c84c5a0f09ff53b88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/errno.h>
#include <sys/device.h>
#include <net/if.h>
#include <net/if_types.h>
#include <net/if_ether.h>
#include <net/if_media.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
int
ether_mediachange(struct ifnet *ifp)
{
struct ethercom *ec = (struct ethercom *)ifp;
int rc;
KASSERT(ec->ec_mii != NULL);
if ((ifp->if_flags & IFF_UP) == 0)
return 0;
if ((rc = mii_mediachg(ec->ec_mii)) == ENXIO)
return 0;
return rc;
}
void
ether_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
{
struct ethercom *ec = (struct ethercom *)ifp;
struct mii_data *mii;
KASSERT(ec->ec_mii != NULL);
#ifdef notyet
if ((ifp->if_flags & IFF_RUNNING) == 0) {
ifmr->ifm_active = IFM_ETHER | IFM_NONE;
ifmr->ifm_status = 0;
return;
}
#endif
mii = ec->ec_mii;
mii_pollstat(mii);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
}
|