Lines Matching refs:hdlc
50 #include "hdlc.h"
77 struct hdlc *hdlc = &link2physical(lcp->fsm.link)->hdlc;
82 echo.sequence = htonl(hdlc->lqm.echo.seq_sent);
83 fsm_Output(&lcp->fsm, CODE_ECHOREQ, hdlc->lqm.echo.seq_sent++,
90 struct hdlc *hdlc = &link2physical(fp->link)->hdlc;
113 if ((hdlc->lqm.echo.seq_recv > (u_int32_t)0 - 5 && lqr.sequence < 5) ||
114 (hdlc->lqm.echo.seq_recv <= (u_int32_t)0 - 5 &&
115 lqr.sequence > hdlc->lqm.echo.seq_recv))
116 hdlc->lqm.echo.seq_recv = lqr.sequence;
167 timer_Stop(&p->hdlc.lqm.timer);
169 if (p->hdlc.lqm.method & LQM_LQR) {
170 if (p->hdlc.lqm.lqr.resent > 5) {
176 p->hdlc.lqm.method = 0;
180 p->hdlc.lqm.lqr.resent++;
182 } else if (p->hdlc.lqm.method & LQM_ECHO) {
183 if ((p->hdlc.lqm.echo.seq_sent > 5 &&
184 p->hdlc.lqm.echo.seq_sent - 5 > p->hdlc.lqm.echo.seq_recv) ||
185 (p->hdlc.lqm.echo.seq_sent <= 5 &&
186 p->hdlc.lqm.echo.seq_sent > p->hdlc.lqm.echo.seq_recv + 5)) {
191 p->hdlc.lqm.method = 0;
196 if (p->hdlc.lqm.method && p->hdlc.lqm.timer.load)
197 timer_Start(&p->hdlc.lqm.timer);
204 struct lcp *lcp = p->hdlc.lqm.owner;
217 else if (!IsAccepted(l->lcp.cfg.lqr) && !(p->hdlc.lqm.method & LQM_LQR)) {
232 memcpy(&lastlqr, &p->hdlc.lqm.lqr.peer, sizeof lastlqr);
233 lqr_ChangeOrder(lqr, &p->hdlc.lqm.lqr.peer);
234 lqr_Dump(l->name, "Input", &p->hdlc.lqm.lqr.peer);
236 p->hdlc.lqm.lqr.resent = 0;
239 memcpy(&p->hdlc.lqm.lqr.prevSave, &p->hdlc.lqm.lqr.Save,
240 sizeof p->hdlc.lqm.lqr.prevSave);
241 p->hdlc.lqm.lqr.Save.InLQRs = ++p->hdlc.lqm.lqr.InLQRs;
242 p->hdlc.lqm.lqr.Save.InPackets = p->hdlc.lqm.ifInUniPackets;
243 p->hdlc.lqm.lqr.Save.InDiscards = p->hdlc.lqm.ifInDiscards;
244 p->hdlc.lqm.lqr.Save.InErrors = p->hdlc.lqm.ifInErrors;
245 p->hdlc.lqm.lqr.Save.InOctets = p->hdlc.lqm.lqr.InGoodOctets;
247 lqr_Analyse(&p->hdlc, &lastlqr, &p->hdlc.lqm.lqr.peer);
253 if (p->hdlc.lqm.timer.load == 0 || !(p->hdlc.lqm.method & LQM_LQR) ||
255 lastlqr.PeerInLQRs == p->hdlc.lqm.lqr.peer.PeerInLQRs))
272 physical->hdlc.lqm.lqr.resent = 0;
273 physical->hdlc.lqm.echo.seq_sent = 0;
274 physical->hdlc.lqm.echo.seq_recv = 0;
275 memset(&physical->hdlc.lqm.lqr.peer, '\0',
276 sizeof physical->hdlc.lqm.lqr.peer);
278 physical->hdlc.lqm.method = lcp->cfg.echo ? LQM_ECHO : 0;
280 physical->hdlc.lqm.method |= LQM_LQR;
281 timer_Stop(&physical->hdlc.lqm.timer);
283 physical->hdlc.lqm.lqr.peer_timeout = lcp->his_lqrperiod;
291 physical->hdlc.lqm.timer.func = SendLqrReport;
292 physical->hdlc.lqm.timer.name = "lqm";
293 physical->hdlc.lqm.timer.arg = lcp;
295 if (lcp->want_lqrperiod || physical->hdlc.lqm.method & LQM_ECHO) {
299 physical->hdlc.lqm.timer.load = period * SECTICKS / 100;
301 physical->hdlc.lqm.timer.load = 0;
314 if (p->hdlc.lqm.timer.load)
324 if (p->hdlc.lqm.timer.load)
325 timer_Start(&p->hdlc.lqm.timer);
331 timer_Stop(&physical->hdlc.lqm.timer);
343 physical->hdlc.lqm.method &= ~method;
344 if (physical->hdlc.lqm.method)
345 SendLqrReport(physical->hdlc.lqm.owner);
347 timer_Stop(&physical->hdlc.lqm.timer);
371 lqr_Analyse(const struct hdlc *hdlc, const struct lqrdata *oldlqr,
383 transitLQRs = hdlc->lqm.lqr.OutLQRs - newlqr->LastOutLQRs;
394 (hdlc->lqm.lqr.Save.InPackets - hdlc->lqm.lqr.prevSave.InPackets);
396 (hdlc->lqm.lqr.Save.InOctets - hdlc->lqm.lqr.prevSave.InOctets);
440 * As we're stacked higher than the HDLC layer (otherwise HDLC wouldn't be
449 p->hdlc.lqm.ifOutUniPackets++;
450 p->hdlc.lqm.ifOutOctets += len + 1; /* plus 1 flag octet! */
454 p->hdlc.lqm.ifOutOctets += acf_WrapperOctets(&l->lcp, *proto);
460 p->hdlc.lqm.ifOutOctets += hdlc_WrapperOctets();
466 p->hdlc.lqm.ifOutOctets += proto_WrapperOctets(&l->lcp, *proto);
482 p->hdlc.lqm.lqr.OutLQRs++;
493 lqr.LastOutLQRs = p->hdlc.lqm.lqr.peer.PeerOutLQRs;
494 lqr.LastOutPackets = p->hdlc.lqm.lqr.peer.PeerOutPackets;
495 lqr.LastOutOctets = p->hdlc.lqm.lqr.peer.PeerOutOctets;
496 lqr.PeerInLQRs = p->hdlc.lqm.lqr.Save.InLQRs;
497 lqr.PeerInPackets = p->hdlc.lqm.lqr.Save.InPackets;
498 lqr.PeerInDiscards = p->hdlc.lqm.lqr.Save.InDiscards;
499 lqr.PeerInErrors = p->hdlc.lqm.lqr.Save.InErrors;
500 lqr.PeerInOctets = p->hdlc.lqm.lqr.Save.InOctets;
501 lqr.PeerOutLQRs = p->hdlc.lqm.lqr.OutLQRs;
502 lqr.PeerOutPackets = p->hdlc.lqm.ifOutUniPackets - pending_pkts;
504 lqr.PeerOutOctets = p->hdlc.lqm.ifOutOctets - pending_octets - pending_pkts;