diff options
author | brian <brian@FreeBSD.org> | 2004-06-30 12:24:56 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2004-06-30 12:24:56 +0000 |
commit | 91f649862ba818f725de4dbbae946f759c67f63d (patch) | |
tree | 76236bba03020705b0cfc202918cca570310fc13 /usr.sbin/ppp/link.c | |
parent | 595d75cc49b8cc7aea7b0e1bef4be2938978bf98 (diff) | |
download | FreeBSD-src-91f649862ba818f725de4dbbae946f759c67f63d.zip FreeBSD-src-91f649862ba818f725de4dbbae946f759c67f63d.tar.gz |
Re-implement LQM, this time according to the rfc.
PR: 11293
MFC after: 4 weeks
Diffstat (limited to 'usr.sbin/ppp/link.c')
-rw-r--r-- | usr.sbin/ppp/link.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/usr.sbin/ppp/link.c b/usr.sbin/ppp/link.c index d5aaca3..1667e8a 100644 --- a/usr.sbin/ppp/link.c +++ b/usr.sbin/ppp/link.c @@ -147,6 +147,34 @@ link_QueueBytes(struct link *l) return bytes; } +void +link_PendingLowPriorityData(struct link *l, size_t *pkts, size_t *octets) +{ + struct mqueue *queue, *highest; + struct mbuf *m; + size_t len; + + /* + * This is all rfc1989 stuff... because our LQR packet is going to bypass + * everything that's not in the highest priority queue, we must be able to + * subtract that data from our outgoing packet/octet counts. However, + * we've already async-encoded our data at this point, but the async + * encodings MUSTn't be a part of the LQR-reported payload :( So, we have + * the async layer record how much it's padded the packet in the mbuf's + * priv field, and when we calculate our outgoing LQR values we subtract + * this value for each packet from the octet count sent. + */ + + highest = LINK_HIGHQ(l); + *pkts = *octets = 0; + for (queue = l->Queue; queue < highest; queue++) { + len = queue->len; + *pkts += len; + for (m = queue->top; len--; m = m->m_nextpkt) + *octets += m_length(m) - m->priv; + } +} + struct mbuf * link_Dequeue(struct link *l) { @@ -232,6 +260,7 @@ link_PushPacket(struct link *l, struct mbuf *bp, struct bundle *b, int pri, if(pri < 0 || pri >= LINK_QUEUES(l)) pri = 0; + bp->priv = 0; /* Adjusted by the async layer ! */ for (layer = l->nlayers; layer && bp; layer--) if (l->layer[layer - 1]->push != NULL) bp = (*l->layer[layer - 1]->push)(b, l, bp, pri, &proto); @@ -360,7 +389,7 @@ Despatch(struct bundle *bundle, struct link *l, struct mbuf *bp, u_short proto) bp = m_pullup(proto_Prepend(bp, proto, 0, 0)); lcp_SendProtoRej(&l->lcp, MBUF_CTOP(bp), bp->m_len); if (p) { - p->hdlc.lqm.SaveInDiscards++; + p->hdlc.lqm.ifInDiscards++; p->hdlc.stats.unknownproto++; } m_freem(bp); |