From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id CD44D8DAC for ; Tue, 13 Oct 2015 15:57:36 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 13 Oct 2015 06:57:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,678,1437462000"; d="scan'208";a="809951026" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 13 Oct 2015 06:57:34 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t9DDvYha013295; Tue, 13 Oct 2015 14:57:34 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t9DDvXvm000656; Tue, 13 Oct 2015 14:57:33 +0100 Received: (from jasvinde@localhost) by sivswdev02.ir.intel.com with id t9DDvXtm000652; Tue, 13 Oct 2015 14:57:33 +0100 From: Jasvinder Singh To: dev@dpdk.org Date: Tue, 13 Oct 2015 14:57:31 +0100 Message-Id: <1444744652-573-8-git-send-email-jasvinder.singh@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1444744652-573-1-git-send-email-jasvinder.singh@intel.com> References: <1444744652-573-1-git-send-email-jasvinder.singh@intel.com> Subject: [dpdk-dev] [PATCH v2 7/8] example/ip_pipeline/pipeline: update flow_classification pipeline X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2015 13:57:37 -0000 From: Fan Zhang This patch updates the flow_classification pipeline for added key_mask parameter in 8/16-byte key hash parameters. The update provides user optional key_mask configuration item applying to the packets. Signed-off-by: Fan Zhang --- .../pipeline/pipeline_flow_classification_be.c | 56 ++++++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c index 06a648d..e22f96f 100644 --- a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c +++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "pipeline_flow_classification_be.h" #include "hash_func.h" @@ -49,6 +50,7 @@ struct pipeline_flow_classification { uint32_t key_offset; uint32_t key_size; uint32_t hash_offset; + uint8_t *key_mask; } __rte_cache_aligned; static void * @@ -125,8 +127,12 @@ pipeline_fc_parse_args(struct pipeline_flow_classification *p, uint32_t key_offset_present = 0; uint32_t key_size_present = 0; uint32_t hash_offset_present = 0; + uint32_t key_mask_present = 0; uint32_t i; + char *key_mask_str = NULL; + + p->hash_offset = 0; for (i = 0; i < params->n_args; i++) { char *arg_name = params->args_name[i]; @@ -171,6 +177,20 @@ pipeline_fc_parse_args(struct pipeline_flow_classification *p, continue; } + /* key_mask */ + if (strcmp(arg_name, "key_mask") == 0) { + if (key_mask_present) + return -1; + + key_mask_str = strdup(arg_value); + if (key_mask_str == NULL) + return -1; + + key_mask_present = 1; + + continue; + } + /* hash_offset */ if (strcmp(arg_name, "hash_offset") == 0) { if (hash_offset_present) @@ -189,10 +209,23 @@ pipeline_fc_parse_args(struct pipeline_flow_classification *p, /* Check that mandatory arguments are present */ if ((n_flows_present == 0) || (key_offset_present == 0) || - (key_size_present == 0) || - (hash_offset_present == 0)) + (key_size_present == 0)) return -1; + if (key_mask_present) { + p->key_mask = rte_malloc(NULL, p->key_size, 0); + if (p->key_mask == NULL) + return -1; + + if (parse_hex_string(key_mask_str, p->key_mask, &p->key_size) + != 0) { + free(p->key_mask); + return -1; + } + + free(key_mask_str); + } + return 0; } @@ -297,6 +330,7 @@ static void *pipeline_fc_init(struct pipeline_params *params, .signature_offset = p_fc->hash_offset, .key_offset = p_fc->key_offset, .f_hash = hash_func[(p_fc->key_size / 8) - 1], + .key_mask = p_fc->key_mask, .seed = 0, }; @@ -307,6 +341,7 @@ static void *pipeline_fc_init(struct pipeline_params *params, .signature_offset = p_fc->hash_offset, .key_offset = p_fc->key_offset, .f_hash = hash_func[(p_fc->key_size / 8) - 1], + .key_mask = p_fc->key_mask, .seed = 0, }; @@ -336,12 +371,25 @@ static void *pipeline_fc_init(struct pipeline_params *params, switch (p_fc->key_size) { case 8: - table_params.ops = &rte_table_hash_key8_lru_ops; + if (p_fc->hash_offset != 0) { + table_params.ops = + &rte_table_hash_key8_ext_ops; + } else { + table_params.ops = + &rte_table_hash_key8_ext_dosig_ops; + } table_params.arg_create = &table_hash_key8_params; break; + break; case 16: - table_params.ops = &rte_table_hash_key16_ext_ops; + if (p_fc->hash_offset != 0) { + table_params.ops = + &rte_table_hash_key16_ext_ops; + } else { + table_params.ops = + &rte_table_hash_key16_ext_dosig_ops; + } table_params.arg_create = &table_hash_key16_params; break; -- 2.1.0