From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2DC38A2EFC for ; Wed, 18 Sep 2019 10:43:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A77C31C125; Wed, 18 Sep 2019 10:43:25 +0200 (CEST) Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) by dpdk.org (Postfix) with ESMTP id B25E81C11E for ; Wed, 18 Sep 2019 10:43:23 +0200 (CEST) Received: by mail-vs1-f50.google.com with SMTP id p13so3945824vsr.4 for ; Wed, 18 Sep 2019 01:43:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=3d36BrDRv/BF5f4C5dPmAL4y1S576k5gMozmDqvK7SM=; b=lIbHPgRAHj7bdIbcQY2N5Lg2ze2Fh3KtrGhRj/ddwhcGXlgcoOQ2rg8Thmp4ySA2Ds gFYGuM+AS5LremxFnV+lQSf1isBZAYyJmQVEY//8D2TbRu4/Ple4GzuJmP8IR1znUNVZ L4R0+L+5YLuTU9f+p57TQm4Smdf9S1hkndHIOnEKWNGjXGEHz3JwATyKKISShZQMWsu9 ZBcB4jjF9Q4U0kVYCrgYfNRHUMfukbFOORauJaCUSs4Qxa7rniLKM3Y10MVrl2lmOnNT 3vxrRzI4DFPpgdfrtlMnpbJVsQszAMbun0SwQUYYRSVlQq5vZwU4I3NQKwUeHOchWM2B 0rtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=3d36BrDRv/BF5f4C5dPmAL4y1S576k5gMozmDqvK7SM=; b=rYAIgxoIly4q7DbaNmpWQr1TRjuRTmurBiwFyptJikYZwgS4DijhunU/hPm2C98GC2 986Hju3nhSi1tVdudVqEKDCkPVyjyW83rkmITX1GRJBlGH/UebFxBRr8IwmuUufRsvmS q/ocm2JR3zt9Aw100brwOvmjTIPACA3hr2WBBxknkdJSyQjStAdyH1jiUOUITr7OsPhi 6t9+3MzBHrm9aYNUCXhbmlyEZ+zXOm9Jfts/dfn7AarHxt0hyh8QXU8o7Q2EPGTq8U2r sXl09o/JeR4HojcWss6f/k94naR11zeW57GkGs6t7xob8poMZKAeedB6Jrc8tmGAKoZb vJ9A== X-Gm-Message-State: APjAAAW92rV0uxvClGz3U33fc4e3CJAbMxMpqChxF2pFv117lUGNrTHi 4SzzB95lf9nnsn7wkjQHewsYnX5LH8/aLUAa5S1yjStp X-Google-Smtp-Source: APXvYqwqylcm/fid5aDeivM/9X7TcdDN5CVrZuKbuIwKrQiPK0HQuQdXUL0A5Ep1Dx83IPtUEzcJlXqwlvtIldBCYe4= X-Received: by 2002:a67:eb85:: with SMTP id e5mr1560374vso.30.1568796202721; Wed, 18 Sep 2019 01:43:22 -0700 (PDT) MIME-Version: 1.0 From: Victor Huertas Date: Wed, 18 Sep 2019 10:43:11 +0200 Message-ID: To: dev@dpdk.org Cc: Vikutoru Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] [DPDK v17.11 LTS] Crash (segmentation fault) in ACL table packet look up 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" Hi all, the DPDK lib always crashes when a packet enters an ACL table I created to check IPv6 fragmented packets. If the table is empty nothing happens as the missed packets go to the next table in the pipeline but as soon as I put some entries a crash happens when the first packet enters. It seems to happen in the acl_run.h file (in librte_acl) in line 178 (static inline uint64_t acl_start_next_trie(struct acl_flow_data *flows, struct parms *parms, int n, const struct rte_acl_ctx *ctx)). Subsequently, I put the section of the code where it crashes (in bold and red): /* set completion parameters and starting index for this slot */ parms[n].cmplt = flows->last_cmplt; transition = * flows->trans[parms[n].data[*parms[n].data_index++]* + ctx->trie[flows->trie].root_index]; Running in debug mode, Eclipse tells me that the 'trans' component of 'flows' is NULL and that's what I think that is the cause of the segmentation fault. The thing is that other ACL tables that I use don't causes this segmentation fault at all. I have revised the fields format configuration, etc. and all seems to be OK. The table creation returns 0 and all the table entry insertions returns 0. So the lib doesn't complain at all until the crash happens. I enclose below the sections of my code where the fields format is set as well as the table creation section. Any help is really wellcome to see what is happening here. Thanks a lot for your attention. Now the code samples: ================== ACL fields format (only the one that fails) ======================= struct rte_acl_field_def *field_format_ipv6_1st_fragment* [NUM_FIELDS_IPV6_1ST_FRAGMENT_ACL] = { /* Protocol (1 byte) this value will always be the same (44)*/ [0] = { .type = RTE_ACL_FIELD_TYPE_BITMASK, .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, .offset = sizeof(struct ether_hdr) + offsetof(struct ipv6_hdr, proto), }, /* ethertype (2 bytes) : this value will always be the same (0x86DD) */ [1] = { .type = RTE_ACL_FIELD_TYPE_BITMASK, .size = sizeof(uint16_t), .field_index = 1, .input_index = 1, // this value must be multiple of 4 bytes .offset = offsetof(struct ether_hdr, ether_type), }, /* tos field (2 bytes) */ [2] = { .type = RTE_ACL_FIELD_TYPE_BITMASK, .size = sizeof(uint16_t), .field_index = 2, .input_index = 1, // this value must be multiple of 4 bytes .offset = sizeof(struct ether_hdr) + offsetof(struct ipv6_hdr, vtc_flow), }, /************* IPv6 source address **************/ /* Source IPv6 address [0-3] */ [3] = { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = 3, .input_index = 2, // this value must be multiple of 4 bytes .offset = sizeof(struct ether_hdr) + offsetof(struct ipv6_hdr, src_addr[0]), }, /* Source IPv6 address [4-7] */ [4] = { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = 4, .input_index = 3, // this value must be multiple of 4 bytes .offset = sizeof(struct ether_hdr) + offsetof(struct ipv6_hdr, src_addr[4]), }, /* Source IPv6 address [8-11] */ [5] = { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = 5, .input_index = 4, // this value must be multiple of 4 bytes .offset = sizeof(struct ether_hdr) + offsetof(struct ipv6_hdr, src_addr[8]), }, /* Source IPv6 address [12-15] */ [6] = { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = 6, .input_index = 5, // this value must be multiple of 4 bytes .offset = sizeof(struct ether_hdr) + offsetof(struct ipv6_hdr, src_addr[12]), }, /************* IPv6 destination address **************/ /* Destination IPv6 address [0-3] */ [7] = { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = 7, .input_index = 6, // this value must be multiple of 4 bytes .offset = sizeof(struct ether_hdr) + offsetof(struct ipv6_hdr, dst_addr[0]), }, /* Destination IPv6 address [4-7] */ [8] = { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = 8, .input_index = 7, // this value must be multiple of 4 bytes .offset = sizeof(struct ether_hdr) + offsetof(struct ipv6_hdr, dst_addr[4]), }, /* Destination IPv6 address [8-11] */ [9] = { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = 9, .input_index = 8, // this value must be multiple of 4 bytes .offset = sizeof(struct ether_hdr) + offsetof(struct ipv6_hdr, dst_addr[8]), }, /* Destination IPv6 address [12-15] */ [10] = { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = 10, .input_index = 9, // this value must be multiple of 4 bytes .offset = sizeof(struct ether_hdr) + offsetof(struct ipv6_hdr, dst_addr[12]), }, /* next_header+reserved+frag_data (4 byte) in ipv6 frag header */ [11] = { .type = RTE_ACL_FIELD_TYPE_BITMASK, .size = sizeof(uint32_t), .field_index = 11, .input_index = 10, // this value must be multiple of 4 bytes .offset = sizeof(struct ether_hdr) + sizeof(struct ipv6_hdr) + offsetof(struct ipv6_extension_fragment, next_header), }, /* Source Port */ [12] = { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = 12, .input_index = 11, // this value must be multiple of 4 bytes .offset = sizeof(struct ether_hdr) + sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment) + offsetof(struct tcp_hdr, src_port), }, /* Destination Port */ [13] = { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = 13, .input_index = 11, // this value must be multiple of 4 bytes .offset = sizeof(struct ether_hdr) + sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment) + offsetof(struct tcp_hdr, dst_port), }, }; ===================== Table creation ========================== struct rte_table_acl_params acl_flow_line_acl_params[SERVICE_QOS_NUM_FLOW_CLASSIF_TABLES]; /* SERVICE_QOS_IPV4_QOS_POLICY_ACL table params setting */ strcpy(s_fc->table_p[SERVICE_QOS_IPV4_QOS_POLICY_ACL].table_name,"table_acl_ipv4_qos_policy"); s_fc->table_p[SERVICE_QOS_IPV4_QOS_POLICY_ACL].field_format = field_format_ipv4; s_fc->table_p[SERVICE_QOS_IPV4_QOS_POLICY_ACL].n_rule_fields = RTE_DIM(field_format_ipv4); s_fc->table_p[SERVICE_QOS_IPV4_QOS_POLICY_ACL].field_format_size = sizeof(field_format_ipv4); s_fc->table_p[SERVICE_QOS_IPV4_QOS_POLICY_ACL].n_rules = FLOW_CLASSIFY_MAX_RULE_NUM; /* SERVICE_QOS_IPV6_QOS_POLICY_ACL table params setting */ strcpy(s_fc->table_p[SERVICE_QOS_IPV6_QOS_POLICY_ACL].table_name,"table_acl_ipv6_qos_policy"); s_fc->table_p[SERVICE_QOS_IPV6_QOS_POLICY_ACL].field_format = field_format_ipv6; s_fc->table_p[SERVICE_QOS_IPV6_QOS_POLICY_ACL].n_rule_fields = RTE_DIM(field_format_ipv6); s_fc->table_p[SERVICE_QOS_IPV6_QOS_POLICY_ACL].field_format_size = sizeof(field_format_ipv6); s_fc->table_p[SERVICE_QOS_IPV6_QOS_POLICY_ACL].n_rules = FLOW_CLASSIFY_MAX_RULE_NUM; // 8*1024 * /* SERVICE_QOS_IPV6_QOS_POLICY_1ST_FRAGMENT_ACL table params setting */ strcpy(s_fc->table_p[SERVICE_QOS_IPV6_QOS_POLICY_1ST_FRAGMENT_ACL].table_name,"table_acl_ipv6_qos_policy_1st_fragment"); s_fc->table_p[SERVICE_QOS_IPV6_QOS_POLICY_1ST_FRAGMENT_ACL].field_format = field_format_ipv6_1st_fragment; s_fc->table_p[SERVICE_QOS_IPV6_QOS_POLICY_1ST_FRAGMENT_ACL].n_rule_fields = RTE_DIM(field_format_ipv6_1st_fragment); s_fc->table_p[SERVICE_QOS_IPV6_QOS_POLICY_1ST_FRAGMENT_ACL].field_format_size = sizeof(field_format_ipv6_1st_fragment); s_fc->table_p[SERVICE_QOS_IPV6_QOS_POLICY_1ST_FRAGMENT_ACL].n_rules = FLOW_CLASSIFY_MAX_RULE_NUM; // 8*1024* for(unsigned int i=0; itable_p[i].table_name; acl_flow_line_acl_params[i].n_rules = s_fc->table_p[i].n_rules; acl_flow_line_acl_params[i].n_rule_fields = s_fc->table_p[i].n_rule_fields; for(unsigned int j=0; jtable_p[i].n_rule_fields; j++){ memcpy(&acl_flow_line_acl_params[i].field_format[j],&s_fc->table_p[i].field_format[j],sizeof(struct rte_acl_field_def)); } s_fc->table_p[i].pipeline_table_params.ops = &rte_table_acl_ops; s_fc->table_p[i].pipeline_table_params.arg_create = &acl_flow_line_acl_params[i]; s_fc->table_p[i].pipeline_table_params.f_action_hit = get_service_qos_fc_table_ah_hit(); s_fc->table_p[i].pipeline_table_params.f_action_miss = NULL; s_fc->table_p[i].pipeline_table_params.arg_ah = &s_qos->qoss.metadata; s_fc->table_p[i].pipeline_table_params.action_data_size = sizeof(struct service_qos_policy_flow_table_entry) - sizeof(struct rte_pipeline_table_entry); status = rte_pipeline_table_create(p->p, &s_fc->table_p[i].pipeline_table_params, &p->table_id[s_fc->table_p[i].table_index]); if (status) { return NULL; // the rte_free must be done in the pipeline } else{ p->n_tables++; uint32_t pipeline_id; APP_PARAM_GET_ID(p,"PIPELINE",pipeline_id); S_LOG_BE(p, pipeline_id,PIPELINE_LOG_LEVEL_INFO, "Successfully added '%s' table with index {%u}", acl_flow_line_acl_params[i].name,s_fc->table_p[i].table_index); } } } -- Victor