projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add ssize_t, required by POSIX 1003.1
[unix-history]
/
usr
/
src
/
sys
/
netccitt
/
hd_input.c
diff --git
a/usr/src/sys/netccitt/hd_input.c
b/usr/src/sys/netccitt/hd_input.c
index
85bc0d5
..
ed76f17
100644
(file)
--- a/
usr/src/sys/netccitt/hd_input.c
+++ b/
usr/src/sys/netccitt/hd_input.c
@@
-9,24
+9,24
@@
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)hd_input.c 7.
3
(Berkeley) %G%
+ * @(#)hd_input.c 7.
7
(Berkeley) %G%
*/
*/
-#include "
../h/
param.h"
-#include "
../h/
systm.h"
-#include "
../h/
mbuf.h"
-#include "
../h/
domain.h"
-#include "
../h/
socket.h"
-#include "
../h/
protosw.h"
-#include "
../h/
errno.h"
-#include "
../h/
time.h"
-#include "
../h/
kernel.h"
+#include "param.h"
+#include "systm.h"
+#include "mbuf.h"
+#include "domain.h"
+#include "socket.h"
+#include "protosw.h"
+#include "errno.h"
+#include "time.h"
+#include "kernel.h"
#include "../net/if.h"
#include "../net/if.h"
-#include "
../netccitt/
hdlc.h"
-#include "
../netccitt/
hd_var.h"
-#include "
../netccitt/
x25.h"
+#include "hdlc.h"
+#include "hd_var.h"
+#include "x25.h"
/*
* HDLC INPUT INTERFACE
/*
* HDLC INPUT INTERFACE
@@
-41,12
+41,13
@@
hdintr ()
register struct hdcb *hdp;
register struct ifnet *ifp;
register int s;
register struct hdcb *hdp;
register struct ifnet *ifp;
register int s;
+ extern struct ifqueue pkintrq;
static struct ifnet *lastifp;
static struct hdcb *lasthdp;
for (;;) {
s = splimp ();
static struct ifnet *lastifp;
static struct hdcb *lasthdp;
for (;;) {
s = splimp ();
- IF_DEQUEUE
IF(&hdintrq, m, ifp
);
+ IF_DEQUEUE
(&hdintrq, m
);
splx (s);
if (m == 0)
break;
splx (s);
if (m == 0)
break;
@@
-56,6
+57,9
@@
hdintr ()
m_freem (m);
continue;
}
m_freem (m);
continue;
}
+ if ((m->m_flags & M_PKTHDR) == 0)
+ panic("hdintr");
+ ifp = m->m_pkthdr.rcvif;
/*
* look up the appropriate hdlc control block
/*
* look up the appropriate hdlc control block
@@
-81,6
+85,8
@@
hdintr ()
if (process_rxframe (hdp, m) == FALSE)
m_freem (m);
}
if (process_rxframe (hdp, m) == FALSE)
m_freem (m);
}
+ if (pkintrq.ifq_len)
+ pkintr ();
}
process_rxframe (hdp, fbuf)
}
process_rxframe (hdp, fbuf)
@@
-130,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_
xc
p);
+ (void) pk_ctlinput (PRC_LINKUP, hdp->hd_
pk
p);
break;
case SABM + SABM_SENT:
break;
case SABM + SABM_SENT:
@@
-149,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_
xc
p);
+ (void) pk_ctlinput (PRC_LINKRESET, hdp->hd_
pk
p);
hdp->hd_resets++;
break;
hdp->hd_resets++;
break;
@@
-162,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_
xc
p);
+ (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_
pk
p);
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:
@@
-190,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_
xc
p);
+ (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_
pk
p);
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;
@@
-199,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_
xc
p);
+ (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_
pk
p);
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;
@@
-220,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_
xc
p);
+ (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_
pk
p);
#ifdef HDLCDEBUG
hd_dumptrace (hdp);
#endif
#ifdef HDLCDEBUG
hd_dumptrace (hdp);
#endif
@@
-266,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_
xc
p);
+ (void) pk_ctlinput (PRC_LINKDOWN, hdp->hd_
pk
p);
case ILLEGAL + WAIT_SABM:
hdp->hd_unknown++;
#ifdef HDLCDEBUG
case ILLEGAL + WAIT_SABM:
hdp->hd_unknown++;
#ifdef HDLCDEBUG
@@
-335,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);
@@
-351,6
+357,8
@@
register struct Hdlc_iframe *frame;
/* Forward iframe to packet level of X.25. */
fbuf -> m_data += HDHEADERLN;
fbuf -> m_len -= HDHEADERLN;
/* Forward iframe to packet level of X.25. */
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
@@
-362,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 {
@@
-481,6
+489,10
@@
int frametype;
hdp->hd_retxcnt = 0;
hdp->hd_condition &= ~TIMER_RECOVERY_CONDITION;
hdp->hd_retxcnt = 0;
hdp->hd_condition &= ~TIMER_RECOVERY_CONDITION;
+ if (frametype == RR && hdp->hd_lastrxnr == hdp->hd_vs
+ && hdp->hd_timer == 0 && hdp->hd_txq.head == 0)
+ hd_writeinternal(hdp, RR, pf);
+ else
/* If any iframes have been queued because of the
timer condition, transmit then now. */
if (hdp->hd_condition & REMOTE_RNR_CONDITION) {
/* If any iframes have been queued because of the
timer condition, transmit then now. */
if (hdp->hd_condition & REMOTE_RNR_CONDITION) {