X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/89413846a67eb48a590d13af133be7769fb201a4..9d1b03e0b0d8de0d8cd79df577a84283a20631eb:/usr/src/sys/vax/if/if_en.c diff --git a/usr/src/sys/vax/if/if_en.c b/usr/src/sys/vax/if/if_en.c index 5742a7ef12..1b047ba808 100644 --- a/usr/src/sys/vax/if/if_en.c +++ b/usr/src/sys/vax/if/if_en.c @@ -1,4 +1,4 @@ -/* if_en.c 4.23 81/12/20 */ +/* if_en.c 4.34 82/02/21 */ #include "en.h" @@ -101,11 +101,18 @@ COUNT(ENATTACH); es->es_if.if_net = ui->ui_flags; es->es_if.if_host[0] = (~(((struct endevice *)eninfo[ui->ui_unit]->ui_addr)->en_addr)) & 0xff; +#ifdef ENKLUDGE + if (es->es_if.if_net == 10) { + es->es_if.if_host[0] <<= 16; + es->es_if.if_host[0] |= 0x4e; + } +#endif es->es_if.if_addr = if_makeaddr(es->es_if.if_net, es->es_if.if_host[0]); es->es_if.if_init = eninit; es->es_if.if_output = enoutput; es->es_if.if_ubareset = enreset; + es->es_ifuba.ifu_flags = UBA_NEEDBDP | UBA_NEED16; if_attach(&es->es_if); } @@ -139,7 +146,7 @@ eninit(unit) int s; if (if_ubainit(&es->es_ifuba, ui->ui_ubanum, - sizeof (struct en_header), (int)btop(ENMTU)) == 0) { + sizeof (struct en_header), (int)btoc(ENMTU)) == 0) { printf("en%d: can't initialize\n", unit); return; } @@ -244,11 +251,11 @@ COUNT(ENXINT); es->es_if.if_oerrors++; printf("en%d: output error\n", unit); } + if (es->es_ifuba.ifu_xtofree) { + m_freem(es->es_ifuba.ifu_xtofree); + es->es_ifuba.ifu_xtofree = 0; + } if (es->es_if.if_snd.ifq_head == 0) { - if (es->es_ifuba.ifu_xtofree) { - m_freem(es->es_ifuba.ifu_xtofree); - es->es_ifuba.ifu_xtofree = 0; - } es->es_lastx = 0; return; } @@ -288,6 +295,7 @@ COUNT(ENCOLLIDE); enstart(unit); } +int enprintierrors; /* * Ethernet interface receiver interrupt. * If input error just drop packet. @@ -317,6 +325,7 @@ COUNT(ENRINT); UBAPURGE(es->es_ifuba.ifu_uba, es->es_ifuba.ifu_r.ifrw_bdp); if (addr->en_istat&EN_IERROR) { es->es_if.if_ierrors++; + if (enprintierrors) printf("en%d: input error\n", unit); goto setup; } @@ -401,6 +410,7 @@ enoutput(ifp, m0, pf) register struct en_header *en; int s; +COUNT(ENOUTPUT); switch (pf) { #ifdef INET @@ -408,8 +418,13 @@ enoutput(ifp, m0, pf) register struct ip *ip = mtod(m0, struct ip *); int off; +#ifndef ENKLUDGE dest = ip->ip_dst.s_addr >> 24; +#else + dest = (ip->ip_dst.s_addr >> 8) & 0xff; +#endif off = ntohs((u_short)ip->ip_len) - m->m_len; +#ifndef ENKLUDGE if (off > 0 && (off & 0x1ff) == 0 && m->m_off >= MMINOFF + 2) { type = ENPUP_TRAIL + (off>>9); m->m_off -= 2; @@ -417,6 +432,7 @@ enoutput(ifp, m0, pf) *mtod(m, u_short *) = ENPUP_IPTYPE; goto gottrailertype; } +#endif type = ENPUP_IPTYPE; off = 0; goto gottype; @@ -448,7 +464,7 @@ gottype: */ if (m->m_off > MMAXOFF || MMINOFF + sizeof (struct en_header) > m->m_off) { - m = m_get(0); + m = m_get(M_DONTWAIT); if (m == 0) { m_freem(m0); return (0);