DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yong Wang <yongwang@vmware.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v3 08/10] vmxnet3: get rid of DEBUG ifdefs
Date: Fri, 6 Mar 2015 21:59:30 +0000	[thread overview]
Message-ID: <D11F62E6.38890%yongwang@vmware.com> (raw)
In-Reply-To: <1425600635-20628-9-git-send-email-stephen@networkplumber.org>

On 3/5/15, 4:10 PM, "Stephen Hemminger" <stephen@networkplumber.org> wrote:

>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 <stephen@networkplumber.org>

Acked-by: Yong Wang <yongwang@vmware.com>

>---
> 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
>


  reply	other threads:[~2015-03-06 21:59 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06  0:10 [dpdk-dev] [PATCH v3 00/10] vmxnet3: multisegment and bugfixes Stephen Hemminger
2015-03-06  0:10 ` [dpdk-dev] [PATCH v3 01/10] vmxnet3: fix link state handling Stephen Hemminger
2015-03-06 17:21   ` Sanford, Robert
     [not found]   ` <0efb310c0ee54f9192eae95f6ee909e0@BRMWP-EXMB11.corp.brocade.com>
2015-03-08 17:45     ` Stephen Hemminger
2015-03-06  0:10 ` [dpdk-dev] [PATCH v3 02/10] vmxnet3: enable VLAN filtering Stephen Hemminger
2015-03-06 21:54   ` Yong Wang
2015-03-06  0:10 ` [dpdk-dev] [PATCH v3 03/10] vmxnet3: remove mtu check Stephen Hemminger
2015-03-06  0:10 ` [dpdk-dev] [PATCH v3 04/10] vmxnet3: cleanup txq stats Stephen Hemminger
2015-03-06  0:10 ` [dpdk-dev] [PATCH v3 05/10] vmxnet3: add support for multi-segment transmit Stephen Hemminger
2015-03-06  0:10 ` [dpdk-dev] [PATCH v3 06/10] vmxnet3: support RSS and refactor offload Stephen Hemminger
2015-03-06  0:10 ` [dpdk-dev] [PATCH v3 07/10] vmxnet3: support jumbo frames Stephen Hemminger
2015-03-09 23:28   ` Yong Wang
2015-03-09 23:32     ` Yong Wang
2015-03-10 18:35       ` Stephen Hemminger
2015-03-11  1:03         ` Yong Wang
     [not found]         ` <4ebc1312d5cb42d583fb8a204c353feb@BRMWP-EXMB11.corp.brocade.com>
2015-03-11  6:54           ` Stephen Hemminger
     [not found]   ` <9bc742bd1778468a815da8070b584ee7@BRMWP-EXMB11.corp.brocade.com>
2015-03-10  4:18     ` Stephen Hemminger
2015-03-06  0:10 ` [dpdk-dev] [PATCH v3 08/10] vmxnet3: get rid of DEBUG ifdefs Stephen Hemminger
2015-03-06 21:59   ` Yong Wang [this message]
2015-03-06  0:10 ` [dpdk-dev] [PATCH v3 09/10] vmxnet3: add check for jumbo segment Stephen Hemminger
2015-03-06 23:48   ` Yong Wang
2015-03-06  0:10 ` [dpdk-dev] [PATCH v3 10/10] vmxnet3: remove excess inlining Stephen Hemminger
2015-03-06 23:54   ` Yong Wang
2015-03-07  2:00     ` Stephen Hemminger
2015-03-10 13:42 ` [dpdk-dev] [PATCH v3 00/10] vmxnet3: multisegment and bugfixes Thomas Monjalon
2015-06-22 12:22   ` Thomas Monjalon
2015-07-08 23:21     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D11F62E6.38890%yongwang@vmware.com \
    --to=yongwang@vmware.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).