Following the removal of the unused struct net_device * parameter from
the NAPI functions named *netif_rx_* in commit 908a7a1, they are
exactly equivalent to the corresponding *napi_* functions and are
therefore redundant.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch modifies how the tg3 driver handles device firmware.
The patch starts by consolidating David Woodhouse's earlier patch under
the same name. Specifically, the patch moves the request_firmware call
into a separate tg3_request_firmware() function and calls that function
from tg3_open() rather than tg3_init_one().
The patch then goes on to limit the number of devices that will make
request_firmware calls. The original firmware patch unnecessarily
requested TSO firmware for devices that did not need it. This patch
reduces the set of devices making TSO firmware patches to approximately
the following device set : 5703, 5704, and 5705.
Finally, the patch reduces the effects of a request_firmware() failure.
For those devices that are requesting TSO firmware, the driver will turn
off the TSO capability. If TSO firmware becomes available at a later
time, the device can be closed and then opened again to reacquire the
TSO capability.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Firmware blob looks like this...
u8 firmware_major
u8 firmware_minor
u8 firmware_fix
u8 pad
__be32 start_address
__be32 length (total, including BSS sections to be zeroed)
data... (in __be32 words, which is native for the firmware)
Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
When the napi api was changed to separate its 1:1 binding to the net_device
struct, the netif_rx_[prep|schedule|complete] api failed to remove the now
vestigual net_device structure parameter. This patch cleans up that api by
properly removing it..
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch updates the version number to 3.97.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
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>
This patch cleans up the tg3 header file by removing the preprocessor
definitions for standard PCI configuration space registers. The driver
should be using the standard definitions when needed. The patch
continues by removing redundant PHY related definitions and reorganizes
some of the remaining entries.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
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>
This patch removes the pci_bist and pci_hdr_type members from the
device structure and removes the code that references them. They are
not really used.
The patch rounds out the changes by moving the pci_cmd member to plug
a structure hole that would have been created. On 32-bit systems, this
movement removes a subsequent structure hole later in the structure. On
64-bit systems though, the movement merely consolidates two holes into
one larger hole.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
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>
This patch attempts to make the relationship between IPV6 checksum
offload and IPV6 LSO more obvious. The patch also toggles a bit
needed for IPV6 LSO on 5785 and 57780 devices.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
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>
The first hunk of this patch inverts a flag that was accidentally
toggled as part of commit 0a459aac9d
("tg3: Allow WOL for phylib controlled Broadcom phys").
The second hunk of the patch removes the call to
device_may_wakeup() in the 5906 config detection path. At the
point of the call, the driver shouldn't be querying for WOL
capability. It should be detecting and setting it.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
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>
These 4 drivers have identical full duplex flow control resolution
functions. This patch changes them all to use one common function.
The function in question decides whether a device should enable TX and
RX flow control in a standard way (IEEE 802.3-2005 table 28B-3), so this
should also be useful for other drivers.
Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
flags used within drivers for indicating tx and rx flow control are
defined in 4 drivers (and probably more), move these constants to mii.h.
The 3 SMSC drivers use the same constants (FLOW_CTRL_TX), but TG3 uses
TG3_FLOW_CTRL_TX, so this patch also renames the constants within TG3.
Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch updates the version number to 3.96.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch adds support for the 57780 ASIC revision.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
The ENABLE_APE flag tells the driver whether or not the device has an
Application Processing Engine (APE). The APE does not need the PHY to
be powered unless it is running management firmware. For backwards
compatibility, management firmware will still set the ENABLE_ASF bit.
Consequently, there is no reason to consider the ENABLE_APE flag when
deciding whether or not to power down the phy.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Per Dave Miller's suggestion, replace the remaining ioremap_nocache()
call with pci_ioremap_bar(). Remove the two IORESOURCE_MEM checks as
they are redundant.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch extracts the bootcode firmware version from the alternate
selfboot patch NVRAM format. This format is used on the 5784, 5761 and
some newer devices.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
GPHY Autopowerdown (APD) is a way to save power when energy is not
detected on the wire. At the moment, only the 5784 and 5761 are
capable of enabling this mode.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch disables CLKREQ at 10Mbps and 100Mbps to workaround a TX BD
corruption issue. This problem only affects the 5784 and 5761 (and
57780 AX) ASIC revisions.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch makes sure the device is a PCIX device before attempting to
use the pcix_cap device structure member. This is prep work for the
following patch.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch replaces hardcoded 2's with the NET_IP_ALIGN constant or
TG3_RAW_IP_ALIGN where appropriate. Some platforms can redefine the
NET_IP_ALIGN definition to zero if unaligned DMA transfers cost more
than the IP header alignment gains. This patch represents a
performance improvement when using the 5701 on these platforms.
The copy path can be avoided.
TG3_RAW_IP_ALIGN is used in cases where we always want to align the
IP header on dword boundaries.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch moves neigh_setup and hard_start_xmit into the network device ops
structure. For bisection, fix all the previously converted drivers as well.
Bonding driver took the biggest hit on this.
Added a prefetch of the hard_start_xmit in the fast path to try and reduce
any impact this would have.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Convert this driver to network device ops.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
The generic packet receive code takes care of setting
netdev->last_rx when necessary, for the sake of the
bonding ARP monitor.
Drivers need not do it any more.
Some cases had to be skipped over because the drivers
were making use of the ->last_rx value themselves.
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch updates the version to 3.95.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch refines support for the 5785 device.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch refines the phylib support in the tg3 driver. The patch does
the following things :
* Rename tg3_mdio_config() to tg3_mdio_config_5785(). The 5785 will be
the only device that will use it so the name might as well reflect
that.
* Fix a memory leak if mdiobus_register() fails.
* Add code to deal with phy device detection failures.
* Add code to correct the supported list of phy features based on the
MAC <=> PHY interface.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch allows WOL to be enabled for Broadcom phys under phylib
control. The only exception is the AC131, which has a completely
different register set.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Commit 12dac0756d ("tg3: adapt tg3 to
use reworked PCI PM code") introduced the new PCI PM API to the tg3
driver. The patch was understandably conservative, so this patch
elaborates on that work.
The patch starts by creating a single point in tg3_set_power_state()
to decide whether or not to enable WOL. The rest of the code in
tg3_set_power_state() was then pivoted to use the result of this
decision.
The patch then makes sure the device is allowed to wakeup before
reporting whether or not WOL is currently enabled. The final hunks of
the patch consolidate where the WOL capability and WOL enabled flags
are set to a single location.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Currently, phylib reports appear with a eth%d prefix. Move the line
after register_netdev() and place it alongside the other informative
messages. Update nearby informative messages accordingly.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
With older versions of the NVRAM format, the driver may mistakenly
determine that APE is enabled. Make sure this doesn't happen by
restricting the ENABLE_APE check to devices known to have more
recent NVRAM image formats.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch reclaims the TG3_FLG3_5761_5784_AX_FIXES flag. It only
used twice in non-fast paths. This patch also consolidates some other
places where specific 5784 AX chip revisions can be generalized.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch moves the __tg3_set_mac_addr() function earlier in the file
listing, to avoid a function prototype, and calls the function to
restore the LAA after a driver unload chip reset. With this code in
place, the administrator can wake the machine using the LAA.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
DASH firmware runs on the APE side of the chip, but it requires a few MAC
to be programmed correctly.
When WOL is enabled and management firmware is disabled, incoming
packets are evaluated and discarded at the chip's rule processor.
When management firmware is enabled, the hardware must be informed that
there are agents further up the stack that still use the incoming
frames. Normally management firmware will configure the MAC correctly
on its own, but there can be cases where the setting could get clobbered
by the driver. The first hunk of this patch preserves this setting.
The second hunk of this patch wipes out the driver present signature of
the APE memory space. By doing so, the DASH firmware can assume
driver absent behavior.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch replaces the existing APE register mapping code with a call
to pci_ioremap_bar(). The code that maps the main device register space
did not undergo a similar change because the information derived from
the pci_resource_start() and pci_resource_len() is still used to
populate the (optional) mem_start and mem_end netdevice members.
Replace hardcoded constants where appropriate.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch adds support for the 5761S chip variants.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This converts pretty much everything to print_mac. There were
a few things that had conflicts which I have just dropped for
now, no harm done.
I've built an allyesconfig with this and looked at the files
that weren't built very carefully, but it's a huge patch.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch introduces mdiobus_alloc() and mdiobus_free(), and
makes all mdio bus drivers use these functions to allocate their
struct mii_bus'es dynamically.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Andy Fleming <afleming@freescale.com>
In preparation of giving mii_bus objects a device tree presence of
their own, rename struct mii_bus's ->dev argument to ->parent, since
having a 'struct device *dev' that points to our parent device
conflicts with introducing a 'struct device dev' representing our own
device.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Andy Fleming <afleming@freescale.com>
This patch updates the version number to 3.94.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Ethtool stats are 64-bits in length. net_device_stats members are
unsigned long types. When gathering information for
a get_ethtool_stats call, the driver will call a driver-private,
inlined get_stat64() function, which returns an unsigned long value.
This call will inadvertently mask off the upper 32-bits of a stat on
32-bit machines.
This patch defines a new get_estat() inline function and modifies the
ESTAT_ADD() macro to use it.
Signed-off-by: Stefan Buehler <stbuehler@web.de>
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
The git commit 7c5026aa9b ("tg3: Add
link state reporting to UMP firmware") introduced code that waits for
previous firmware events to be serviced before attempting to submit a
new event. Unfortunately that patch contained a bug that cause the
driver to wait 2.5 seconds, rather than 2.5 milliseconds as intended.
This patch fixes that bug.
This bug revealed that not all firmware versions service driver events
though. Since we do not know which versions of the firmware do and don't
service these events, the driver needs some way to minimize the effects
of the delay. This patch solves the problem by recording a jiffies
timestamp when it submits an event to the hardware. If the jiffies
counter shows that 2.5 milliseconds have already passed, a wait is not
needed and the driver can proceed to submit a new event.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
The ENABLE_ASF flag is set when DASH is enabled on the NIC, but DASH
does not run on the RX CPU. Instead it runs on the APE.
Consequently, the driver does not need to send "driver alive" updates
to the RX CPU when the APE is present.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Broadcom's DASH (Desktop and mobile Architecture for System Hardware)
implementation requires that the driver preserve particular register
settings. If the driver does not preserve them, communication with
the DASH firmware will be lost.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Recently, more status bits have been added to the APE status register.
This patch refines the status register check so that the driver can
send more events than it would have otherwise.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
If the driver resets the chip while the APE is performing a register
access, that register access will never complete and the APE will hang
indefinitely. To prevent this race condition, the driver must acquire
an APE mutex before resetting the chip. The APE will not attempt a
register access until it acquires this lock.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch fixes the 'scheduling while atomic' errors introduced by
commit 12dac0756d ("tg3: adapt tg3 to
use reworked PCI PM code").
The first hunk of the patch removes an unnecessary
tg3_set_power_state() call. The chip will already be in the D0 state
either due to a chip reset or through a previous call to
tg3_set_power_state().
The second hunk of the patch moves the tg3_set_power_state() call
outside the critical section guarded by tg3_full_lock() and
tg3_full_unlock() functions. The power state of the device is and
should be outside the lock's domain and all other
tg3_set_power_state() calls support this.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>