From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by dpdk.org (Postfix) with ESMTP id 042B9C31E for ; Thu, 9 Jul 2015 20:24:15 +0200 (CEST) Received: by pdjr16 with SMTP id r16so8192279pdj.3 for ; Thu, 09 Jul 2015 11:24:14 -0700 (PDT) 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=/hOkCQDRiuswGMmAQSNx5QneShhs4UZAii4dpflCDgk=; b=UI3a0hjJzP/u+C8igyNBSl/mDwrTyDIJCE+auh0hNlxpI2a7r87NagrUSkvQ7sGtgT iLZDTcGhOSy0cYb9+Vyi9JfYUDW8nzgjxQtW6Gn3KmPWlNvJ2VFjxhMFxqNNsju9Cine YkM5R7f3oDkgyX6i8MOrJ8iJuonHH8Fubr9+x69zr3LipyhvSG9E7OG9GOmicUCXBoMV VD3VcPlYOzjyxibpX47r4eUxhzsOPowrCkgqchGqdw3nk3q6cwETW2Mn81wPGR5RrPRh +qOhfNMe/jW0fFP4mDPWjwaqJPXKH8W1jlrWx7jVTkfjibdGONn2ukvVtFJe8abhJGGb 205g== X-Gm-Message-State: ALoCoQl/jBKGTTiRxwjukFGGk9MK2QpeyfIrvVW8IPnGvH6aNcaPp3YJQXGqB8F9O206VS9gQRgs X-Received: by 10.68.180.131 with SMTP id do3mr33750931pbc.42.1436466254408; Thu, 09 Jul 2015 11:24:14 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id ff10sm6741567pab.13.2015.07.09.11.24.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Jul 2015 11:24:13 -0700 (PDT) From: stephen@networkplumber.org X-Google-Original-From: stephen@networplumber.org To: dev@dpdk.org Date: Thu, 9 Jul 2015 11:24:15 -0700 Message-Id: <1436466256-17442-8-git-send-email-stephen@networplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1436466256-17442-1-git-send-email-stephen@networplumber.org> References: <1436466256-17442-1-git-send-email-stephen@networplumber.org> Cc: Stephen Hemminger Subject: [dpdk-dev] [PATCH 7/8] 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: Thu, 09 Jul 2015 18:24:16 -0000 From: Stephen Hemminger 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 --- drivers/net/vmxnet3/vmxnet3_ethdev.h | 6 ++++-- drivers/net/vmxnet3/vmxnet3_rxtx.c | 10 ++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h index b392061..b8db6a1 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h +++ b/drivers/net/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 (!(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/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 63d3bab..c680346 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -306,9 +306,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; txq->cmd_ring.buf_info[txq->cmd_ring.next2comp].m = NULL; @@ -585,16 +583,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; } @@ -607,9 +602,8 @@ 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.4