Changeset View
Changeset View
Standalone View
Standalone View
sys/netpfil/ipfw/dn_sched_fq_pie.c
| Show First 20 Lines • Show All 335 Lines • ▼ Show 20 Lines | |||||
| * Extract a packet from the head of sub-queue 'q' | * Extract a packet from the head of sub-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. | ||||
| */ | */ | ||||
| __inline static struct mbuf * | __inline static struct mbuf * | ||||
| fq_pie_extract_head(struct fq_pie_flow *q, aqm_time_t *pkt_ts, | fq_pie_extract_head(struct fq_pie_flow *q, aqm_time_t *pkt_ts, | ||||
| struct fq_pie_si *si, int getts) | struct fq_pie_si *si, int getts) | ||||
| { | { | ||||
| 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; | ||||
| fq_update_stats(q, si, -m->m_pkthdr.len, 0); | fq_update_stats(q, si, -m->m_pkthdr.len, 0); | ||||
| if (si->main_q.ni.length == 0) /* queue is now idle */ | if (si->main_q.ni.length == 0) /* queue is now idle */ | ||||
| si->main_q.q_time = V_dn_cfg.curr_time; | si->main_q.q_time = V_dn_cfg.curr_time; | ||||
| if (getts) { | if (getts) { | ||||
| /* extract packet timestamp*/ | /* extract packet timestamp*/ | ||||
| struct m_tag *mtag; | struct m_tag *mtag; | ||||
| 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; | ||||
| } | } | ||||
| /* | /* | ||||
| * Callout function for drop probability calculation | * Callout function for drop probability calculation | ||||
| * This function is called over tupdate ms and takes pointer of FQ-PIE | * This function is called over tupdate ms and takes pointer of FQ-PIE | ||||
| * flow as an argument | * flow as an argument | ||||
| ▲ Show 20 Lines • Show All 860 Lines • Show Last 20 Lines | |||||