DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nikhil Agarwal <nikhil.agarwal@linaro.org>
To: <dev@dpdk.org>
Cc: <david.hunt@intel.com>, <nikhil.agarwal@nxp.com>,
	<hemant.agrawal@nxp.com>, <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH 3/3] examples/l3fwd-power: use device max burst size
Date: Tue, 12 Dec 2017 15:35:20 +0530	[thread overview]
Message-ID: <20171212100520.20502-3-nikhil.agarwal@linaro.org> (raw)
In-Reply-To: <20171212100520.20502-1-nikhil.agarwal@linaro.org>

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(-)

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,
-- 
2.7.4

  parent reply	other threads:[~2017-12-12 10:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12 10:05 [dpdk-dev] [PATCH 1/3] ethdev: add max burst size to device info Nikhil Agarwal
2017-12-12 10:05 ` [dpdk-dev] [PATCH 2/3] net/dpaa: implement max burst size in dev info Nikhil Agarwal
2017-12-12 10:05 ` Nikhil Agarwal [this message]
2017-12-12 10:45 ` [dpdk-dev] [PATCH 1/3] ethdev: add max burst size to device info Matan Azrad
2017-12-12 11:03   ` Ananyev, Konstantin
2017-12-12 13:43     ` Shreyansh Jain
2017-12-13 12:52       ` Ananyev, Konstantin
2017-12-13 15:22         ` Shreyansh Jain
2018-05-22 22:17 ` Thomas Monjalon
2019-04-05 14:55   ` Ferruh Yigit
2019-04-05 14:55     ` Ferruh Yigit
2019-04-05 14:57     ` Yigit, Ferruh
2019-04-05 14:57       ` Yigit, Ferruh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171212100520.20502-3-nikhil.agarwal@linaro.org \
    --to=nikhil.agarwal@linaro.org \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=nikhil.agarwal@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).