From patchwork Thu Aug 24 13:53:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 27870 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 5EF7A7D8E; Thu, 24 Aug 2017 15:53:18 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id B32897D52 for ; Thu, 24 Aug 2017 15:53:13 +0200 (CEST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Aug 2017 06:53:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,421,1498546800"; d="scan'208";a="141567970" Received: from silpixa00382658.ir.intel.com ([10.237.223.29]) by orsmga005.jf.intel.com with ESMTP; 24 Aug 2017 06:53:12 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Thu, 24 Aug 2017 14:53:08 +0100 Message-Id: <1503582789-121358-5-git-send-email-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503582789-121358-1-git-send-email-cristian.dumitrescu@intel.com> References: <1503582789-121358-1-git-send-email-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH 4/5] ip_pipeline: update due to api changes in librte_table X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Cristian Dumitrescu --- .../pipeline/pipeline_flow_classification.c | 9 ++-- .../pipeline/pipeline_flow_classification_be.c | 54 ++++------------------ .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 18 ++++---- .../ip_pipeline/pipeline/pipeline_routing_be.c | 18 ++++---- 4 files changed, 33 insertions(+), 66 deletions(-) diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c index 9ef50cc..a8fae1e 100644 --- a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c +++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c @@ -88,8 +88,11 @@ app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in, uint32_t *signature) { uint8_t buffer[PIPELINE_FC_FLOW_KEY_MAX_SIZE]; + uint8_t m[PIPELINE_FC_FLOW_KEY_MAX_SIZE]; /* key mask */ void *key_buffer = (key_out) ? key_out : buffer; + memset(m, 0xFF, sizeof(m)); + switch (key_in->type) { case FLOW_KEY_QINQ: { @@ -101,7 +104,7 @@ app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in, qinq->cvlan = rte_cpu_to_be_16(key_in->key.qinq.cvlan); if (signature) - *signature = (uint32_t) hash_default_key8(qinq, 8, 0); + *signature = (uint32_t) hash_default_key8(qinq, m, 8, 0); return 0; } @@ -118,7 +121,7 @@ app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in, ipv4->port_dst = rte_cpu_to_be_16(key_in->key.ipv4_5tuple.port_dst); if (signature) - *signature = (uint32_t) hash_default_key16(ipv4, 16, 0); + *signature = (uint32_t) hash_default_key16(ipv4, m, 16, 0); return 0; } @@ -136,7 +139,7 @@ app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in, ipv6->port_dst = rte_cpu_to_be_16(key_in->key.ipv6_5tuple.port_dst); if (signature) - *signature = (uint32_t) hash_default_key64(ipv6, 64, 0); + *signature = (uint32_t) hash_default_key64(ipv6, m, 64, 0); return 0; } diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c index 026f00c..e489957 100644 --- a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c +++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c @@ -492,40 +492,15 @@ static void *pipeline_fc_init(struct pipeline_params *params, /* Tables */ p->n_tables = 1; { - struct rte_table_hash_key8_ext_params - table_hash_key8_params = { - .n_entries = p_fc->n_flows, - .n_entries_ext = p_fc->n_flows, - .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_present) ? - p_fc->key_mask : NULL, - .seed = 0, - }; - - struct rte_table_hash_key16_ext_params - table_hash_key16_params = { - .n_entries = p_fc->n_flows, - .n_entries_ext = p_fc->n_flows, - .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_present) ? - p_fc->key_mask : NULL, - .seed = 0, - }; - - struct rte_table_hash_ext_params - table_hash_params = { + struct rte_table_hash_params table_hash_params = { + .name = p->name, .key_size = p_fc->key_size, + .key_offset = p_fc->key_offset, + .key_mask = (p_fc->key_mask_present)? p_fc->key_mask : NULL, .n_keys = p_fc->n_flows, .n_buckets = p_fc->n_flows / 4, - .n_buckets_ext = p_fc->n_flows / 4, .f_hash = hash_func[(p_fc->key_size / 8) - 1], .seed = 0, - .signature_offset = p_fc->hash_offset, - .key_offset = p_fc->key_offset, }; struct rte_pipeline_table_params table_params = { @@ -542,32 +517,19 @@ static void *pipeline_fc_init(struct pipeline_params *params, switch (p_fc->key_size) { case 8: - 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; + table_params.ops = &rte_table_hash_key8_ext_ops; break; case 16: - 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; + table_params.ops = &rte_table_hash_key16_ext_ops; break; default: table_params.ops = &rte_table_hash_ext_ops; - table_params.arg_create = &table_hash_params; } + table_params.arg_create = &table_hash_params; + status = rte_pipeline_table_create(p->p, &table_params, &p->table_id[0]); diff --git a/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c b/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c index 8cb2f0c..2500332 100644 --- a/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c +++ b/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c @@ -76,7 +76,7 @@ static pipeline_msg_req_handler handlers[] = { pipeline_msg_req_invalid_handler, }; -static __rte_always_inline void +static inline __attribute__((always_inline)) void pkt_work_dma( struct rte_mbuf *pkt, void *arg, @@ -102,7 +102,7 @@ pkt_work_dma( /* Read (dma_dst), compute (hash), write (hash) */ if (hash_enabled) { - uint32_t hash = p->f_hash(dma_dst, dma_size, 0); + uint32_t hash = p->f_hash(dma_src, dma_mask, dma_size, 0); *dma_hash = hash; if (lb_hash) { @@ -121,7 +121,7 @@ pkt_work_dma( } } -static __rte_always_inline void +static inline __attribute__((always_inline)) void pkt4_work_dma( struct rte_mbuf **pkts, void *arg, @@ -173,10 +173,10 @@ pkt4_work_dma( /* Read (dma_dst), compute (hash), write (hash) */ if (hash_enabled) { - uint32_t hash0 = p->f_hash(dma_dst0, dma_size, 0); - uint32_t hash1 = p->f_hash(dma_dst1, dma_size, 0); - uint32_t hash2 = p->f_hash(dma_dst2, dma_size, 0); - uint32_t hash3 = p->f_hash(dma_dst3, dma_size, 0); + uint32_t hash0 = p->f_hash(dma_src0, dma_mask, dma_size, 0); + uint32_t hash1 = p->f_hash(dma_src1, dma_mask, dma_size, 0); + uint32_t hash2 = p->f_hash(dma_src2, dma_mask, dma_size, 0); + uint32_t hash3 = p->f_hash(dma_src3, dma_mask, dma_size, 0); *dma_hash0 = hash0; *dma_hash1 = hash1; @@ -217,7 +217,7 @@ pkt4_work_dma( } } -static __rte_always_inline void +static inline __attribute__((always_inline)) void pkt_work_swap( struct rte_mbuf *pkt, void *arg) @@ -241,7 +241,7 @@ pkt_work_swap( } } -static __rte_always_inline void +static inline __attribute__((always_inline)) void pkt4_work_swap( struct rte_mbuf **pkts, void *arg) diff --git a/examples/ip_pipeline/pipeline/pipeline_routing_be.c b/examples/ip_pipeline/pipeline/pipeline_routing_be.c index 7831716..d281e65 100644 --- a/examples/ip_pipeline/pipeline/pipeline_routing_be.c +++ b/examples/ip_pipeline/pipeline/pipeline_routing_be.c @@ -191,7 +191,7 @@ struct layout { dst->c = src->c; \ } -static __rte_always_inline void +static inline __attribute__((always_inline)) void pkt_work_routing( struct rte_mbuf *pkt, struct rte_pipeline_table_entry *table_entry, @@ -317,7 +317,7 @@ pkt_work_routing( } } -static __rte_always_inline void +static inline __attribute__((always_inline)) void pkt4_work_routing( struct rte_mbuf **pkts, struct rte_pipeline_table_entry **table_entries, @@ -1349,17 +1349,19 @@ pipeline_routing_init(struct pipeline_params *params, /* ARP table configuration */ if (p_rt->params.n_arp_entries) { - struct rte_table_hash_key8_ext_params table_arp_params = { - .n_entries = p_rt->params.n_arp_entries, - .n_entries_ext = p_rt->params.n_arp_entries, + struct rte_table_hash_params table_arp_params = { + .name = p->name, + .key_size = 8, + .key_offset = p_rt->params.arp_key_offset, + .key_mask = NULL, + .n_keys = p_rt->params.n_arp_entries, + .n_buckets = p_rt->params.n_arp_entries / 4, .f_hash = hash_default_key8, .seed = 0, - .signature_offset = 0, /* Unused */ - .key_offset = p_rt->params.arp_key_offset, }; struct rte_pipeline_table_params table_params = { - .ops = &rte_table_hash_key8_ext_dosig_ops, + .ops = &rte_table_hash_key8_ext_ops, .arg_create = &table_arp_params, .f_action_hit = get_arp_table_ah_hit(p_rt), .f_action_miss = NULL,