From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B833DA0093; Sat, 21 May 2022 00:13:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E62B42B73; Sat, 21 May 2022 00:13:02 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id DC88F427F2 for ; Sat, 21 May 2022 00:12:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653084780; x=1684620780; h=from:to:subject:date:message-id:in-reply-to:references; bh=maHLaBc3LDRjSGFBVxk7EoEgpp8qPb9l2SK5G44EUr4=; b=TLCtLqpc9CEUUSz3NmB4tnnqVhXH/RgBk6GCfVsROX3RErAzq6E7P37l T3A638gdn1YttZxsa/Ro5qqn/dt8jtG4cKyvhCuhSO7XT1hzgea3kM9Hr GorCbxKgqpgDh7J+hp2KWtjmgXM1y44G7qaEVivijinerDWv4fT7mkmye NADP97hCLJ5SvYmiuJFpyWoN5t/fDD5mejFezG+KIvROG5JRMDsnRNSd4 K1+JG6g6N32mA0jyoIulYvmr7tZDwFvBUko7YuEOmYsuMofZAPQ2UB/jE hSHItVwTQmEYqK+1fkANbxwcGdYMDHf/39JFYwXw1+Tv1FlEKE5kiOE+h A==; X-IronPort-AV: E=McAfee;i="6400,9594,10353"; a="298067080" X-IronPort-AV: E=Sophos;i="5.91,240,1647327600"; d="scan'208";a="298067080" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2022 15:12:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,240,1647327600"; d="scan'208";a="640511078" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.107]) by fmsmga004.fm.intel.com with ESMTP; 20 May 2022 15:12:58 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Subject: [PATCH V3 3/3] examples/pipeline: improve learner table timers Date: Fri, 20 May 2022 23:12:55 +0100 Message-Id: <20220520221255.1731-3-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220520221255.1731-1-cristian.dumitrescu@intel.com> References: <20220422130343.44060-1-cristian.dumitrescu@intel.com> <20220520221255.1731-1-cristian.dumitrescu@intel.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Added the rearm counter to the statistics. Updated the learner table example to the new learner table timer operation. Signed-off-by: Cristian Dumitrescu --- 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