Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys On drivers which use MII(4) and have hook SIOC[GS]IFMEDI...



details:   https://anonhg.NetBSD.org/src/rev/2969ec07058b
branches:  trunk
changeset: 456081:2969ec07058b
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Apr 22 08:05:00 2019 +0000

description:
On drivers which use MII(4) and have hook SIOC[GS]IFMEDIA which just pass to
ifmedia_ioctl(), the hook is not required because ether_ioctl has it
(if_ethersubr.c rev. 1.160). These drivers don't return ENETRESET in
ifmedia_ioctl(), so no functional change.

diffstat:

 sys/arch/arm/at91/at91emac.c    |  12 ++++--------
 sys/arch/arm/gemini/if_gmc.c    |   9 ++-------
 sys/arch/arm/sunxi/sunxi_emac.c |  15 ++-------------
 sys/dev/cadence/if_cemac.c      |   9 ++-------
 sys/dev/ic/elinkxl.c            |  10 +++-------
 sys/dev/ic/lan9118.c            |  11 +++--------
 sys/dev/ic/tulip.c              |  22 +++++++++++++++-------
 sys/dev/marvell/if_mvgbe.c      |  10 ++--------
 sys/dev/pci/if_et.c             |   9 ++-------
 sys/dev/pci/if_lii.c            |  23 +++++------------------
 10 files changed, 40 insertions(+), 90 deletions(-)

diffs (truncated from 507 to 300 lines):

diff -r ce2717f3979e -r 2969ec07058b sys/arch/arm/at91/at91emac.c
--- a/sys/arch/arm/at91/at91emac.c      Mon Apr 22 07:51:16 2019 +0000
+++ b/sys/arch/arm/at91/at91emac.c      Mon Apr 22 08:05:00 2019 +0000
@@ -1,5 +1,5 @@
-/*     $Id: at91emac.c,v 1.24 2019/02/05 06:17:00 msaitoh Exp $        */
-/*     $NetBSD: at91emac.c,v 1.24 2019/02/05 06:17:00 msaitoh Exp $    */
+/*     $Id: at91emac.c,v 1.25 2019/04/22 08:05:00 msaitoh Exp $        */
+/*     $NetBSD: at91emac.c,v 1.25 2019/04/22 08:05:00 msaitoh Exp $    */
 
 /*
  * Copyright (c) 2007 Embedtronics Oy
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at91emac.c,v 1.24 2019/02/05 06:17:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at91emac.c,v 1.25 2019/04/22 08:05:00 msaitoh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -454,6 +454,7 @@
        sc->sc_mii.mii_readreg = emac_mii_readreg;
        sc->sc_mii.mii_writereg = emac_mii_writereg;
        sc->sc_mii.mii_statchg = emac_statchg;
+       sc->sc_ec.ec_mii = &sc->sc_mii;
        ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, emac_mediachange,
                emac_mediastatus);
        mii_attach((device_t )sc, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
@@ -594,15 +595,10 @@
 emac_ifioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
        struct emac_softc *sc = ifp->if_softc;
-       struct ifreq *ifr = (struct ifreq *)data;
        int s, error;
 
        s = splnet();
        switch(cmd) {
-       case SIOCSIFMEDIA:
-       case SIOCGIFMEDIA:
-               error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
-               break;
        default:
                error = ether_ioctl(ifp, cmd, data);
                if (error == ENETRESET) {
diff -r ce2717f3979e -r 2969ec07058b sys/arch/arm/gemini/if_gmc.c
--- a/sys/arch/arm/gemini/if_gmc.c      Mon Apr 22 07:51:16 2019 +0000
+++ b/sys/arch/arm/gemini/if_gmc.c      Mon Apr 22 08:05:00 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gmc.c,v 1.7 2017/02/20 08:25:57 ozaki-r Exp $ */
+/* $NetBSD: if_gmc.c,v 1.8 2019/04/22 08:05:00 msaitoh Exp $ */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -47,7 +47,7 @@
 #include <net/if_ether.h>
 #include <net/if_dl.h>
 
-__KERNEL_RCSID(0, "$NetBSD: if_gmc.c,v 1.7 2017/02/20 08:25:57 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gmc.c,v 1.8 2019/04/22 08:05:00 msaitoh Exp $");
 
 #define        MAX_TXSEG       32
 
@@ -353,16 +353,11 @@
 gmc_ifioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
        struct gmc_softc * const sc = ifp->if_softc;
-       struct ifreq * const ifr = data;
        int s;
        int error;
        s = splnet();
 
        switch (cmd) {
-       case SIOCSIFMEDIA:
-       case SIOCGIFMEDIA:
-               error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
-               break;
        default:
                error = ether_ioctl(ifp, cmd, data);
                if (error == ENETRESET) {
diff -r ce2717f3979e -r 2969ec07058b sys/arch/arm/sunxi/sunxi_emac.c
--- a/sys/arch/arm/sunxi/sunxi_emac.c   Mon Apr 22 07:51:16 2019 +0000
+++ b/sys/arch/arm/sunxi/sunxi_emac.c   Mon Apr 22 08:05:00 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.23 2019/03/05 08:25:02 msaitoh Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.24 2019/04/22 08:05:01 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.23 2019/03/05 08:25:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.24 2019/04/22 08:05:01 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -909,7 +909,6 @@
 {
        struct sunxi_emac_softc *sc = ifp->if_softc;
        struct mii_data *mii = &sc->mii;
-       struct ifreq *ifr = data;
        int error, s;
 
 #ifndef EMAC_MPSAFE
@@ -917,16 +916,6 @@
 #endif
 
        switch (cmd) {
-       case SIOCSIFMEDIA:
-       case SIOCGIFMEDIA:
-#ifdef EMAC_MPSAFE
-               s = splnet();
-#endif
-               error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd);
-#ifdef EMAC_MPSAFE
-               splx(s);
-#endif
-               break;
        default:
 #ifdef EMAC_MPSAFE
                s = splnet();
diff -r ce2717f3979e -r 2969ec07058b sys/dev/cadence/if_cemac.c
--- a/sys/dev/cadence/if_cemac.c        Mon Apr 22 07:51:16 2019 +0000
+++ b/sys/dev/cadence/if_cemac.c        Mon Apr 22 08:05:00 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cemac.c,v 1.16 2019/02/05 06:17:02 msaitoh Exp $    */
+/*     $NetBSD: if_cemac.c,v 1.17 2019/04/22 08:05:01 msaitoh Exp $    */
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.16 2019/02/05 06:17:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.17 2019/04/22 08:05:01 msaitoh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -740,15 +740,10 @@
 cemac_ifioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
        struct cemac_softc *sc = ifp->if_softc;
-       struct ifreq *ifr = (struct ifreq *)data;
        int s, error;
 
        s = splnet();
        switch(cmd) {
-       case SIOCSIFMEDIA:
-       case SIOCGIFMEDIA:
-               error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
-               break;
        default:
                error = ether_ioctl(ifp, cmd, data);
                if (error != ENETRESET)
diff -r ce2717f3979e -r 2969ec07058b sys/dev/ic/elinkxl.c
--- a/sys/dev/ic/elinkxl.c      Mon Apr 22 07:51:16 2019 +0000
+++ b/sys/dev/ic/elinkxl.c      Mon Apr 22 08:05:00 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elinkxl.c,v 1.127 2019/02/05 06:17:02 msaitoh Exp $    */
+/*     $NetBSD: elinkxl.c,v 1.128 2019/04/22 08:05:01 msaitoh Exp $    */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.127 2019/02/05 06:17:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.128 2019/04/22 08:05:01 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -375,6 +375,7 @@
        sc->ex_mii.mii_readreg = ex_mii_readreg;
        sc->ex_mii.mii_writereg = ex_mii_writereg;
        sc->ex_mii.mii_statchg = ex_mii_statchg;
+       sc->sc_ethercom.ec_mii = &sc->ex_mii;
        ifmedia_init(&sc->ex_mii.mii_media, IFM_IMASK, ex_media_chg,
            ex_media_stat);
 
@@ -1439,16 +1440,11 @@
 ex_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
        struct ex_softc *sc = ifp->if_softc;
-       struct ifreq *ifr = (struct ifreq *)data;
        int s, error;
 
        s = splnet();
 
        switch (cmd) {
-       case SIOCSIFMEDIA:
-       case SIOCGIFMEDIA:
-               error = ifmedia_ioctl(ifp, ifr, &sc->ex_mii.mii_media, cmd);
-               break;
        default:
                if ((error = ether_ioctl(ifp, cmd, data)) != ENETRESET)
                        break;
diff -r ce2717f3979e -r 2969ec07058b sys/dev/ic/lan9118.c
--- a/sys/dev/ic/lan9118.c      Mon Apr 22 07:51:16 2019 +0000
+++ b/sys/dev/ic/lan9118.c      Mon Apr 22 08:05:00 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lan9118.c,v 1.29 2019/01/22 15:34:04 jmcneill Exp $    */
+/*     $NetBSD: lan9118.c,v 1.30 2019/04/22 08:05:01 msaitoh Exp $     */
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.29 2019/01/22 15:34:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.30 2019/04/22 08:05:01 msaitoh Exp $");
 
 /*
  * The LAN9118 Family
@@ -232,6 +232,7 @@
        sc->sc_ec.ec_capabilities |= ETHERCAP_VLAN_MTU;
 #endif
 
+       sc->sc_ec.ec_mii = &sc->sc_mii;
        ifmedia_init(&sc->sc_mii.mii_media, 0,
            lan9118_ifm_change, lan9118_ifm_status);
        sc->sc_mii.mii_ifp = ifp;
@@ -505,12 +506,6 @@
                error = 0;
                break;
 
-       case SIOCGIFMEDIA:
-       case SIOCSIFMEDIA:
-               DPRINTFN(2, ("%s: MEDIA\n", __func__));
-               error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
-               break;
-
        default:
                DPRINTFN(2, ("%s: ETHER\n", __func__));
                error = ether_ioctl(ifp, command, data);
diff -r ce2717f3979e -r 2969ec07058b sys/dev/ic/tulip.c
--- a/sys/dev/ic/tulip.c        Mon Apr 22 07:51:16 2019 +0000
+++ b/sys/dev/ic/tulip.c        Mon Apr 22 08:05:00 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tulip.c,v 1.192 2019/01/22 03:42:26 msaitoh Exp $      */
+/*     $NetBSD: tulip.c,v 1.193 2019/04/22 08:05:01 msaitoh Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.192 2019/01/22 03:42:26 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.193 2019/04/22 08:05:01 msaitoh Exp $");
 
 
 #include <sys/param.h>
@@ -983,16 +983,11 @@
 tlp_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
        struct tulip_softc *sc = ifp->if_softc;
-       struct ifreq *ifr = (struct ifreq *)data;
        int s, error;
 
        s = splnet();
 
        switch (cmd) {
-       case SIOCSIFMEDIA:
-       case SIOCGIFMEDIA:
-               error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
-               break;
        default:
                error = ether_ioctl(ifp, cmd, data);
                if (error == ENETRESET) {
@@ -4374,6 +4369,7 @@
        };
        struct tulip_21x4x_media *tm;
 
+       sc->sc_ethercom.ec_mii = &sc->sc_mii;
        ifmedia_init(&sc->sc_mii.mii_media, 0, tlp_mediachange,
            tlp_mediastatus);
 
@@ -4409,6 +4405,7 @@
                TULIP_ROM_MB_MEDIA_TP_FDX,
        };
 
+       sc->sc_ethercom.ec_mii = &sc->sc_mii;
        ifmedia_init(&sc->sc_mii.mii_media, 0, tlp_mediachange,
            tlp_mediastatus);
 
@@ -4426,6 +4423,7 @@
                TULIP_ROM_MB_MEDIA_AUI,
        };
 
+       sc->sc_ethercom.ec_mii = &sc->sc_mii;
        ifmedia_init(&sc->sc_mii.mii_media, 0, tlp_mediachange,
            tlp_mediastatus);
 
@@ -4451,6 +4449,7 @@
        uint16_t romdef;
        uint8_t mb;



Home | Main Index | Thread Index | Old Index