From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-outbound-1.vmware.com (smtp-outbound-1.vmware.com [208.91.2.12]) by dpdk.org (Postfix) with ESMTP id 5AB45CE7 for ; Wed, 11 Feb 2015 01:55:31 +0100 (CET) Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id D2AB42934A; Tue, 10 Feb 2015 16:55:28 -0800 (PST) Received: from EX13-CAS-010.vmware.com (EX13-CAS-010.vmware.com [10.113.191.62]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id CB49818A2A; Tue, 10 Feb 2015 16:55:28 -0800 (PST) Received: from EX13-MBX-026.vmware.com (10.113.191.46) by EX13-MBX-002.vmware.com (10.113.191.22) with Microsoft SMTP Server (TLS) id 15.0.913.22; Tue, 10 Feb 2015 16:55:28 -0800 Received: from EX13-MBX-026.vmware.com ([fe80::858b:7f42:fd7c:703d]) by EX13-MBX-026.vmware.com ([fe80::858b:7f42:fd7c:703d%17]) with mapi id 15.00.0913.011; Tue, 10 Feb 2015 16:55:10 -0800 From: Yong Wang To: Stephen Hemminger , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 5/7] vmxnet3: get rid of DEBUG ifdefs Thread-Index: AQHQGbhpmpEHfJ22ZU27bZfZO8S5I5zq8i+A Date: Wed, 11 Feb 2015 00:54:57 +0000 Message-ID: References: <1418793196-17953-1-git-send-email-stephen@networkplumber.org> <1418793196-17953-6-git-send-email-stephen@networkplumber.org> In-Reply-To: <1418793196-17953-6-git-send-email-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.113.160.246] Content-Type: text/plain; charset="iso-8859-1" Content-ID: <7F22C4559A5AF4478062E23280F500D7@pa-exch1.vmware.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: Stephen Hemminger Subject: Re: [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, 11 Feb 2015 00:55:31 -0000 On 12/16/14, 9:13 PM, "Stephen Hemminger" wrote: >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_ >=20 > #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) Why not #define VMXNET_ASSERT(x) do { (void)(0); } while (0) or simply #define VMXNET_ASSERT(x) Are you expecting the condition (x) to have some side effects? At least that=B9s not the case for current usages. > #endif >=20 > #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 =3D=3D comp_ring->gen) { >=20 > /* Release cmd_ring descriptor and free mbuf */ >-#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER > VMXNET3_ASSERT(txq->cmd_ring.base[tcd->txdIdx].txd.eop =3D=3D 1); >-#endif > mbuf =3D txq->cmd_ring.buf_info[tcd->txdIdx].m; > rte_pktmbuf_free_seg(mbuf); > txq->cmd_ring.buf_info[tcd->txdIdx].m =3D NULL; >@@ -539,16 +537,13 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf >**rx_pkts, uint16_t nb_pkts) >=20 > PMD_RX_LOG(DEBUG, "rxd idx: %d ring idx: %d.", idx, ring_idx); >=20 >-#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER > VMXNET3_ASSERT(rcd->len <=3D rxd->len); > VMXNET3_ASSERT(rbi->m); >-#endif >+ > if (unlikely(rcd->len =3D=3D 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 =3D=3D VMXNET3_RXD_BTYPE_HEAD); >-#endif > /* Get the packet buffer pointer from buf_info */ > rxm =3D rbi->m; >=20 >--=20 >2.1.3 >