Skip to contentSkip to conversation

bnx2: Add firmware decompression

PATCH Applied Michael Chan 2 participants 4 messages Jun 13, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/6 bnx2: Add firmware decompression

Add functions to decompress firmware before loading to the internal CPUs. Compressing the firmware reduces the driver size significantly.

drivers/net/Kconfig +2 -0
index bdaaad8..1fb0a19 100644
@@ -2163,6 +2163,8 @@ config TIGON3
 config BNX2
 	tristate "Broadcom NetXtremeII support"
 	depends on PCI
+	select CRC32
+	select ZLIB_INFLATE
 	help
 	  This driver supports Broadcom NetXtremeII gigabit Ethernet cards.
 
drivers/net/bnx2.c +147 -12

238 lines not on this page · raw message

drivers/net/bnx2.h +3 -0
index de2b58c..768abca 100644
@@ -4048,6 +4048,9 @@ struct bnx2 {
 	u32			flash_size;
 
 	int			status_stats_size;
+
+	struct z_stream_s	*strm;
+	void			*gunzip_buf;
 };
 
 static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset);
maintainer
#1 lore raw

From: "Michael Chan" <[email protected]>
Date: Mon, 12 Jun 2006 17:17:18 -0700

Quoted 4 lines

Add functions to decompress firmware before loading to the internal CPUs. Compressing the firmware reduces the driver size significantly.

...

drivers/net/bnx2.c bnx2_set_rx_mode(struct net_device *dev) · line 2146

Quoted 3 lines
drivers/net/bnx2.c +3 -0
+#define FNAME	0x8
+	if (zbuf[3] & FNAME)
+		while (zbuf[n++] != 0);

This can potentially loop past the end of zbuf[], so maybe put a sanity check against 'len' and return non-zero if we traverse past the end?

#2 lore raw
Quoted 7 lines · David Miller

From: "Michael Chan" <[email protected]>
Date: Mon, 12 Jun 2006 17:17:18 -0700

Quoted 4 lines

Add functions to decompress firmware before loading to the internal CPUs. Compressing the firmware reduces the driver size significantly.

Quoted 8 lines

...

Review

Quoted 3 lines
(quoted diff) +3 -0
+#define FNAME	0x8
+	if (zbuf[3] & FNAME)
+		while (zbuf[n++] != 0);

This can potentially loop past the end of zbuf[], so maybe put a sanity check against 'len' and return non-zero if we traverse past the end?

Add functions to decompress firmware before loading to the internal CPUs. Compressing the firmware reduces the driver size significantly.

Added file name length sanity check in the gzip header to prevent going past the end of buffer [suggested by DaveM].

drivers/net/Kconfig +2 -0
index bdaaad8..1fb0a19 100644
@@ -2163,6 +2163,8 @@ config TIGON3
 config BNX2
 	tristate "Broadcom NetXtremeII support"
 	depends on PCI
+	select CRC32
+	select ZLIB_INFLATE
 	help
 	  This driver supports Broadcom NetXtremeII gigabit Ethernet cards.
 
drivers/net/bnx2.c +147 -12

238 lines not on this page · raw message

drivers/net/bnx2.h +3 -0
index de2b58c..768abca 100644
@@ -4048,6 +4048,9 @@ struct bnx2 {
 	u32			flash_size;
 
 	int			status_stats_size;
+
+	struct z_stream_s	*strm;
+	void			*gunzip_buf;
 };
 
 static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset);
maintainer
#3 lore raw

From: "Michael Chan" <[email protected]>
Date: Mon, 12 Jun 2006 18:42:29 -0700

Quoted 17 lines · David Miller
Quoted 7 lines

From: "Michael Chan" <[email protected]>
Date: Mon, 12 Jun 2006 17:17:18 -0700

Quoted 4 lines

Add functions to decompress firmware before loading to the internal CPUs. Compressing the firmware reduces the driver size significantly.

Quoted 8 lines

...

drivers/net/bnx2.c bnx2_set_rx_mode(struct net_device *dev)

Quoted 3 lines
drivers/net/bnx2.c +3 -0
+#define FNAME	0x8
+	if (zbuf[3] & FNAME)
+		while (zbuf[n++] != 0);

This can potentially loop past the end of zbuf[], so maybe put a sanity check against 'len' and return non-zero if we traverse past the end?

Quoted 7 lines

Add functions to decompress firmware before loading to the internal CPUs. Compressing the firmware reduces the driver size significantly.

Added file name length sanity check in the gzip header to prevent going past the end of buffer [suggested by DaveM].

This looks great, applied.

Thanks a lot.