[dpdk-dev] [PATCH v3 08/11] bnx2x: Handle zlib compatibility error

Rasesh Mody rasesh.mody at qlogic.com
Tue Nov 24 08:44:33 CET 2015


Following error will be reported:

PMD: ecore_gunzip(): Newer version of zlib required, 1.2.5.2 or higher
EAL: Error - exiting with code: 1
  Cause: rte_eth_dev_start:err=-1, port=0

Signed-off-by: Rasesh Mody <rasesh.mody at qlogic.com>
---
 doc/guides/nics/bnx2x.rst          |    4 ++++
 drivers/net/bnx2x/bnx2x.c          |   10 +++++++++-
 drivers/net/bnx2x/ecore_init_ops.h |   18 ++++++++++++------
 3 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/doc/guides/nics/bnx2x.rst b/doc/guides/nics/bnx2x.rst
index 85ac1c3..2936d8b 100644
--- a/doc/guides/nics/bnx2x.rst
+++ b/doc/guides/nics/bnx2x.rst
@@ -86,6 +86,10 @@ Prerequisites
   `QLogic Driver Download Center <http://driverdownloads.qlogic.com>`_
   to get the required firmware.
 
+- This driver relies on external zlib library for unzipping the firmware image.
+  The zlib library is not part of DPDK and must be installed separately. The
+  minimum version of zlib library required is v1.2.5.2.
+
 Pre-Installation Configuration
 ------------------------------
 
diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index f125c79..088c041 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -10029,6 +10029,7 @@ static int bnx2x_init_hw_common(struct bnx2x_softc *sc)
 {
 	uint8_t abs_func_id;
 	uint32_t val;
+	int ret = 0;
 
 	PMD_DRV_LOG(DEBUG, "starting common init for func %d", SC_ABS_FUNC(sc));
 
@@ -10328,7 +10329,9 @@ static int bnx2x_init_hw_common(struct bnx2x_softc *sc)
 		DELAY(20000);
 	}
 
-	ecore_init_block(sc, BLOCK_TSEM, PHASE_COMMON);
+	ret = ecore_init_block(sc, BLOCK_TSEM, PHASE_COMMON);
+	if (ret != 0)
+		return ret;
 	ecore_init_block(sc, BLOCK_USEM, PHASE_COMMON);
 	ecore_init_block(sc, BLOCK_CSEM, PHASE_COMMON);
 	ecore_init_block(sc, BLOCK_XSEM, PHASE_COMMON);
@@ -11567,7 +11570,12 @@ static int ecore_gunzip(struct bnx2x_softc *sc, const uint8_t * zbuf, int len)
 	}
 
 	memset(&zlib_stream, 0, sizeof(zlib_stream));
+#if ZLIB_VERNUM < 0x1252
+	PMD_INIT_LOG(ERR, "Newer version of zlib required, 1.2.5.2 or higher");
+	return Z_VERSION_ERROR;
+#else
 	zlib_stream.next_in = zbuf + data_begin;
+#endif
 	zlib_stream.avail_in = len - data_begin;
 	zlib_stream.next_out = sc->gz_buf;
 	zlib_stream.avail_out = FW_BUF_SIZE;
diff --git a/drivers/net/bnx2x/ecore_init_ops.h b/drivers/net/bnx2x/ecore_init_ops.h
index b6f9832..cd042bb 100644
--- a/drivers/net/bnx2x/ecore_init_ops.h
+++ b/drivers/net/bnx2x/ecore_init_ops.h
@@ -150,18 +150,18 @@ static void ecore_wr_64(struct bnx2x_softc *sc, uint32_t reg, uint32_t val_lo,
 	REG_WR_DMAE_LEN(sc, reg, wb_write, 2);
 }
 
-static void ecore_init_wr_zp(struct bnx2x_softc *sc, uint32_t addr, uint32_t len,
+static int ecore_init_wr_zp(struct bnx2x_softc *sc, uint32_t addr, uint32_t len,
 			     uint32_t blob_off)
 {
 	const uint8_t *data = NULL;
-	int rc;
+	int rc = 0;
 	uint32_t i;
 
 	data = ecore_sel_blob(sc, addr, data) + blob_off*4;
 
 	rc = ecore_gunzip(sc, data, len);
 	if (rc)
-		return;
+		return rc;
 
 	/* gunzip_outlen is in dwords */
 	len = GUNZIP_OUTLEN(sc);
@@ -170,9 +170,11 @@ static void ecore_init_wr_zp(struct bnx2x_softc *sc, uint32_t addr, uint32_t len
 				ECORE_CPU_TO_LE32(((uint32_t *)GUNZIP_BUF(sc))[i]);
 
 	ecore_write_big_buf_wb(sc, addr, len);
+
+	return rc;
 }
 
-static void ecore_init_block(struct bnx2x_softc *sc, uint32_t block, uint32_t stage)
+static int ecore_init_block(struct bnx2x_softc *sc, uint32_t block, uint32_t stage)
 {
 	uint16_t op_start =
 		INIT_OPS_OFFSETS(sc)[BLOCK_OPS_IDX(block, stage,
@@ -183,10 +185,11 @@ static void ecore_init_block(struct bnx2x_softc *sc, uint32_t block, uint32_t st
 	const union init_op *op;
 	uint32_t op_idx, op_type, addr, len;
 	const uint32_t *data, *data_base;
+	int ret = 0;
 
 	/* If empty block */
 	if (op_start == op_end)
-		return;
+		return ret;
 
 	data_base = INIT_DATA(sc);
 
@@ -221,7 +224,9 @@ static void ecore_init_block(struct bnx2x_softc *sc, uint32_t block, uint32_t st
 			ecore_init_fill(sc, addr, 0, op->zero.len);
 			break;
 		case OP_ZP:
-			ecore_init_wr_zp(sc, addr, len, op->arr_wr.data_off);
+			ret = ecore_init_wr_zp(sc, addr, len, op->arr_wr.data_off);
+			if (ret != 0)
+				return ret;
 			break;
 		case OP_WR_64:
 			ecore_init_wr_64(sc, addr, data, len);
@@ -254,6 +259,7 @@ static void ecore_init_block(struct bnx2x_softc *sc, uint32_t block, uint32_t st
 			break;
 		}
 	}
+	return ret;
 }
 
 
-- 
1.7.10.3



More information about the dev mailing list