| 737 | } |
| 738 | |
| 739 | static int |
| 740 | emac_ioctl(struct ifnet *ifp, u_long command, caddr_t data) |
| 741 | { |
| 742 | struct emac_softc *sc; |
| 743 | struct mii_data *mii; |
| 744 | struct ifreq *ifr; |
| 745 | int error = 0; |
| 746 | |
| 747 | sc = ifp->if_softc; |
| 748 | ifr = (struct ifreq *)data; |
| 749 | |
| 750 | switch (command) { |
| 751 | case SIOCSIFFLAGS: |
| 752 | EMAC_LOCK(sc); |
| 753 | if (ifp->if_flags & IFF_UP) { |
| 754 | if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { |
| 755 | if ((ifp->if_flags ^ sc->emac_if_flags) & |
| 756 | (IFF_PROMISC | IFF_ALLMULTI)) |
| 757 | emac_set_rx_mode(sc); |
| 758 | } else |
| 759 | emac_init_locked(sc); |
| 760 | } else { |
| 761 | if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) |
| 762 | emac_stop_locked(sc); |
| 763 | } |
| 764 | sc->emac_if_flags = ifp->if_flags; |
| 765 | EMAC_UNLOCK(sc); |
| 766 | break; |
| 767 | case SIOCADDMULTI: |
| 768 | case SIOCDELMULTI: |
| 769 | EMAC_LOCK(sc); |
| 770 | if (ifp->if_drv_flags & IFF_DRV_RUNNING) { |
| 771 | emac_set_rx_mode(sc); |
| 772 | } |
| 773 | EMAC_UNLOCK(sc); |
| 774 | break; |
| 775 | case SIOCGIFMEDIA: |
| 776 | case SIOCSIFMEDIA: |
| 777 | mii = device_get_softc(sc->emac_miibus); |
| 778 | error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); |
| 779 | break; |
| 780 | default: |
| 781 | error = ether_ioctl(ifp, command, data); |
| 782 | break; |
| 783 | } |
| 784 | return (error); |
| 785 | } |
| 786 | |
| 787 | static int |
| 788 | emac_probe(device_t dev) |
nothing calls this directly
no test coverage detected