- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* @param [in,out] data pointer to RED runtime data
*
* @return Operation status
* @param [in,out] data pointer to RED runtime data
*
* @return Operation status
* @param [in,out] config pointer to a RED configuration parameter structure
* @param [in] wq_log2 log2 of the filter weight, valid range is:
* RTE_RED_WQ_LOG2_MIN <= wq_log2 <= RTE_RED_WQ_LOG2_MAX
* @param [in] min_th queue minimum threshold in number of packets
* @param [in] max_th queue maximum threshold in number of packets
* @param [in] maxp_inv inverse maximum mark probability
* @param [in,out] config pointer to a RED configuration parameter structure
* @param [in] wq_log2 log2 of the filter weight, valid range is:
* RTE_RED_WQ_LOG2_MIN <= wq_log2 <= RTE_RED_WQ_LOG2_MAX
* @param [in] min_th queue minimum threshold in number of packets
* @param [in] max_th queue maximum threshold in number of packets
* @param [in] maxp_inv inverse maximum mark probability
* @brief Updates queue average in condition when queue is empty
*
* Note: packet is never dropped in this particular case.
* @brief Updates queue average in condition when queue is empty
*
* Note: packet is never dropped in this particular case.
* @param [in] config pointer to a RED configuration parameter structure
* @param [in,out] data pointer to RED runtime data
* @param [in] time current time stamp
* @param [in] config pointer to a RED configuration parameter structure
* @param [in,out] data pointer to RED runtime data
* @param [in] time current time stamp
* @return Operation status
* @retval 0 enqueue the packet
* @retval 1 drop the packet based on max threshold criterion
* @return Operation status
* @retval 0 enqueue the packet
* @retval 1 drop the packet based on max threshold criterion
* transmitted on network port). Such time stamp translates into time units as
* port speed is fixed but such approach simplifies the code.
*/
* transmitted on network port). Such time stamp translates into time units as
* port speed is fixed but such approach simplifies the code.
*/
/* If drop, generate and save random number to be used next time */
if (unlikely((rte_red_rand_val % pa_den) < pa_num)) {
rte_red_rand_val = rte_fast_rand();
/* If drop, generate and save random number to be used next time */
if (unlikely((rte_red_rand_val % pa_den) < pa_num)) {
rte_red_rand_val = rte_fast_rand();
* @brief Decides if new packet should be enqeued or dropped in queue non-empty case
*
* @param [in] config pointer to a RED configuration parameter structure
* @param [in,out] data pointer to RED runtime data
* @param [in] q current queue size (measured in packets)
* @brief Decides if new packet should be enqeued or dropped in queue non-empty case
*
* @param [in] config pointer to a RED configuration parameter structure
* @param [in,out] data pointer to RED runtime data
* @param [in] q current queue size (measured in packets)
* @return Operation status
* @retval 0 enqueue the packet
* @retval 1 drop the packet based on max threshold criterion
* @return Operation status
* @retval 0 enqueue the packet
* @retval 1 drop the packet based on max threshold criterion
* @brief Decides if new packet should be enqeued or dropped
* Updates run time data based on new queue size value.
* Based on new queue average and RED configuration parameters
* @brief Decides if new packet should be enqeued or dropped
* Updates run time data based on new queue size value.
* Based on new queue average and RED configuration parameters
*
* @param [in] config pointer to a RED configuration parameter structure
* @param [in,out] data pointer to RED runtime data
* @param [in] q updated queue size in packets
* @param [in] time current time stamp
*
* @param [in] config pointer to a RED configuration parameter structure
* @param [in,out] data pointer to RED runtime data
* @param [in] q updated queue size in packets
* @param [in] time current time stamp
* @return Operation status
* @retval 0 enqueue the packet
* @retval 1 drop the packet based on max threshold criteria
* @return Operation status
* @retval 0 enqueue the packet
* @retval 1 drop the packet based on max threshold criteria
* @brief Callback to records time that queue became empty
*
* @param [in,out] data pointer to RED runtime data
* @brief Callback to records time that queue became empty
*
* @param [in,out] data pointer to RED runtime data