DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rasesh Mody <rasesh.mody@qlogic.com>
To: <thomas.monjalon@6wind.com>, <dev@dpdk.org>
Cc: sony.chacko@qlogic.com
Subject: [dpdk-dev] [PATCH v3 03/11] bnx2x: Add periodic debug option
Date: Mon, 23 Nov 2015 23:44:28 -0800	[thread overview]
Message-ID: <1448351076-23161-4-git-send-email-rasesh.mody@qlogic.com> (raw)
In-Reply-To: <1448351076-23161-1-git-send-email-rasesh.mody@qlogic.com>

From: Harish Patil <harish.patil@qlogic.com>

The periodic debug option is used to collect periodic
events like statistics, register access etc and won't
interfere with user-level messages.

Signed-off-by: Harish Patil <harish.patil@qlogic.com>
Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
---
 config/common_bsdapp             |    1 +
 config/common_linuxapp           |    1 +
 drivers/net/bnx2x/Makefile       |    4 ++--
 drivers/net/bnx2x/bnx2x.c        |    6 +++---
 drivers/net/bnx2x/bnx2x.h        |    2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c |    2 +-
 drivers/net/bnx2x/bnx2x_logs.h   |    8 ++++++++
 drivers/net/bnx2x/bnx2x_stats.c  |    2 +-
 drivers/net/bnx2x/debug.c        |   36 ++++++++++++++++++++----------------
 9 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index bdf1fcd..7872859 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -237,6 +237,7 @@ CONFIG_RTE_LIBRTE_BNX2X_DEBUG_INIT=n
 CONFIG_RTE_LIBRTE_BNX2X_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_BNX2X_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_BNX2X_MF_SUPPORT=n
+CONFIG_RTE_LIBRTE_BNX2X_DEBUG_PERIODIC=n
 
 #
 # Compile burst-oriented Chelsio Terminator 10GbE/40GbE (CXGBE) PMD
diff --git a/config/common_linuxapp b/config/common_linuxapp
index f72c46d..04a7f1a 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -235,6 +235,7 @@ CONFIG_RTE_LIBRTE_BNX2X_DEBUG_INIT=n
 CONFIG_RTE_LIBRTE_BNX2X_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_BNX2X_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_BNX2X_MF_SUPPORT=n
+CONFIG_RTE_LIBRTE_BNX2X_DEBUG_PERIODIC=n
 
 #
 # Compile burst-oriented Chelsio Terminator 10GbE/40GbE (CXGBE) PMD
diff --git a/drivers/net/bnx2x/Makefile b/drivers/net/bnx2x/Makefile
index 87f31b6..13bbc81 100644
--- a/drivers/net/bnx2x/Makefile
+++ b/drivers/net/bnx2x/Makefile
@@ -5,7 +5,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 #
 LIB = librte_pmd_bnx2x.a
 
-CFLAGS += -O3 -g
+CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -DZLIB_CONST
 
@@ -23,7 +23,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += ecore_sp.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += elink.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_vfpf.c
-SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_DEBUG) += debug.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_DEBUG_PERIODIC) += debug.c
 
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += lib/librte_eal lib/librte_ether lib/librte_hash
diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index fed7a06..5d41d4f 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -4335,7 +4335,7 @@ static void bnx2x_eq_int(struct bnx2x_softc *sc)
 /* handle eq element */
 		switch (opcode) {
 		case EVENT_RING_OPCODE_STAT_QUERY:
-			PMD_DRV_LOG(DEBUG, "got statistics completion event %d",
+			PMD_DEBUG_PERIODIC_LOG(DEBUG, "got statistics completion event %d",
 				    sc->stats_comp++);
 			/* nothing to do with stats comp */
 			goto next_spqe;
@@ -4486,7 +4486,7 @@ static int bnx2x_handle_sp_tq(struct bnx2x_softc *sc)
 	/* SP events: STAT_QUERY and others */
 	if (status & BNX2X_DEF_SB_IDX) {
 /* handle EQ completions */
-		PMD_DRV_LOG(DEBUG, "---> EQ INTR <---");
+		PMD_DEBUG_PERIODIC_LOG(DEBUG, "---> EQ INTR <---");
 		bnx2x_eq_int(sc);
 		bnx2x_ack_sb(sc, sc->igu_dsb_id, USTORM_ID,
 			   le16toh(sc->def_idx), IGU_INT_NOP, 1);
@@ -4559,7 +4559,7 @@ int bnx2x_intr_legacy(struct bnx2x_softc *sc, int scan_fp)
 		return 0;
 	}
 
-	PMD_DRV_LOG(DEBUG, "Interrupt status 0x%04x", status);
+	PMD_DEBUG_PERIODIC_LOG(DEBUG, "Interrupt status 0x%04x", status);
 	//bnx2x_dump_status_block(sc);
 
 	FOR_EACH_ETH_QUEUE(sc, i) {
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 867b92a..a5f9f1d 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -1445,7 +1445,7 @@ struct bnx2x_func_init_params {
 #define BAR1 2
 #define BAR2 4
 
-#ifdef RTE_LIBRTE_BNX2X_DEBUG
+#ifdef RTE_LIBRTE_BNX2X_DEBUG_PERIODIC
 uint8_t bnx2x_reg_read8(struct bnx2x_softc *sc, size_t offset);
 uint16_t bnx2x_reg_read16(struct bnx2x_softc *sc, size_t offset);
 uint32_t bnx2x_reg_read32(struct bnx2x_softc *sc, size_t offset);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 36779ea..d09c72f 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -52,7 +52,7 @@ bnx2x_interrupt_action(struct rte_eth_dev *dev)
 	struct bnx2x_softc *sc = dev->data->dev_private;
 	uint32_t link_status;
 
-	PMD_DRV_LOG(INFO, "Interrupt handled");
+	PMD_DEBUG_PERIODIC_LOG(INFO, "Interrupt handled");
 
 	if (bnx2x_intr_legacy(sc, 0))
 		DELAY_MS(250);
diff --git a/drivers/net/bnx2x/bnx2x_logs.h b/drivers/net/bnx2x/bnx2x_logs.h
index d31c253..32f8c62 100644
--- a/drivers/net/bnx2x/bnx2x_logs.h
+++ b/drivers/net/bnx2x/bnx2x_logs.h
@@ -47,4 +47,12 @@
 #define PMD_DRV_LOG(level, fmt, args...) \
 	PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
 
+#ifdef RTE_LIBRTE_BNX2X_DEBUG_PERIODIC
+#define PMD_DEBUG_PERIODIC_LOG(level, fmt, args...) \
+	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+#else
+#define PMD_DEBUG_PERIODIC_LOG(level, fmt, args...) do { } while(0)
+#endif
+
+
 #endif /* _PMD_LOGS_H_ */
diff --git a/drivers/net/bnx2x/bnx2x_stats.c b/drivers/net/bnx2x/bnx2x_stats.c
index 80260f0..e161f4f 100644
--- a/drivers/net/bnx2x/bnx2x_stats.c
+++ b/drivers/net/bnx2x/bnx2x_stats.c
@@ -105,7 +105,7 @@ bnx2x_storm_stats_post(struct bnx2x_softc *sc)
 		sc->fw_stats_req->hdr.drv_stats_counter =
 			htole16(sc->stats_counter++);
 
-		PMD_DRV_LOG(DEBUG,
+		PMD_DEBUG_PERIODIC_LOG(DEBUG,
 				"sending statistics ramrod %d",
 				le16toh(sc->fw_stats_req->hdr.drv_stats_counter));
 
diff --git a/drivers/net/bnx2x/debug.c b/drivers/net/bnx2x/debug.c
index 9ab4f1d..d8d0c13 100644
--- a/drivers/net/bnx2x/debug.c
+++ b/drivers/net/bnx2x/debug.c
@@ -44,30 +44,32 @@
 void
 bnx2x_reg_write8(struct bnx2x_softc *sc, size_t offset, uint8_t val)
 {
-	PMD_DRV_LOG(DEBUG, "offset=0x%08lx val=0x%02x", offset, val);
-	*((volatile uint8_t*)((uint64_t)sc->bar[BAR0].base_addr + offset)) = val;
+	PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%02x", (unsigned long)offset, val);
+	*((volatile uint8_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)) = val;
 }
 
 void
 bnx2x_reg_write16(struct bnx2x_softc *sc, size_t offset, uint16_t val)
 {
 	if ((offset % 2) != 0) {
-		PMD_DRV_LOG(DEBUG, "Unaligned 16-bit write to 0x%08lx", offset);
+		PMD_DRV_LOG(NOTICE, "Unaligned 16-bit write to 0x%08lx",
+			    (unsigned long)offset);
 	}
 
-	PMD_DRV_LOG(DEBUG, "offset=0x%08lx val=0x%04x", offset, val);
-	*((volatile uint16_t*)((uint64_t)sc->bar[BAR0].base_addr + offset)) = val;
+	PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%04x", (unsigned long)offset, val);
+	*((volatile uint16_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)) = val;
 }
 
 void
 bnx2x_reg_write32(struct bnx2x_softc *sc, size_t offset, uint32_t val)
 {
 	if ((offset % 4) != 0) {
-		PMD_DRV_LOG(DEBUG, "Unaligned 32-bit write to 0x%08lx", offset);
+		PMD_DRV_LOG(NOTICE, "Unaligned 32-bit write to 0x%08lx",
+			    (unsigned long)offset);
 	}
 
-	PMD_DRV_LOG(DEBUG, "offset=0x%08lx val=0x%08x", offset, val);
-	*((volatile uint32_t*)((uint64_t)sc->bar[BAR0].base_addr + offset)) = val;
+	PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%08x", (unsigned long)offset, val);
+	*((volatile uint32_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)) = val;
 }
 
 uint8_t
@@ -75,8 +77,8 @@ bnx2x_reg_read8(struct bnx2x_softc *sc, size_t offset)
 {
 	uint8_t val;
 
-	val = (uint8_t)(*((volatile uint8_t*)((uint64_t)sc->bar[BAR0].base_addr + offset)));
-	PMD_DRV_LOG(DEBUG, "offset=0x%08lx val=0x%02x", offset, val);
+	val = (uint8_t)(*((volatile uint8_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)));
+	PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%02x", (unsigned long)offset, val);
 
 	return (val);
 }
@@ -87,11 +89,12 @@ bnx2x_reg_read16(struct bnx2x_softc *sc, size_t offset)
 	uint16_t val;
 
 	if ((offset % 2) != 0) {
-		PMD_DRV_LOG(DEBUG, "Unaligned 16-bit read from 0x%08lx", offset);
+		PMD_DRV_LOG(NOTICE, "Unaligned 16-bit read from 0x%08lx",
+			    (unsigned long)offset);
 	}
 
-	val = (uint16_t)(*((volatile uint16_t*)((uint64_t)sc->bar[BAR0].base_addr + offset)));
-	PMD_DRV_LOG(DEBUG, "offset=0x%08lx val=0x%08x", offset, val);
+	val = (uint16_t)(*((volatile uint16_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)));
+	PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%08x", (unsigned long)offset, val);
 
 	return (val);
 }
@@ -102,12 +105,13 @@ bnx2x_reg_read32(struct bnx2x_softc *sc, size_t offset)
 	uint32_t val;
 
 	if ((offset % 4) != 0) {
-		PMD_DRV_LOG(DEBUG, "Unaligned 32-bit read from 0x%08lx", offset);
+		PMD_DRV_LOG(NOTICE, "Unaligned 32-bit read from 0x%08lx",
+			    (unsigned long)offset);
 		return 0;
 	}
 
-	val = (uint32_t)(*((volatile uint32_t*)((uint64_t)sc->bar[BAR0].base_addr + offset)));
-	PMD_DRV_LOG(DEBUG, "offset=0x%08lx val=0x%08x", offset, val);
+	val = (uint32_t)(*((volatile uint32_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)));
+	PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%08x", (unsigned long)offset, val);
 
 	return (val);
 }
-- 
1.7.10.3

  parent reply	other threads:[~2015-11-24  7:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-24  7:44 [dpdk-dev] [PATCH v3 00/11] bnx2x: Enhancement, fixes, licensing and doumentation Rasesh Mody
2015-11-24  7:44 ` [dpdk-dev] [PATCH v3 01/11] bnx2x: Update VF to support newer PF drivers Rasesh Mody
2015-11-24  7:44 ` [dpdk-dev] [PATCH v3 02/11] bnx2x: Fix x86_64-native-linuxapp-clang build error Rasesh Mody
2015-11-24  7:44 ` Rasesh Mody [this message]
2015-11-24  7:44 ` [dpdk-dev] [PATCH v3 04/11] doc: Add BNX2X PMD documentationdoc: Add BNX2X PMD documentation Rasesh Mody
2015-11-24 14:16   ` Thomas Monjalon
2015-11-24  7:44 ` [dpdk-dev] [PATCH v3 05/11] bnx2x: Add LICENSE.bnx2x_pmd and update source files Rasesh Mody
2015-11-24  7:44 ` [dpdk-dev] [PATCH v3 06/11] bnx2x: FreeBSD enablement Rasesh Mody
2015-11-24 14:09   ` Thomas Monjalon
2015-11-24  7:44 ` [dpdk-dev] [PATCH v3 07/11] bnx2x: Linux 32bit enablement Rasesh Mody
2015-11-24  7:44 ` [dpdk-dev] [PATCH v3 08/11] bnx2x: Handle zlib compatibility error Rasesh Mody
2015-11-24  7:44 ` [dpdk-dev] [PATCH v3 09/11] maintainers: Add maintainers for BNX2X PMD Rasesh Mody
2015-11-24 14:19   ` Thomas Monjalon
2015-11-24  7:44 ` [dpdk-dev] [PATCH v3 10/11] config: Enable BNX2X driver build by default Rasesh Mody
2015-11-24 14:25   ` Thomas Monjalon
2015-12-03  0:54     ` Rasesh Mody
2015-12-03  1:30       ` Thomas Monjalon
2015-12-03  2:54         ` Rasesh Mody
2015-12-08 21:45     ` Rasesh Mody
2015-11-24  7:44 ` [dpdk-dev] [PATCH v3 11/11] bnx2x: Add BNX2X PMD versioning Rasesh Mody

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=1448351076-23161-4-git-send-email-rasesh.mody@qlogic.com \
    --to=rasesh.mody@qlogic.com \
    --cc=dev@dpdk.org \
    --cc=sony.chacko@qlogic.com \
    --cc=thomas.monjalon@6wind.com \
    /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).