* @brief Decides packet enqueue when queue is empty * * Note: packet is never dropped in this particular case. * * @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 * * @return Operation status * @retval 0 enqueue the packet * @retval !0 drop the packet */
| 113 | * @retval !0 drop the packet |
| 114 | */ |
| 115 | static int |
| 116 | rte_pie_enqueue_empty(const struct rte_pie_config *pie_cfg, |
| 117 | struct rte_pie *pie, |
| 118 | uint32_t pkt_len) |
| 119 | { |
| 120 | RTE_ASSERT(pkt_len != 0); |
| 121 | |
| 122 | /* Update the PIE qlen parameter */ |
| 123 | pie->qlen++; |
| 124 | pie->qlen_bytes += pkt_len; |
| 125 | |
| 126 | /** |
| 127 | * If the queue has been idle for a while, turn off PIE and Reset counters |
| 128 | */ |
| 129 | if ((pie->active == 1) && |
| 130 | (pie->qlen < (pie_cfg->tailq_th * 0.1))) { |
| 131 | pie->active = 0; |
| 132 | pie->in_measurement = 0; |
| 133 | } |
| 134 | |
| 135 | return 0; |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * @brief make a decision to drop or enqueue a packet based on probability |