From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 8A99C8DAF for ; Wed, 28 Oct 2015 18:11:30 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 28 Oct 2015 10:11:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,210,1444719600"; d="scan'208";a="837261357" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 28 Oct 2015 10:11:28 -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 t9SHBRT8002839; Wed, 28 Oct 2015 17:11:27 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t9SHBREG022478; Wed, 28 Oct 2015 17:11:27 GMT Received: (from fanzhan2@localhost) by sivswdev02.ir.intel.com with id t9SHBR3u022474; Wed, 28 Oct 2015 17:11:27 GMT From: roy.fan.zhang@intel.com To: dev@dpdk.org Date: Wed, 28 Oct 2015 17:11:21 +0000 Message-Id: <1446052282-22391-7-git-send-email-roy.fan.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1446052282-22391-1-git-send-email-roy.fan.zhang@intel.com> References: <1446052282-22391-1-git-send-email-roy.fan.zhang@intel.com> Subject: [dpdk-dev] [PATCH v4 6/7] 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: Wed, 28 Oct 2015 17:11:31 -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