From 8d3b73e0ab70c1110b5b479b02809b80891945cc Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Thu, 2 Oct 2008 20:21:16 +0000 Subject: First step towards cleaning up the Ethernet driver ioctl handling. Move calling ether_ioctl() from the top of the ioctl function, which at the moment does absolutely nothing, to the default switch case. Thus allowing drivers to define their own ioctl handlers and then falling back on ether_ioctl(). The only functional change this results in at the moment is having all Ethernet drivers returning the proper errno of ENOTTY instead of EINVAL/ENXIO when encountering unknown ioctl's. Shrinks the i386 kernels by.. RAMDISK - 1024 bytes RAMDISKB - 1120 bytes RAMDISKC - 832 bytes Tested by martin@/jsing@/todd@/brad@ Build tested on almost all archs by todd@/brad@ ok jsing@ --- sys/arch/sparc/dev/be.c | 10 +++------- sys/arch/sparc/dev/hme.c | 9 ++------- sys/arch/sparc/dev/if_ie.c | 6 +++--- sys/arch/sparc/dev/qe.c | 10 +++------- 4 files changed, 11 insertions(+), 24 deletions(-) (limited to 'sys/arch/sparc') diff --git a/sys/arch/sparc/dev/be.c b/sys/arch/sparc/dev/be.c index 50a5126a552..9cf5a694449 100644 --- a/sys/arch/sparc/dev/be.c +++ b/sys/arch/sparc/dev/be.c @@ -1,4 +1,4 @@ -/* $OpenBSD: be.c,v 1.40 2006/05/27 23:59:07 jason Exp $ */ +/* $OpenBSD: be.c,v 1.41 2008/10/02 20:21:13 brad Exp $ */ /* * Copyright (c) 1998 Theo de Raadt and Jason L. Wright. @@ -636,13 +636,9 @@ beioctl(ifp, cmd, data) error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd); break; default: - if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) { - splx(s); - return error; - } - error = ENOTTY; - break; + error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + splx(s); return error; } diff --git a/sys/arch/sparc/dev/hme.c b/sys/arch/sparc/dev/hme.c index 75883c28501..a9984cb6b21 100644 --- a/sys/arch/sparc/dev/hme.c +++ b/sys/arch/sparc/dev/hme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hme.c,v 1.55 2006/06/25 21:53:44 brad Exp $ */ +/* $OpenBSD: hme.c,v 1.56 2008/10/02 20:21:13 brad Exp $ */ /* * Copyright (c) 1998 Jason L. Wright (jason@thought.net) @@ -385,11 +385,6 @@ hmeioctl(ifp, cmd, data) s = splnet(); - if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) { - splx(s); - return (error); - } - switch (cmd) { case SIOCSIFADDR: switch (ifa->ifa_addr->sa_family) { @@ -466,7 +461,7 @@ hmeioctl(ifp, cmd, data) error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); break; default: - error = ENOTTY; + error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } sc->sc_if_flags = ifp->if_flags; diff --git a/sys/arch/sparc/dev/if_ie.c b/sys/arch/sparc/dev/if_ie.c index 61400a7f868..b26ae16859d 100644 --- a/sys/arch/sparc/dev/if_ie.c +++ b/sys/arch/sparc/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.37 2006/12/03 16:35:25 miod Exp $ */ +/* $OpenBSD: if_ie.c,v 1.38 2008/10/02 20:21:13 brad Exp $ */ /* $NetBSD: if_ie.c,v 1.33 1997/07/29 17:55:38 fair Exp $ */ /*- @@ -1954,7 +1954,6 @@ ieioctl(ifp, cmd, data) s = splnet(); switch(cmd) { - case SIOCSIFADDR: ifp->if_flags |= IFF_UP; @@ -2022,8 +2021,9 @@ ieioctl(ifp, cmd, data) break; default: - error = ENOTTY; + error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + splx(s); return error; } diff --git a/sys/arch/sparc/dev/qe.c b/sys/arch/sparc/dev/qe.c index f3599a03a7c..360ee17842a 100644 --- a/sys/arch/sparc/dev/qe.c +++ b/sys/arch/sparc/dev/qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qe.c,v 1.30 2006/05/27 23:59:07 jason Exp $ */ +/* $OpenBSD: qe.c,v 1.31 2008/10/02 20:21:13 brad Exp $ */ /* * Copyright (c) 1998, 2000 Jason L. Wright. @@ -655,13 +655,9 @@ qeioctl(ifp, cmd, data) error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd); break; default: - if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) { - splx(s); - return (error); - } - error = ENOTTY; - break; + error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + splx(s); return (error); } -- cgit v1.2.3