DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/4] examples/l3fwd-power: fix non Rx intr supported platform
@ 2017-12-12 10:08 Nikhil Agarwal
  2017-12-12 10:08 ` [dpdk-dev] [PATCH 2/4] examples/l3fwd-power: fix the timer for any platform freq Nikhil Agarwal
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Nikhil Agarwal @ 2017-12-12 10:08 UTC (permalink / raw)
  To: dev
  Cc: david.hunt, nikhil.agarwal, hemant.agrawal, stable, Danny Zhou,
	Cunming Liang

This existing code cause the platform to start receiving packet
immediately irrespective of interrupts available or not.
If the platform does not support Rx interrupt, it shall not start
receiving packets immediately. It shall let the timer management work.

Fixes: aee3bc79cc34 ("examples/l3fwd-power: enable one-shot Rx interrupt and polling switch")
Cc: stable@dpdk.org
Cc: Danny Zhou <danny.zhou@intel.com>
Cc: Cunming Liang <cunming.liang@intel.com>

Signed-off-by: Nikhil Agarwal <nikhil.agarwal@linaro.org>
---
 examples/l3fwd-power/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 0a4ed14..d335b0d 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -1051,9 +1051,11 @@ main_loop(__attribute__((unused)) void *dummy)
 					turn_on_intr(qconf);
 					sleep_until_rx_interrupt(
 						qconf->n_rx_queue);
+					/**
+					 * start receiving packets immediately
+					 */
+					goto start_rx;
 				}
-				/* start receiving packets immediately */
-				goto start_rx;
 			}
 			stats[lcore_id].sleep_time += lcore_idle_hint;
 		}
-- 
2.7.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 2/4] examples/l3fwd-power: fix the timer for any platform freq
  2017-12-12 10:08 [dpdk-dev] [PATCH 1/4] examples/l3fwd-power: fix non Rx intr supported platform Nikhil Agarwal
@ 2017-12-12 10:08 ` Nikhil Agarwal
  2017-12-13 14:22   ` Hunt, David
  2017-12-12 10:08 ` [dpdk-dev] [PATCH 3/4] examples/l3fwd-power: replace desc done with Rx queue count Nikhil Agarwal
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Nikhil Agarwal @ 2017-12-12 10:08 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, nikhil.agarwal, hemant.agrawal, stable

The code assumes that the platform frequency is 2GHz.
This patch add support for dynamically detecting platform frequence.

Fixes: d7937e2e3d12 ("power: initial import")
Cc: stable@dpdk.org

Signed-off-by: Nikhil Agarwal <nikhil.agarwal@linaro.org>
---
 examples/l3fwd-power/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index d335b0d..50c3702 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -79,8 +79,6 @@
 
 #define MIN_ZERO_POLL_COUNT 10
 
-/* around 100ms at 2 Ghz */
-#define TIMER_RESOLUTION_CYCLES           200000000ULL
 /* 100 ms interval */
 #define TIMER_NUMBER_PER_SECOND           10
 /* 100000 us */
@@ -875,7 +873,7 @@ main_loop(__attribute__((unused)) void *dummy)
 {
 	struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
 	unsigned lcore_id;
-	uint64_t prev_tsc, diff_tsc, cur_tsc;
+	uint64_t prev_tsc, diff_tsc, cur_tsc, tim_res_tsc, hz;
 	uint64_t prev_tsc_power = 0, cur_tsc_power, diff_tsc_power;
 	int i, j, nb_rx;
 	uint8_t queueid;
@@ -890,6 +888,8 @@ main_loop(__attribute__((unused)) void *dummy)
 	const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / US_PER_S * BURST_TX_DRAIN_US;
 
 	prev_tsc = 0;
+	hz = rte_get_timer_hz();
+	tim_res_tsc = hz/TIMER_NUMBER_PER_SECOND;
 
 	lcore_id = rte_lcore_id();
 	qconf = &lcore_conf[lcore_id];
@@ -935,7 +935,7 @@ main_loop(__attribute__((unused)) void *dummy)
 		}
 
 		diff_tsc_power = cur_tsc_power - prev_tsc_power;
-		if (diff_tsc_power > TIMER_RESOLUTION_CYCLES) {
+		if (diff_tsc_power > tim_res_tsc) {
 			rte_timer_manage();
 			prev_tsc_power = cur_tsc_power;
 		}
-- 
2.7.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 3/4] examples/l3fwd-power: replace desc done with Rx queue count
  2017-12-12 10:08 [dpdk-dev] [PATCH 1/4] examples/l3fwd-power: fix non Rx intr supported platform Nikhil Agarwal
  2017-12-12 10:08 ` [dpdk-dev] [PATCH 2/4] examples/l3fwd-power: fix the timer for any platform freq Nikhil Agarwal
@ 2017-12-12 10:08 ` Nikhil Agarwal
  2017-12-13 14:22   ` Hunt, David
  2017-12-12 10:08 ` [dpdk-dev] [PATCH 4/4] examples/l3fwd-power: disable Lsc interrupts Nikhil Agarwal
  2017-12-13 14:21 ` [dpdk-dev] [PATCH 1/4] examples/l3fwd-power: fix non Rx intr supported platform Hunt, David
  3 siblings, 1 reply; 9+ messages in thread
From: Nikhil Agarwal @ 2017-12-12 10:08 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, nikhil.agarwal, hemant.agrawal

HW queue based platforms may not support descriptor done API.
This patch changes the usages to rx_queue_count API, which
is more generic.

Signed-off-by: Nikhil Agarwal <nikhil.agarwal@linaro.org>
---
 examples/l3fwd-power/main.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 50c3702..4ddd04c 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -755,6 +755,7 @@ power_freq_scaleup_heuristic(unsigned lcore_id,
 			     uint16_t port_id,
 			     uint16_t queue_id)
 {
+	uint32_t rxq_count = rte_eth_rx_queue_count(port_id, queue_id);
 /**
  * HW Rx queue size is 128 by default, Rx burst read at maximum 32 entries
  * per iteration
@@ -766,15 +767,12 @@ power_freq_scaleup_heuristic(unsigned lcore_id,
 #define FREQ_UP_TREND2_ACC   100
 #define FREQ_UP_THRESHOLD    10000
 
-	if (likely(rte_eth_rx_descriptor_done(port_id, queue_id,
-			FREQ_GEAR3_RX_PACKET_THRESHOLD) > 0)) {
+	if (likely(rxq_count > FREQ_GEAR3_RX_PACKET_THRESHOLD)) {
 		stats[lcore_id].trend = 0;
 		return FREQ_HIGHEST;
-	} else if (likely(rte_eth_rx_descriptor_done(port_id, queue_id,
-			FREQ_GEAR2_RX_PACKET_THRESHOLD) > 0))
+	} else if (likely(rxq_count > FREQ_GEAR2_RX_PACKET_THRESHOLD))
 		stats[lcore_id].trend += FREQ_UP_TREND2_ACC;
-	else if (likely(rte_eth_rx_descriptor_done(port_id, queue_id,
-			FREQ_GEAR1_RX_PACKET_THRESHOLD) > 0))
+	else if (likely(rxq_count > FREQ_GEAR1_RX_PACKET_THRESHOLD))
 		stats[lcore_id].trend += FREQ_UP_TREND1_ACC;
 
 	if (likely(stats[lcore_id].trend > FREQ_UP_THRESHOLD)) {
-- 
2.7.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 4/4] examples/l3fwd-power: disable Lsc interrupts
  2017-12-12 10:08 [dpdk-dev] [PATCH 1/4] examples/l3fwd-power: fix non Rx intr supported platform Nikhil Agarwal
  2017-12-12 10:08 ` [dpdk-dev] [PATCH 2/4] examples/l3fwd-power: fix the timer for any platform freq Nikhil Agarwal
  2017-12-12 10:08 ` [dpdk-dev] [PATCH 3/4] examples/l3fwd-power: replace desc done with Rx queue count Nikhil Agarwal
@ 2017-12-12 10:08 ` Nikhil Agarwal
  2017-12-13 14:23   ` Hunt, David
  2017-12-13 14:21 ` [dpdk-dev] [PATCH 1/4] examples/l3fwd-power: fix non Rx intr supported platform Hunt, David
  3 siblings, 1 reply; 9+ messages in thread
From: Nikhil Agarwal @ 2017-12-12 10:08 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, nikhil.agarwal, hemant.agrawal

This application does not need Link Status Interrupt.
It will cause failure for the platforms not supporting LSC.

Signed-off-by: Nikhil Agarwal <nikhil.agarwal@linaro.org>
---
 examples/l3fwd-power/main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 4ddd04c..d80f663 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -229,7 +229,6 @@ static struct rte_eth_conf port_conf = {
 		.mq_mode = ETH_MQ_TX_NONE,
 	},
 	.intr_conf = {
-		.lsc = 1,
 		.rxq = 1,
 	},
 };
-- 
2.7.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH 1/4] examples/l3fwd-power: fix non Rx intr supported platform
  2017-12-12 10:08 [dpdk-dev] [PATCH 1/4] examples/l3fwd-power: fix non Rx intr supported platform Nikhil Agarwal
                   ` (2 preceding siblings ...)
  2017-12-12 10:08 ` [dpdk-dev] [PATCH 4/4] examples/l3fwd-power: disable Lsc interrupts Nikhil Agarwal
@ 2017-12-13 14:21 ` Hunt, David
  2018-01-15 17:43   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
  3 siblings, 1 reply; 9+ messages in thread
From: Hunt, David @ 2017-12-13 14:21 UTC (permalink / raw)
  To: Nikhil Agarwal, dev
  Cc: nikhil.agarwal, hemant.agrawal, stable, Danny Zhou, Cunming Liang

On 12/12/2017 10:08 AM, Nikhil Agarwal wrote:
> This existing code cause the platform to start receiving packet
> immediately irrespective of interrupts available or not.
> If the platform does not support Rx interrupt, it shall not start
> receiving packets immediately. It shall let the timer management work.
>
> Fixes: aee3bc79cc34 ("examples/l3fwd-power: enable one-shot Rx interrupt and polling switch")
> Cc: stable@dpdk.org
> Cc: Danny Zhou <danny.zhou@intel.com>
> Cc: Cunming Liang <cunming.liang@intel.com>
>
> Signed-off-by: Nikhil Agarwal <nikhil.agarwal@linaro.org>
> ---

---snip---

Acked-by: David Hunt <david.hunt@intel.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH 2/4] examples/l3fwd-power: fix the timer for any platform freq
  2017-12-12 10:08 ` [dpdk-dev] [PATCH 2/4] examples/l3fwd-power: fix the timer for any platform freq Nikhil Agarwal
@ 2017-12-13 14:22   ` Hunt, David
  0 siblings, 0 replies; 9+ messages in thread
From: Hunt, David @ 2017-12-13 14:22 UTC (permalink / raw)
  To: Nikhil Agarwal, dev; +Cc: nikhil.agarwal, hemant.agrawal, stable


On 12/12/2017 10:08 AM, Nikhil Agarwal wrote:
> The code assumes that the platform frequency is 2GHz.
> This patch add support for dynamically detecting platform frequence.
>
> Fixes: d7937e2e3d12 ("power: initial import")
> Cc: stable@dpdk.org
>
> Signed-off-by: Nikhil Agarwal <nikhil.agarwal@linaro.org>
> ---

---snip---

Acked-by: David Hunt <david.hunt@intel.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH 3/4] examples/l3fwd-power: replace desc done with Rx queue count
  2017-12-12 10:08 ` [dpdk-dev] [PATCH 3/4] examples/l3fwd-power: replace desc done with Rx queue count Nikhil Agarwal
@ 2017-12-13 14:22   ` Hunt, David
  0 siblings, 0 replies; 9+ messages in thread
From: Hunt, David @ 2017-12-13 14:22 UTC (permalink / raw)
  To: Nikhil Agarwal, dev; +Cc: nikhil.agarwal, hemant.agrawal


On 12/12/2017 10:08 AM, Nikhil Agarwal wrote:
> HW queue based platforms may not support descriptor done API.
> This patch changes the usages to rx_queue_count API, which
> is more generic.
>
> Signed-off-by: Nikhil Agarwal <nikhil.agarwal@linaro.org>
> ---

---snip---

Acked-by: David Hunt <david.hunt@intel.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH 4/4] examples/l3fwd-power: disable Lsc interrupts
  2017-12-12 10:08 ` [dpdk-dev] [PATCH 4/4] examples/l3fwd-power: disable Lsc interrupts Nikhil Agarwal
@ 2017-12-13 14:23   ` Hunt, David
  0 siblings, 0 replies; 9+ messages in thread
From: Hunt, David @ 2017-12-13 14:23 UTC (permalink / raw)
  To: Nikhil Agarwal, dev; +Cc: nikhil.agarwal, hemant.agrawal


On 12/12/2017 10:08 AM, Nikhil Agarwal wrote:
> This application does not need Link Status Interrupt.
> It will cause failure for the platforms not supporting LSC.
>
> Signed-off-by: Nikhil Agarwal <nikhil.agarwal@linaro.org>
> ---
>   

---snip---

Acked-by: David Hunt <david.hunt@intel.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH 1/4] examples/l3fwd-power: fix non Rx intr supported platform
  2017-12-13 14:21 ` [dpdk-dev] [PATCH 1/4] examples/l3fwd-power: fix non Rx intr supported platform Hunt, David
@ 2018-01-15 17:43   ` Thomas Monjalon
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Monjalon @ 2018-01-15 17:43 UTC (permalink / raw)
  To: Nikhil Agarwal
  Cc: stable, Hunt, David, dev, nikhil.agarwal, hemant.agrawal,
	Danny Zhou, Cunming Liang

13/12/2017 15:21, Hunt, David:
> On 12/12/2017 10:08 AM, Nikhil Agarwal wrote:
> > This existing code cause the platform to start receiving packet
> > immediately irrespective of interrupts available or not.
> > If the platform does not support Rx interrupt, it shall not start
> > receiving packets immediately. It shall let the timer management work.
> >
> > Fixes: aee3bc79cc34 ("examples/l3fwd-power: enable one-shot Rx interrupt and polling switch")
> > Cc: stable@dpdk.org
> > Cc: Danny Zhou <danny.zhou@intel.com>
> > Cc: Cunming Liang <cunming.liang@intel.com>
> >
> > Signed-off-by: Nikhil Agarwal <nikhil.agarwal@linaro.org>
> > ---
> 
> ---snip---
> 
> Acked-by: David Hunt <david.hunt@intel.com>

Series applied, thanks

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-01-15 17:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-12 10:08 [dpdk-dev] [PATCH 1/4] examples/l3fwd-power: fix non Rx intr supported platform Nikhil Agarwal
2017-12-12 10:08 ` [dpdk-dev] [PATCH 2/4] examples/l3fwd-power: fix the timer for any platform freq Nikhil Agarwal
2017-12-13 14:22   ` Hunt, David
2017-12-12 10:08 ` [dpdk-dev] [PATCH 3/4] examples/l3fwd-power: replace desc done with Rx queue count Nikhil Agarwal
2017-12-13 14:22   ` Hunt, David
2017-12-12 10:08 ` [dpdk-dev] [PATCH 4/4] examples/l3fwd-power: disable Lsc interrupts Nikhil Agarwal
2017-12-13 14:23   ` Hunt, David
2017-12-13 14:21 ` [dpdk-dev] [PATCH 1/4] examples/l3fwd-power: fix non Rx intr supported platform Hunt, David
2018-01-15 17:43   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon

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