DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] net/bnx2x: fix to use rte log
@ 2018-11-08 21:19 Mody, Rasesh
  2018-11-08 21:19 ` [dpdk-dev] [PATCH 2/2] net/bnx2x: fix VF link status update Mody, Rasesh
  2018-11-08 21:38 ` [dpdk-dev] [PATCH 1/2] net/bnx2x: fix to use rte log Stephen Hemminger
  0 siblings, 2 replies; 5+ messages in thread
From: Mody, Rasesh @ 2018-11-08 21:19 UTC (permalink / raw)
  To: dev; +Cc: Mody, Rasesh, ferruh.yigit, Dept-Eng DPDK Dev

Use rte_log() rather than RTE_LOG() for dynamic logging. Rearrange
dynamic log types to the top and configurable log types to bottom.
Remove unused RTE_LIBRTE_BNX2X_DEBUG_TX_FREE

Fixes: ba7eeb035a5f ("net/bnx2x: fix logging to include device name")

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
---
 drivers/net/bnx2x/bnx2x_logs.h |   35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x_logs.h b/drivers/net/bnx2x/bnx2x_logs.h
index 753bccd..f0cf69c 100644
--- a/drivers/net/bnx2x/bnx2x_logs.h
+++ b/drivers/net/bnx2x/bnx2x_logs.h
@@ -10,43 +10,40 @@
 
 extern int bnx2x_logtype_init;
 #define PMD_INIT_LOG(level, sc, fmt, args...) \
-	RTE_LOG(level, PMD, \
+	rte_log(RTE_LOG_ ## level, bnx2x_logtype_init, \
 	"[bnx2x_pmd: %s] %s() " fmt "\n", (sc)->devinfo.name, __func__, ##args)
 
 #define PMD_INIT_FUNC_TRACE(sc) PMD_INIT_LOG(DEBUG, sc, " >>")
 
+extern int bnx2x_logtype_driver;
+#define PMD_DRV_LOG_RAW(level, sc, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, bnx2x_logtype_driver, \
+		"[%s:%d(%s)] " fmt,	__func__, __LINE__, \
+		(sc)->devinfo.name ? (sc)->devinfo.name : "", ## args)
+
+#define PMD_DRV_LOG(level, sc, fmt, args...) \
+	PMD_DRV_LOG_RAW(level, sc, fmt "\n", ## args)
+
 #ifdef RTE_LIBRTE_BNX2X_DEBUG_RX
 #define PMD_RX_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	rte_log(RTE_LOG_ ## level, bnx2x_logtype_driver, \
+	"%s(): " fmt "\n", __func__, ## args)
 #else
 #define PMD_RX_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_BNX2X_DEBUG_TX
 #define PMD_TX_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	rte_log(RTE_LOG_ ## level, bnx2x_logtype_driver, \
+		"%s(): " fmt "\n", __func__, ## args)
 #else
 #define PMD_TX_LOG(level, fmt, args...) do { } while(0)
 #endif
 
-#ifdef RTE_LIBRTE_BNX2X_DEBUG_TX_FREE
-#define PMD_TX_FREE_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
-#else
-#define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0)
-#endif
-
-extern int bnx2x_logtype_driver;
-#define PMD_DRV_LOG_RAW(level, sc, fmt, args...) \
-	RTE_LOG(level, PMD, "[%s:%d(%s)] " fmt,	__func__, __LINE__, \
-		(sc)->devinfo.name ? (sc)->devinfo.name : "", ## args)
-
-#define PMD_DRV_LOG(level, sc, fmt, args...) \
-	PMD_DRV_LOG_RAW(level, sc, fmt "\n", ## args)
-
 #ifdef RTE_LIBRTE_BNX2X_DEBUG_PERIODIC
 #define PMD_DEBUG_PERIODIC_LOG(level, sc, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(%s): " fmt "\n", __func__, \
+	rte_log(RTE_LOG_ ## level, bnx2x_logtype_driver, \
+		"%s(%s): " fmt "\n", __func__, \
 		(sc)->devinfo.name ? (sc)->devinfo.name : "", ## args)
 #else
 #define PMD_DEBUG_PERIODIC_LOG(level, sc, fmt, args...) do { } while (0)
-- 
1.7.10.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 2/2] net/bnx2x: fix VF link status update
  2018-11-08 21:19 [dpdk-dev] [PATCH 1/2] net/bnx2x: fix to use rte log Mody, Rasesh
@ 2018-11-08 21:19 ` Mody, Rasesh
  2018-11-08 21:38 ` [dpdk-dev] [PATCH 1/2] net/bnx2x: fix to use rte log Stephen Hemminger
  1 sibling, 0 replies; 5+ messages in thread
From: Mody, Rasesh @ 2018-11-08 21:19 UTC (permalink / raw)
  To: dev; +Cc: Mody, Rasesh, ferruh.yigit, Dept-Eng DPDK Dev

In general the VF driver should not access the chip. For VF link status
update, VF driver should not use HW lock, use bnx2x_link_report_locked()
instead.
Add few prints for releasing previously held HW locks.

Fixes: a9b58b15ed51 ("net/bnx2x: fix to add PHY lock")

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
---
 drivers/net/bnx2x/bnx2x.c |   25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 2797593..a6d2687 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -199,8 +199,12 @@ static int bnx2x_acquire_hw_lock(struct bnx2x_softc *sc, uint32_t resource)
 	uint32_t hw_lock_control_reg;
 	int cnt;
 
+#ifndef RTE_LIBRTE_BNX2X_DEBUG_PERIODIC
 	if (resource)
 		PMD_INIT_FUNC_TRACE(sc);
+#else
+	PMD_INIT_FUNC_TRACE(sc);
+#endif
 
 	/* validate the resource is within range */
 	if (resource > HW_LOCK_MAX_RESOURCE_VALUE) {
@@ -248,8 +252,12 @@ static int bnx2x_release_hw_lock(struct bnx2x_softc *sc, uint32_t resource)
 	int func = SC_FUNC(sc);
 	uint32_t hw_lock_control_reg;
 
+#ifndef RTE_LIBRTE_BNX2X_DEBUG_PERIODIC
 	if (resource)
 		PMD_INIT_FUNC_TRACE(sc);
+#else
+	PMD_INIT_FUNC_TRACE(sc);
+#endif
 
 	/* validate the resource is within range */
 	if (resource > HW_LOCK_MAX_RESOURCE_VALUE) {
@@ -7041,7 +7049,7 @@ void bnx2x_link_status_update(struct bnx2x_softc *sc)
 		}
 		bnx2x_link_report(sc);
 	} else {
-		bnx2x_link_report(sc);
+		bnx2x_link_report_locked(sc);
 		bnx2x_stats_handle(sc, STATS_EVENT_LINK_UP);
 	}
 }
@@ -9388,6 +9396,8 @@ static int bnx2x_prev_unload(struct bnx2x_softc *sc)
 	uint32_t fw, hw_lock_reg, hw_lock_val;
 	uint32_t rc = 0;
 
+	PMD_INIT_FUNC_TRACE(sc);
+
 	/*
 	 * Clear HW from errors which may have resulted from an interrupted
 	 * DMAE transaction.
@@ -9395,22 +9405,23 @@ static int bnx2x_prev_unload(struct bnx2x_softc *sc)
 	bnx2x_prev_interrupted_dmae(sc);
 
 	/* Release previously held locks */
-	if (SC_FUNC(sc) <= 5)
-		hw_lock_reg = (MISC_REG_DRIVER_CONTROL_1 + SC_FUNC(sc) * 8);
-	else
-		hw_lock_reg =
-		    (MISC_REG_DRIVER_CONTROL_7 + (SC_FUNC(sc) - 6) * 8);
+	hw_lock_reg = (SC_FUNC(sc) <= 5) ?
+			(MISC_REG_DRIVER_CONTROL_1 + SC_FUNC(sc) * 8) :
+			(MISC_REG_DRIVER_CONTROL_7 + (SC_FUNC(sc) - 6) * 8);
 
 	hw_lock_val = (REG_RD(sc, hw_lock_reg));
 	if (hw_lock_val) {
 		if (hw_lock_val & HW_LOCK_RESOURCE_NVRAM) {
+			PMD_DRV_LOG(DEBUG, sc, "Releasing previously held NVRAM lock\n");
 			REG_WR(sc, MCP_REG_MCPR_NVM_SW_ARB,
 			       (MCPR_NVM_SW_ARB_ARB_REQ_CLR1 << SC_PORT(sc)));
 		}
+		PMD_DRV_LOG(DEBUG, sc, "Releasing previously held HW lock\n");
 		REG_WR(sc, hw_lock_reg, 0xffffffff);
 	}
 
 	if (MCPR_ACCESS_LOCK_LOCK & REG_RD(sc, MCP_REG_MCPR_ACCESS_LOCK)) {
+		PMD_DRV_LOG(DEBUG, sc, "Releasing previously held ALR\n");
 		REG_WR(sc, MCP_REG_MCPR_ACCESS_LOCK, 0);
 	}
 
@@ -9740,6 +9751,8 @@ int bnx2x_attach(struct bnx2x_softc *sc)
 		sc->fw_seq =
 		    (SHMEM_RD(sc, func_mb[SC_FW_MB_IDX(sc)].drv_mb_header) &
 		     DRV_MSG_SEQ_NUMBER_MASK);
+		PMD_DRV_LOG(DEBUG, sc, "prev unload fw_seq 0x%04x",
+			    sc->fw_seq);
 		bnx2x_prev_unload(sc);
 	}
 
-- 
1.7.10.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] net/bnx2x: fix to use rte log
  2018-11-08 21:19 [dpdk-dev] [PATCH 1/2] net/bnx2x: fix to use rte log Mody, Rasesh
  2018-11-08 21:19 ` [dpdk-dev] [PATCH 2/2] net/bnx2x: fix VF link status update Mody, Rasesh
@ 2018-11-08 21:38 ` Stephen Hemminger
  2018-11-08 22:57   ` Mody, Rasesh
  2018-11-09 21:55   ` Ferruh Yigit
  1 sibling, 2 replies; 5+ messages in thread
From: Stephen Hemminger @ 2018-11-08 21:38 UTC (permalink / raw)
  To: Mody, Rasesh; +Cc: dev, ferruh.yigit, Dept-Eng DPDK Dev

On Thu, 8 Nov 2018 21:19:26 +0000
"Mody, Rasesh" <Rasesh.Mody@cavium.com> wrote:

> Use rte_log() rather than RTE_LOG() for dynamic logging. Rearrange
> dynamic log types to the top and configurable log types to bottom.
> Remove unused RTE_LIBRTE_BNX2X_DEBUG_TX_FREE
> 
> Fixes: ba7eeb035a5f ("net/bnx2x: fix logging to include device name")
> 
> Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>


Looks good to me.

You might also want to address the excessive number of INFO messages in
bnx2x.c. There are things like debug messages at INFO level, extra new
lines and banner bars.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] net/bnx2x: fix to use rte log
  2018-11-08 21:38 ` [dpdk-dev] [PATCH 1/2] net/bnx2x: fix to use rte log Stephen Hemminger
@ 2018-11-08 22:57   ` Mody, Rasesh
  2018-11-09 21:55   ` Ferruh Yigit
  1 sibling, 0 replies; 5+ messages in thread
From: Mody, Rasesh @ 2018-11-08 22:57 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, ferruh.yigit, Dept-Eng DPDK Dev

>From: Stephen Hemminger <stephen@networkplumber.org>
>Sent: Thursday, November 08, 2018 1:39 PM
>
>On Thu, 8 Nov 2018 21:19:26 +0000
>"Mody, Rasesh" <Rasesh.Mody@cavium.com> wrote:
>
>> Use rte_log() rather than RTE_LOG() for dynamic logging. Rearrange
>> dynamic log types to the top and configurable log types to bottom.
>> Remove unused RTE_LIBRTE_BNX2X_DEBUG_TX_FREE
>>
>> Fixes: ba7eeb035a5f ("net/bnx2x: fix logging to include device name")
>>
>> Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
>
>
>Looks good to me.
>
>You might also want to address the excessive number of INFO messages in
>bnx2x.c. There are things like debug messages at INFO level, extra new lines
>and banner bars.

I'll send follow up patch addressing above.

Thanks!
-Rasesh
>
>Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] net/bnx2x: fix to use rte log
  2018-11-08 21:38 ` [dpdk-dev] [PATCH 1/2] net/bnx2x: fix to use rte log Stephen Hemminger
  2018-11-08 22:57   ` Mody, Rasesh
@ 2018-11-09 21:55   ` Ferruh Yigit
  1 sibling, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2018-11-09 21:55 UTC (permalink / raw)
  To: Stephen Hemminger, Mody, Rasesh; +Cc: dev, Dept-Eng DPDK Dev

On 11/8/2018 9:38 PM, Stephen Hemminger wrote:
> On Thu, 8 Nov 2018 21:19:26 +0000
> "Mody, Rasesh" <Rasesh.Mody@cavium.com> wrote:
> 
>> Use rte_log() rather than RTE_LOG() for dynamic logging. Rearrange
>> dynamic log types to the top and configurable log types to bottom.
>> Remove unused RTE_LIBRTE_BNX2X_DEBUG_TX_FREE
>>
>> Fixes: ba7eeb035a5f ("net/bnx2x: fix logging to include device name")
>>
>> Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
> 
> 
> Looks good to me.
> 
> You might also want to address the excessive number of INFO messages in
> bnx2x.c. There are things like debug messages at INFO level, extra new
> lines and banner bars.
> 
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>

Series applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-09 21:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-08 21:19 [dpdk-dev] [PATCH 1/2] net/bnx2x: fix to use rte log Mody, Rasesh
2018-11-08 21:19 ` [dpdk-dev] [PATCH 2/2] net/bnx2x: fix VF link status update Mody, Rasesh
2018-11-08 21:38 ` [dpdk-dev] [PATCH 1/2] net/bnx2x: fix to use rte log Stephen Hemminger
2018-11-08 22:57   ` Mody, Rasesh
2018-11-09 21:55   ` Ferruh Yigit

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