diff mbox series

[3/3] examples/l3fwd-power: use device max burst size

Message ID 20171212100520.20502-3-nikhil.agarwal@linaro.org
State New
Headers show
Series [1/3] ethdev: add max burst size to device info | expand

Commit Message

Nikhil Agarwal Dec. 12, 2017, 10:05 a.m. UTC
On some of the hardware e.g. DPAA, rx burst can only return
upto 16 packets, which causes the application to assume that
no more packets are present.

This patch modifies the application to use device published
packet burst size.

Signed-off-by: Nikhil Agarwal <nikhil.agarwal@linaro.org>

---
 examples/l3fwd-power/main.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

-- 
2.7.4
diff mbox series

Patch

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index d80f663..000ac53 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -145,6 +145,7 @@ 
 #define RTE_TEST_TX_DESC_DEFAULT 512
 static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
 static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
+static uint16_t max_pkt_burst = MAX_PKT_BURST;
 
 /* ethernet addresses of ports */
 static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
@@ -421,7 +422,7 @@  power_timer_cb(__attribute__((unused)) struct rte_timer *tim,
 			rte_power_freq_down(lcore_id);
 	}
 	else if ( (unsigned)(stats[lcore_id].nb_rx_processed /
-		stats[lcore_id].nb_iteration_looped) < MAX_PKT_BURST) {
+		stats[lcore_id].nb_iteration_looped) < max_pkt_burst) {
 		/**
 		 * scale down a step if average packet per iteration less
 		 * than expectation.
@@ -759,9 +760,9 @@  power_freq_scaleup_heuristic(unsigned lcore_id,
  * HW Rx queue size is 128 by default, Rx burst read at maximum 32 entries
  * per iteration
  */
-#define FREQ_GEAR1_RX_PACKET_THRESHOLD             MAX_PKT_BURST
-#define FREQ_GEAR2_RX_PACKET_THRESHOLD             (MAX_PKT_BURST*2)
-#define FREQ_GEAR3_RX_PACKET_THRESHOLD             (MAX_PKT_BURST*3)
+#define FREQ_GEAR1_RX_PACKET_THRESHOLD             max_pkt_burst
+#define FREQ_GEAR2_RX_PACKET_THRESHOLD             (max_pkt_burst*2)
+#define FREQ_GEAR3_RX_PACKET_THRESHOLD             (max_pkt_burst*3)
 #define FREQ_UP_TREND1_ACC   1
 #define FREQ_UP_TREND2_ACC   100
 #define FREQ_UP_THRESHOLD    10000
@@ -950,7 +951,7 @@  main_loop(__attribute__((unused)) void *dummy)
 			queueid = rx_queue->queue_id;
 
 			nb_rx = rte_eth_rx_burst(portid, queueid, pkts_burst,
-								MAX_PKT_BURST);
+								max_pkt_burst);
 
 			stats[lcore_id].nb_rx_processed += nb_rx;
 			if (unlikely(nb_rx == 0)) {
@@ -1703,6 +1704,9 @@  main(int argc, char **argv)
 		dev_rxq_num = dev_info.max_rx_queues;
 		dev_txq_num = dev_info.max_tx_queues;
 
+		if (dev_info.max_burst_size &&
+				dev_info.max_burst_size < max_pkt_burst)
+			max_pkt_burst = dev_info.max_burst_size;
 		nb_rx_queue = get_port_n_rx_queues(portid);
 		if (nb_rx_queue > dev_rxq_num)
 			rte_exit(EXIT_FAILURE,