aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-18 13:24:36 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-18 13:24:36 -0400
commit485cf925d8b7a6b3c62fe5f1e167f2d0d4edf32a (patch)
tree57798f48123a62dd1801f039b676b06913e34e72 /drivers/net
parent31bdc5dc7666aa2fe04c626cea30fe3c20cf481c (diff)
parent3fd8f9e4b6c184d03d340bc86630f700de967fa8 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (24 commits) [NETFILTER]: xt_connlimit needs to depend on nf_conntrack [NETFILTER]: ipt_iprange.h must #include <linux/types.h> [IrDA]: Fix IrDA build failure [ATM]: nicstar needs virt_to_bus [NET]: move __dev_addr_discard adjacent to dev_addr_discard for readability [NET]: merge dev_unicast_discard and dev_mc_discard into one [NET]: move dev_mc_discard from dev_mcast.c to dev.c [NETLINK]: negative groups in netlink_setsockopt [PPPOL2TP]: Reset meta-data in xmit function [PPPOL2TP]: Fix use-after-free [PKT_SCHED]: Some typo fixes in net/sched/Kconfig [XFRM]: Fix crash introduced by struct dst_entry reordering [TCP]: remove unused argument to cong_avoid op [ATM]: [idt77252] Rename CONFIG_ATM_IDT77252_SEND_IDLE to not resemble a Kconfig variable [ATM]: [drivers] ioremap balanced with iounmap [ATM]: [lanai] sram_test_word() must be __devinit [ATM]: [nicstar] Replace C code with call to ARRAY_SIZE() macro. [ATM]: Eliminate dead config variable CONFIG_BR2684_FAST_TRANS. [ATM]: Replacing kmalloc/memset combination with kzalloc. [NET]: gen_estimator deadlock fix ...
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bnx2.c103
-rw-r--r--drivers/net/bnx2.h10
-rw-r--r--drivers/net/pppol2tp.c18
3 files changed, 87 insertions, 44 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index d23861c8658c..a729da061bbb 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -54,8 +54,8 @@
54 54
55#define DRV_MODULE_NAME "bnx2" 55#define DRV_MODULE_NAME "bnx2"
56#define PFX DRV_MODULE_NAME ": " 56#define PFX DRV_MODULE_NAME ": "
57#define DRV_MODULE_VERSION "1.6.2" 57#define DRV_MODULE_VERSION "1.6.3"
58#define DRV_MODULE_RELDATE "July 6, 2007" 58#define DRV_MODULE_RELDATE "July 16, 2007"
59 59
60#define RUN_AT(x) (jiffies + (x)) 60#define RUN_AT(x) (jiffies + (x))
61 61
@@ -126,91 +126,102 @@ static struct pci_device_id bnx2_pci_tbl[] = {
126 126
127static struct flash_spec flash_table[] = 127static struct flash_spec flash_table[] =
128{ 128{
129#define BUFFERED_FLAGS (BNX2_NV_BUFFERED | BNX2_NV_TRANSLATE)
130#define NONBUFFERED_FLAGS (BNX2_NV_WREN)
129 /* Slow EEPROM */ 131 /* Slow EEPROM */
130 {0x00000000, 0x40830380, 0x009f0081, 0xa184a053, 0xaf000400, 132 {0x00000000, 0x40830380, 0x009f0081, 0xa184a053, 0xaf000400,
131 1, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE, 133 BUFFERED_FLAGS, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE,
132 SEEPROM_BYTE_ADDR_MASK, SEEPROM_TOTAL_SIZE, 134 SEEPROM_BYTE_ADDR_MASK, SEEPROM_TOTAL_SIZE,
133 "EEPROM - slow"}, 135 "EEPROM - slow"},
134 /* Expansion entry 0001 */ 136 /* Expansion entry 0001 */
135 {0x08000002, 0x4b808201, 0x00050081, 0x03840253, 0xaf020406, 137 {0x08000002, 0x4b808201, 0x00050081, 0x03840253, 0xaf020406,
136 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, 138 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
137 SAIFUN_FLASH_BYTE_ADDR_MASK, 0, 139 SAIFUN_FLASH_BYTE_ADDR_MASK, 0,
138 "Entry 0001"}, 140 "Entry 0001"},
139 /* Saifun SA25F010 (non-buffered flash) */ 141 /* Saifun SA25F010 (non-buffered flash) */
140 /* strap, cfg1, & write1 need updates */ 142 /* strap, cfg1, & write1 need updates */
141 {0x04000001, 0x47808201, 0x00050081, 0x03840253, 0xaf020406, 143 {0x04000001, 0x47808201, 0x00050081, 0x03840253, 0xaf020406,
142 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, 144 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
143 SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE*2, 145 SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE*2,
144 "Non-buffered flash (128kB)"}, 146 "Non-buffered flash (128kB)"},
145 /* Saifun SA25F020 (non-buffered flash) */ 147 /* Saifun SA25F020 (non-buffered flash) */
146 /* strap, cfg1, & write1 need updates */ 148 /* strap, cfg1, & write1 need updates */
147 {0x0c000003, 0x4f808201, 0x00050081, 0x03840253, 0xaf020406, 149 {0x0c000003, 0x4f808201, 0x00050081, 0x03840253, 0xaf020406,
148 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, 150 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
149 SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE*4, 151 SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE*4,
150 "Non-buffered flash (256kB)"}, 152 "Non-buffered flash (256kB)"},
151 /* Expansion entry 0100 */ 153 /* Expansion entry 0100 */
152 {0x11000000, 0x53808201, 0x00050081, 0x03840253, 0xaf020406, 154 {0x11000000, 0x53808201, 0x00050081, 0x03840253, 0xaf020406,
153 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, 155 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
154 SAIFUN_FLASH_BYTE_ADDR_MASK, 0, 156 SAIFUN_FLASH_BYTE_ADDR_MASK, 0,
155 "Entry 0100"}, 157 "Entry 0100"},
156 /* Entry 0101: ST M45PE10 (non-buffered flash, TetonII B0) */ 158 /* Entry 0101: ST M45PE10 (non-buffered flash, TetonII B0) */
157 {0x19000002, 0x5b808201, 0x000500db, 0x03840253, 0xaf020406, 159 {0x19000002, 0x5b808201, 0x000500db, 0x03840253, 0xaf020406,
158 0, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE, 160 NONBUFFERED_FLAGS, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE,
159 ST_MICRO_FLASH_BYTE_ADDR_MASK, ST_MICRO_FLASH_BASE_TOTAL_SIZE*2, 161 ST_MICRO_FLASH_BYTE_ADDR_MASK, ST_MICRO_FLASH_BASE_TOTAL_SIZE*2,
160 "Entry 0101: ST M45PE10 (128kB non-bufferred)"}, 162 "Entry 0101: ST M45PE10 (128kB non-bufferred)"},
161 /* Entry 0110: ST M45PE20 (non-buffered flash)*/ 163 /* Entry 0110: ST M45PE20 (non-buffered flash)*/
162 {0x15000001, 0x57808201, 0x000500db, 0x03840253, 0xaf020406, 164 {0x15000001, 0x57808201, 0x000500db, 0x03840253, 0xaf020406,
163 0, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE, 165 NONBUFFERED_FLAGS, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE,
164 ST_MICRO_FLASH_BYTE_ADDR_MASK, ST_MICRO_FLASH_BASE_TOTAL_SIZE*4, 166 ST_MICRO_FLASH_BYTE_ADDR_MASK, ST_MICRO_FLASH_BASE_TOTAL_SIZE*4,
165 "Entry 0110: ST M45PE20 (256kB non-bufferred)"}, 167 "Entry 0110: ST M45PE20 (256kB non-bufferred)"},
166 /* Saifun SA25F005 (non-buffered flash) */ 168 /* Saifun SA25F005 (non-buffered flash) */
167 /* strap, cfg1, & write1 need updates */ 169 /* strap, cfg1, & write1 need updates */
168 {0x1d000003, 0x5f808201, 0x00050081, 0x03840253, 0xaf020406, 170 {0x1d000003, 0x5f808201, 0x00050081, 0x03840253, 0xaf020406,
169 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, 171 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
170 SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE, 172 SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE,
171 "Non-buffered flash (64kB)"}, 173 "Non-buffered flash (64kB)"},
172 /* Fast EEPROM */ 174 /* Fast EEPROM */
173 {0x22000000, 0x62808380, 0x009f0081, 0xa184a053, 0xaf000400, 175 {0x22000000, 0x62808380, 0x009f0081, 0xa184a053, 0xaf000400,
174 1, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE, 176 BUFFERED_FLAGS, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE,
175 SEEPROM_BYTE_ADDR_MASK, SEEPROM_TOTAL_SIZE, 177 SEEPROM_BYTE_ADDR_MASK, SEEPROM_TOTAL_SIZE,
176 "EEPROM - fast"}, 178 "EEPROM - fast"},
177 /* Expansion entry 1001 */ 179 /* Expansion entry 1001 */
178 {0x2a000002, 0x6b808201, 0x00050081, 0x03840253, 0xaf020406, 180 {0x2a000002, 0x6b808201, 0x00050081, 0x03840253, 0xaf020406,
179 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, 181 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
180 SAIFUN_FLASH_BYTE_ADDR_MASK, 0, 182 SAIFUN_FLASH_BYTE_ADDR_MASK, 0,
181 "Entry 1001"}, 183 "Entry 1001"},
182 /* Expansion entry 1010 */ 184 /* Expansion entry 1010 */
183 {0x26000001, 0x67808201, 0x00050081, 0x03840253, 0xaf020406, 185 {0x26000001, 0x67808201, 0x00050081, 0x03840253, 0xaf020406,
184 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, 186 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
185 SAIFUN_FLASH_BYTE_ADDR_MASK, 0, 187 SAIFUN_FLASH_BYTE_ADDR_MASK, 0,
186 "Entry 1010"}, 188 "Entry 1010"},
187 /* ATMEL AT45DB011B (buffered flash) */ 189 /* ATMEL AT45DB011B (buffered flash) */
188 {0x2e000003, 0x6e808273, 0x00570081, 0x68848353, 0xaf000400, 190 {0x2e000003, 0x6e808273, 0x00570081, 0x68848353, 0xaf000400,
189 1, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, 191 BUFFERED_FLAGS, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE,
190 BUFFERED_FLASH_BYTE_ADDR_MASK, BUFFERED_FLASH_TOTAL_SIZE, 192 BUFFERED_FLASH_BYTE_ADDR_MASK, BUFFERED_FLASH_TOTAL_SIZE,
191 "Buffered flash (128kB)"}, 193 "Buffered flash (128kB)"},
192 /* Expansion entry 1100 */ 194 /* Expansion entry 1100 */
193 {0x33000000, 0x73808201, 0x00050081, 0x03840253, 0xaf020406, 195 {0x33000000, 0x73808201, 0x00050081, 0x03840253, 0xaf020406,
194 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, 196 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
195 SAIFUN_FLASH_BYTE_ADDR_MASK, 0, 197 SAIFUN_FLASH_BYTE_ADDR_MASK, 0,
196 "Entry 1100"}, 198 "Entry 1100"},
197 /* Expansion entry 1101 */ 199 /* Expansion entry 1101 */
198 {0x3b000002, 0x7b808201, 0x00050081, 0x03840253, 0xaf020406, 200 {0x3b000002, 0x7b808201, 0x00050081, 0x03840253, 0xaf020406,
199 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, 201 NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE,
200 SAIFUN_FLASH_BYTE_ADDR_MASK, 0, 202 SAIFUN_FLASH_BYTE_ADDR_MASK, 0,
201 "Entry 1101"}, 203 "Entry 1101"},
202 /* Ateml Expansion entry 1110 */ 204 /* Ateml Expansion entry 1110 */
203 {0x37000001, 0x76808273, 0x00570081, 0x68848353, 0xaf000400, 205 {0x37000001, 0x76808273, 0x00570081, 0x68848353, 0xaf000400,
204 1, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, 206 BUFFERED_FLAGS, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE,
205 BUFFERED_FLASH_BYTE_ADDR_MASK, 0, 207 BUFFERED_FLASH_BYTE_ADDR_MASK, 0,
206 "Entry 1110 (Atmel)"}, 208 "Entry 1110 (Atmel)"},
207 /* ATMEL AT45DB021B (buffered flash) */ 209 /* ATMEL AT45DB021B (buffered flash) */
208 {0x3f000003, 0x7e808273, 0x00570081, 0x68848353, 0xaf000400, 210 {0x3f000003, 0x7e808273, 0x00570081, 0x68848353, 0xaf000400,
209 1, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, 211 BUFFERED_FLAGS, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE,
210 BUFFERED_FLASH_BYTE_ADDR_MASK, BUFFERED_FLASH_TOTAL_SIZE*2, 212 BUFFERED_FLASH_BYTE_ADDR_MASK, BUFFERED_FLASH_TOTAL_SIZE*2,
211 "Buffered flash (256kB)"}, 213 "Buffered flash (256kB)"},
212}; 214};
213 215
216static struct flash_spec flash_5709 = {
217 .flags = BNX2_NV_BUFFERED,
218 .page_bits = BCM5709_FLASH_PAGE_BITS,
219 .page_size = BCM5709_FLASH_PAGE_SIZE,
220 .addr_mask = BCM5709_FLASH_BYTE_ADDR_MASK,
221 .total_size = BUFFERED_FLASH_TOTAL_SIZE*2,
222 .name = "5709 Buffered flash (256kB)",
223};
224
214MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl); 225MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl);
215 226
216static inline u32 bnx2_tx_avail(struct bnx2 *bp) 227static inline u32 bnx2_tx_avail(struct bnx2 *bp)
@@ -3289,7 +3300,7 @@ bnx2_enable_nvram_write(struct bnx2 *bp)
3289 val = REG_RD(bp, BNX2_MISC_CFG); 3300 val = REG_RD(bp, BNX2_MISC_CFG);
3290 REG_WR(bp, BNX2_MISC_CFG, val | BNX2_MISC_CFG_NVM_WR_EN_PCI); 3301 REG_WR(bp, BNX2_MISC_CFG, val | BNX2_MISC_CFG_NVM_WR_EN_PCI);
3291 3302
3292 if (!bp->flash_info->buffered) { 3303 if (bp->flash_info->flags & BNX2_NV_WREN) {
3293 int j; 3304 int j;
3294 3305
3295 REG_WR(bp, BNX2_NVM_COMMAND, BNX2_NVM_COMMAND_DONE); 3306 REG_WR(bp, BNX2_NVM_COMMAND, BNX2_NVM_COMMAND_DONE);
@@ -3349,7 +3360,7 @@ bnx2_nvram_erase_page(struct bnx2 *bp, u32 offset)
3349 u32 cmd; 3360 u32 cmd;
3350 int j; 3361 int j;
3351 3362
3352 if (bp->flash_info->buffered) 3363 if (bp->flash_info->flags & BNX2_NV_BUFFERED)
3353 /* Buffered flash, no erase needed */ 3364 /* Buffered flash, no erase needed */
3354 return 0; 3365 return 0;
3355 3366
@@ -3392,8 +3403,8 @@ bnx2_nvram_read_dword(struct bnx2 *bp, u32 offset, u8 *ret_val, u32 cmd_flags)
3392 /* Build the command word. */ 3403 /* Build the command word. */
3393 cmd = BNX2_NVM_COMMAND_DOIT | cmd_flags; 3404 cmd = BNX2_NVM_COMMAND_DOIT | cmd_flags;
3394 3405
3395 /* Calculate an offset of a buffered flash. */ 3406 /* Calculate an offset of a buffered flash, not needed for 5709. */
3396 if (bp->flash_info->buffered) { 3407 if (bp->flash_info->flags & BNX2_NV_TRANSLATE) {
3397 offset = ((offset / bp->flash_info->page_size) << 3408 offset = ((offset / bp->flash_info->page_size) <<
3398 bp->flash_info->page_bits) + 3409 bp->flash_info->page_bits) +
3399 (offset % bp->flash_info->page_size); 3410 (offset % bp->flash_info->page_size);
@@ -3439,8 +3450,8 @@ bnx2_nvram_write_dword(struct bnx2 *bp, u32 offset, u8 *val, u32 cmd_flags)
3439 /* Build the command word. */ 3450 /* Build the command word. */
3440 cmd = BNX2_NVM_COMMAND_DOIT | BNX2_NVM_COMMAND_WR | cmd_flags; 3451 cmd = BNX2_NVM_COMMAND_DOIT | BNX2_NVM_COMMAND_WR | cmd_flags;
3441 3452
3442 /* Calculate an offset of a buffered flash. */ 3453 /* Calculate an offset of a buffered flash, not needed for 5709. */
3443 if (bp->flash_info->buffered) { 3454 if (bp->flash_info->flags & BNX2_NV_TRANSLATE) {
3444 offset = ((offset / bp->flash_info->page_size) << 3455 offset = ((offset / bp->flash_info->page_size) <<
3445 bp->flash_info->page_bits) + 3456 bp->flash_info->page_bits) +
3446 (offset % bp->flash_info->page_size); 3457 (offset % bp->flash_info->page_size);
@@ -3478,15 +3489,19 @@ static int
3478bnx2_init_nvram(struct bnx2 *bp) 3489bnx2_init_nvram(struct bnx2 *bp)
3479{ 3490{
3480 u32 val; 3491 u32 val;
3481 int j, entry_count, rc; 3492 int j, entry_count, rc = 0;
3482 struct flash_spec *flash; 3493 struct flash_spec *flash;
3483 3494
3495 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
3496 bp->flash_info = &flash_5709;
3497 goto get_flash_size;
3498 }
3499
3484 /* Determine the selected interface. */ 3500 /* Determine the selected interface. */
3485 val = REG_RD(bp, BNX2_NVM_CFG1); 3501 val = REG_RD(bp, BNX2_NVM_CFG1);
3486 3502
3487 entry_count = sizeof(flash_table) / sizeof(struct flash_spec); 3503 entry_count = sizeof(flash_table) / sizeof(struct flash_spec);
3488 3504
3489 rc = 0;
3490 if (val & 0x40000000) { 3505 if (val & 0x40000000) {
3491 3506
3492 /* Flash interface has been reconfigured */ 3507 /* Flash interface has been reconfigured */
@@ -3542,6 +3557,7 @@ bnx2_init_nvram(struct bnx2 *bp)
3542 return -ENODEV; 3557 return -ENODEV;
3543 } 3558 }
3544 3559
3560get_flash_size:
3545 val = REG_RD_IND(bp, bp->shmem_base + BNX2_SHARED_HW_CFG_CONFIG2); 3561 val = REG_RD_IND(bp, bp->shmem_base + BNX2_SHARED_HW_CFG_CONFIG2);
3546 val &= BNX2_SHARED_HW_CFG2_NVM_SIZE_MASK; 3562 val &= BNX2_SHARED_HW_CFG2_NVM_SIZE_MASK;
3547 if (val) 3563 if (val)
@@ -3706,7 +3722,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3706 buf = align_buf; 3722 buf = align_buf;
3707 } 3723 }
3708 3724
3709 if (bp->flash_info->buffered == 0) { 3725 if (!(bp->flash_info->flags & BNX2_NV_BUFFERED)) {
3710 flash_buffer = kmalloc(264, GFP_KERNEL); 3726 flash_buffer = kmalloc(264, GFP_KERNEL);
3711 if (flash_buffer == NULL) { 3727 if (flash_buffer == NULL) {
3712 rc = -ENOMEM; 3728 rc = -ENOMEM;
@@ -3739,7 +3755,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3739 bnx2_enable_nvram_access(bp); 3755 bnx2_enable_nvram_access(bp);
3740 3756
3741 cmd_flags = BNX2_NVM_COMMAND_FIRST; 3757 cmd_flags = BNX2_NVM_COMMAND_FIRST;
3742 if (bp->flash_info->buffered == 0) { 3758 if (!(bp->flash_info->flags & BNX2_NV_BUFFERED)) {
3743 int j; 3759 int j;
3744 3760
3745 /* Read the whole page into the buffer 3761 /* Read the whole page into the buffer
@@ -3767,7 +3783,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3767 /* Loop to write back the buffer data from page_start to 3783 /* Loop to write back the buffer data from page_start to
3768 * data_start */ 3784 * data_start */
3769 i = 0; 3785 i = 0;
3770 if (bp->flash_info->buffered == 0) { 3786 if (!(bp->flash_info->flags & BNX2_NV_BUFFERED)) {
3771 /* Erase the page */ 3787 /* Erase the page */
3772 if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0) 3788 if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0)
3773 goto nvram_write_end; 3789 goto nvram_write_end;
@@ -3791,7 +3807,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3791 /* Loop to write the new data from data_start to data_end */ 3807 /* Loop to write the new data from data_start to data_end */
3792 for (addr = data_start; addr < data_end; addr += 4, i += 4) { 3808 for (addr = data_start; addr < data_end; addr += 4, i += 4) {
3793 if ((addr == page_end - 4) || 3809 if ((addr == page_end - 4) ||
3794 ((bp->flash_info->buffered) && 3810 ((bp->flash_info->flags & BNX2_NV_BUFFERED) &&
3795 (addr == data_end - 4))) { 3811 (addr == data_end - 4))) {
3796 3812
3797 cmd_flags |= BNX2_NVM_COMMAND_LAST; 3813 cmd_flags |= BNX2_NVM_COMMAND_LAST;
@@ -3808,7 +3824,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3808 3824
3809 /* Loop to write back the buffer data from data_end 3825 /* Loop to write back the buffer data from data_end
3810 * to page_end */ 3826 * to page_end */
3811 if (bp->flash_info->buffered == 0) { 3827 if (!(bp->flash_info->flags & BNX2_NV_BUFFERED)) {
3812 for (addr = data_end; addr < page_end; 3828 for (addr = data_end; addr < page_end;
3813 addr += 4, i += 4) { 3829 addr += 4, i += 4) {
3814 3830
@@ -4107,7 +4123,7 @@ bnx2_init_chip(struct bnx2 *bp)
4107 if (CHIP_NUM(bp) == CHIP_NUM_5708) 4123 if (CHIP_NUM(bp) == CHIP_NUM_5708)
4108 REG_WR(bp, BNX2_HC_STATS_TICKS, 0); 4124 REG_WR(bp, BNX2_HC_STATS_TICKS, 0);
4109 else 4125 else
4110 REG_WR(bp, BNX2_HC_STATS_TICKS, bp->stats_ticks & 0xffff00); 4126 REG_WR(bp, BNX2_HC_STATS_TICKS, bp->stats_ticks);
4111 REG_WR(bp, BNX2_HC_STAT_COLLECT_TICKS, 0xbb8); /* 3ms */ 4127 REG_WR(bp, BNX2_HC_STAT_COLLECT_TICKS, 0xbb8); /* 3ms */
4112 4128
4113 if (CHIP_ID(bp) == CHIP_ID_5706_A1) 4129 if (CHIP_ID(bp) == CHIP_ID_5706_A1)
@@ -4127,10 +4143,6 @@ bnx2_init_chip(struct bnx2 *bp)
4127 4143
4128 REG_WR(bp, BNX2_HC_ATTN_BITS_ENABLE, STATUS_ATTN_EVENTS); 4144 REG_WR(bp, BNX2_HC_ATTN_BITS_ENABLE, STATUS_ATTN_EVENTS);
4129 4145
4130 if (REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_FEATURE) &
4131 BNX2_PORT_FEATURE_ASF_ENABLED)
4132 bp->flags |= ASF_ENABLE_FLAG;
4133
4134 /* Initialize the receive filter. */ 4146 /* Initialize the receive filter. */
4135 bnx2_set_rx_mode(bp->dev); 4147 bnx2_set_rx_mode(bp->dev);
4136 4148
@@ -5786,8 +5798,9 @@ bnx2_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal)
5786 if (bp->stats_ticks != 0 && bp->stats_ticks != USEC_PER_SEC) 5798 if (bp->stats_ticks != 0 && bp->stats_ticks != USEC_PER_SEC)
5787 bp->stats_ticks = USEC_PER_SEC; 5799 bp->stats_ticks = USEC_PER_SEC;
5788 } 5800 }
5789 if (bp->stats_ticks > 0xffff00) bp->stats_ticks = 0xffff00; 5801 if (bp->stats_ticks > BNX2_HC_STATS_TICKS_HC_STAT_TICKS)
5790 bp->stats_ticks &= 0xffff00; 5802 bp->stats_ticks = BNX2_HC_STATS_TICKS_HC_STAT_TICKS;
5803 bp->stats_ticks &= BNX2_HC_STATS_TICKS_HC_STAT_TICKS;
5791 5804
5792 if (netif_running(bp->dev)) { 5805 if (netif_running(bp->dev)) {
5793 bnx2_netif_stop(bp); 5806 bnx2_netif_stop(bp);
@@ -6629,6 +6642,18 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
6629 if (i != 2) 6642 if (i != 2)
6630 bp->fw_version[j++] = '.'; 6643 bp->fw_version[j++] = '.';
6631 } 6644 }
6645 if (REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_FEATURE) &
6646 BNX2_PORT_FEATURE_ASF_ENABLED) {
6647 bp->flags |= ASF_ENABLE_FLAG;
6648
6649 for (i = 0; i < 30; i++) {
6650 reg = REG_RD_IND(bp, bp->shmem_base +
6651 BNX2_BC_STATE_CONDITION);
6652 if (reg & BNX2_CONDITION_MFW_RUN_MASK)
6653 break;
6654 msleep(10);
6655 }
6656 }
6632 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_BC_STATE_CONDITION); 6657 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_BC_STATE_CONDITION);
6633 reg &= BNX2_CONDITION_MFW_RUN_MASK; 6658 reg &= BNX2_CONDITION_MFW_RUN_MASK;
6634 if (reg != BNX2_CONDITION_MFW_RUN_UNKNOWN && 6659 if (reg != BNX2_CONDITION_MFW_RUN_UNKNOWN &&
@@ -6672,7 +6697,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
6672 bp->rx_ticks_int = 18; 6697 bp->rx_ticks_int = 18;
6673 bp->rx_ticks = 18; 6698 bp->rx_ticks = 18;
6674 6699
6675 bp->stats_ticks = 1000000 & 0xffff00; 6700 bp->stats_ticks = USEC_PER_SEC & BNX2_HC_STATS_TICKS_HC_STAT_TICKS;
6676 6701
6677 bp->timer_interval = HZ; 6702 bp->timer_interval = HZ;
6678 bp->current_interval = HZ; 6703 bp->current_interval = HZ;
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index d8cd1afeb23d..102adfe1e923 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6433,6 +6433,11 @@ struct sw_bd {
6433#define ST_MICRO_FLASH_PAGE_SIZE 256 6433#define ST_MICRO_FLASH_PAGE_SIZE 256
6434#define ST_MICRO_FLASH_BASE_TOTAL_SIZE 65536 6434#define ST_MICRO_FLASH_BASE_TOTAL_SIZE 65536
6435 6435
6436#define BCM5709_FLASH_PAGE_BITS 8
6437#define BCM5709_FLASH_PHY_PAGE_SIZE (1 << BCM5709_FLASH_PAGE_BITS)
6438#define BCM5709_FLASH_BYTE_ADDR_MASK (BCM5709_FLASH_PHY_PAGE_SIZE-1)
6439#define BCM5709_FLASH_PAGE_SIZE 256
6440
6436#define NVRAM_TIMEOUT_COUNT 30000 6441#define NVRAM_TIMEOUT_COUNT 30000
6437 6442
6438 6443
@@ -6449,7 +6454,10 @@ struct flash_spec {
6449 u32 config2; 6454 u32 config2;
6450 u32 config3; 6455 u32 config3;
6451 u32 write1; 6456 u32 write1;
6452 u32 buffered; 6457 u32 flags;
6458#define BNX2_NV_BUFFERED 0x00000001
6459#define BNX2_NV_TRANSLATE 0x00000002
6460#define BNX2_NV_WREN 0x00000004
6453 u32 page_bits; 6461 u32 page_bits;
6454 u32 page_size; 6462 u32 page_size;
6455 u32 addr_mask; 6463 u32 addr_mask;
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index 5891a0fbdc8b..f87176055d0e 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -824,6 +824,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
824 struct pppol2tp_session *session; 824 struct pppol2tp_session *session;
825 struct pppol2tp_tunnel *tunnel; 825 struct pppol2tp_tunnel *tunnel;
826 struct udphdr *uh; 826 struct udphdr *uh;
827 unsigned int len;
827 828
828 error = -ENOTCONN; 829 error = -ENOTCONN;
829 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) 830 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED))
@@ -912,14 +913,15 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
912 } 913 }
913 914
914 /* Queue the packet to IP for output */ 915 /* Queue the packet to IP for output */
916 len = skb->len;
915 error = ip_queue_xmit(skb, 1); 917 error = ip_queue_xmit(skb, 1);
916 918
917 /* Update stats */ 919 /* Update stats */
918 if (error >= 0) { 920 if (error >= 0) {
919 tunnel->stats.tx_packets++; 921 tunnel->stats.tx_packets++;
920 tunnel->stats.tx_bytes += skb->len; 922 tunnel->stats.tx_bytes += len;
921 session->stats.tx_packets++; 923 session->stats.tx_packets++;
922 session->stats.tx_bytes += skb->len; 924 session->stats.tx_bytes += len;
923 } else { 925 } else {
924 tunnel->stats.tx_errors++; 926 tunnel->stats.tx_errors++;
925 session->stats.tx_errors++; 927 session->stats.tx_errors++;
@@ -958,6 +960,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
958 __wsum csum = 0; 960 __wsum csum = 0;
959 struct sk_buff *skb2 = NULL; 961 struct sk_buff *skb2 = NULL;
960 struct udphdr *uh; 962 struct udphdr *uh;
963 unsigned int len;
961 964
962 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) 965 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED))
963 goto abort; 966 goto abort;
@@ -1046,18 +1049,25 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1046 printk("\n"); 1049 printk("\n");
1047 } 1050 }
1048 1051
1052 memset(&(IPCB(skb2)->opt), 0, sizeof(IPCB(skb2)->opt));
1053 IPCB(skb2)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
1054 IPSKB_REROUTED);
1055 nf_reset(skb2);
1056
1049 /* Get routing info from the tunnel socket */ 1057 /* Get routing info from the tunnel socket */
1058 dst_release(skb2->dst);
1050 skb2->dst = sk_dst_get(sk_tun); 1059 skb2->dst = sk_dst_get(sk_tun);
1051 1060
1052 /* Queue the packet to IP for output */ 1061 /* Queue the packet to IP for output */
1062 len = skb2->len;
1053 rc = ip_queue_xmit(skb2, 1); 1063 rc = ip_queue_xmit(skb2, 1);
1054 1064
1055 /* Update stats */ 1065 /* Update stats */
1056 if (rc >= 0) { 1066 if (rc >= 0) {
1057 tunnel->stats.tx_packets++; 1067 tunnel->stats.tx_packets++;
1058 tunnel->stats.tx_bytes += skb2->len; 1068 tunnel->stats.tx_bytes += len;
1059 session->stats.tx_packets++; 1069 session->stats.tx_packets++;
1060 session->stats.tx_bytes += skb2->len; 1070 session->stats.tx_bytes += len;
1061 } else { 1071 } else {
1062 tunnel->stats.tx_errors++; 1072 tunnel->stats.tx_errors++;
1063 session->stats.tx_errors++; 1073 session->stats.tx_errors++;