Fall back to ether_ioctl() by default.

The common pratice in ethernet device drivers is to fall back to
ether_ioctl() to implement generic ioctls not implemented by the driver
and to fail if no handler exists.

Convert these drivers to follow that practice rather than calling
ether_ioctl() for specific cases.

vxge(4) aready had the default case, but it was only called on failure
to match.

Reviewed by:	imp
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14895
This commit is contained in:
Brooks Davis 2018-03-30 20:24:29 +00:00
parent 4b70609941
commit 6361c24b8a
4 changed files with 5 additions and 28 deletions

View file

@ -823,12 +823,6 @@ ex_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
DODEBUG(Start_End, printf("%s: ex_ioctl: start ", ifp->if_xname););
switch(cmd) {
case SIOCSIFADDR:
case SIOCGIFADDR:
case SIOCSIFMTU:
error = ether_ioctl(ifp, cmd, data);
break;
case SIOCSIFFLAGS:
DODEBUG(Start_End, printf("SIOCSIFFLAGS"););
EX_LOCK(sc);
@ -850,8 +844,8 @@ ex_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
error = ifmedia_ioctl(ifp, ifr, &sc->ifmedia, cmd);
break;
default:
DODEBUG(Start_End, printf("unknown"););
error = EINVAL;
error = ether_ioctl(ifp, cmd, data);
break;
}
DODEBUG(Start_End, printf("\n%s: ex_ioctl: finish\n", ifp->if_xname););

View file

@ -525,11 +525,6 @@ ixgb_ioctl(struct ifnet * ifp, IOCTL_CMD_TYPE command, caddr_t data)
goto out;
switch (command) {
case SIOCSIFADDR:
case SIOCGIFADDR:
IOCTL_DEBUGOUT("ioctl rcv'd: SIOCxIFADDR (Get/Set Interface Addr)");
ether_ioctl(ifp, command, data);
break;
case SIOCSIFMTU:
IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)");
if (ifr->ifr_mtu > IXGB_MAX_JUMBO_FRAME_SIZE - ETHER_HDR_LEN) {
@ -610,8 +605,8 @@ ixgb_ioctl(struct ifnet * ifp, IOCTL_CMD_TYPE command, caddr_t data)
}
break;
default:
IOCTL_DEBUGOUT1("ioctl received: UNKNOWN (0x%X)\n", (int)command);
error = EINVAL;
error = ether_ioctl(ifp, command, data);
break;
}
out:

View file

@ -1623,12 +1623,6 @@ xge_ioctl(struct ifnet *ifnetp, unsigned long command, caddr_t data)
}
switch(command) {
/* Set/Get ifnet address */
case SIOCSIFADDR:
case SIOCGIFADDR:
ether_ioctl(ifnetp, command, data);
break;
/* Set ifnet MTU */
case SIOCSIFMTU:
retValue = xge_change_mtu(lldev, ifreqp->ifr_mtu);
@ -1713,7 +1707,7 @@ xge_ioctl(struct ifnet *ifnetp, unsigned long command, caddr_t data)
break;
default:
retValue = EINVAL;
retValue = ether_ioctl(ifnetp, command, data);
break;
}
return retValue;

View file

@ -3573,12 +3573,6 @@ vxge_ioctl(ifnet_t ifp, u_long command, caddr_t data)
return (EBUSY);
switch (command) {
/* Set/Get ifnet address */
case SIOCSIFADDR:
case SIOCGIFADDR:
ether_ioctl(ifp, command, data);
break;
/* Set Interface MTU */
case SIOCSIFMTU:
err = vxge_change_mtu(vdev, (unsigned long)ifr->ifr_mtu);