for LLC2/2, there may be many pkp's to one xcp;
authorKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Thu, 30 May 1991 10:20:12 +0000 (02:20 -0800)
committerKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Thu, 30 May 1991 10:20:12 +0000 (02:20 -0800)
so stuff pkp in m_pkthdr.rcvif, and change conventions for pk_ctlinput to get pkp

SCCS-vsn: sys/netccitt/hd_var.h 7.4
SCCS-vsn: sys/netccitt/hd_subr.c 7.6
SCCS-vsn: sys/netccitt/hd_input.c 7.7
SCCS-vsn: sys/netccitt/hd_output.c 7.6
SCCS-vsn: sys/netccitt/hd_timer.c 7.4

usr/src/sys/netccitt/hd_input.c
usr/src/sys/netccitt/hd_output.c
usr/src/sys/netccitt/hd_subr.c
usr/src/sys/netccitt/hd_timer.c
usr/src/sys/netccitt/hd_var.h

index 8b9d22c..ed76f17 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)hd_input.c  7.6 (Berkeley) %G%
+ *     @(#)hd_input.c  7.7 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -136,7 +136,7 @@ register struct mbuf *fbuf;
                hdp->hd_state = ABM;
                hd_message (hdp, "Link level operational");
                /* Notify the packet level - to send RESTART. */
                hdp->hd_state = ABM;
                hd_message (hdp, "Link level operational");
                /* Notify the packet level - to send RESTART. */
-               (void) pk_ctlinput (PRC_LINKUP, hdp->hd_xcp);
+               (void) pk_ctlinput (PRC_LINKUP, hdp->hd_pkp);
                break;
 
        case SABM + SABM_SENT: 
                break;
 
        case SABM + SABM_SENT: 
@@ -155,7 +155,7 @@ register struct mbuf *fbuf;
                hd_flush (hdp->hd_ifp);
                hd_writeinternal (hdp, UA, pf);
                hd_initvars (hdp);
                hd_flush (hdp->hd_ifp);
                hd_writeinternal (hdp, UA, pf);
                hd_initvars (hdp);
-               (void) pk_ctlinput (PRC_LINKRESET, hdp->hd_xcp);
+               (void) pk_ctlinput (PRC_LINKRESET, hdp->hd_pkp);
                hdp->hd_resets++;
                break;
 
                hdp->hd_resets++;
                break;
 
@@ -168,7 +168,7 @@ register struct mbuf *fbuf;
 #ifdef HDLCDEBUG
                hd_dumptrace (hdp);
 #endif
 #ifdef HDLCDEBUG
                hd_dumptrace (hdp);
 #endif
-               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_xcp);
+               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_pkp);
                hd_flush (hdp->hd_ifp);
        case DM + DM_SENT: 
        case DM + WAIT_SABM: 
                hd_flush (hdp->hd_ifp);
        case DM + DM_SENT: 
        case DM + WAIT_SABM: 
@@ -196,7 +196,7 @@ register struct mbuf *fbuf;
 
        case DISC + ABM: 
                hd_message (hdp, "DISC received: link down");
 
        case DISC + ABM: 
                hd_message (hdp, "DISC received: link down");
-               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_xcp);
+               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_pkp);
        case DISC + WAIT_SABM: 
                hd_writeinternal (hdp, UA, pf);
                hdp->hd_state = DM_SENT;
        case DISC + WAIT_SABM: 
                hd_writeinternal (hdp, UA, pf);
                hdp->hd_state = DM_SENT;
@@ -205,7 +205,7 @@ register struct mbuf *fbuf;
 
        case UA + ABM: 
                hd_message (hdp, "UA received: link down");
 
        case UA + ABM: 
                hd_message (hdp, "UA received: link down");
-               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_xcp);
+               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_pkp);
        case UA + WAIT_SABM: 
                hd_writeinternal (hdp, DM, pf);
                hdp->hd_state = DM_SENT;
        case UA + WAIT_SABM: 
                hd_writeinternal (hdp, DM, pf);
                hdp->hd_state = DM_SENT;
@@ -226,7 +226,7 @@ register struct mbuf *fbuf;
 
        case FRMR + ABM: 
                hd_message (hdp, "FRMR received: link down");
 
        case FRMR + ABM: 
                hd_message (hdp, "FRMR received: link down");
-               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_xcp);
+               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_pkp);
 #ifdef HDLCDEBUG
                hd_dumptrace (hdp);
 #endif
 #ifdef HDLCDEBUG
                hd_dumptrace (hdp);
 #endif
@@ -272,7 +272,7 @@ register struct mbuf *fbuf;
 
        case ILLEGAL + ABM: 
                hd_message (hdp, "Unknown frame received: link down");
 
        case ILLEGAL + ABM: 
                hd_message (hdp, "Unknown frame received: link down");
-               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_xcp);
+               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_pkp);
        case ILLEGAL + WAIT_SABM:
                hdp->hd_unknown++;
 #ifdef HDLCDEBUG
        case ILLEGAL + WAIT_SABM:
                hdp->hd_unknown++;
 #ifdef HDLCDEBUG
@@ -341,8 +341,8 @@ register struct Hdlc_iframe *frame;
         *  it is queued for the packet level.
         */
 
         *  it is queued for the packet level.
         */
 
-       if (ns != (hdp->hd_lasttxnr + hdp->hd_xcp->xc_lwsize) % MODULUS) {
-               hdp->hd_vr = (hdp->hd_vr + 1) % MODULUS;
+       if (ns != (hdp -> hd_lasttxnr + hdp -> hd_xcp -> xc_lwsize) % MODULUS) {
+               hdp -> hd_vr = (hdp -> hd_vr + 1) % MODULUS;
                if (pf == 1) {
                        /* Must generate a RR or RNR with final bit on. */
                        hd_writeinternal (hdp, RR, POLLON);
                if (pf == 1) {
                        /* Must generate a RR or RNR with final bit on. */
                        hd_writeinternal (hdp, RR, POLLON);
@@ -358,6 +358,7 @@ register struct Hdlc_iframe *frame;
                fbuf -> m_data += HDHEADERLN;
                fbuf -> m_len -= HDHEADERLN;
                fbuf -> m_pkthdr.len -= HDHEADERLN;
                fbuf -> m_data += HDHEADERLN;
                fbuf -> m_len -= HDHEADERLN;
                fbuf -> m_pkthdr.len -= HDHEADERLN;
+               fbuf -> m_pkthdr.rcvif = (struct ifnet *)hdp -> hd_pkp;
 #ifdef BSD4_3
                fbuf->m_act = 0;        /* probably not necessary */
 #else
 #ifdef BSD4_3
                fbuf->m_act = 0;        /* probably not necessary */
 #else
@@ -369,7 +370,7 @@ register struct Hdlc_iframe *frame;
                        m -> m_act = (struct mbuf *) 1;
                }
 #endif
                        m -> m_act = (struct mbuf *) 1;
                }
 #endif
-               pk_input (fbuf, hdp->hd_xcp);
+               pk_input (fbuf);
                queued = TRUE;
                hd_start (hdp);
        } else {
                queued = TRUE;
                hd_start (hdp);
        } else {
index ef17e5a..7cc2978 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)hd_output.c 7.5 (Berkeley) %G%
+ *     @(#)hd_output.c 7.6 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -216,6 +216,6 @@ register struct hdcb *hdp;
                hdp->hd_state = WAIT_UA;
                SET_TIMER (hdp);
                hd_message (hdp, "Timer recovery failed: link down");
                hdp->hd_state = WAIT_UA;
                SET_TIMER (hdp);
                hd_message (hdp, "Timer recovery failed: link down");
-               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_xcp);
+               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_pkp);
        }
 }
        }
 }
index 488d0ae..8c0aca6 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)hd_subr.c   7.5 (Berkeley) %G%
+ *     @(#)hd_subr.c   7.6 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -41,6 +41,7 @@ struct sockaddr *addr;
        register struct hdcb *hdp;
        register struct ifaddr *ifa;
        struct ifnet *ifp;
        register struct hdcb *hdp;
        register struct ifaddr *ifa;
        struct ifnet *ifp;
+       caddr_t pk_newlink();
 
        if (addr->sa_family != AF_CCITT)
                return (EAFNOSUPPORT);
 
        if (addr->sa_family != AF_CCITT)
                return (EAFNOSUPPORT);
@@ -62,18 +63,19 @@ struct sockaddr *addr;
                if (hdp == 0)
                        return (ENOBUFS);
                bzero((caddr_t)hdp, sizeof(*hdp));
                if (hdp == 0)
                        return (ENOBUFS);
                bzero((caddr_t)hdp, sizeof(*hdp));
-               if (error = pk_ctlinput (PRC_LINKDOWN, xcp)) {
-                       free((caddr_t)hdp, M_PCB);
-                       return (error);
+               hdp->hd_pkp =
+                       pk_newlink ((struct x25_ifaddr *)ifa, (caddr_t)hdp);
+               if (hdp -> hd_pkp == 0) {
+                       free(hdp, M_PCB);
+                       return (ENOBUFS);
                }
                }
-               hdp->hd_next = hdcbhead;
-               hdcbhead = hdp;
                hdp->hd_ifp = ifp;
                hdp->hd_ifa = ifa;
                hdp->hd_xcp = xcp;
                hdp->hd_state = INIT;
                hdp->hd_output = hd_ifoutput;
                hdp->hd_ifp = ifp;
                hdp->hd_ifa = ifa;
                hdp->hd_xcp = xcp;
                hdp->hd_state = INIT;
                hdp->hd_output = hd_ifoutput;
-               pk_ifattach((struct x25_ifaddr *)ifa, hd_output, (caddr_t)hdp);
+               hdp->hd_next = hdcbhead;
+               hdcbhead = hdp;
        }
 
        switch (prc) {
        }
 
        switch (prc) {
@@ -88,7 +90,7 @@ struct sockaddr *addr;
        case PRC_IFDOWN:
                if (hdp->hd_state == ABM)
                        hd_message (hdp, "Operator shutdown: link closed");
        case PRC_IFDOWN:
                if (hdp->hd_state == ABM)
                        hd_message (hdp, "Operator shutdown: link closed");
-               (void) pk_ctlinput (PRC_LINKDOWN, xcp);
+               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_pkp);
                hd_writeinternal (hdp, DISC, POLLON);
                hdp->hd_state = DISC_SENT;
                SET_TIMER (hdp);
                hd_writeinternal (hdp, DISC, POLLON);
                hdp->hd_state = DISC_SENT;
                SET_TIMER (hdp);
index 4d62f5d..d234346 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)hd_timer.c  7.3 (Berkeley) %G%
+ *     @(#)hd_timer.c  7.4 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -83,7 +83,7 @@ hd_timer ()
                case DM_SENT: 
                        if (++hdp->hd_retxcnt == hd_n2) {
                                /* Notify the packet level. */
                case DM_SENT: 
                        if (++hdp->hd_retxcnt == hd_n2) {
                                /* Notify the packet level. */
-                               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_xcp);
+                               (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_pkp);
                                hdp->hd_retxcnt = 0;
                                hdp->hd_state = SABM_SENT;
                                hd_writeinternal (hdp, SABM, POLLOFF);
                                hdp->hd_retxcnt = 0;
                                hdp->hd_state = SABM_SENT;
                                hd_writeinternal (hdp, SABM, POLLOFF);
index 89e940c..7d4c2bb 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)hd_var.h    7.3 (Berkeley) %G%
+ *     @(#)hd_var.h    7.4 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -46,8 +46,9 @@ struct        hdcb {
        char    hd_dontcopy;    /* if-driver doesn't free I-frames */
        struct  ifnet *hd_ifp;  /* device's network visible interface */
        struct  ifaddr *hd_ifa; /* device's X.25 network address */
        char    hd_dontcopy;    /* if-driver doesn't free I-frames */
        struct  ifnet *hd_ifp;  /* device's network visible interface */
        struct  ifaddr *hd_ifa; /* device's X.25 network address */
+       struct  x25config *hd_xcp;
+       caddr_t hd_pkp;         /* Level III junk */
        int     (*hd_output)(); /* separate entry for HDLC direct output */
        int     (*hd_output)(); /* separate entry for HDLC direct output */
-       struct  x25config *hd_xcp;      /* copy of &hdp->hd_if->if_addr */
 
        /* link statistics */
 
 
        /* link statistics */