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

Function rte_pie_enqueue_nonempty

dpdk/lib/sched/rte_pie.h:257–308  ·  view source on GitHub ↗

* @brief Decides if new packet should be enqueued or dropped for non-empty queue * * @param pie_cfg [in] config pointer to a PIE configuration parameter structure * @param pie [in,out] data pointer to PIE runtime data * @param pkt_len [in] packet length in bytes * @param time [in] current time (measured in cpu cycles) * * @return Operation status * @retval 0 enqueue the packet * @retval 1

Source from the content-addressed store, hash-verified

255 * @retval 2 drop the packet based on mark probability criterion
256 */
257static inline int
258rte_pie_enqueue_nonempty(const struct rte_pie_config *pie_cfg,
259 struct rte_pie *pie,
260 uint32_t pkt_len,
261 const uint64_t time)
262{
263 /* Check queue space against the tail drop threshold */
264 if (pie->qlen >= pie_cfg->tailq_th) {
265
266 pie->accu_prob = 0;
267 return 1;
268 }
269
270 if (pie->active) {
271 /* Update drop probability after certain interval */
272 if ((time - pie->last_measurement) >= pie_cfg->dp_update_interval)
273 _calc_drop_probability(pie_cfg, pie, time);
274
275 /* Decide whether packet to be dropped or enqueued */
276 if (_rte_pie_drop(pie_cfg, pie) && pie->burst_allowance == 0)
277 return 2;
278 }
279
280 /* When queue occupancy is over a certain threshold, turn on PIE */
281 if ((pie->active == 0) &&
282 (pie->qlen >= (pie_cfg->tailq_th * 0.1))) {
283 pie->active = 1;
284 pie->qdelay_old = 0;
285 pie->drop_prob = 0;
286 pie->in_measurement = 1;
287 pie->departed_bytes_count = 0;
288 pie->avg_dq_time = 0;
289 pie->last_measurement = time;
290 pie->burst_allowance = pie_cfg->max_burst;
291 pie->accu_prob = 0;
292 pie->start_measurement = time;
293 }
294
295 /* when queue has been idle for a while, turn off PIE and Reset counters */
296 if (pie->active == 1 &&
297 pie->qlen < (pie_cfg->tailq_th * 0.1)) {
298 pie->active = 0;
299 pie->in_measurement = 0;
300 }
301
302 /* Update PIE qlen parameter */
303 pie->qlen++;
304 pie->qlen_bytes += pkt_len;
305
306 /* No drop */
307 return 0;
308}
309
310/**
311 * @brief Decides if new packet should be enqueued or dropped

Callers 1

rte_pie_enqueueFunction · 0.85

Calls 2

_calc_drop_probabilityFunction · 0.85
_rte_pie_dropFunction · 0.85

Tested by

no test coverage detected