MCPcopy Create free account
hub / github.com/F-Stack/f-stack / _rte_pie_drop

Function _rte_pie_drop

dpdk/lib/sched/rte_pie.h:209–242  ·  view source on GitHub ↗

* @brief make a decision to drop or enqueue a packet based on probability * criteria * * @param pie_cfg [in] config pointer to a PIE configuration parameter structure * @param pie [in, out] data pointer to PIE runtime data * * @return operation status * @retval 0 enqueue the packet * @retval 1 drop the packet */

Source from the content-addressed store, hash-verified

207 * @retval 1 drop the packet
208 */
209static inline int
210_rte_pie_drop(const struct rte_pie_config *pie_cfg,
211 struct rte_pie *pie)
212{
213 uint64_t qdelay = pie_cfg->qdelay_ref / 2;
214
215 /* PIE is active but the queue is not congested: return 0 */
216 if (((pie->qdelay_old < qdelay) && (pie->drop_prob < 0.2)) ||
217 (pie->qlen <= (pie_cfg->tailq_th * 0.1)))
218 return 0;
219
220 if (pie->drop_prob == 0)
221 pie->accu_prob = 0;
222
223 /* For practical reasons, drop probability can be further scaled according
224 * to packet size, but one needs to set a bound to avoid unnecessary bias
225 * Random drop
226 */
227 pie->accu_prob += pie->drop_prob;
228
229 if (pie->accu_prob < 0.85)
230 return 0;
231
232 if (pie->accu_prob >= 8.5)
233 return 1;
234
235 if (rte_drand() < pie->drop_prob) {
236 pie->accu_prob = 0;
237 return 1;
238 }
239
240 /* No drop */
241 return 0;
242}
243
244/**
245 * @brief Decides if new packet should be enqueued or dropped for non-empty queue

Callers 1

rte_pie_enqueue_nonemptyFunction · 0.85

Calls 1

rte_drandFunction · 0.85

Tested by

no test coverage detected