summaryrefslogtreecommitdiffstats
path: root/sys/dev/fe
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2003-10-31 18:32:15 +0000
committerbrooks <brooks@FreeBSD.org>2003-10-31 18:32:15 +0000
commitf1e94c6f29b079e4ad9d9305ef3e90a719bcbbda (patch)
tree4d9e6671d486576767506230a4240131526fea49 /sys/dev/fe
parentbe546fdee455a96afdefee10d0bdba8547399f5b (diff)
downloadFreeBSD-src-f1e94c6f29b079e4ad9d9305ef3e90a719bcbbda.zip
FreeBSD-src-f1e94c6f29b079e4ad9d9305ef3e90a719bcbbda.tar.gz
Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname)
Diffstat (limited to 'sys/dev/fe')
-rw-r--r--sys/dev/fe/if_fe.c57
-rw-r--r--sys/dev/fe/if_fevar.h3
2 files changed, 30 insertions, 30 deletions
diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c
index 0a21324..8e9c69e 100644
--- a/sys/dev/fe/if_fe.c
+++ b/sys/dev/fe/if_fe.c
@@ -423,8 +423,8 @@ fe_read_eeprom_jli (struct fe_softc * sc, u_char * data)
int i;
data -= JLI_EEPROM_SIZE;
for (i = 0; i < JLI_EEPROM_SIZE; i += 16) {
- printf("fe%d: EEPROM(JLI):%3x: %16D\n",
- sc->sc_unit, i, data + i, " ");
+ printf("%s: EEPROM(JLI):%3x: %16D\n",
+ sc->sc_xname, i, data + i, " ");
}
}
#endif
@@ -539,8 +539,8 @@ fe_read_eeprom_ssi (struct fe_softc *sc, u_char *data)
int i;
data -= SSI_EEPROM_SIZE;
for (i = 0; i < SSI_EEPROM_SIZE; i += 16) {
- printf("fe%d: EEPROM(SSI):%3x: %16D\n",
- sc->sc_unit, i, data + i, " ");
+ printf("%s: EEPROM(SSI):%3x: %16D\n",
+ sc->sc_xname, i, data + i, " ");
}
}
#endif
@@ -641,8 +641,8 @@ fe_read_eeprom_lnx (struct fe_softc *sc, u_char *data)
this board was not a TDK/LANX) or not working
properly. */
if (bootverbose) {
- printf("fe%d: no ACK received from EEPROM(LNX)\n",
- sc->sc_unit);
+ printf("%s: no ACK received from EEPROM(LNX)\n",
+ sc->sc_xname);
}
/* Clear the given buffer to indicate we could not get
any info. and return. */
@@ -680,8 +680,8 @@ fe_read_eeprom_lnx (struct fe_softc *sc, u_char *data)
if (bootverbose) {
data -= LNX_EEPROM_SIZE;
for (i = 0; i < LNX_EEPROM_SIZE; i += 16) {
- printf("fe%d: EEPROM(LNX):%3x: %16D\n",
- sc->sc_unit, i, data + i, " ");
+ printf("%s: EEPROM(LNX):%3x: %16D\n",
+ sc->sc_xname, i, data + i, " ");
}
}
#endif
@@ -739,8 +739,7 @@ fe_attach (device_t dev)
* Initialize ifnet structure
*/
sc->sc_if.if_softc = sc;
- sc->sc_if.if_unit = sc->sc_unit;
- sc->sc_if.if_name = "fe";
+ if_initname(&sc->sc_if, device_get_name(dev), device_get_unit(dev));
sc->sc_if.if_output = ether_output;
sc->sc_if.if_start = fe_start;
sc->sc_if.if_ioctl = fe_ioctl;
@@ -791,8 +790,8 @@ fe_attach (device_t dev)
default:
/* Oops, we can't work with single buffer configuration. */
if (bootverbose) {
- printf("fe%d: strange TXBSIZ config; fixing\n",
- sc->sc_unit);
+ printf("%s: strange TXBSIZ config; fixing\n",
+ sc->sc_xname);
}
sc->proto_dlcr6 &= ~FE_D6_TXBSIZ;
sc->proto_dlcr6 |= FE_D6_TXBSIZ_2x2KB;
@@ -1013,7 +1012,7 @@ fe_init (void * xsc)
/* We need an address. */
if (TAILQ_EMPTY(&sc->sc_if.if_addrhead)) { /* XXX unlikely */
#ifdef DIAGNOSTIC
- printf("fe%d: init() without any address\n", sc->sc_unit);
+ printf("%s: init() without any address\n", sc->sc_xname);
#endif
return;
}
@@ -1098,8 +1097,8 @@ fe_init (void * xsc)
* The following message helps discovering the fact. FIXME.
*/
if (!(fe_inb(sc, FE_DLCR5) & FE_D5_BUFEMP)) {
- printf("fe%d: receive buffer has some data after reset\n",
- sc->sc_unit);
+ printf("%s: receive buffer has some data after reset\n",
+ sc->sc_xname);
fe_emptybuffer(sc);
}
@@ -1366,7 +1365,7 @@ fe_emptybuffer (struct fe_softc * sc)
u_char saved_dlcr5;
#ifdef FE_DEBUG
- printf("fe%d: emptying receive buffer\n", sc->sc_unit);
+ printf("%s: emptying receive buffer\n", sc->sc_xname);
#endif
/*
@@ -1402,7 +1401,7 @@ fe_emptybuffer (struct fe_softc * sc)
* Double check.
*/
if (fe_inb(sc, FE_DLCR5) & FE_D5_BUFEMP) {
- printf("fe%d: could not empty receive buffer\n", sc->sc_unit);
+ printf("%s: could not empty receive buffer\n", sc->sc_xname);
/* Hmm. What should I do if this happens? FIXME. */
}
@@ -1433,8 +1432,8 @@ fe_tint (struct fe_softc * sc, u_char tstat)
* are left unsent in transmission buffer.
*/
left = fe_inb(sc, FE_BMPR10);
- printf("fe%d: excessive collision (%d/%d)\n",
- sc->sc_unit, left, sc->txb_sched);
+ printf("%s: excessive collision (%d/%d)\n",
+ sc->sc_xname, left, sc->txb_sched);
/*
* Clear the collision flag (in 86960) here
@@ -1636,7 +1635,7 @@ fe_rint (struct fe_softc * sc, u_char rstat)
if ((status & 0xF0) != 0x20 ||
len > ETHER_MAX_LEN - ETHER_CRC_LEN ||
len < ETHER_MIN_LEN - ETHER_CRC_LEN) {
- printf("fe%d: RX buffer out-of-sync\n", sc->sc_unit);
+ printf("%s: RX buffer out-of-sync\n", sc->sc_xname);
sc->sc_if.if_ierrors++;
sc->mibdata.dot3StatsInternalMacReceiveErrors++;
fe_reset(sc);
@@ -1666,7 +1665,7 @@ fe_rint (struct fe_softc * sc, u_char rstat)
/* Maximum number of frames has been received. Something
strange is happening here... */
- printf("fe%d: unusual receive flood\n", sc->sc_unit);
+ printf("%s: unusual receive flood\n", sc->sc_xname);
sc->mibdata.dot3StatsInternalMacReceiveErrors++;
fe_reset(sc);
}
@@ -1740,7 +1739,7 @@ fe_intr (void *arg)
fe_start(&sc->sc_if);
}
- printf("fe%d: too many loops\n", sc->sc_unit);
+ printf("%s: too many loops\n", sc->sc_xname);
}
/*
@@ -1918,7 +1917,7 @@ fe_write_mbufs (struct fe_softc *sc, struct mbuf *m)
/* Check if this matches the one in the packet header. */
if (length != m->m_pkthdr.len) {
- printf("fe%d: packet length mismatch? (%d/%d)\n", sc->sc_unit,
+ printf("%s: packet length mismatch? (%d/%d)\n", sc->sc_xname,
length, m->m_pkthdr.len);
}
#else
@@ -1934,8 +1933,8 @@ fe_write_mbufs (struct fe_softc *sc, struct mbuf *m)
*/
if (length < ETHER_HDR_LEN ||
length > ETHER_MAX_LEN - ETHER_CRC_LEN) {
- printf("fe%d: got an out-of-spec packet (%u bytes) to send\n",
- sc->sc_unit, length);
+ printf("%s: got an out-of-spec packet (%u bytes) to send\n",
+ sc->sc_xname, length);
sc->sc_if.if_oerrors++;
sc->mibdata.dot3StatsInternalMacTransmitErrors++;
return;
@@ -2086,8 +2085,8 @@ fe_mcaf ( struct fe_softc *sc )
continue;
index = fe_hash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
#ifdef FE_DEBUG
- printf("fe%d: hash(%6D) == %d\n",
- sc->sc_unit, enm->enm_addrlo , ":", index);
+ printf("%s: hash(%6D) == %d\n",
+ sc->sc_xname, enm->enm_addrlo , ":", index);
#endif
filter.data[index >> 3] |= 1 << (index & 7);
@@ -2229,8 +2228,8 @@ fe_medchange (struct ifnet *ifp)
if (bit2media[b] == sc->media.ifm_media) break;
}
if (((1 << b) & sc->mbitmap) == 0) {
- printf("fe%d: got an unsupported media request (0x%x)\n",
- sc->sc_unit, sc->media.ifm_media);
+ printf("%s: got an unsupported media request (0x%x)\n",
+ sc->sc_xname, sc->media.ifm_media);
return EINVAL;
}
#endif
diff --git a/sys/dev/fe/if_fevar.h b/sys/dev/fe/if_fevar.h
index 37842b2..c8fd355 100644
--- a/sys/dev/fe/if_fevar.h
+++ b/sys/dev/fe/if_fevar.h
@@ -69,6 +69,7 @@ struct fe_softc {
/* Used by "common" codes. */
struct arpcom arpcom; /* Ethernet common */
+ int sc_unit;
/* Used by config codes. */
int type;
@@ -118,7 +119,7 @@ struct fe_softc {
};
#define sc_if arpcom.ac_if
-#define sc_unit arpcom.ac_if.if_unit
+#define sc_xname arpcom.ac_if.if_xname
#define sc_enaddr arpcom.ac_enaddr
OpenPOWER on IntegriCloud