From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id A89528D96 for ; Sat, 26 Sep 2015 00:33:57 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 25 Sep 2015 15:33:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,588,1437462000"; d="scan'208";a="813400568" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 25 Sep 2015 15:33:16 -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 t8PMXGtQ015222; Fri, 25 Sep 2015 23:33:16 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t8PMXFrP013704; Fri, 25 Sep 2015 23:33:15 +0100 Received: (from fanzhan2@localhost) by sivswdev02.ir.intel.com with id t8PMXFTF013700; Fri, 25 Sep 2015 23:33:15 +0100 From: roy.fan.zhang@intel.com To: dev@dpdk.org Date: Fri, 25 Sep 2015 23:33:11 +0100 Message-Id: <1443220392-13434-8-git-send-email-roy.fan.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1443220392-13434-1-git-send-email-roy.fan.zhang@intel.com> References: <1443220392-13434-1-git-send-email-roy.fan.zhang@intel.com> Subject: [dpdk-dev] [PATCH 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: Fri, 25 Sep 2015 22:33:58 -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