Changeset View
Changeset View
Standalone View
Standalone View
sys/netpfil/ipfw/dn_aqm_pie.c
Show First 20 Lines • Show All 322 Lines • ▼ Show 20 Lines | |||||
* Extract a packet from the head of queue 'q' | * Extract a packet from the head of queue 'q' | ||||
* Return a packet or NULL if the queue is empty. | * Return a packet or NULL if the queue is empty. | ||||
* If getts is set, also extract packet's timestamp from mtag. | * If getts is set, also extract packet's timestamp from mtag. | ||||
*/ | */ | ||||
static struct mbuf * | static struct mbuf * | ||||
pie_extract_head(struct dn_queue *q, aqm_time_t *pkt_ts, int getts) | pie_extract_head(struct dn_queue *q, aqm_time_t *pkt_ts, int getts) | ||||
{ | { | ||||
struct m_tag *mtag; | struct m_tag *mtag; | ||||
struct mbuf *m = q->mq.head; | struct mbuf *m; | ||||
next: m = q->mq.head; | |||||
if (m == NULL) | if (m == NULL) | ||||
return m; | return m; | ||||
q->mq.head = m->m_nextpkt; | q->mq.head = m->m_nextpkt; | ||||
/* Update stats */ | /* Update stats */ | ||||
update_stats(q, -m->m_pkthdr.len, 0); | update_stats(q, -m->m_pkthdr.len, 0); | ||||
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 (getts) { | if (getts) { | ||||
/* extract packet TS*/ | /* extract packet TS*/ | ||||
mtag = m_tag_locate(m, MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, NULL); | mtag = m_tag_locate(m, MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, NULL); | ||||
if (mtag == NULL) { | if (mtag == NULL) { | ||||
D("PIE timestamp mtag not found!"); | D("PIE timestamp mtag not found!"); | ||||
*pkt_ts = 0; | *pkt_ts = 0; | ||||
} else { | } else { | ||||
*pkt_ts = *(aqm_time_t *)(mtag + 1); | *pkt_ts = *(aqm_time_t *)(mtag + 1); | ||||
m_tag_delete(m,mtag); | m_tag_delete(m,mtag); | ||||
} | } | ||||
} | |||||
if (m->m_pkthdr.rcvif != NULL && | |||||
__predict_false(m_rcvif_restore(m) == NULL)) { | |||||
m_freem(m); | |||||
goto next; | |||||
} | } | ||||
return m; | return m; | ||||
} | } | ||||
/* | /* | ||||
* Initiate PIE variable and optionally activate it | * Initiate PIE variable and optionally activate it | ||||
*/ | */ | ||||
__inline static void | __inline static void | ||||
▲ Show 20 Lines • Show All 447 Lines • Show Last 20 Lines |