} break; case SIOCSIFMTU: if (ifr->ifr_mtu > TI_JUMBO_FRAMELEN - ETHER_HDR_LEN) { error = EINVAL; } else { ifp->if_mtu = ifr->ifr_mtu; ti_init(sc);
int ti_ioctl(ifp, command, data)	struct ifnet		*ifp;	u_long			command;	caddr_t			data;{	struct ti_softc		*sc = ifp->if_softc;	struct ifreq		*ifr = (struct ifreq *)data;	struct ifaddr		*ifa = (struct ifaddr *)data;	int			s, error = 0;	struct ti_cmd_desc	cmd;	s = splimp();	if ((error = ether_ioctl(ifp, &sc->arpcom, command, data)) > 0) {		splx(s);		return (error);	}	switch(command) {	case SIOCSIFADDR:		ifp->if_flags |= IFF_UP;		switch (ifa->ifa_addr->sa_family) {#ifdef INET		case AF_INET:			ti_init(sc);			arp_ifinit(&sc->arpcom, ifa);			break;#endif /* INET */		default:			ti_init(sc);			break;		}		break;	case SIOCSIFFLAGS:		if (ifp->if_flags & IFF_UP) {			/*			 * If only the state of the PROMISC flag changed,			 * then just use the 'set promisc mode' command			 * instead of reinitializing the entire NIC. Doing			 * a full re-init means reloading the firmware and			 * waiting for it to start up, which may take a			 * second or two.			 */			if (ifp->if_flags & IFF_RUNNING &&			    ifp->if_flags & IFF_PROMISC &&			    !(sc->ti_if_flags & IFF_PROMISC)) {				TI_DO_CMD(TI_CMD_SET_PROMISC_MODE,				    TI_CMD_CODE_PROMISC_ENB, 0);			} else if (ifp->if_flags & IFF_RUNNING &&			    !(ifp->if_flags & IFF_PROMISC) &&			    sc->ti_if_flags & IFF_PROMISC) {				TI_DO_CMD(TI_CMD_SET_PROMISC_MODE,				    TI_CMD_CODE_PROMISC_DIS, 0);			} else				ti_init(sc);		} else {			if (ifp->if_flags & IFF_RUNNING) {				ti_stop(sc);			}		}		sc->ti_if_flags = ifp->if_flags;		error = 0;		break;	case SIOCADDMULTI:	case SIOCDELMULTI:		error = (command == SIOCADDMULTI) ?		    ether_addmulti(ifr, &sc->arpcom) :		    ether_delmulti(ifr, &sc->arpcom);		if (error == ENETRESET) {			if (ifp->if_flags & IFF_RUNNING)				ti_setmulti(sc);			error = 0;		}		break;	case SIOCSIFMEDIA:	case SIOCGIFMEDIA:		error = ifmedia_ioctl(ifp, ifr, &sc->ifmedia, command);		break;	default:		error = EINVAL;		break;	}	splx(s);	return(error);}