DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rasesh Mody <rasesh.mody@qlogic.com>
To: <thomas.monjalon@6wind.com>
Cc: dev@dpdk.org, sony.chacko@qlogic.com
Subject: [dpdk-dev] [PATCH v2 08/11] bnx2x: Handle zlib compatibility error
Date: Mon, 9 Nov 2015 15:56:23 -0800	[thread overview]
Message-ID: <1447113386-19346-9-git-send-email-rasesh.mody@qlogic.com> (raw)
In-Reply-To: <1447113386-19346-1-git-send-email-rasesh.mody@qlogic.com>

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@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 b70de04..d3912ed 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

  parent reply	other threads:[~2015-11-09 23:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09 23:56 [dpdk-dev] [PATCH v2 00/11] bnx2x: Enhancement, fixes, licensing and doumentation Rasesh Mody
2015-11-09 23:56 ` [dpdk-dev] [PATCH v2 01/11] bnx2x: Update VF to support newer PF drivers Rasesh Mody
2015-11-09 23:56 ` [dpdk-dev] [PATCH v2 02/11] bnx2x: Fix x86_64-native-linuxapp-clang build error Rasesh Mody
2015-11-09 23:56 ` [dpdk-dev] [PATCH v2 03/11] bnx2x: Add periodic debug option Rasesh Mody
2015-11-09 23:56 ` [dpdk-dev] [PATCH v2 04/11] doc: Add BNX2X PMD documentation Rasesh Mody
2015-11-13 16:11   ` Mcnamara, John
2015-11-09 23:56 ` [dpdk-dev] [PATCH v2 05/11] bnx2x: Add LICENSE.bnx2x_pmd and update source files Rasesh Mody
2015-11-09 23:56 ` [dpdk-dev] [PATCH v2 06/11] bnx2x: FreeBSD enablement Rasesh Mody
2015-11-10 10:48   ` Bruce Richardson
2015-11-09 23:56 ` [dpdk-dev] [PATCH v2 07/11] bnx2x: Linux 32bit enablement Rasesh Mody
2015-11-09 23:56 ` Rasesh Mody [this message]
2015-11-09 23:56 ` [dpdk-dev] [PATCH v2 09/11] maintainers: Add maintainers for BNX2X PMD Rasesh Mody
2015-11-09 23:56 ` [dpdk-dev] [PATCH v2 10/11] config: Enable BNX2X driver build by default Rasesh Mody
2015-11-09 23:56 ` [dpdk-dev] [PATCH v2 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=1447113386-19346-9-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).