summaryrefslogtreecommitdiff
path: root/drivers/net/tg3.c
AgeCommit message (Collapse)Author
2011-11-11tg3: fix tigon3_dma_hwbug_workaround()Eric Dumazet
[ Upstream commit f7ff19871bb4a3451e1ca2cf660bf633018cfbec ] Ari got kernel panics using tg3 NIC, and bisected to 2669069aacc9 "tg3: enable transmit time stamping." This is because tigon3_dma_hwbug_workaround() might alloc a new skb and free the original. We panic when skb_tx_timestamp() is called on freed skb. Reported-by: Ari Savolainen <ari.m.savolainen@gmail.com> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-10-18tg3: negate USE_PHYLIB flag checkJiri Pirko
USE_PHYLIB flag in tg3_remove_one() is being checked incorrectly. This results tg3_phy_fini->phy_disconnect is never called and when tg3 module is removed. In my case this resulted in panics in phy_state_machine calling function phydev->adjust_link. So correct this check. Signed-off-by: Jiri Pirko <jpirko@redhat.com> Acked-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-09-21tg3: fix VLAN tagging regressionKasper Pedersen
commit 92cd3a17ce9c719abb4c28dee3438e0c641f8de4 tg3: Simplify tx bd assignments broke VLAN tagging on outbound packets. It ifdef'ed BCM_KERNEL_SUPPORTS_8021Q, but this is not set anywhere. So vlan never gets set, and all packets are sent with vlan=0. v2: We can just remove the test. vlan_tx_tag_present is valid regardless of whether the 802.1q module is built. Tested on BCM5721 rev 11. Signed-off-by: Kasper Pedersen <kernel@kasperkp.dk> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-27tg3: Remove 5719 jumbo frames and TSO blocksMatt Carlson
The A0 revision of this chip is the only device that requires these features to be disabled. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-27tg3: Break larger frags into 4k chunks for 5719Matt Carlson
The 5719 has bug where RDMAs larger than 4k can cause problems. This patch works around the problem by dividing larger DMA requests into something the hardware can handle. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-27tg3: Add tx BD budgeting codeMatt Carlson
As the driver breaks large skb fragments into smaller submissions to the hardware, there is a new danger that BDs might get exhausted before all fragments have been mapped. This patch adds code to make sure tx BDs aren't oversubscribed and flag the condition if it happens. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-27tg3: Consolidate code that calls tg3_tx_set_bd()Matt Carlson
This patch consolidates all code that populates tx BDs into a single routine. Setting tx BDs needs to be more carefully controlled to see if workarounds need to be applied. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-27tg3: Add partial fragment unmapping codeMatt Carlson
The following patches are going to break skb fragments into smaller sizes. This patch attempts to make the change easier to digest by only addressing the skb teardown portion. The patch modifies the driver to skip over any BDs that have a flag set that indicates the BD isn't the beginning of an skb fragment. Such BDs were a result of segmentation and do not need a pci_unmap_page() call. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-27tg3: Generalize tg3_skb_error_unmap()Matt Carlson
In the following patches, unmapping skb fragments will get just as complicated as mapping them. This patch generalizes tg3_skb_error_unmap() and makes it the one-stop-shop for skb unmapping. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-27tg3: Remove short DMA check for 1st fragmentMatt Carlson
The first fragment of an skb should always be greater than 8 bytes. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-27tg3: Simplify tx bd assignmentsMatt Carlson
In the following patches, the process the driver will use to assign skb fragments to transmit BDs will get more complicated. To prepare for that new code, this patch seeks to simplify how transmit BDs are populated. It does this by separating the code that assigns the BD members from the logic that controls how the fields are set. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-27tg3: Reintroduce tg3_tx_ring_infoMatt Carlson
The following patches will require the use of an additional flag in the ring_info structure. The use of this flag is tx path specific, so this patch defines a specialized ring_info structure. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-21tg3: Fix NVRAM selftest failures for 5720 devsMatt Carlson
This patch fixes NVRAM selftest failures for 5720 devices by fixing the checksum area size. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-21tg3: Return size from tg3_vpd_readblock()Matt Carlson
Newer VPD datablocks can exceed the size the tg3 driver is traditionally used to. This can cause some of the routines that operate on the VPD data to fail when in-fact they could have succeeded had they known the correct size. This patch fixes the problem. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-21tg3: Fix int selftest for recent devices.Matt Carlson
This patch fixes interrupt selftest failures for recent devices (57765, 5717, 5718. 5719, 5720) by disabling MSI one-shot mode and applying the status tag workaround to the selftest code. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-21tg3: Fix RSS indirection table distributionMatt Carlson
The current RSS indirection table is populated such that more traffic will hit the first RSS ring. This patch adjusts the indirection table so that the load is more evenly distributed. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-21tg3: Add 5719 and 5720 to EEE_CAP listMatt Carlson
This patch adds the 5719 and the 5720 to the list of devices that are EEE capable. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-21tg3: Fix link down notify failure when EEE disabledMatt Carlson
Occasionally, when the network cable is removed after a successful autonegotiation, the device will not send a link down interrupt to the driver. This happens because of a bad interaction of an EEE workaround. The fix is to adjust the code so that the root cause condition does not happen. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-21tg3: Fix link flap at 100Mbps with EEE enabledMatt Carlson
This patch increases the scope of the EEE interoperability workaround to include more asic revisions. The workarond value is tuned to workaround a link flap issue at 100Mbps. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-21tg3: Fix io failures after chip resetMatt Carlson
Commit f2096f94b514d88593355995d5dd276961e88af1, entitled "tg3: Add 5720 H2BMC support", needed to add code to preserve some bits set by firmware. Unfortunately the new code causes throughput to stop after a chip reset because it enables state machines before they are ready. This patch undoes the problematic code. The bits will be restored later in the init sequence. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-14tg3: Match power source to driver stateMatt Carlson
Now that the driver state (and power source) is being more intensely scrutinized, we need to make sure it is correct 100% of the time. This patch finds and fixes all dangling power state transitions. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-14tg3: Add function status reportingMatt Carlson
This patch adds code to update the status of the function to a common location to the critical section added in the previous patch. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-14tg3: Create critical section around GPIO togglingMatt Carlson
The code that performs the power source switching will need to consider the status of the other devices before making any switches. The status updates and power source switching will need to be an atomic operation, so a critical section will be needed. This patch establishes the critical section through a CPMU mutex. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-14tg3: Determine PCI function number in one placeMatt Carlson
tg3 devices will need to know exactly what function number they are so that they can communicate their status to the other functions. In a KVM environment, the function number of a device presented by the kernel might not be the true function number, so an alternative method to determine the function number is needed. This patch used to contain an implementation for the alternative method, but recently we discovered a hardware bug that renders it incorrect. While new method is not yet known, it is still useful to consolidate the code that determines the PCI function to one location and use the results throughout the code. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-14tg3: Check transitions to D0 power stateMatt Carlson
Currently pci_set_power_state() does not return useful return codes for transitions to the D0 power state. If a device refuses to go into D0, the PCI layer issues a warning but returns success. Entering into D0 is a requirement for correct operation of tg3 devices though. If the PCI layer should be changed to return an error code for this type of failure, the tg3 driver would be interested in catching it and reacting to it. This patch makes the necessary modifications. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-14tg3: Move power state transitions to init_oneMatt Carlson
The tg3 driver is going to require memory mapped register access much sooner than before. This patch makes sure the device is in the D0 power state as soon as possible, and moves the code that enables the memory arbiter outside tg3_get_eeprom_hw_cfg() where it can be more easily monitored. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-14tg3: Detect APE enabled devs earlierMatt Carlson
The following patch will require the driver to communicate with the APE much sooner than before. This patch make sure the APE registers are memory mapped and that the ENABLE_APE bit is set before the first use. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-06-27tg3: remove unnecessary read of PCI_CAP_ID_EXPJon Mason
The PCIE capability offset is saved during PCI bus walking. Use the value from pci_dev instead of checking in the driver and saving it off the the driver specific structure. It will remove an unnecessary search in the PCI configuration space if this value is referenced instead of reacquiring it. v2 of the patch re-adds the PCI_EXPRESS flag and adds comments describing why it is necessary. [ pdev->pcie_cap --> pci_pcie_cap(pdev) -DaveM ] Signed-off-by: Jon Mason <jdmason@kudzu.us> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-06-19tg3: fix race in transmit time stamping.Richard Cochran
Signed-off-by: Richard Cochran <richard.cochran@omicron.at> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-06-15tg3: Create funcs for power source switchingMatt Carlson
The power source switching code is about to get a little more complex. This patch seeks to simplify future power source switching patches by clarifying the existing code. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@conan.davemloft.net>
2011-06-15tg3: Migrate phy preprocessor defs to system defsMatt Carlson
This patch changes to code to use some of the preprocessor definitions from mii.h over its homegrown equivalents. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@conan.davemloft.net>
2011-06-15tg3: Show flowctrl settings through get_settings()Matt Carlson
This patch adds code to present the flow control advertisements through the ethtool get_settings callback. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@conan.davemloft.net>
2011-06-15tg3: Add more selfboot formats to NVRAM selftestMatt Carlson
This patch adds more selfboot formats to the NVRAM selftest. It also changes the code to return an error on an unsupported NVRAM format. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@conan.davemloft.net>
2011-06-15tg3: Remove 4G_DMA_BNDRY_BUG flagMatt Carlson
Now that all chips have this bug, the flag checks become useless code. This patch removes the flag. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@conan.davemloft.net>
2011-06-15tg3: Remove 40BIT_DMA_LIMIT_BUGMatt Carlson
This patch removes the 40BIT_DMA_LIMIT_BUG flag. There already exists a flag for this purpose (TG3_FLAG_40BIT_DMA_BUG) and was already being used in the correct spot. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@conan.davemloft.net>
2011-06-15tg3: Workaround tagged status update bugMatt Carlson
On rare occasions, writing the tag to the interrupt mailbox does not reenable interrupts. This patch fixes the problem by reissuing the mailbox update. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@conan.davemloft.net>
2011-06-13tg3: enable transmit time stamping.Richard Cochran
This patch enables software (and phy device) transmit time stamping for the TIGON3 driver. Compile tested only. Cc: Matt Carlson <mcarlson@broadcom.com> Cc: Michael Chan <mchan@broadcom.com> Signed-off-by: Richard Cochran <richard.cochran@omicron.at> Signed-off-by: David S. Miller <davem@conan.davemloft.net>
2011-06-06net: remove interrupt.h inclusion from netdevice.hAlexey Dobriyan
* remove interrupt.g inclusion from netdevice.h -- not needed * fixup fallout, add interrupt.h and hardirq.h back where needed. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-06-03tg3: Fix tg3_skb_error_unmap()Matt Carlson
This function attempts to free one fragment beyond the number of fragments that were actually mapped. This patch brings back the limit to the correct spot. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Tested-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-25Add Fujitsu 1000base-SX PCI ID to tg3Meelis Roos
This patch adds the PCI ID of Fujitsu 1000base-SX NIC to tg3 driver. Tested to detect the card, MAC and serdes, not tested with link at the moment since I have no fiber switch here. I did not add new constants to the pci_ids.h header file since these constants are used only here. Signed-off-by: Meelis Roos <mroos@linux.ee> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-20tg3: Add braces around 5906 workaround.Matt Carlson
Commit dabc5c670d3f86d15ee4f42ab38ec5bd2682487d, entitled "tg3: Move TSO_CAPABLE assignment", moved some TSO flagging code around. In the process it failed to add braces around an exceptional 5906 condition. This patch fixes the problem. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-20tg3: Fix NETIF_F_LOOPBACK errorMatt Carlson
Mahesh Bandewar noticed that the features cleanup in commit 0da0606f493c5cdab74bdcc96b12f4305ad94085, entitled "tg3: Consolidate all netdev feature assignments", mistakenly sets NETIF_F_LOOPBACK by default. This patch corrects the error. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Mahesh Bandewar <maheshb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-19tg3: Update version to 3.119Matt Carlson
This patch updates the tg3 version to 3.119. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-19tg3: Apply rx_discards fix to 5719/5720Matt Carlson
Commit 4d95847381228639844c7197deb8b2211274ef22, entitled "tg3: Workaround rx_discards stat bug", was intended to be applied to the 5717, 5718, 5719_A0, and 5720 A0 chip revisions. The implementation missed the latter two when applying the fix in a critical area. This patch fixes the problem. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-19tg3: Remove excessive parenthesisMatt Carlson
This patch removes some excessive parenthesizing. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-19tg3: Consolidate all netdev feature assignmentsMatt Carlson
This patch consolidates all the netdev feature bit assignments to one location. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-19tg3: Move TSO_CAPABLE assignmentMatt Carlson
This patch moves the code that asserts the TSO_CAPABLE flag closer to where the TSO capabilities flags are set. There isn't a good enough reason for the code to be separated. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-19tg3: Fix stats for 5704 and later devicesMatt Carlson
Commit 4d95847381228639844c7197deb8b2211274ef22, entitled "tg3: Workaround rx_discards stat bug" modified the hardware statistics data structure. The modification shifted the statistics so that the labels no longer corresponded to the counter values. This patch fixes the problem by utilizing reserved space for the new counters. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-19tg3: Fix TSO loopback testMatt Carlson
Commit bb158d696489244f79fd4c3abd47968a06b48c79, entitled "tg3: Add TSO loopback test", mistakenly inverted the checksum field test from the receive BD. This patch corrects the problem. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-19tg3: Consolidate autoneg advertisement setup codeMatt Carlson
Autonegotiation setup has gotten a little more complicated since the tg3 driver was created. This patch consolidates autoneg setup into one routine and modifies the call sites accordingly. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>