DPDK patches and discussions
 help / color / mirror / Atom feed
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: dev@dpdk.org
Subject: [PATCH V3 3/3] examples/pipeline: improve learner table timers
Date: Fri, 20 May 2022 23:12:55 +0100	[thread overview]
Message-ID: <20220520221255.1731-3-cristian.dumitrescu@intel.com> (raw)
In-Reply-To: <20220520221255.1731-1-cristian.dumitrescu@intel.com>

Added the rearm counter to the statistics. Updated the learner table
example to the new learner table timer operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 examples/pipeline/cli.c                 |  2 ++
 examples/pipeline/examples/learner.spec | 15 +++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c
index d52ad6b61e..0334616bd9 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -2677,12 +2677,14 @@ cmd_pipeline_stats(char **tokens,
 			"\t\tMiss (packets): %" PRIu64 "\n"
 			"\t\tLearn OK (packets): %" PRIu64 "\n"
 			"\t\tLearn error (packets): %" PRIu64 "\n"
+			"\t\tRearm (packets): %" PRIu64 "\n"
 			"\t\tForget (packets): %" PRIu64 "\n",
 			learner_info.name,
 			stats.n_pkts_hit,
 			stats.n_pkts_miss,
 			stats.n_pkts_learn_ok,
 			stats.n_pkts_learn_err,
+			stats.n_pkts_rearm,
 			stats.n_pkts_forget);
 		out_size -= strlen(out);
 		out += strlen(out);
diff --git a/examples/pipeline/examples/learner.spec b/examples/pipeline/examples/learner.spec
index 4ee52da7ac..095325c293 100644
--- a/examples/pipeline/examples/learner.spec
+++ b/examples/pipeline/examples/learner.spec
@@ -48,6 +48,9 @@ struct metadata_t {
 	bit<32> port_in
 	bit<32> port_out
 
+	// Key timeout.
+	bit<32> timeout_id
+
 	// Arguments for the "fwd_action" action.
 	bit<32> fwd_action_arg_port_out
 }
@@ -68,10 +71,14 @@ struct fwd_action_args_t {
 
 action fwd_action args instanceof fwd_action_args_t {
 	mov m.port_out t.port_out
+	rearm
 	return
 }
 
 action learn_action args none {
+	// Pick the key timeout. Timeout ID #1 (i.e. 120 seconds) is selected.
+	mov m.timeout_id 1
+
 	// Read current counter value into m.fwd_action_arg_port_out.
 	regrd m.fwd_action_arg_port_out counter 0
 
@@ -84,7 +91,7 @@ action learn_action args none {
 	// Add the current lookup key to the table with fwd_action as the key action. The action
 	// arguments are read from the packet meta-data (the m.fwd_action_arg_port_out field). These
 	// packet meta-data fields have to be written before the "learn" instruction is invoked.
-	learn fwd_action m.fwd_action_arg_port_out
+	learn fwd_action m.fwd_action_arg_port_out m.timeout_id
 
 	// Send the current packet to the same output port.
 	mov m.port_out m.fwd_action_arg_port_out
@@ -110,7 +117,11 @@ learner fwd_table {
 
 	size 1048576
 
-	timeout 120
+	timeout {
+		60
+		120
+		180
+	}
 }
 
 //
-- 
2.17.1


  parent reply	other threads:[~2022-05-20 22:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 15:59 [PATCH 1/3] table: " Cristian Dumitrescu
2022-04-21 15:59 ` [PATCH 2/3] pipeline: " Cristian Dumitrescu
2022-04-21 15:59 ` [PATCH 3/3] examples/pipeline: " Cristian Dumitrescu
2022-04-22 13:03 ` [PATCH V2 1/3] table: " Cristian Dumitrescu
2022-04-22 13:03   ` [PATCH V2 2/3] pipeline: " Cristian Dumitrescu
2022-04-22 13:03   ` [PATCH V2 3/3] examples/pipeline: " Cristian Dumitrescu
2022-05-20 22:12   ` [PATCH V3 1/3] table: " Cristian Dumitrescu
2022-05-20 22:12     ` [PATCH V3 2/3] pipeline: " Cristian Dumitrescu
2022-05-20 22:12     ` Cristian Dumitrescu [this message]
2022-06-01 13:57     ` [PATCH V3 1/3] table: " Thomas Monjalon

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=20220520221255.1731-3-cristian.dumitrescu@intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    /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).