Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Even if we don't use MII(4), use the common path of ...
details: https://anonhg.NetBSD.org/src/rev/387e7c620266
branches: trunk
changeset: 999344:387e7c620266
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Wed May 29 10:07:28 2019 +0000
description:
Even if we don't use MII(4), use the common path of SIOC[GS]IFMEDIA in
sys/net/if_ethersubr.c if we can.
- Add ec_ifmedia into struct ethercom.
- ec_mii in struct ethercom is kept and used as it is. It might be used in
future. Note that some Ethernet drivers which _DOESN'T_ use mii(4) use
ec_mii for keeping the if_media. Those should be changed in future.
diffstat:
sys/arch/amiga/dev/if_es.c | 12 ++++--------
sys/arch/arm/broadcom/bcm53xx_eth.c | 9 ++-------
sys/arch/arm/gemini/if_gpn.c | 14 +++++---------
sys/arch/emips/ebus/if_le_ebus.c | 6 +++---
sys/arch/macppc/dev/am79c950.c | 12 +++---------
sys/arch/next68k/dev/mb8795.c | 16 ++++------------
sys/arch/sun2/dev/if_ec.c | 12 +++---------
sys/arch/usermode/dev/if_veth.c | 16 +++++-----------
sys/arch/x86/pci/if_vmx.c | 12 ++++--------
sys/dev/hyperv/if_hvn.c | 11 ++++-------
sys/dev/ic/cs89x0.c | 11 +++--------
sys/dev/ic/dm9000.c | 8 ++------
sys/dev/ic/dp8390.c | 11 +++--------
sys/dev/ic/i82586.c | 10 +++-------
sys/dev/ic/i82596.c | 12 ++++--------
sys/dev/ic/lance.c | 10 +++-------
sys/dev/ic/lemac.c | 15 +++++----------
sys/dev/ic/mb86950.c | 11 +++--------
sys/dev/ic/mb86960.c | 11 +++--------
sys/dev/ic/pdq_ifsubr.c | 16 +++++-----------
sys/dev/ic/tropic.c | 10 ++++------
sys/dev/isa/if_iy.c | 12 ++++--------
sys/dev/pci/if_bge.c | 10 ++++++----
sys/dev/pci/if_de.c | 12 +++++-------
sys/dev/pci/if_dge.c | 10 +++-------
sys/dev/pci/if_ena.c | 8 ++------
sys/dev/pci/if_kse.c | 12 ++++--------
sys/dev/pci/if_ti.c | 9 +++------
sys/dev/pci/if_txp.c | 11 ++++-------
sys/dev/pci/if_xge.c | 10 +++-------
sys/dev/pci/ixgbe/ixgbe.c | 6 ++----
sys/dev/pci/ixgbe/ixv.c | 7 ++-----
sys/dev/sbus/be.c | 12 +++++-------
sys/dev/sbus/qe.c | 11 +++--------
sys/net/if_ether.h | 3 ++-
sys/net/if_ethersubr.c | 13 +++++++++----
sys/net/if_tap.c | 11 +++--------
37 files changed, 135 insertions(+), 267 deletions(-)
diffs (truncated from 1540 to 300 lines):
diff -r 3c5712ecf920 -r 387e7c620266 sys/arch/amiga/dev/if_es.c
--- a/sys/arch/amiga/dev/if_es.c Wed May 29 09:04:01 2019 +0000
+++ b/sys/arch/amiga/dev/if_es.c Wed May 29 10:07:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_es.c,v 1.63 2019/05/29 06:21:56 msaitoh Exp $ */
+/* $NetBSD: if_es.c,v 1.64 2019/05/29 10:07:28 msaitoh Exp $ */
/*
* Copyright (c) 1995 Michael L. Hitch
@@ -33,7 +33,7 @@
#include "opt_ns.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_es.c,v 1.63 2019/05/29 06:21:56 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_es.c,v 1.64 2019/05/29 10:07:28 msaitoh Exp $");
#include <sys/param.h>
@@ -176,6 +176,8 @@
ifp->if_watchdog = eswatchdog;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ /* Setup ifmedia interface */
+ sc->sc_ethercom.ec_ifmedia = &sc->sc_media;
ifmedia_init(&sc->sc_media, 0, esmediachange, esmediastatus);
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_MANUAL, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_MANUAL);
@@ -943,7 +945,6 @@
{
struct es_softc *sc = ifp->if_softc;
register struct ifaddr *ifa = (struct ifaddr *)data;
- struct ifreq *ifr = (struct ifreq *)data;
int s, error = 0;
s = splnet();
@@ -1018,11 +1019,6 @@
}
break;
- case SIOCGIFMEDIA:
- case SIOCSIFMEDIA:
- error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd);
- break;
-
default:
error = ether_ioctl(ifp, cmd, data);
break;
diff -r 3c5712ecf920 -r 387e7c620266 sys/arch/arm/broadcom/bcm53xx_eth.c
--- a/sys/arch/arm/broadcom/bcm53xx_eth.c Wed May 29 09:04:01 2019 +0000
+++ b/sys/arch/arm/broadcom/bcm53xx_eth.c Wed May 29 10:07:28 2019 +0000
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.36 2019/05/29 06:21:56 msaitoh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.37 2019/05/29 10:07:28 msaitoh Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -379,6 +379,7 @@
*/
int ifmedia = IFM_ETHER | IFM_1000_T | IFM_FDX;
//ifmedia |= IFM_FLOW | IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE;
+ ec->ec_ifmedia = &sc->sc_media;
ifmedia_init(&sc->sc_media, IFM_IMASK, bcmeth_mediachange,
bcmeth_mediastatus);
ifmedia_add(&sc->sc_media, ifmedia, 0, NULL);
@@ -686,16 +687,10 @@
bcmeth_ifioctl(struct ifnet *ifp, u_long cmd, void *data)
{
struct bcmeth_softc *sc = ifp->if_softc;
- struct ifreq * const ifr = data;
const int s = splnet();
int error;
switch (cmd) {
- case SIOCSIFMEDIA:
- case SIOCGIFMEDIA:
- error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd);
- break;
-
default:
error = ether_ioctl(ifp, cmd, data);
if (error != ENETRESET)
diff -r 3c5712ecf920 -r 387e7c620266 sys/arch/arm/gemini/if_gpn.c
--- a/sys/arch/arm/gemini/if_gpn.c Wed May 29 09:04:01 2019 +0000
+++ b/sys/arch/arm/gemini/if_gpn.c Wed May 29 10:07:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gpn.c,v 1.11 2019/05/29 06:21:56 msaitoh Exp $ */
+/* $NetBSD: if_gpn.c,v 1.12 2019/05/29 10:07:28 msaitoh Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,7 +32,7 @@
#include "opt_gemini.h"
-__KERNEL_RCSID(0, "$NetBSD: if_gpn.c,v 1.11 2019/05/29 06:21:56 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gpn.c,v 1.12 2019/05/29 10:07:28 msaitoh Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -617,10 +617,6 @@
s = splnet();
switch (cmd) {
- case SIOCSIFMEDIA:
- case SIOCGIFMEDIA:
- error = ifmedia_ioctl(ifp, ifr, &sc->sc_im, cmd);
- break;
case SIOCSIFPHYADDR: {
const struct sockaddr_dl *sdl = satosdl(&ifra->ifra_addr);
@@ -688,10 +684,10 @@
sc->sc_dev = self;
sc->sc_dmat = &gemini_bus_dma_tag;
- /*
- * Pretend we are full-duplex gigabit ethernet.
- */
+ /* Setup ifmedia interface */
+ sc->sc_ec.ec_ifmedia = &sc->sc_im;
ifmedia_init(&sc->sc_im, 0, gpn_mediachange, gpn_mediastatus);
+ /* Pretend we are full-duplex gigabit ethernet. */
ifmedia_add(&sc->sc_im, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL);
ifmedia_add(&sc->sc_im, IFM_ETHER | IFM_NONE, 0, NULL);
ifmedia_set(&sc->sc_im, IFM_ETHER | IFM_NONE);
diff -r 3c5712ecf920 -r 387e7c620266 sys/arch/emips/ebus/if_le_ebus.c
--- a/sys/arch/emips/ebus/if_le_ebus.c Wed May 29 09:04:01 2019 +0000
+++ b/sys/arch/emips/ebus/if_le_ebus.c Wed May 29 10:07:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_le_ebus.c,v 1.19 2019/05/29 06:21:57 msaitoh Exp $ */
+/* $NetBSD: if_le_ebus.c,v 1.20 2019/05/29 10:07:28 msaitoh Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.19 2019/05/29 06:21:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.20 2019/05/29 10:07:28 msaitoh Exp $");
#include "opt_inet.h"
@@ -194,6 +194,7 @@
IFQ_SET_READY(&ifp->if_snd);
/* Initialize ifmedia structures. */
+ sc->sc_ethercom.ec_ifmedia = &sc->sc_media;
ifmedia_init(&sc->sc_media, 0, enic_mediachange, enic_mediastatus);
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_MANUAL, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_MANUAL);
@@ -597,7 +598,6 @@
s = splnet();
switch (cmd) {
- case SIOCGIFMEDIA:
case SIOCSIFMEDIA:
#if 0 /*DEBUG*/
{
diff -r 3c5712ecf920 -r 387e7c620266 sys/arch/macppc/dev/am79c950.c
--- a/sys/arch/macppc/dev/am79c950.c Wed May 29 09:04:01 2019 +0000
+++ b/sys/arch/macppc/dev/am79c950.c Wed May 29 10:07:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: am79c950.c,v 1.45 2019/05/28 07:41:47 msaitoh Exp $ */
+/* $NetBSD: am79c950.c,v 1.46 2019/05/29 10:07:28 msaitoh Exp $ */
/*-
* Copyright (c) 1997 David Huang <khym%bga.com@localhost>
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.45 2019/05/28 07:41:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.46 2019/05/29 10:07:28 msaitoh Exp $");
#include "opt_inet.h"
@@ -154,6 +154,7 @@
ifp->if_watchdog = mcwatchdog;
/* Initialize ifmedia structures */
+ sc->sc_ethercom.ec_ifmedia = &sc->sc_media;
ifmedia_init(&sc->sc_media, 0, mc_mediachange, mc_mediastatus);
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_MANUAL, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_MANUAL);
@@ -170,7 +171,6 @@
{
struct mc_softc *sc = ifp->if_softc;
struct ifaddr *ifa;
- struct ifreq *ifr;
int s = splnet(), err = 0;
@@ -233,12 +233,6 @@
}
break;
- case SIOCGIFMEDIA:
- case SIOCSIFMEDIA:
- ifr = (struct ifreq *) data;
- err = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd);
- break;
-
default:
err = ether_ioctl(ifp, cmd, data);
break;
diff -r 3c5712ecf920 -r 387e7c620266 sys/arch/next68k/dev/mb8795.c
--- a/sys/arch/next68k/dev/mb8795.c Wed May 29 09:04:01 2019 +0000
+++ b/sys/arch/next68k/dev/mb8795.c Wed May 29 10:07:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mb8795.c,v 1.64 2019/05/29 06:21:57 msaitoh Exp $ */
+/* $NetBSD: mb8795.c,v 1.65 2019/05/29 10:07:29 msaitoh Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
* All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.64 2019/05/29 06:21:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.65 2019/05/29 10:07:29 msaitoh Exp $");
#include "opt_inet.h"
@@ -111,8 +111,8 @@
ifp->if_flags = IFF_BROADCAST;
/* Initialize media goo. */
- ifmedia_init(&sc->sc_media, 0, mb8795_mediachange,
- mb8795_mediastatus);
+ sc->sc_ethercom.ec_ifmedia = &sc->sc_media;
+ ifmedia_init(&sc->sc_media, 0, mb8795_mediachange, mb8795_mediastatus);
if (media != NULL) {
int i;
for (i = 0; i < nmedia; i++)
@@ -561,7 +561,6 @@
{
struct mb8795_softc *sc = ifp->if_softc;
struct ifaddr *ifa = (struct ifaddr *)data;
- struct ifreq *ifr = (struct ifreq *)data;
int s, error = 0;
s = splnet();
@@ -642,13 +641,6 @@
}
break;
- case SIOCGIFMEDIA:
- case SIOCSIFMEDIA:
- DPRINTF(("%s: mb8795_ioctl() SIOCSIFMEDIA\n",
- device_xname(sc->sc_dev)));
- error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd);
- break;
-
default:
error = ether_ioctl(ifp, cmd, data);
break;
diff -r 3c5712ecf920 -r 387e7c620266 sys/arch/sun2/dev/if_ec.c
--- a/sys/arch/sun2/dev/if_ec.c Wed May 29 09:04:01 2019 +0000
+++ b/sys/arch/sun2/dev/if_ec.c Wed May 29 10:07:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ec.c,v 1.33 2019/05/29 06:21:57 msaitoh Exp $ */
+/* $NetBSD: if_ec.c,v 1.34 2019/05/29 10:07:29 msaitoh Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.33 2019/05/29 06:21:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.34 2019/05/29 10:07:29 msaitoh Exp $");
#include "opt_inet.h"
#include "opt_ns.h"
@@ -223,6 +223,7 @@
IFQ_SET_READY(&ifp->if_snd);
/* Initialize ifmedia structures. */
+ sc->sc_ethercom.ec_ifmedia = &sc->sc_media;
ifmedia_init(&sc->sc_media, 0, ec_mediachange, ec_mediastatus);
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_MANUAL, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_MANUAL);
@@ -559,8 +560,6 @@
ec_ioctl(struct ifnet *ifp, u_long cmd, void *data)
{
struct ifaddr *ifa = (struct ifaddr *)data;
- struct ifreq *ifr = (struct ifreq *)data;
- struct ec_softc *sc = ifp->if_softc;
int s, error = 0;
s = splnet();
@@ -611,11 +610,6 @@
}
break;
- case SIOCGIFMEDIA:
- case SIOCSIFMEDIA:
Home |
Main Index |
Thread Index |
Old Index