X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/8daa518218aeb8ff6d11322d23262b95ae772ec9..4a404244ad5a6e8679d302ed44ecc61cac172725:/usr/src/sys/vax/if/if_ec.c diff --git a/usr/src/sys/vax/if/if_ec.c b/usr/src/sys/vax/if/if_ec.c index ad3a440c38..3aa5f69b5c 100644 --- a/usr/src/sys/vax/if/if_ec.c +++ b/usr/src/sys/vax/if/if_ec.c @@ -1,4 +1,4 @@ -/* if_ec.c 4.8 82/05/20 */ +/* if_ec.c 4.12 82/05/27 */ #include "ec.h" #include "imp.h" @@ -39,6 +39,7 @@ struct uba_device *ecinfo[NEC]; u_short ecstd[] = { 0 }; struct uba_driver ecdriver = { ecprobe, 0, ecattach, 0, ecstd, "ec", ecinfo }; +u_char ec_iltop[3] = { 0x02, 0x07, 0x01 }; #define ECUNIT(x) minor(x) int ecinit(),ecoutput(),ecreset(); @@ -161,12 +162,10 @@ COUNT(ECATTACH); } cp++; } -#ifdef notdef printf("ec%d: addr=%x:%x:%x:%x:%x:%x\n", ui->ui_unit, es->es_enaddr[0]&0xff, es->es_enaddr[1]&0xff, es->es_enaddr[2]&0xff, es->es_enaddr[3]&0xff, es->es_enaddr[4]&0xff, es->es_enaddr[5]&0xff); -#endif es->es_if.if_host[0] = ((es->es_enaddr[3]&0xff)<<16) | ((es->es_enaddr[4]&0xff)<<8) | (es->es_enaddr[5]&0xff); sin = (struct sockaddr_in *)&es->es_if.if_addr; @@ -187,7 +186,7 @@ COUNT(ECATTACH); #if NIMP == 0 /* here's one for you john baby.... */ if (ui->ui_flags &~ 0xff) - eclhinit((ui->ui_flags &~ 0xff) | 0x0a); + eclhinit(&es->es_if, (ui->ui_flags &~ 0xff) | 0x0a); #endif } @@ -272,9 +271,6 @@ COUNT(ECSTART); es->es_oactive = 0; return; } -#ifdef notdef - dest = mtod(m, struct ec_header *)->ec_dhost; /* wrong! */ -#endif ecput(es->es_buf[ECTBF], m); restart: @@ -313,8 +309,9 @@ COUNT(ECXINT); 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_if.if_snd.ifq_head == 0) { return; + } ecstart(unit); } @@ -401,9 +398,6 @@ ecrint(unit) struct ecdevice *addr = (struct ecdevice *)ecinfo[unit]->ui_addr; COUNT(ECRINT); -#ifdef notdef - printf("ec%d: ecrint:%d\n", unit, addr->ec_rcr & 0xf); -#endif while (addr->ec_rcr & EC_RDONE) ecread(unit); } @@ -597,10 +591,16 @@ gottype: for (i=0; i<6; i++) ec->ec_dhost[i] = 0xff; else { - ec->ec_dhost[0] = es->es_enaddr[0]; - ec->ec_dhost[1] = es->es_enaddr[1]; - ec->ec_dhost[2] = es->es_enaddr[2]; - ec->ec_dhost[3] = (dest>>8) & 0xff; + if (dest & 0x8000) { + ec->ec_dhost[0] = ec_iltop[0]; + ec->ec_dhost[1] = ec_iltop[1]; + ec->ec_dhost[2] = ec_iltop[2]; + } else { + ec->ec_dhost[0] = es->es_enaddr[0]; + ec->ec_dhost[1] = es->es_enaddr[1]; + ec->ec_dhost[2] = es->es_enaddr[2]; + } + ec->ec_dhost[3] = (dest>>8) & 0x7f; ec->ec_dhost[4] = (dest>>16) & 0xff; ec->ec_dhost[5] = (dest>>24) & 0xff; } @@ -655,7 +655,19 @@ COUNT(ECPUT); mp = m; while (mp) { mcp = mtod(mp, char *); + i = 0; + if ((int)bp&1) { + *bp++ = *mcp++; + i++; + } for (i=0; im_len; i++) + while (i < mp->m_len) { + *(short *)bp = *(short *)mcp; + bp += 2; + mcp += 2; + i += 2; + } + if (mp->m_len&1) *bp++ = *mcp++; mp = m_free(mp); } @@ -666,6 +678,9 @@ COUNT(ECPUT); /* * Routine to copy from UNIBUS memory into mbufs. * Similar in spirit to if_rubaget. + * + * Warning: This makes the fairly safe assumption that + * mbufs have even lengths. */ struct mbuf * ecget(ecbuf, totlen, off0) @@ -707,7 +722,12 @@ COUNT(ECGET); m->m_off = MMINOFF; } mcp = mtod(m, char *); - for (i=0; im_next; @@ -738,15 +758,15 @@ bad: */ struct ifnet eclhif; -int eclhoutput(); +int looutput(); /* * Called by localnet interface to allow logical - * host interface to "attach". Nothing should ever - * be sent locally to this interface, it's purpose + * host interface to "attach", it's purpose * is simply to establish the host's arpanet address. */ -eclhinit(addr) +eclhinit(ecifp, addr) + struct ifnet *ecifp; int addr; { register struct ifnet *ifp = &eclhif; @@ -758,20 +778,12 @@ COUNT(ECLHINIT); sin = (struct sockaddr_in *)&ifp->if_addr; sin->sin_family = AF_INET; sin->sin_addr.s_addr = addr; + sin->sin_addr.s_lh = ecifp->if_host[0]; ifp->if_net = sin->sin_addr.s_net; - ifp->if_flags = IFF_UP; - ifp->if_output = eclhoutput; /* should never be used */ + ifp->if_dstaddr = ifp->if_addr; + ifp->if_flags = IFF_UP|IFF_POINTOPOINT; + ifp->if_output = looutput; if_attach(ifp); -} - -eclhoutput(ifp, m0, dst) - struct ifnet *ifp; - struct mbuf *m0; - struct sockaddr *dst; -{ -COUNT(ECLHOUTPUT); - ifp->if_oerrors++; - m_freem(m0); - return (0); + rtinit(&ifp->if_addr, &ifp->if_addr, RTF_UP|RTF_DIRECT|RTF_HOST); } #endif