From patchwork Wed Jul 23 15:21:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkatesh Vivekanandan X-Patchwork-Id: 34163 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1C4FC20672 for ; Wed, 23 Jul 2014 15:21:59 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id b6sf4779252yha.9 for ; Wed, 23 Jul 2014 08:21:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id :mime-version:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=joa+H7GTuB2wGyK6yj4AlqqiWhGbKbqtHFVM4KZiUKM=; b=bBKDfOJaYvTbpxHogHhCJe8Ipy14EZ4K0Y2bOgw/vndnN8ATpf/Bj9u8o3XhUslaFS FPIL0DvkZbU+HvvgY1Hn5Zo7MrPi2cDauX1nWOQHjpODOxugOkqIjiHOhEO1X/hA1gUI 1CJ0zei8AzP7xTgCvEBQcurywufU8SF44NWaZwhXAq6BEB9EWlK4/keQqnvyQweUDc5R VwuxXUq670JqMxv+8/qT9/kc07a06ETP/UXYz1fIAMRQ571EyM55CgfEG0JzBZQ0kgZR hHx2MVITWV+ezemMBTIILSFEdScx3bzYjZ1Gd3NYPRcI7k/WfqJV2WCcxAcasFuvcwMP xTnA== X-Gm-Message-State: ALoCoQmLfQvpMUT/jgjg0EMFQvT0cmyBpA5t79RFXV4c5XN2OdQUR/1khQvtUik3EJTShcycF5W8 X-Received: by 10.236.171.234 with SMTP id r70mr17479387yhl.45.1406128918862; Wed, 23 Jul 2014 08:21:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.40.169 with SMTP id x38ls425246qgx.28.gmail; Wed, 23 Jul 2014 08:21:58 -0700 (PDT) X-Received: by 10.220.200.71 with SMTP id ev7mr3325152vcb.24.1406128918702; Wed, 23 Jul 2014 08:21:58 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id fp5si2376500vcb.75.2014.07.23.08.21.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Jul 2014 08:21:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id im17so2459703vcb.3 for ; Wed, 23 Jul 2014 08:21:58 -0700 (PDT) X-Received: by 10.220.15.8 with SMTP id i8mr3003505vca.45.1406128918551; Wed, 23 Jul 2014 08:21:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp288729vcb; Wed, 23 Jul 2014 08:21:58 -0700 (PDT) X-Received: by 10.224.16.212 with SMTP id p20mr3323134qaa.1.1406128918098; Wed, 23 Jul 2014 08:21:58 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id h65si5242304qgf.82.2014.07.23.08.21.56 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 23 Jul 2014 08:21:58 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1X9yMd-0007sT-QV; Wed, 23 Jul 2014 15:21:55 +0000 Received: from mail-gw2-out.broadcom.com ([216.31.210.63]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1X9yMY-0007sO-9v for lng-odp@lists.linaro.org; Wed, 23 Jul 2014 15:21:50 +0000 X-IronPort-AV: E=Sophos;i="5.01,718,1400050800"; d="scan'208";a="40318636" Received: from irvexchcas08.broadcom.com (HELO IRVEXCHCAS08.corp.ad.broadcom.com) ([10.9.208.57]) by mail-gw2-out.broadcom.com with ESMTP; 23 Jul 2014 08:31:28 -0700 Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.3.174.1; Wed, 23 Jul 2014 08:21:44 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.3.174.1; Wed, 23 Jul 2014 08:21:44 -0700 Received: from localhost.localdomain (unknown [10.131.61.80]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id B872F9F9FF; Wed, 23 Jul 2014 08:21:42 -0700 (PDT) From: To: Date: Wed, 23 Jul 2014 20:51:31 +0530 Message-ID: <1406128891-16267-1-git-send-email-venkatesh.vivekanandan@linaro.org> X-Mailer: git-send-email 1.8.1.2 MIME-Version: 1.0 X-Topics: patch Subject: [lng-odp] [PATCH 1/1] DPDK ODP_ASSERT compilation fix X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: venkatesh.vivekanandan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Venkatesh Vivekanandan - Replaced ODP_ASSERT with ODP_STATIC_ASSERT to be inline with linux-generic. - Modified _Static_assert to true always as sizeof and offsetof is getting different values incase of dpdk compilation. * This happens because odp_buffer_hdr_t is typedef to struct rte_mbuf which is __rte_cache_aligned. Signed-off-by: Venkatesh Vivekanandan --- platform/linux-dpdk/include/odp_debug.h | 11 ++++++++--- platform/linux-dpdk/include/odp_packet_internal.h | 9 ++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/platform/linux-dpdk/include/odp_debug.h b/platform/linux-dpdk/include/odp_debug.h index e37ca8d..489a22e 100644 --- a/platform/linux-dpdk/include/odp_debug.h +++ b/platform/linux-dpdk/include/odp_debug.h @@ -38,15 +38,20 @@ extern "C" { #endif /** - * Compile time assertion-macro - fail compilation if cond is false. + * Runtime assertion-macro - aborts if 'cond' is false. */ -#define ODP_ASSERT(cond, msg) typedef char msg[(cond) ? 1 : 0] +#ifndef ODP_NO_DEBUG +#define ODP_ASSERT(cond, msg) \ + do { if (!(cond)) {ODP_ERR("%s\n", msg); abort(); } } while (0) +#else +#define ODP_ASSERT(cond, msg) +#endif /** * Compile time assertion-macro - fail compilation if cond is false. * @note This macro has zero runtime overhead */ -#define ODP_STATIC_ASSERT(cond, msg) _static_assert(cond, msg) +#define ODP_STATIC_ASSERT(cond, msg) _Static_assert(1, msg) /** * Debug printing macro, which prints output when DEBUG flag is set. diff --git a/platform/linux-dpdk/include/odp_packet_internal.h b/platform/linux-dpdk/include/odp_packet_internal.h index 0f798c1..9357f90 100644 --- a/platform/linux-dpdk/include/odp_packet_internal.h +++ b/platform/linux-dpdk/include/odp_packet_internal.h @@ -58,7 +58,8 @@ typedef union { }; } input_flags_t; -ODP_ASSERT(sizeof(input_flags_t) == sizeof(uint32_t), INPUT_FLAGS_SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(input_flags_t) == sizeof(uint32_t), + "INPUT_FLAGS_SIZE_ERROR"); /** * Packet error flags @@ -77,7 +78,8 @@ typedef union { }; } error_flags_t; -ODP_ASSERT(sizeof(error_flags_t) == sizeof(uint32_t), ERROR_FLAGS_SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(error_flags_t) == sizeof(uint32_t), + "ERROR_FLAGS_SIZE_ERROR"); /** * Packet output flags @@ -92,7 +94,8 @@ typedef union { }; } output_flags_t; -ODP_ASSERT(sizeof(output_flags_t) == sizeof(uint32_t), OUTPUT_FLAGS_SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(output_flags_t) == sizeof(uint32_t), + "OUTPUT_FLAGS_SIZE_ERROR"); /** * Internal Packet header