diff options
author | Narender Kumar <narender.kumar@qlogic.com> | 2009-11-20 10:09:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-21 14:37:35 -0500 |
commit | a7483b0afa63e851c4438ddda8934a296851f1de (patch) | |
tree | d19a6cdd0a81f759f810292d3a2bde64f9a90112 /drivers | |
parent | 5d521fd36de4e61ab16a358df54c5babe153396c (diff) |
netxen: fix promisc for NX2031.
Kernel crashes, if promisc mode set without disabling rx queue.
Before changing mode in NX2031 chip, wait till rx queue drains.
Signed-off-by: Narender Kumar <narender.kumar@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/netxen/netxen_nic_hdr.h | 2 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 49 |
2 files changed, 40 insertions, 11 deletions
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index 1c46da632125..17bb3818d84e 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
@@ -545,6 +545,8 @@ enum { | |||
545 | #define NETXEN_NIU_TEST_MUX_CTL (NETXEN_CRB_NIU + 0x00094) | 545 | #define NETXEN_NIU_TEST_MUX_CTL (NETXEN_CRB_NIU + 0x00094) |
546 | #define NETXEN_NIU_XG_PAUSE_CTL (NETXEN_CRB_NIU + 0x00098) | 546 | #define NETXEN_NIU_XG_PAUSE_CTL (NETXEN_CRB_NIU + 0x00098) |
547 | #define NETXEN_NIU_XG_PAUSE_LEVEL (NETXEN_CRB_NIU + 0x000dc) | 547 | #define NETXEN_NIU_XG_PAUSE_LEVEL (NETXEN_CRB_NIU + 0x000dc) |
548 | #define NETXEN_NIU_FRAME_COUNT_SELECT (NETXEN_CRB_NIU + 0x000ac) | ||
549 | #define NETXEN_NIU_FRAME_COUNT (NETXEN_CRB_NIU + 0x000b0) | ||
548 | #define NETXEN_NIU_XG_SEL (NETXEN_CRB_NIU + 0x00128) | 550 | #define NETXEN_NIU_XG_SEL (NETXEN_CRB_NIU + 0x00128) |
549 | #define NETXEN_NIU_GB_PAUSE_CTL (NETXEN_CRB_NIU + 0x0030c) | 551 | #define NETXEN_NIU_GB_PAUSE_CTL (NETXEN_CRB_NIU + 0x0030c) |
550 | 552 | ||
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 3185a98b0917..e2c4a0192ea1 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -383,24 +383,51 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) | |||
383 | 383 | ||
384 | int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) | 384 | int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) |
385 | { | 385 | { |
386 | __u32 reg; | 386 | u32 mac_cfg; |
387 | u32 cnt = 0; | ||
388 | __u32 reg = 0x0200; | ||
387 | u32 port = adapter->physical_port; | 389 | u32 port = adapter->physical_port; |
390 | u16 board_type = adapter->ahw.board_type; | ||
388 | 391 | ||
389 | if (port > NETXEN_NIU_MAX_XG_PORTS) | 392 | if (port > NETXEN_NIU_MAX_XG_PORTS) |
390 | return -EINVAL; | 393 | return -EINVAL; |
391 | 394 | ||
392 | reg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port)); | 395 | mac_cfg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port)); |
393 | if (mode == NETXEN_NIU_PROMISC_MODE) | 396 | mac_cfg &= ~0x4; |
394 | reg = (reg | 0x2000UL); | 397 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), mac_cfg); |
395 | else | ||
396 | reg = (reg & ~0x2000UL); | ||
397 | 398 | ||
398 | if (mode == NETXEN_NIU_ALLMULTI_MODE) | 399 | if ((board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) || |
399 | reg = (reg | 0x1000UL); | 400 | (board_type == NETXEN_BRDTYPE_P2_SB31_10G_HMEZ)) |
400 | else | 401 | reg = (0x20 << port); |
401 | reg = (reg & ~0x1000UL); | 402 | |
403 | NXWR32(adapter, NETXEN_NIU_FRAME_COUNT_SELECT, reg); | ||
404 | |||
405 | mdelay(10); | ||
406 | |||
407 | while (NXRD32(adapter, NETXEN_NIU_FRAME_COUNT) && ++cnt < 20) | ||
408 | mdelay(10); | ||
409 | |||
410 | if (cnt < 20) { | ||
411 | |||
412 | reg = NXRD32(adapter, | ||
413 | NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port)); | ||
414 | |||
415 | if (mode == NETXEN_NIU_PROMISC_MODE) | ||
416 | reg = (reg | 0x2000UL); | ||
417 | else | ||
418 | reg = (reg & ~0x2000UL); | ||
419 | |||
420 | if (mode == NETXEN_NIU_ALLMULTI_MODE) | ||
421 | reg = (reg | 0x1000UL); | ||
422 | else | ||
423 | reg = (reg & ~0x1000UL); | ||
424 | |||
425 | NXWR32(adapter, | ||
426 | NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), reg); | ||
427 | } | ||
402 | 428 | ||
403 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), reg); | 429 | mac_cfg |= 0x4; |
430 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), mac_cfg); | ||
404 | 431 | ||
405 | return 0; | 432 | return 0; |
406 | } | 433 | } |