Commit Graph

225 Commits (35e9010b22503f42cbf88144ffe1feff90ea3835)

Author SHA1 Message Date
Michael Chan 35e9010b22 bnx2: Put tx ring variables in a separate struct.
In preparation for multi-ring support, tx ring variables are now put
in a separate bnx2_tx_ring_info struct.  Multi tx ring will not be
enabled until it is fully supported by the stack.  Only 1 tx ring
will be used at the moment.

The functions to allocate/free tx memory and to initialize tx rings
are now modified to handle multiple rings.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-06-19 16:37:42 -07:00
David S. Miller 4ae127d1b6 Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:

	drivers/net/smc911x.c
2008-06-13 20:52:39 -07:00
David S. Miller 4bb073c0e3 net: Eliminate flush_scheduled_work() calls while RTNL is held.
If the RTNL is held when we invoke flush_scheduled_work() we could
deadlock.  One such case is linkwatch, it is a work struct which tries
to grab the RTNL semaphore.

The most common case are net driver ->stop() methods.  The
simplest conversion is to instead use cancel_{delayed_}work_sync()
explicitly on the various work struct the driver uses.

This is an OK transformation because these work structs are doing
things like resetting the chip, restarting link negotiation, and so
forth.  And if we're bringing down the device, we're about to turn the
chip off and reset it anways.  So if we cancel a pending work event,
that's fine here.

Some drivers were working around this deadlock by using a msleep()
polling loop of some sort, and those cases are converted to instead
use cancel_{delayed_}work_sync() as well.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-06-12 02:22:02 -07:00
Michael Chan 236ae64063 bnx2: Update version to 1.7.6.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-16 22:20:59 -07:00
Benjamin Li 10343cca2b bnx2: Pre-initialize struct cpu_reg.
Instead of assigning values for the struct cpu_reg's at runtime,
we already know these values at compile time.  Therefore, we can use
designated initializers, to initialize these structures and not have
to incur this assignment cost at run-time.

Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-16 22:20:27 -07:00
Benjamin Li 601d3d18b2 bnx2: Rename RX_COPY_THRESH to BNX2_RX_COPY_THRESH.
To make the bnx2 code more consistent, all instances of
RX_COPY_THRESH have been changed to BNX2_RX_COPY_THRESH.

Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-16 22:19:35 -07:00
Benjamin Li d89cb6af41 bnx2: Remove the rx_offset field from the bnx2 structure.
The rx_offset field is set to a constant value and initialized
only once.  By replacing all references to the rx_offset field,
we can eliminate rx_offset from the bnx2 structure.  This will
save 4 bytes for every bnx2 instance.

[Added parentheses to the definition of BNX2_RX_OFFSET, as noted
by Ben Hutchings.]

Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-16 22:18:57 -07:00
Wendy Xiong 6ff2da49c8 bnx2: Add EEH PCI recovery.
Add PCI recovery functions to the driver.  The initial pci state is
also saved so the the MSI state can be restored during PCI recovery.

Signed-off-by: Wendy Xiong <wendyx@us.ibm.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-16 22:18:21 -07:00
Michael Chan 9a120bc570 bnx2: Allow phy reset to be skipped during chip reset.
Andy Gospodarek <andy@greyhouse.net> found that netconsole would
panic when resetting bnx2 devices.

>From Andy:
"The issue is the bnx2_set_link in bnx2_init_nic will print a link-status
message before we are fully initialized and ready to start polling.
Polling is currently disabled in this state, but since the
__LINK_STATE_RX_SCHED is overloaded to not only try and disable polling
but also to make the system aware there is something waiting to be
polled, we really have to fix this in drivers.

The problematic call is the one to netif_rx_complete as it tries to
remove an entry from the poll_list when there isn't one."

While this netconsole problem should be fixed separately, we really
should not reset the PHY when changing ring sizes, MTU, or other
similar settings.  The PHY reset causes several seconds of unnecessary
link disruptions.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Acked-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-16 22:17:45 -07:00
Michael Chan 705d209168 bnx2: Update version to 1.7.5.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-02 16:58:18 -07:00
Michael Chan d25be1d3ec bnx2: Update RV2P firmware for 5709.
The new RV2P firmware fixes 2 issues:

1. The jumbo rx buffer page size is now configurable and set to the
   proper PAGE_SIZE.  Before, it was assumed to be always 4K.

2. Driver sometimes would crash when receiving jumbo packets mixed
   with firmware management packets.  This was caused by the old
   firmware DMA'ing to the wrong address.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-02 16:57:59 -07:00
Michael Chan 352f76879e bnx2: Zero out context memory for 5709.
We should zero out the context memory for 5709 before each reset.  When
we resume after suspend for example, the memory may not be zero and the
chip may not function correctly.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-02 16:57:26 -07:00
Michael Chan 15b169cccf bnx2: Fix register test on 5709.
The register BNX2_CTX_STATUS (0x1004) should be skipped on 5709 as it
contains reserved bits.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-02 16:57:08 -07:00
Michael Chan 543a827d7a bnx2: Fix remote PHY initial link state.
On some remote PHY blade systems, the driver receives no initial link
interrupt.  As a result, the GMII/MII MAC mode does not get setup properly.
To fix this problem, we add an initial poll of the link state after chip
reset.

With this change, the setting of the initial carrier state in the init
code can be eliminated.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-02 16:56:44 -07:00
Michael Chan 74ecc62d6e bnx2: Refine remote PHY locking.
bnx2_set_remote_link() should be called under bp->phy_lock to protect
against concurrent polling and interrupt calls.  This change is needed
by the next patch which will add one initial poll of the remote PHY
link status.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-02 16:56:16 -07:00
Harvey Harrison ab59859de1 net: fix returning void-valued expression warnings
drivers/net/8390.c:37:2: warning: returning void-valued expression
drivers/net/bnx2.c:1635:3: warning: returning void-valued expression
drivers/net/xen-netfront.c:1806:2: warning: returning void-valued expression
net/ipv4/tcp_hybla.c:105:3: warning: returning void-valued expression
net/ipv4/tcp_vegas.c:171:3: warning: returning void-valued expression
net/ipv4/tcp_veno.c:123:3: warning: returning void-valued expression
net/sysctl_net.c:85:2: warning: returning void-valued expression

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-01 02:47:38 -07:00
Michael Chan c73b1d1f26 [BNX2]: Update version to 1.7.4.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-23 19:49:48 -08:00
Michael Chan 38ea3686f6 [BNX2]: Disable parallel detect on an HP blade.
Because of some board issues, we need to disable parallel detect on
an HP blade.  Without this patch, the link state can become stuck
when it goes into parallel detect mode.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-23 19:48:57 -08:00
Michael Chan a2724e2559 [BNX2]: More 5706S link down workaround.
The previous patches to workaround the 5706S on an HP blade were not
sufficient.  The link state still does not change properly in some
cases.  This patch adds polling to make it completely reliable.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-23 19:47:44 -08:00
Andrew Morton fefa864530 bnx2: section fix
gcc-3.4.4 on powerpc:

drivers/net/bnx2.c:67: error: version causes a section type conflict

Cc: Jeff Garzik <jeff@garzik.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-09 23:17:15 -08:00
Michael Chan c26736ec17 [BNX2]: Fix ASYM PAUSE advertisement for remote PHY.
We were checking for the ASYM_PAUSE bit for 1000Base-X twice instead
checking for both the 1000Base-X bit and the 10/100/1000Base-T bit.
The purpose of the logic is to tell the firmware that ASYM_PAUSE is
set on either the Serdes or Copper interface.

Problem was discovered by Roel Kluin <12o3l@tiscali.nl>

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-31 19:28:28 -08:00
Michael Chan 18c0226e3c [BNX2]: Update version to 1.7.3.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-31 19:27:17 -08:00
Michael Chan 83e3fc89bb [BNX2]: Fine-tune flow control on 5709.
Make use of the programmable high/low water marks in 5709 for
802.3 flow control.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-31 19:27:16 -08:00
Michael Chan 62a8313cdd [BNX2]: Remove CTX_WR macro.
The CTX_WR macro is unnecessary and obfuscates the code.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-31 19:27:15 -08:00
Michael Chan 2726d6e126 [BNX2]: Remove REG_WR_IND/REG_RD_IND macros.
The REG_WR_IND/REG_RD_IND macros are unnecessary and obfuscate the
code.  Many callers to these macros read and write shared memory from
the bp->shmem_base, so we add 2 similar functions that automatically
add the shared memory base.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-31 19:27:14 -08:00
Michael Chan 6f743ca052 [BNX2]: Refine tx coalescing setup.
Make the tx coalescing setup code independent of the MSIX vector.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-31 19:27:13 -08:00
Michael Chan f3014c0cb6 [BNX2]: Fix 5706 serdes link down bug.
1. Correct the MII expansion serdes control register definition.
2. Check an additional RUDI_INVALID bit when determining 5706S link.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-31 19:27:12 -08:00
Al Viro b491edd581 bnx2 annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-28 15:10:32 -08:00
Michael Chan 583c28e564 [BNX2]: Fix driver phy_flags name space.
Prefix "bp->phy_flags" names with BNX2_PHY_FLAG_* for consistency.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 15:10:23 -08:00
David S. Miller f86e82fb54 [BNX2]: Fix driver software flag namespace.
Prefix "bnx2->flags" names with BNX2_* for consistency.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 15:10:16 -08:00
Michael Chan feebb33183 [BNX2] Update version to 1.7.2.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 15:10:16 -08:00
Michael Chan b2fadeae13 [BNX2]: Add link-down workaround on 5706 serdes.
In some blade systems using the 5706 serdes, the hardware sometimes
does not properly generate link down interrupts.  We add a workaround
in the driver's timer to force a link-down when some PHY registers
report loss of SYNC.

The parallel detect logic is cleaned up slightly to better integrate
the workaround.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 15:10:15 -08:00
Michael Chan 1097f5e921 [BNX2]: Fix minor bug in bnx2_has_work().
It is more correct to get the status block from the bnx2_napi struct
instead of the bnx2 struct.  It happens that they are the same in this
case because we are using the first MSIX vector.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 15:10:14 -08:00
Michael Chan 2dd201d7b7 [BNX2]: Disable jumbo rx paging on 5709 Ax.
The chip has problem running in this mode and needs to be disabled.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 15:10:13 -08:00
Al Viro 79ea13ce07 NULL noise in drivers/net
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 15:07:12 -08:00
Michael Chan 2ba582b782 [BNX2]: Fix compiler warning.
Change bnx2_init_napi() to void.

Warning was noted by DaveM.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:40 -08:00
Michael Chan f13561cb2f [BNX2]: Update version to 1.7.1.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:40 -08:00
Michael Chan 57851d8453 [BNX2]: Enable new tx ring.
Enable new tx ring and add new MSIX handler and NAPI poll function
for the new tx ring.  Enable MSIX when the hardware supports it.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:39 -08:00
Michael Chan c76c04758b [BNX2]: Add support for a new tx ring.
To separate TX IRQs into a different MSIX vector, we need to
support a new tx ring.  The original tx ring will still be used
when not using MSIX.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:38 -08:00
Michael Chan b4b360420d [BNX2]: Support multiple MSIX IRQs.
Change bnx2_napi struct into an array and add code to manage multiple
IRQs.  MSIX hardware structures and new registers are also added.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:37 -08:00
Michael Chan a1f6019090 [BNX2]: Move rx indexes into bnx2_napi struct.
Rx related fields used in NAPI polling are moved from the main
bnx2 struct to the bnx2_napi struct.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:37 -08:00
Michael Chan a550c99bc3 [BNX2]: Move tx indexes into bnx2_napi struct.
Tx related fields used in NAPI polling are moved from the main
bnx2 struct to the bnx2_napi struct.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:36 -08:00
Michael Chan 35efa7c1f4 [BNX2]: Introduce new bnx2_napi structure.
Introduce a bnx2_napi structure that will hold a napi_struct and
other fields to handle NAPI polling for the napi_struct.  Various tx
and rx indexes and status block pointers will be moved from the main
bnx2 structure to this bnx2_napi structure.

Most NAPI path functions are modified to be passed this bnx2_napi
struct pointer.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:35 -08:00
Michael Chan 6d866ffc69 [BNX2]: Restructure IRQ datastructures.
Add a table to keep track of multiple IRQs and restructure the IRQ
request and free functions so that they can be easily expanded to
handle multiple IRQs.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:34 -08:00
Michael Chan ead7270b99 [BNX2]: Add function to fetch hardware tx index.
This makes the code cleaner and easier to support different tx rings.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:33 -08:00
Michael Chan a0d142c628 [BNX2]: Update version to 1.6.9.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:33 -08:00
Michael Chan 84eaa18771 [BNX2]: Enable S/G for jumbo RX.
If the MTU requires more than 1 page for the SKB, enable the page ring
and calculate the size of the page ring.  This will guarantee order-0
allocation regardless of the MTU size.

Fixup loopback test packet size so that we don't deal with the pages
during loopback test.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:32 -08:00
Michael Chan 1db82f2aec [BNX2]: Add fast path code to handle RX pages.
Add function to reuse a page in case of allocation or other errors.
Add code to construct the completed SKB with the additional data in
the pages.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:31 -08:00
Michael Chan 47bf4246a3 [BNX2]: Add init. code to handle RX pages.
Add new fields to keep track of the pages and the page rings.
Add functions to allocate and free pages.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:30 -08:00
Michael Chan 110d0ef990 [BNX2]: Update firmware to support S/G RX buffers.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:57:30 -08:00