typed mbufs
[unix-history] / usr / src / sys / deprecated / netimp / if_imp.c
index 0a138df..0767502 100644 (file)
@@ -1,4 +1,4 @@
-/*     if_imp.c        4.39    82/10/09        */
+/*     if_imp.c        4.45    82/12/14        */
 
 #include "imp.h"
 #if NIMP > 0
 
 #include "imp.h"
 #if NIMP > 0
 #include "../h/buf.h"
 #include "../h/protosw.h"
 #include "../h/socket.h"
 #include "../h/buf.h"
 #include "../h/protosw.h"
 #include "../h/socket.h"
-#include "../h/ubareg.h"
-#include "../h/ubavar.h"
-#include "../h/cpu.h"
-#include "../h/mtpr.h"
 #include "../h/vmmac.h"
 #include "../h/vmmac.h"
-#include "../netinet/in.h"
-#include "../netinet/in_systm.h"
+
+#include "../vax/cpu.h"
+#include "../vax/mtpr.h"
+#include "../vaxuba/ubareg.h"
+#include "../vaxuba/ubavar.h"
+
 #include "../net/if.h"
 #include "../net/if.h"
+#include "../net/route.h"
 #include "../net/netisr.h"
 #include "../net/netisr.h"
+#include "../netinet/in.h"
+#include "../netinet/in_systm.h"
+#include "../netinet/ip.h"
+#include "../netinet/ip_var.h"
 /* define IMPLEADERS here to get leader printing code */
 #include "../netimp/if_imp.h"
 #include "../netimp/if_imphost.h"
 /* define IMPLEADERS here to get leader printing code */
 #include "../netimp/if_imp.h"
 #include "../netimp/if_imphost.h"
-#include "../netinet/ip.h"
-#include "../netinet/ip_var.h"
-#include "../net/route.h"
 #include <errno.h>
 
 /*
 #include <errno.h>
 
 /*
@@ -74,8 +76,9 @@ int   impdown(), impinit(), impoutput();
  * structures.  This is then used by the device's attach routine
  * set up its back pointers. 
  */
  * structures.  This is then used by the device's attach routine
  * set up its back pointers. 
  */
-impattach(ui)
+impattach(ui, reset)
        struct uba_device *ui;
        struct uba_device *ui;
+       int (*reset)();
 {
        struct imp_softc *sc = &imp_softc[ui->ui_unit];
        register struct ifnet *ifp = &sc->imp_if;
 {
        struct imp_softc *sc = &imp_softc[ui->ui_unit];
        register struct ifnet *ifp = &sc->imp_if;
@@ -86,6 +89,7 @@ impattach(ui)
        ifp->if_name = "imp";
        ifp->if_mtu = IMPMTU - sizeof(struct imp_leader);
        ifp->if_net = ui->ui_flags;
        ifp->if_name = "imp";
        ifp->if_mtu = IMPMTU - sizeof(struct imp_leader);
        ifp->if_net = ui->ui_flags;
+       ifp->if_reset = reset;
        /* the host and imp fields will be filled in by the imp */
        sin = (struct sockaddr_in *)&ifp->if_addr;
        sin->sin_family = AF_INET;
        /* the host and imp fields will be filled in by the imp */
        sin = (struct sockaddr_in *)&ifp->if_addr;
        sin->sin_family = AF_INET;
@@ -263,7 +267,8 @@ impinput(unit, m)
        case IMPTYPE_HOSTDEAD:
        case IMPTYPE_HOSTUNREACH: {
                int s = splnet();
        case IMPTYPE_HOSTDEAD:
        case IMPTYPE_HOSTUNREACH: {
                int s = splnet();
-               impnotify(ip->il_mtype, ip, hostlookup(addr));
+               impnotify((int)ip->il_mtype, (struct control_leader *)ip,
+                   hostlookup(addr));
                splx(s);
                goto rawlinkin;
        }
                splx(s);
                goto rawlinkin;
        }
@@ -403,7 +408,7 @@ impoutput(ifp, m0, dst)
 {
        register struct imp_leader *imp;
        register struct mbuf *m = m0;
 {
        register struct imp_leader *imp;
        register struct mbuf *m = m0;
-       int x, dhost, dimp, dlink, len, dnet;
+       int dhost, dimp, dlink, len, dnet;
        int error = 0;
 
        /*
        int error = 0;
 
        /*
@@ -446,7 +451,7 @@ impoutput(ifp, m0, dst)
         */
        if (m->m_off > MMAXOFF ||
            MMINOFF + sizeof(struct imp_leader) > m->m_off) {
         */
        if (m->m_off > MMAXOFF ||
            MMINOFF + sizeof(struct imp_leader) > m->m_off) {
-               m = m_get(M_DONTWAIT);
+               m = m_get(M_DONTWAIT, MT_HEADER);
                if (m == 0) {
                        error = ENOBUFS;
                        goto drop;
                if (m == 0) {
                        error = ENOBUFS;
                        goto drop;
@@ -563,11 +568,10 @@ impnoops(sc)
        register i;
        register struct mbuf *m;
        register struct control_leader *cp;
        register i;
        register struct mbuf *m;
        register struct control_leader *cp;
-       int x;
 
        sc->imp_dropcnt = IMP_DROPCNT;
        for (i = 0; i < IMP_DROPCNT + 1; i++ ) { 
 
        sc->imp_dropcnt = IMP_DROPCNT;
        for (i = 0; i < IMP_DROPCNT + 1; i++ ) { 
-               if ((m = m_getclr(M_DONTWAIT)) == 0) 
+               if ((m = m_getclr(M_DONTWAIT, MT_HEADER)) == 0) 
                        return;
                m->m_len = sizeof(struct control_leader);
                cp = mtod(m, struct control_leader *);
                        return;
                m->m_len = sizeof(struct control_leader);
                cp = mtod(m, struct control_leader *);