support for options NS (XNS networking).
* This structure contains the output queue for the interface, its address, ...
*/
struct ec_softc {
* This structure contains the output queue for the interface, its address, ...
*/
struct ec_softc {
- struct arpcom ec_ac; /* Ethernet common part */
-#define ec_if ec_ac.ac_if /* network-visible interface */
-#define ec_addr ec_ac.ac_enaddr /* hardware Ethernet address */
+ struct arpcom arpcom; /* Ethernet common part */
+#define ec_if arpcom.ac_if /* network-visible interface */
+#define ec_addr arpcom.ac_enaddr /* hardware Ethernet address */
u_char ec_flags; /* software state */
#define EC_RUNNING 0x01
u_char ec_flags; /* software state */
#define EC_RUNNING 0x01
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
- ina->x_host = *(union ns_host *)(sc->ns_addr);
+ ina->x_host =
+ *(union ns_host *)(sc->arpcom.ac_enaddr);
else {
/*
* The manual says we can't change the address
else {
/*
* The manual says we can't change the address
*/
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t)ina->x_host.c_host,
*/
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t)ina->x_host.c_host,
- (caddr_t)sc->ns_addr, sizeof(sc->ns_addr));
+ (caddr_t)sc->arpcom.ac_enaddr,
+ sizeof(sc->arpcom.ac_enaddr));
}
ec_init(ifp->if_unit); /* does ne_setaddr() */
break;
}
ec_init(ifp->if_unit); /* does ne_setaddr() */
break;
- register struct arpcom.ac_enaddr *ina = &(IA_SNS(ifa)->sns_addr);
+ register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
- ina->x_host = *(union ns_host *)(is->arpcom.ac_enaddr);
+ ina->x_host =
+ *(union ns_host *)(is->arpcom.ac_enaddr);
*/
bcopy((caddr_t)ina->x_host.c_host,
*/
bcopy((caddr_t)ina->x_host.c_host,
- (caddr_t)is->arpcom.ac_enaddr, sizeof(is->arpcom.ac_enaddr));
+ (caddr_t)is->arpcom.ac_enaddr,
+ sizeof(is->arpcom.ac_enaddr));
* Ethernet software status per interface.
*
* Each interface is referenced by a network interface structure,
* Ethernet software status per interface.
*
* Each interface is referenced by a network interface structure,
- * ns_if, which the routing code uses to locate the interface.
+ * arpcom.ac_if, which the routing code uses to locate the interface.
* This structure contains the output queue for the interface, its address, ...
*/
struct ne_softc {
* This structure contains the output queue for the interface, its address, ...
*/
struct ne_softc {
- struct arpcom ns_ac; /* Ethernet common part */
-#define ns_if ns_ac.ac_if /* network-visible interface */
-#define ns_addr ns_ac.ac_enaddr /* hardware Ethernet address */
+ struct arpcom arpcom; /* Ethernet common part */
int ns_flags;
#define DSF_LOCK 1 /* block re-entering enstart */
int ns_oactive ;
int ns_flags;
#define DSF_LOCK 1 /* block re-entering enstart */
int ns_oactive ;
nefetch (ns, (caddr_t)boarddata, 0, sizeof(boarddata));
for(i=0; i < 6; i++)
nefetch (ns, (caddr_t)boarddata, 0, sizeof(boarddata));
for(i=0; i < 6; i++)
- ns->ns_addr[i] = boarddata[i];
+ ns->arpcom.ac_enaddr[i] = boarddata[i];
{
int unit = dvp->id_unit;
register struct ne_softc *ns = &ne_softc[unit];
{
int unit = dvp->id_unit;
register struct ne_softc *ns = &ne_softc[unit];
- register struct ifnet *ifp = &ns->ns_if;
+ register struct ifnet *ifp = &ns->arpcom.ac_if;
ifp->if_unit = unit;
ifp->if_name = nedriver.name ;
ifp->if_mtu = ETHERMTU;
ifp->if_unit = unit;
ifp->if_name = nedriver.name ;
ifp->if_mtu = ETHERMTU;
- printf ("ne%d: address %s", unit, ether_sprintf(ns->ns_addr)) ;
+ printf ("ne%d: address %s", unit, ether_sprintf(ns->arpcom.ac_enaddr));
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS;
ifp->if_init = neinit;
ifp->if_output = ether_output;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS;
ifp->if_init = neinit;
ifp->if_output = ether_output;
int unit;
{
register struct ne_softc *ns = &ne_softc[unit];
int unit;
{
register struct ne_softc *ns = &ne_softc[unit];
- struct ifnet *ifp = &ns->ns_if;
+ struct ifnet *ifp = &ns->arpcom.ac_if;
int s;
int i; char *cp;
register nec = ns->ns_port;
int s;
int i; char *cp;
register nec = ns->ns_port;
/* set physical address on ethernet */
outb (nec+ds_cmd, DSCM_NODMA|DSCM_PG1|DSCM_STOP);
/* set physical address on ethernet */
outb (nec+ds_cmd, DSCM_NODMA|DSCM_PG1|DSCM_STOP);
- for (i=0 ; i < 6 ; i++) outb(nec+ds1_par0+i,ns->ns_addr[i]);
+ for (i=0 ; i < 6 ; i++) outb(nec+ds1_par0+i,ns->arpcom.ac_enaddr[i]);
/* clr logical address hash filter for now */
for (i=0 ; i < 8 ; i++) outb(nec+ds1_mar0+i,0xff);
/* clr logical address hash filter for now */
for (i=0 ; i < 8 ; i++) outb(nec+ds1_mar0+i,0xff);
outb(nec+ds0_dcr, ns->ns_mode);
outb (nec+ds0_imr, 0xff);
outb(nec+ds0_dcr, ns->ns_mode);
outb (nec+ds0_imr, 0xff);
- ns->ns_if.if_flags |= IFF_RUNNING;
+ ns->arpcom.ac_if.if_flags |= IFF_RUNNING;
ns->ns_flags &= ~DSF_LOCK;
ns->ns_oactive = 0; ns->ns_mask = ~0;
nestart(ifp);
ns->ns_flags &= ~DSF_LOCK;
ns->ns_oactive = 0; ns->ns_mask = ~0;
nestart(ifp);
if (inb(nec+ds_cmd) & DSCM_TRANS)
return;
if (inb(nec+ds_cmd) & DSCM_TRANS)
return;
- if ((ns->ns_if.if_flags & IFF_RUNNING) == 0)
+ if ((ns->arpcom.ac_if.if_flags & IFF_RUNNING) == 0)
- IF_DEQUEUE(&ns->ns_if.if_snd, m);
+ IF_DEQUEUE(&ns->arpcom.ac_if.if_snd, m);
(void) inb(nec+ 0xD);
(void) inb(nec + 0xE);
(void) inb(nec + 0xF);
(void) inb(nec+ 0xD);
(void) inb(nec + 0xE);
(void) inb(nec + 0xF);
- ns->ns_if.if_ierrors++;
+ ns->arpcom.ac_if.if_ierrors++;
}
/* We received something; rummage thru tiny ring buffer */
}
/* We received something; rummage thru tiny ring buffer */
if (isr & DSIS_TXE) {
ns->ns_flags &= ~DSF_LOCK;
/* Need to read these registers to clear status */
if (isr & DSIS_TXE) {
ns->ns_flags &= ~DSF_LOCK;
/* Need to read these registers to clear status */
- ns->ns_if.if_collisions += inb(nec+ds0_tbcr0);
- ns->ns_if.if_oerrors++;
+ ns->arpcom.ac_if.if_collisions += inb(nec+ds0_tbcr0);
+ ns->arpcom.ac_if.if_oerrors++;
}
/* Packet Transmitted */
if (isr & DSIS_TX) {
ns->ns_flags &= ~DSF_LOCK;
}
/* Packet Transmitted */
if (isr & DSIS_TX) {
ns->ns_flags &= ~DSF_LOCK;
- ++ns->ns_if.if_opackets;
- ns->ns_if.if_collisions += inb(nec+ds0_tbcr0);
+ ++ns->arpcom.ac_if.if_opackets;
+ ns->arpcom.ac_if.if_collisions += inb(nec+ds0_tbcr0);
}
/* Receiver ovverun? */
}
/* Receiver ovverun? */
/* Any more to send? */
outb (nec+ds_cmd, DSCM_NODMA|DSCM_PG0|DSCM_START);
/* Any more to send? */
outb (nec+ds_cmd, DSCM_NODMA|DSCM_PG0|DSCM_START);
+ nestart(&ns->arpcom.ac_if);
outb (nec+ds_cmd, cmd);
outb (nec+ds0_imr, 0xff);
outb (nec+ds_cmd, cmd);
outb (nec+ds0_imr, 0xff);
- ns->ns_if.if_ipackets++;
+ ns->arpcom.ac_if.if_ipackets++;
len = ns->ns_ph.pr_sz0 + (ns->ns_ph.pr_sz1<<8);
if(len < ETHER_MIN_LEN || len > ETHER_MAX_LEN)
return;
len = ns->ns_ph.pr_sz0 + (ns->ns_ph.pr_sz1<<8);
if(len < ETHER_MIN_LEN || len > ETHER_MAX_LEN)
return;
* information to be at the front, but we still have to drop
* the type and length which are at the front of any trailer data.
*/
* information to be at the front, but we still have to drop
* the type and length which are at the front of any trailer data.
*/
- m = neget(buf, len, off, &ns->ns_if);
+ m = neget(buf, len, off, &ns->arpcom.ac_if);
- ether_input(&ns->ns_if, eh, m);
+ ether_input(&ns->arpcom.ac_if, eh, m);
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
- ina->x_host = *(union ns_host *)(ns->ns_addr);
+ ina->x_host =
+ *(union ns_host *)(ns->arpcom.ac_enaddr);
else {
/*
* The manual says we can't change the address
else {
/*
* The manual says we can't change the address
*/
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t)ina->x_host.c_host,
*/
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t)ina->x_host.c_host,
- (caddr_t)ns->ns_addr, sizeof(ns->ns_addr));
+ (caddr_t)ns->arpcom.ac_enaddr,
+ sizeof(ns->arpcom.ac_enaddr));
}
neinit(ifp->if_unit); /* does ne_setaddr() */
break;
}
neinit(ifp->if_unit); /* does ne_setaddr() */
break;
#ifdef notdef
case SIOCGHWADDR:
#ifdef notdef
case SIOCGHWADDR:
- bcopy((caddr_t)ns->ns_addr, (caddr_t) &ifr->ifr_data,
- sizeof(ns->ns_addr));
+ bcopy((caddr_t)ns->arpcom.ac_enaddr, (caddr_t) &ifr->ifr_data,
+ sizeof(ns->arpcom.ac_enaddr));
* we_attach enhanced with link level address by Rodney W. Grimes, 1/30/93
*
* $Log: if_we.c,v $
* we_attach enhanced with link level address by Rodney W. Grimes, 1/30/93
*
* $Log: if_we.c,v $
+ * Revision 1.4 1993/08/24 00:15:31 rgrimes
+ * Fixed the printf's for ethernet address so that ALL ethernet drivers are
+ * consistent in the format of this.
+ *
* Revision 1.3 1993/08/22 22:54:56 ats
* Added a new-line in the output of the ethernet-address that it gets
* on it's line alone ( not mangled with the FPU detection ).
* Revision 1.3 1993/08/22 22:54:56 ats
* Added a new-line in the output of the ethernet-address that it gets
* on it's line alone ( not mangled with the FPU detection ).
* This structure contains the output queue for the interface, its address, ...
*/
struct we_softc {
* This structure contains the output queue for the interface, its address, ...
*/
struct we_softc {
- struct arpcom we_ac; /* Ethernet common part */
-#define we_if we_ac.ac_if /* network-visible interface */
-#define we_addr we_ac.ac_enaddr /* hardware Ethernet address */
+ struct arpcom arpcom; /* Ethernet common part */
u_char we_flags; /* software state */
#define WDF_RUNNING 0x01
u_char we_flags; /* software state */
#define WDF_RUNNING 0x01
* Save board ROM station address
*/
for (i = 0; i < ETHER_ADDR_LEN; ++i)
* Save board ROM station address
*/
for (i = 0; i < ETHER_ADDR_LEN; ++i)
- sc->we_addr[i] = inb(sc->we_io_ctl_addr + WD_ROM_OFFSET + i);
+ sc->arpcom.ac_enaddr[i] = inb(sc->we_io_ctl_addr + WD_ROM_OFFSET + i);
/*
* Mapin interface memory, setup memory select register
/*
* Mapin interface memory, setup memory select register
struct isa_device *is;
{
register struct we_softc *sc = &we_softc[is->id_unit];
struct isa_device *is;
{
register struct we_softc *sc = &we_softc[is->id_unit];
- register struct ifnet *ifp = &sc->we_if;
+ register struct ifnet *ifp = &sc->arpcom.ac_if;
union we_command wecmd;
struct ifaddr *ifa;
struct sockaddr_dl *sdl;
union we_command wecmd;
struct ifaddr *ifa;
struct sockaddr_dl *sdl;
sdl->sdl_type = IFT_ETHER;
sdl->sdl_alen = ETHER_ADDR_LEN;
sdl->sdl_slen = 0;
sdl->sdl_type = IFT_ETHER;
sdl->sdl_alen = ETHER_ADDR_LEN;
sdl->sdl_slen = 0;
- bcopy(sc->we_addr, LLADDR(sdl), ETHER_ADDR_LEN);
+ bcopy(sc->arpcom.ac_enaddr, LLADDR(sdl), ETHER_ADDR_LEN);
printf("we%d: %s address %s\n",
is->id_unit,
(sc->we_type & WD_ETHERNET) ? "ethernet" : "starlan",
printf("we%d: %s address %s\n",
is->id_unit,
(sc->we_type & WD_ETHERNET) ? "ethernet" : "starlan",
- ether_sprintf(sc->we_addr));
+ ether_sprintf(sc->arpcom.ac_enaddr));
int unit;
{
register struct we_softc *sc = &we_softc[unit];
int unit;
{
register struct we_softc *sc = &we_softc[unit];
- register struct ifnet *ifp = &sc->we_if;
+ register struct ifnet *ifp = &sc->arpcom.ac_if;
union we_command wecmd;
int i, s;
union we_command wecmd;
int i, s;
wecmd.cs_ps = 1;
outb(sc->we_io_nic_addr + WD_P0_COMMAND, wecmd.cs_byte);
for (i = 0; i < ETHER_ADDR_LEN; ++i)
wecmd.cs_ps = 1;
outb(sc->we_io_nic_addr + WD_P0_COMMAND, wecmd.cs_byte);
for (i = 0; i < ETHER_ADDR_LEN; ++i)
- outb(sc->we_io_nic_addr + WD_P1_PAR0 + i, sc->we_addr[i]);
+ outb(sc->we_io_nic_addr + WD_P1_PAR0 + i, sc->arpcom.ac_enaddr[i]);
for (i = 0; i < ETHER_ADDR_LEN; ++i) /* == broadcast addr */
outb(sc->we_io_nic_addr + WD_P1_MAR0 + i, 0xff);
outb(sc->we_io_nic_addr + WD_P1_CURR, WD_TXBUF_SIZE);
for (i = 0; i < ETHER_ADDR_LEN; ++i) /* == broadcast addr */
outb(sc->we_io_nic_addr + WD_P1_MAR0 + i, 0xff);
outb(sc->we_io_nic_addr + WD_P1_CURR, WD_TXBUF_SIZE);
wecmd.cs_rd = 0x4;
outb(sc->we_io_nic_addr + WD_P1_COMMAND, wecmd.cs_byte);
#if NBPFILTER > 0
wecmd.cs_rd = 0x4;
outb(sc->we_io_nic_addr + WD_P1_COMMAND, wecmd.cs_byte);
#if NBPFILTER > 0
- if (sc->we_if.if_flags & IFF_PROMISC) {
+ if (sc->arpcom.ac_if.if_flags & IFF_PROMISC) {
outb(sc->we_io_nic_addr + WD_P0_RCR,
WD_R_PRO | WD_R_SEP | WD_R_AR | WD_R_CONFIG);
} else
outb(sc->we_io_nic_addr + WD_P0_RCR,
WD_R_PRO | WD_R_SEP | WD_R_AR | WD_R_CONFIG);
} else
(void) splx(s);
return;
}
(void) splx(s);
return;
}
- IF_DEQUEUE(&sc->we_if.if_snd, m);
+ IF_DEQUEUE(&sc->arpcom.ac_if.if_snd, m);
if (m == 0) {
(void) splx(s);
return;
if (m == 0) {
(void) splx(s);
return;
outb(sc->we_io_nic_addr + WD_P0_TBCR1, len >> 8);
wecmd.cs_txp = 1;
outb(sc->we_io_nic_addr + WD_P0_COMMAND, wecmd.cs_byte);
outb(sc->we_io_nic_addr + WD_P0_TBCR1, len >> 8);
wecmd.cs_txp = 1;
outb(sc->we_io_nic_addr + WD_P0_COMMAND, wecmd.cs_byte);
- sc->we_if.if_timer = 3;
+ sc->arpcom.ac_if.if_timer = 3;
/* transmit error */
if (weisr.is_txe) {
/* need to read these registers to clear status */
/* transmit error */
if (weisr.is_txe) {
/* need to read these registers to clear status */
- sc->we_if.if_collisions +=
+ sc->arpcom.ac_if.if_collisions +=
inb(sc->we_io_nic_addr + WD_P0_TBCR0);
inb(sc->we_io_nic_addr + WD_P0_TBCR0);
- ++sc->we_if.if_oerrors;
+ ++sc->arpcom.ac_if.if_oerrors;
(void) inb(sc->we_io_nic_addr + 0xD);
(void) inb(sc->we_io_nic_addr + 0xE);
(void) inb(sc->we_io_nic_addr + 0xF);
(void) inb(sc->we_io_nic_addr + 0xD);
(void) inb(sc->we_io_nic_addr + 0xE);
(void) inb(sc->we_io_nic_addr + 0xF);
- ++sc->we_if.if_ierrors;
+ ++sc->arpcom.ac_if.if_ierrors;
}
/* normal transmit complete */
}
/* normal transmit complete */
werint (unit);
/* try to start transmit */
werint (unit);
/* try to start transmit */
+ westart(&sc->arpcom.ac_if);
/* re-enable onboard interrupts */
wecmd.cs_byte = inb(sc->we_io_nic_addr + WD_P0_COMMAND);
/* re-enable onboard interrupts */
wecmd.cs_byte = inb(sc->we_io_nic_addr + WD_P0_COMMAND);
* Do some statistics (assume page zero of NIC mapped in)
*/
sc->we_flags &= ~WDF_TXBUSY;
* Do some statistics (assume page zero of NIC mapped in)
*/
sc->we_flags &= ~WDF_TXBUSY;
- sc->we_if.if_timer = 0;
- ++sc->we_if.if_opackets;
- sc->we_if.if_collisions += inb(sc->we_io_nic_addr + WD_P0_TBCR0);
+ sc->arpcom.ac_if.if_timer = 0;
+ ++sc->arpcom.ac_if.if_opackets;
+ sc->arpcom.ac_if.if_collisions += inb(sc->we_io_nic_addr + WD_P0_TBCR0);
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
- ina->x_host = *(union ns_host *)(sc->ns_addr);
+ ina->x_host =
+ *(union ns_host *)(sc->arpcom.ac_enaddr);
else {
/*
* The manual says we cant change the address
else {
/*
* The manual says we cant change the address
*/
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t)ina->x_host.c_host,
*/
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t)ina->x_host.c_host,
- (caddr_t)sc->ns_addr, sizeof(sc->ns_addr));
+ (caddr_t)sc->arpcom.ac_enaddr,
+ sizeof(sc->arpcom.ac_enaddr));
}
weinit(ifp->if_unit); /* does ne_setaddr() */
break;
}
weinit(ifp->if_unit); /* does ne_setaddr() */
break;
(ifp->if_flags & IFF_RUNNING) == 0)
weinit(ifp->if_unit);
#if NBPFILTER > 0
(ifp->if_flags & IFF_RUNNING) == 0)
weinit(ifp->if_unit);
#if NBPFILTER > 0
- if (sc->we_if.if_flags & IFF_PROMISC) {
+ if (sc->arpcom.ac_if.if_flags & IFF_PROMISC) {
outb(sc->we_io_nic_addr + WD_P0_RCR,
WD_R_PRO | WD_R_SEP | WD_R_AR | WD_R_CONFIG);
} else
outb(sc->we_io_nic_addr + WD_P0_RCR,
WD_R_PRO | WD_R_SEP | WD_R_AR | WD_R_CONFIG);
} else
* Rewrite ethernet address, and then force restart of NIC
*/
for (i = 0; i < ETHER_ADDR_LEN; i++)
* Rewrite ethernet address, and then force restart of NIC
*/
for (i = 0; i < ETHER_ADDR_LEN; i++)
- sc->we_addr[i] = physaddr[i];
+ sc->arpcom.ac_enaddr[i] = physaddr[i];
sc->we_flags &= ~WDF_RUNNING;
weinit(unit);
}
sc->we_flags &= ~WDF_RUNNING;
weinit(unit);
}
u_short trail_residual;
} trailer_header;
u_short trail_residual;
} trailer_header;
- ++sc->we_if.if_ipackets;
+ ++sc->arpcom.ac_if.if_ipackets;
/* Allocate a header mbuf */
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == 0)
goto bad;
/* Allocate a header mbuf */
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == 0)
goto bad;
- m->m_pkthdr.rcvif = &sc->we_if;
+ m->m_pkthdr.rcvif = &sc->arpcom.ac_if;
m->m_pkthdr.len = len;
m->m_len = 0;
head = m;
m->m_pkthdr.len = len;
m->m_len = 0;
head = m;
*
* XXX This test does not support multicasts.
*/
*
* XXX This test does not support multicasts.
*/
- if ((sc->we_if.if_flags & IFF_PROMISC) &&
- bcmp(eh->ether_dhost, sc->we_addr,
+ if ((sc->arpcom.ac_if.if_flags & IFF_PROMISC) &&
+ bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
sizeof(eh->ether_dhost)) != 0 &&
bcmp(eh->ether_dhost, etherbroadcastaddr,
sizeof(eh->ether_dhost)) != 0) {
sizeof(eh->ether_dhost)) != 0 &&
bcmp(eh->ether_dhost, etherbroadcastaddr,
sizeof(eh->ether_dhost)) != 0) {
*/
eh->ether_type = ntohs(eh->ether_type);
*/
eh->ether_type = ntohs(eh->ether_type);
- ether_input(&sc->we_if, eh, head);
+ ether_input(&sc->arpcom.ac_if, eh, head);