Commit Graph

254 Commits

Author SHA1 Message Date
Michael Chan ec7e6fabbe bnx2: Update version to 1.8.1.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-09 12:27:06 -07:00
Benjamin Li 3d16af8665 bnx2: Handle DMA mapping errors.
Before, the driver would not care about the return codes from pci_map_*
functions.  This could be potentially dangerous if a mapping failed.
Now, we will check all pci_map_* calls.  On the transmit side, we switch
to use the new function skb_dma_map().  On the receive side, we add
pci_dma_mapping_error().

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-10-09 12:26:41 -07:00
Michael Chan a1efb4b686 bnx2: Eliminate TSO header modifications.
This is now possible with updated firmware.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-09 12:24:39 -07:00
Michael Chan 9f52b564b7 bnx2: Check netif_running() in all ethtool operations.
We need to check netif_running() state in most ethtool operations
and properly handle the !netif_running() state where the chip is
in an uninitailzed state or low power state that may not accept
any MMIO.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-09 12:21:46 -07:00
Michael Chan 74bf4ba3d3 bnx2: Add bnx2_shutdown_chip().
This logic is used in bnx2_close() and bnx2_suspend() and
so should be separated out into a separate function.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-09 12:21:08 -07:00
Benjamin Li ac392abce9 bnx2: Remove timer_interval field from the bnx2 structure
The timer_interval field is only assigned once, and never reassigned.
We can safely replace all instances of the timer_interval with a
constant value.

Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-18 16:40:49 -07:00
Benjamin Li fbbf68b7f8 bnx2: Remove name field from bnx2 structure
The name of the board is only used during the initialization of
the adapter.  We can save the space of a pointer by not storing
this information.

Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-18 16:40:03 -07:00
Benjamin Li 453a9c6e99 bnx2: Update MODULE_DESCRIPTION to include the 5716
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-18 16:39:16 -07:00
Benjamin Li 344478db53 bnx2: In bnx2_set_mac_link() return void rather then int
bnx2_set_mac_link() doesn't need to return any error codes.  And
all the callers don't check the return code. It is safe to
change the return type to a void.

Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-18 16:38:24 -07:00
David S. Miller 08013fa353 bnx2: Fix build with VLAN_8021Q disabled.
Reported by Randy Dunlap.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-15 19:52:31 -07:00
Michael Chan 0eb8b1fe92 bnx2: Update version to 1.8.0.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-14 15:30:31 -07:00
Michael Chan f22828e89f bnx2: Reinsert VLAN tag when necessary.
In certain cases when ASF or other management firmware is running, the
chip may be configured to always strip out the VLAN tag even when
VLAN acceleration is not enabled.  This causes some VLAN tagged
packets to be received by the host stack without any knowledge that
the original packet was VLAN tagged.

We fix this by re-inserting the VLAN tag into the packet when necessary.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-14 15:30:14 -07:00
Michael Chan 729b85cd47 bnx2: Use proper CONFIG_VLAN_8021Q to compile the VLAN code.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-14 15:29:39 -07:00
Michael Chan 7c6337a15e bnx2: Fix logic to setup VLAN rx tagging.
We should now be checking BNX2_FLAG_CAN_KEEP_VLAN to determine how
to set the VLAN rx tagging in the RX_MODE register.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-14 15:29:09 -07:00
Benjamin Li 3ca4095f24 bnx2: Update version to 1.7.9.
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-07-18 17:58:57 -07:00
Benjamin Li 8a31329eae bnx2: Fix Sparse warnings
This patch will fix the following sparse warnings:

/home/benli/sparse/bnx2.c:297:8: warning: symbol 'val' shadows an earlier one
/home/benli/sparse/bnx2.c:286:60: originally declared here
/home/benli/sparse/bnx2.c:7461:7: warning: symbol 'i' shadows an earlier one
/home/benli/sparse/bnx2.c:7265:10: originally declared here

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-07-18 17:57:26 -07:00
Benjamin Li 706bf24038 bnx2: Add TX multiqueue support.
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-07-18 17:55:11 -07:00
Michael Chan 3cb29b1bca bnx2: Update version to 1.7.8.
Signed-off-by: Michael Chan <mchan@braodcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-14 22:40:21 -07:00
Benjamin Li 5fcaed0124 bnx2: Support secondary MAC addresses.
Add support for configuring secondary unicast addresses.  There
are 4 additional perfect match filters which can be used for
secondary unicast address support.

  *  Modified bnx2_set_mac_addr() to be more generic in handling
     the setting of the perfect match filters
  *  Changed bnx2_set_rx_mode() to handle the unicast dev_addr_list

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-07-14 22:39:52 -07:00
Michael Chan 7c62e83beb bnx2: Allow flexible VLAN tag settings.
Negotiate with boot code and ASF firmware to see if it can
support keeping VLAN tags in the RX packets.  If supported
by firmware, the VLAN tag will be kept in the RX packet
unless VLAN acceleration is registered.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-14 22:39:03 -07:00
Michael Chan a2f138900d bnx2: Add ack parameter to bnx2_fw_sync().
ack=1 means wait for firmware acknowledgement, and ack=0
means don't wait.  All current callers will set it to 1.

In the next patch, new calls will set ack=0.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-14 22:38:23 -07:00
Michael Chan 7bb0a04fcd bnx2: Add PCI ID for 5716.
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-07-14 22:37:47 -07:00
Michael Chan d6b1448695 bnx2: Prevent ethtool -s from crashing when device is down.
The device may be in D3-hot state and may crash if we try to
configure the speed settings by accessing the registers.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-14 22:37:21 -07:00
Michael Chan 8427f13612 bnx2: Update driver version to 1.7.7.
And update module description.

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:44:44 -07:00
Michael Chan 2739a8bb5b bnx2: Cleanup error handling in bnx2_open().
All error handling in bnx2_open() can be consolidated.

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:44:10 -07:00
Michael Chan 5e9ad9e108 bnx2: Turn on multi rx rings.
Enable multiple rx rings if MSI-X vectors are available.  We enable
up to 7 rx 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:43:17 -07:00
Michael Chan f0ea2e6385 bnx2: Use one handler for all MSI-X vectors.
Use the same MSI-X handler to schedule NAPI.  Change the dev_instance
void pointer to the bnx2_napi struct instead so we can have the proper
context for each MSI-X vector.

Add a new bnx2_poll_msix() that is optimized for handling MSI-X
NAPI polling of rx/tx work only.  Remove the old bnx2_tx_poll() that
is no longer needed.  Each MSI-X vector handles 1 tx and 1 rx ring.
The first vector handles link events as well.

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:41:57 -07:00
Michael Chan 43e80b89b6 bnx2: Optimize fast-path tx and rx work.
Add hw_tx_cons_ptr and hw_rx_cons_ptr to speed up the retreival of
the tx and rx consumer index, since the MSI-X and default status
blocks have different structures.

Combine status_blk and status_blk_msix into a union.  We'll only use
one type of status block for each vector.

Separate the code to detect more rx and tx work from the code to
detect link related work.

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:41:08 -07:00
Michael Chan bb4f98abf5 bnx2: Put rx ring variables in a separate struct.
In preparation for multi-ring support, rx ring variables are now put
in a separate bnx2_rx_ring_info struct.  With MSI-X, we can support
multiple rx rings.

The functions to allocate/free rx memory and to initialize rx 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:38:19 -07:00
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