From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by dpdk.org (Postfix) with ESMTP id 6E4F67F10 for ; Wed, 17 Dec 2014 06:13:46 +0100 (CET) Received: by mail-pa0-f43.google.com with SMTP id kx10so15651560pab.2 for ; Tue, 16 Dec 2014 21:13:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5oEE0I1EA25Hl06A2VGAkioVu6fUXaTfL3PUwepCh9w=; b=f1c952GfePcTJR2Cqy3b2h46vyjoDRVAOvc6PDiM+d1KSaWUxuuXvEq4ZIKFWbdPbY f8LRxugy+DAsAaNPWezdQiHDFN4Sdc1P/HI2pwYFGc6WbMKpSIllQ2WPUyzRQUIk/+t/ na+sH7sbZwvKi7XWMXZnzRtHGCWLD91cz3i+W/pMuEAcspm7r0FOb4doxmRGzjRoRWIb Y5Om5f+1I84MPL70kt8SnV1wkY2DKH5JQzDBHCPEbL59TXOZUAVN4dBUR1Y50GNXmcQR zCq6w1dboBhHl5T8qGR3KEGFmMbxzmh7cw2CWCT3xFIyjugc0G9l24Ol1lfZkDPzj/9Z CMFg== X-Gm-Message-State: ALoCoQnJ6eLRpS//Nm7qXIKyVTIpVmtTfPXOEFF2Cqll2WmDPBKyynByLoY1Dcxt+LeIGLqxmQcI X-Received: by 10.70.41.2 with SMTP id b2mr37786911pdl.62.1418793225673; Tue, 16 Dec 2014 21:13:45 -0800 (PST) Received: from urahara.brocade.com (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id gd1sm2518208pbd.67.2014.12.16.21.13.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Dec 2014 21:13:45 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Date: Tue, 16 Dec 2014 21:13:14 -0800 Message-Id: <1418793196-17953-6-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1418793196-17953-1-git-send-email-stephen@networkplumber.org> References: <1418793196-17953-1-git-send-email-stephen@networkplumber.org> Cc: Stephen Hemminger Subject: [dpdk-dev] [PATCH 5/7] vmxnet3: get rid of DEBUG ifdefs 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, 17 Dec 2014 05:13:47 -0000 From: Stephen Hemminger By defining macro as a stub it is possible to get rid of #ifdef's in the actual code. Signed-off-by: Stephen Hemminger --- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h | 6 ++++-- lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 9 +-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h index 258fbae..0990f59 100644 --- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h +++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h @@ -35,9 +35,11 @@ #define _VMXNET3_ETHDEV_H_ #ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER -#define VMXNET3_ASSERT(x) do { \ - if (!(x)) rte_panic("VMXNET3: x"); \ +#define VMXNET3_ASSERT(x) do { \ + if (unlikely(!(x))) rte_panic("VMXNET3: %s\n", #x); \ } while(0) +#else +#define VMXNET3_ASSERT(x) do { (void)(x); } while (0) #endif #define VMXNET3_MAX_MAC_ADDRS 1 diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c index 7cb0b93..bd47c6c 100644 --- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c @@ -308,9 +308,7 @@ vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq) while (tcd->gen == comp_ring->gen) { /* Release cmd_ring descriptor and free mbuf */ -#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER VMXNET3_ASSERT(txq->cmd_ring.base[tcd->txdIdx].txd.eop == 1); -#endif mbuf = txq->cmd_ring.buf_info[tcd->txdIdx].m; rte_pktmbuf_free_seg(mbuf); txq->cmd_ring.buf_info[tcd->txdIdx].m = NULL; @@ -539,16 +537,13 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) PMD_RX_LOG(DEBUG, "rxd idx: %d ring idx: %d.", idx, ring_idx); -#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER VMXNET3_ASSERT(rcd->len <= rxd->len); VMXNET3_ASSERT(rbi->m); -#endif + if (unlikely(rcd->len == 0)) { PMD_RX_LOG(DEBUG, "Rx buf was skipped. rxring[%d][%d]\n)", ring_idx, idx); -#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER VMXNET3_ASSERT(rcd->sop && rcd->eop); -#endif rte_pktmbuf_free_seg(rbi->m); goto rcd_done; } @@ -561,9 +556,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rte_pktmbuf_free_seg(rbi->m); goto rcd_done; } -#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER VMXNET3_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_HEAD); -#endif /* Get the packet buffer pointer from buf_info */ rxm = rbi->m; -- 2.1.3