From: Stephen Hemminger Date: Thu, 9 Jul 2015 18:24:15 +0000 (-0700) Subject: vmxnet3: get rid of debug ifdefs X-Git-Tag: spdx-start~8808 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=cd3606435b8f43e7836b0eccae28b4ad7be86ab2;p=dpdk.git vmxnet3: get rid of debug ifdefs 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 Acked-by: Yong Wang --- diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h index 3286923370..4f9d0bd22b 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 be982d5487..96ec69adb2 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;