Skip to contentSkip to conversation

.h files rewrite

RFC Eliezer Tamir 4 participants 8 messages Oct 28, 2007 – Nov 12, 2007 1 message not in the archive

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

Dave,

Please take a look and tell me if this is better than the last attempt.

Main changes:

* Rewrite of the init code:
1. Full rewrite of the generated code into something easier to read.
2. Removed zeroes by adding a zero command.
3. Big chucks of data are read by the chip using the DMA engine (instead of being written by the driver).
4. Gzipped more of the data.

* Removed BE microcode, the swapping is done in the driver instead.

* Rewrite of the HSI - broke it into three files bnx2x_hsi.h bnx2x_reg.h and bnx2x_fw_defs.h

* Fixed SPARSE warnings.

* Fixed all but three checkpatch.pl warnings. (IMHO they are false positives)

The diff is against latest net-2.6.

ftp link:
ftp://[email protected]/0001-bnx2x-h-file-rewrite.txt

gzipped:
ftp://[email protected]/0001-bnx2x-h-file-rewrite.txt.gz

(will also attache patch inline as reply to this email for review)

Thanks
Eliezer

A message that is not in the archive (sent off-list or not yet received): 1193602875.4836.28.camel@eliezer

maintainer
#2 lore raw

From: "Eliezer Tamir" <[email protected]>
Date: Sun, 28 Oct 2007 22:21:14 +0200

Overall things look significantly better, thanks a lot!

However, there is still one set of magic constants in here which I hope you can clear up:

Quoted 6 lines
(quoted diff) +6 -0
+static const struct raw_op init_ops[] = {
+#define PRS_COMMON_START        0
+	{OP_WR, PRS_REG_INC_VALUE, 0xf},
+	{OP_WR, PRS_REG_EVENT_ID_1, 0x45},
+	{OP_WR, PRS_REG_EVENT_ID_2, 0x84},
+	{OP_WR, PRS_REG_EVENT_ID_3, 0x6},

Review

Quoted 10 lines
(quoted diff) +10 -0
+	{OP_WR, PRS_REG_NO_MATCH_EVENT_ID, 0x4},
+	{OP_WR, PRS_REG_CM_HDR_TYPE_0, 0x0},
+	{OP_WR, PRS_REG_CM_HDR_TYPE_1, 0x12170000},
+	{OP_WR, PRS_REG_CM_HDR_TYPE_2, 0x22170000},
+	{OP_WR, PRS_REG_CM_HDR_TYPE_3, 0x32170000},
+	{OP_ZR, PRS_REG_CM_HDR_TYPE_4, 0x5},
+	{OP_WR, PRS_REG_CM_HDR_LOOPBACK_TYPE_1, 0x12150000},
+	{OP_WR, PRS_REG_CM_HDR_LOOPBACK_TYPE_2, 0x22150000},
+	{OP_WR, PRS_REG_CM_HDR_LOOPBACK_TYPE_3, 0x32150000},
+	{OP_ZR, PRS_REG_CM_HDR_LOOPBACK_TYPE_4, 0x4},

etc. etc.

Take care.

#3 lore raw

(Sorry It took so long to answer, I've had to go over a lot of stuff to make sure I'm giving you accurate answers.)

Quoted 17 lines · David Miller

From: "Eliezer Tamir" <[email protected]>
Date: Sun, 28 Oct 2007 22:21:14 +0200

Overall things look significantly better, thanks a lot!

However, there is still one set of magic constants in here which I hope you can clear up:

Quoted 9 lines
(quoted diff) +9 -0
+static const struct raw_op init_ops[] = {
+#define PRS_COMMON_START        0
+     {OP_WR, PRS_REG_INC_VALUE, 0xf},
+     {OP_WR, PRS_REG_EVENT_ID_1, 0x45},
+     {OP_WR, PRS_REG_EVENT_ID_2, 0x84},
+     {OP_WR, PRS_REG_EVENT_ID_3, 0x6},
+     {OP_WR, PRS_REG_NO_MATCH_EVENT_ID, 0x4},
+     {OP_WR, PRS_REG_CM_HDR_TYPE_0, 0x0},
+     {OP_WR, PRS_REG_CM_HDR_TYPE_1, 0x12170000},
Quoted 8 lines

Review

Quoted 7 lines
(quoted diff) +7 -0
+     {OP_WR, PRS_REG_CM_HDR_TYPE_2, 0x22170000},
+     {OP_WR, PRS_REG_CM_HDR_TYPE_3, 0x32170000},
+     {OP_ZR, PRS_REG_CM_HDR_TYPE_4, 0x5},
+     {OP_WR, PRS_REG_CM_HDR_LOOPBACK_TYPE_1, 0x12150000},
+     {OP_WR, PRS_REG_CM_HDR_LOOPBACK_TYPE_2, 0x22150000},
+     {OP_WR, PRS_REG_CM_HDR_LOOPBACK_TYPE_3, 0x32150000},
+     {OP_ZR, PRS_REG_CM_HDR_LOOPBACK_TYPE_4, 0x4},

etc. etc.

These are the steps performed to initialize the chip and load the microcode.

Each element in the array is an operation in the form:
{operation, chip address, value}

Where the operation is one of:
OP_WR - write a value to the chip.
OP_RD - read a register (this is a read with a side effect, usually a clear on read register).
OP_SW - string write to the chip (parts of the microcode). OP_SI - string write using indirect write registers.
OP_ZR - clear a range of memory.
OP_ZP - unzip and copy using DMAE.
OP_WB - string copy using DMAE.

(I will add these explanations to bnx2x_init.h)

As you can see there are quite a lot of them, that is because most of them are setting up the microcode internal structures.
Maybe it would have been better if the microcode were to do these things but because of size issues it currently is not an option.

We will add comments to all register definitions explaining as much as possible about each register.

All of the registers that are related to the driver flow are accessed explicitly inside the driver code in the main .c file.

Writes to memories are simply parts of the microcode.

However, almost all of the registers written to here, are numeric values not bit constants. The values are derived from HW definitions (and that was the source of the extra-ugly generated code that we replaced).

In a perfect world almost all of these would have been the reset values of the registers.
#include "bitching_about_HW_guys.h"

The added documentation for each register in the register file will provide all the info that I have about the values.
I feel bad about adding several hundred lines of defines that are only used once, and do not add any real information about the values.

Your insights would be appreciated.

Thanks,
Eliezer

maintainer
#4 lore raw

From: "Eliezer Tamir" <[email protected]>
Date: Wed, 31 Oct 2007 12:14:47 +0200

Quoted 2 lines

I feel bad about adding several hundred lines of defines that are only used once, and do not add any real information about the values.

Ok, let's skip this for now.

#5 lore raw
In reply to Eliezer Tamir
Quoted 22 lines · Eliezer Tamir

Dave,

Please take a look and tell me if this is better than the last attempt.

Main changes:

* Rewrite of the init code:
1. Full rewrite of the generated code into something easier to read.
2. Removed zeroes by adding a zero command.
3. Big chucks of data are read by the chip using the DMA engine (instead of being written by the driver).
4. Gzipped more of the data.

* Removed BE microcode, the swapping is done in the driver instead.

* Rewrite of the HSI - broke it into three files bnx2x_hsi.h bnx2x_reg.h and bnx2x_fw_defs.h

* Fixed SPARSE warnings.

* Fixed all but three checkpatch.pl warnings. (IMHO they are false positives)

The diff is against latest net-2.6.

Quoted 8 lines

ftp link:
ftp://[email protected]/0001-bnx2x-h-file-rewrite.txt

gzipped:
ftp://[email protected]/0001-bnx2x-h-file-rewrite.txt.gz

(will also attache patch inline as reply to this email for review)

I built the newest bnx2x code against the net-2.6 kernel and ran a number of stress tests with netperf and pktgen. I did not encounter any errors.

Max

#6 lore raw
Quoted 8 lines · Max Asbock

I built the newest bnx2x code against the net-2.6 kernel and ran a number of stress tests with netperf and pktgen. I did not encounter any
errors.

Max

Thanks,
Eliezer

#7 lore raw
Quoted 11 lines · Eliezer Tamir
Quoted 8 lines · Max Asbock

I built the newest bnx2x code against the net-2.6 kernel and ran a number of stress tests with netperf and pktgen. I did not encounter any
errors.

Max

Thanks,

Dave/Jeff,

What is the current outlook for this driver? Is it ready for upstream?

thanks,
RP

Quoted 7 lines

Eliezer

-
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#8 lore raw

From: Ram Pai <[email protected]>
Date: Mon, 12 Nov 2007 15:13:23 -0800

Quoted 13 lines · Eliezer Tamir
Quoted 10 lines · Max Asbock
Quoted 9 lines

I built the newest bnx2x code against the net-2.6 kernel and ran a number of stress tests with netperf and pktgen. I did not encounter any
errors.

Max

Quoted 6 lines
Quoted 1 line

Thanks,

Dave/Jeff,

What is the current outlook for this driver? Is it ready for upstream?

Yes, I intend to add it for 2.6.25