From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com [209.85.192.180]) by dpdk.org (Postfix) with ESMTP id C23885FEB for ; Fri, 6 Mar 2015 01:10:51 +0100 (CET) Received: by pdbfl12 with SMTP id fl12so39220711pdb.9 for ; Thu, 05 Mar 2015 16:10:51 -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=2YNutfArCNdtuiT16V/Uohwq+tj6w3mFvQgcT+Dc1Dg=; b=B/gAbINE1hy7dKafQ7rvjtFwam3vADORCoCU27of/UTVjfw1W6fKljPpTaSxWZ/a0X HbL02WR+F6iLkvaiYa8x3wyrqIapvwSRdzRxnD3oZjqAAkKt1+/agORzs1SdsE+sDbDO CttLxrSiZEL6ga8sz0L8EvSEy7fbH/9dF0OHbptVEQikxDePFog+TPBsSnqSTZgaxLRQ +sH6bDg4JFvx8ZqqpW64a0IF1IbVXyomrJ2ApipnYU7yDYZAELKpiIdnl57Owwi3oUBe X7U2sMmNQu/uwcuEnWfg78DD/UKPtHfhAgKQg7Fg42FHR7yI0m2COAPk1mULYecC/4Uc SdLA== X-Gm-Message-State: ALoCoQn2FcPZLRXUwuiLbtOg/atJBQRZcJiF2VU9mCGedB/XtudL1UTGlIzrNCEHWdwHPPsL7yz1 X-Received: by 10.70.128.197 with SMTP id nq5mr20822666pdb.56.1425600651096; Thu, 05 Mar 2015 16:10:51 -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 ms5sm7940550pbb.59.2015.03.05.16.10.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Mar 2015 16:10:50 -0800 (PST) From: Stephen Hemminger To: Yong Wang Date: Thu, 5 Mar 2015 16:10:33 -0800 Message-Id: <1425600635-20628-9-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1425600635-20628-1-git-send-email-stephen@networkplumber.org> References: <1425600635-20628-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH v3 08/10] 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: Fri, 06 Mar 2015 00:10:52 -0000 By defining macro as a stub it is possible to get rid of #ifdef's in the actual code. Always evaluate the argument (even in the stub) so that there are no extra unused variable errors. Signed-off-by: Stephen Hemminger --- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h | 6 ++++-- lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 13 ++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h index 83182e2..1c0d95f 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 5cf187a..3bd13ef 100644 --- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c @@ -307,9 +307,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 while (txq->cmd_ring.next2comp != tcd->txdIdx) { mbuf = txq->cmd_ring.buf_info[txq->cmd_ring.next2comp].m; @@ -570,6 +568,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) uint8_t ring_idx; vmxnet3_rx_queue_t *rxq; Vmxnet3_RxCompDesc *rcd; + Vmxnet3_RxDesc *rxd; vmxnet3_buf_info_t *rbi; struct rte_mbuf *rxm = NULL; struct vmxnet3_hw *hw; @@ -596,16 +595,12 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) idx = rcd->rxdIdx; ring_idx = (uint8_t)((rcd->rqID == rxq->qid1) ? 0 : 1); rbi = rxq->cmd_ring[ring_idx].buf_info + idx; - + rxd = (Vmxnet3_RxDesc *)rxq->cmd_ring[ring_idx].base + idx; PMD_RX_LOG(DEBUG, "rxd idx: %d ring idx: %d.", idx, ring_idx); -#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER - Vmxnet3_RxDesc *rxd - = (Vmxnet3_RxDesc *)rxq->cmd_ring[ring_idx].base + idx; VMXNET3_ASSERT(rcd->len <= rxd->len); VMXNET3_ASSERT(rbi->m); -#endif /* Get the packet buffer pointer from buf_info */ rxm = rbi->m; @@ -652,10 +647,8 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) * the last mbuf of the current packet. */ if (rcd->sop) { -#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER VMXNET3_ASSERT(!rxq->start_seg); VMXNET3_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_HEAD); -#endif if (unlikely(rcd->len == 0)) { PMD_RX_LOG(DEBUG, @@ -670,10 +663,8 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) } else { struct rte_mbuf *start = rxq->start_seg; -#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER VMXNET3_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_BODY); VMXNET3_ASSERT(start != NULL); -#endif start->pkt_len += rxm->data_len; start->nb_segs++; -- 2.1.4