Changeset View
Changeset View
Standalone View
Standalone View
sys/netpfil/ipfw/dn_sched.h
| Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | |||||
| /* | /* | ||||
| * Extract the head of a queue, update stats. Must be the very last | * Extract the head of a queue, update stats. Must be the very last | ||||
| * thing done on a dequeue as the queue itself may go away. | * thing done on a dequeue as the queue itself may go away. | ||||
| */ | */ | ||||
| static __inline struct mbuf* | static __inline struct mbuf* | ||||
| dn_dequeue(struct dn_queue *q) | dn_dequeue(struct dn_queue *q) | ||||
| { | { | ||||
| struct mbuf *m = q->mq.head; | struct mbuf *m; | ||||
| next: | |||||
| m = q->mq.head; | |||||
| if (m == NULL) | if (m == NULL) | ||||
| return NULL; | return NULL; | ||||
| #ifdef NEW_AQM | #ifdef NEW_AQM | ||||
| /* Call AQM dequeue function */ | /* Call AQM dequeue function */ | ||||
| if (q->fs->aqmfp && q->fs->aqmfp->dequeue ) | if (q->fs->aqmfp && q->fs->aqmfp->dequeue ) | ||||
| return q->fs->aqmfp->dequeue(q); | return q->fs->aqmfp->dequeue(q); | ||||
| #endif | #endif | ||||
| q->mq.head = m->m_nextpkt; | q->mq.head = m->m_nextpkt; | ||||
| q->mq.count--; | q->mq.count--; | ||||
| /* Update stats for the queue */ | /* Update stats for the queue */ | ||||
| q->ni.length--; | q->ni.length--; | ||||
| q->ni.len_bytes -= m->m_pkthdr.len; | q->ni.len_bytes -= m->m_pkthdr.len; | ||||
| if (q->_si) { | if (q->_si) { | ||||
| q->_si->ni.length--; | q->_si->ni.length--; | ||||
| q->_si->ni.len_bytes -= m->m_pkthdr.len; | q->_si->ni.len_bytes -= m->m_pkthdr.len; | ||||
| } | } | ||||
| if (q->ni.length == 0) /* queue is now idle */ | if (q->ni.length == 0) /* queue is now idle */ | ||||
| q->q_time = V_dn_cfg.curr_time; | q->q_time = V_dn_cfg.curr_time; | ||||
| if (m->m_pkthdr.rcvif != NULL && | |||||
| __predict_false(m_rcvif_restore(m) == NULL)) { | |||||
| m_freem(m); | |||||
| goto next; | |||||
| } | |||||
| return m; | return m; | ||||
| } | } | ||||
| int dn_sched_modevent(module_t mod, int cmd, void *arg); | int dn_sched_modevent(module_t mod, int cmd, void *arg); | ||||
| #define DECLARE_DNSCHED_MODULE(name, dnsched) \ | #define DECLARE_DNSCHED_MODULE(name, dnsched) \ | ||||
| static moduledata_t name##_mod = { \ | static moduledata_t name##_mod = { \ | ||||
| #name, dn_sched_modevent, dnsched \ | #name, dn_sched_modevent, dnsched \ | ||||
| }; \ | }; \ | ||||
| DECLARE_MODULE(name, name##_mod, \ | DECLARE_MODULE(name, name##_mod, \ | ||||
| SI_SUB_PROTO_FIREWALL, SI_ORDER_ANY); \ | SI_SUB_PROTO_FIREWALL, SI_ORDER_ANY); \ | ||||
| MODULE_DEPEND(name, dummynet, 3, 3, 3) | MODULE_DEPEND(name, dummynet, 3, 3, 3) | ||||
| #endif /* _DN_SCHED_H */ | #endif /* _DN_SCHED_H */ | ||||