Index: ifq.c =================================================================== RCS file: /cvs/src/sys/net/ifq.c,v retrieving revision 1.7 diff -u -p -r1.7 ifq.c --- ifq.c 7 Mar 2017 01:29:53 -0000 1.7 +++ ifq.c 7 Mar 2017 03:26:30 -0000 @@ -402,12 +402,32 @@ priq_enq(struct ifqueue *ifq, struct mbu { struct priq *pq; struct priq_list *pl; - - if (ifq_len(ifq) >= ifq->ifq_maxlen) - return (m); + struct mbuf *dm = NULL; pq = ifq->ifq_q; KASSERT(m->m_pkthdr.pf.prio <= IFQ_MAXPRIO); + + if (ifq_len(ifq) >= ifq->ifq_maxlen) { + unsigned int prio; + + /* Find a lower priority queue to drop from */ + for (prio = 0; prio < m->m_pkthdr.pf.prio; prio++) { + pl = &pq->pq_lists[prio]; + if (pl->head != NULL) { + dm = pl->head; + priq_deq_commit(ifq, dm, pl); + goto enqueue; + } + } + + /* + * There's no lower priority queue that we can + * drop from so don't enqueue this one. + */ + return (m); + } + +enqueue: pl = &pq->pq_lists[m->m_pkthdr.pf.prio]; m->m_nextpkt = NULL; @@ -417,7 +437,7 @@ priq_enq(struct ifqueue *ifq, struct mbu pl->tail->m_nextpkt = m; pl->tail = m; - return (NULL); + return (dm); } struct mbuf *