Skip to content

Commit

Permalink
Merge branch 'upstream-davem' of master.kernel.org:/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/jgarzik/netdev-2.6
  • Loading branch information
David S. Miller committed Aug 14, 2008
2 parents b635ace + c091258 commit b793b3a
Show file tree
Hide file tree
Showing 37 changed files with 423 additions and 239 deletions.
2 changes: 1 addition & 1 deletion drivers/net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ config ETH16I

config NE2000
tristate "NE2000/NE1000 support"
depends on NET_ISA || (Q40 && m) || M32R || TOSHIBA_RBTX4927 || TOSHIBA_RBTX4938
depends on NET_ISA || (Q40 && m) || M32R || MACH_TX49XX
select CRC32
---help---
If you have a network (Ethernet) card of this type, say Y and read
Expand Down
1 change: 0 additions & 1 deletion drivers/net/acenic.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/version.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/ioport.h>
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/arm/ixp4xx_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ static int eth_poll(struct napi_struct *napi, int budget)
if ((skb = netdev_alloc_skb(dev, RX_BUFF_SIZE))) {
phys = dma_map_single(&dev->dev, skb->data,
RX_BUFF_SIZE, DMA_FROM_DEVICE);
if (dma_mapping_error(phys)) {
if (dma_mapping_error(&dev->dev, phys)) {
dev_kfree_skb(skb);
skb = NULL;
}
Expand Down Expand Up @@ -698,7 +698,7 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev)
#endif

phys = dma_map_single(&dev->dev, mem, bytes, DMA_TO_DEVICE);
if (dma_mapping_error(phys)) {
if (dma_mapping_error(&dev->dev, phys)) {
#ifdef __ARMEB__
dev_kfree_skb(skb);
#else
Expand Down Expand Up @@ -883,7 +883,7 @@ static int init_queues(struct port *port)
desc->buf_len = MAX_MRU;
desc->data = dma_map_single(&port->netdev->dev, data,
RX_BUFF_SIZE, DMA_FROM_DEVICE);
if (dma_mapping_error(desc->data)) {
if (dma_mapping_error(&port->netdev->dev, desc->data)) {
free_buffer(buff);
return -EIO;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/atl1e/atl1e_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ static int atl1e_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
struct atl1e_adapter *adapter = netdev_priv(netdev);

if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE |
WAKE_MCAST | WAKE_BCAST | WAKE_MCAST))
WAKE_UCAST | WAKE_MCAST | WAKE_BCAST))
return -EOPNOTSUPP;
/* these settings will always override what we currently have */
adapter->wol = 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/au1000_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ static struct net_device * au1000_probe(int port_num)
static int au1000_init(struct net_device *dev)
{
struct au1000_private *aup = (struct au1000_private *) dev->priv;
u32 flags;
unsigned long flags;
int i;
u32 control;

Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ax88796.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

spin_lock_irqsave(&ax->mii_lock, flags);
mii_ethtool_gset(&ax->mii, cmd);
spin_lock_irqsave(&ax->mii_lock, flags);
spin_unlock_irqrestore(&ax->mii_lock, flags);

return 0;
}
Expand All @@ -567,7 +567,7 @@ static int ax_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)

spin_lock_irqsave(&ax->mii_lock, flags);
rc = mii_ethtool_sset(&ax->mii, cmd);
spin_lock_irqsave(&ax->mii_lock, flags);
spin_unlock_irqrestore(&ax->mii_lock, flags);

return rc;
}
Expand Down
1 change: 0 additions & 1 deletion drivers/net/bnx2x_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <linux/delay.h>
#include <linux/ethtool.h>
#include <linux/mutex.h>
#include <linux/version.h>

#include "bnx2x_reg.h"
#include "bnx2x_fw_defs.h"
Expand Down
1 change: 0 additions & 1 deletion drivers/net/bnx2x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include <net/ip.h>
#include <net/tcp.h>
#include <net/checksum.h>
#include <linux/version.h>
#include <net/ip6_checksum.h>
#include <linux/workqueue.h>
#include <linux/crc32.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/net/cpmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/version.h>

#include <linux/netdevice.h>
#include <linux/etherdevice.h>
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/e1000e/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@

/* Interrupt Cause Set */
#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */
#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */
#define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */
#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */

/* Transmit Descriptor Control */
Expand Down
1 change: 1 addition & 0 deletions drivers/net/e1000e/e1000.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ struct e1000_info {
#define FLAG_RX_CSUM_ENABLED (1 << 28)
#define FLAG_TSO_FORCE (1 << 29)
#define FLAG_RX_RESTART_NOW (1 << 30)
#define FLAG_MSI_TEST_FAILED (1 << 31)

#define E1000_RX_DESC_PS(R, i) \
(&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/e1000e/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static u32 e1000_get_link(struct net_device *netdev)
u32 status;

status = er32(STATUS);
return (status & E1000_STATUS_LU);
return (status & E1000_STATUS_LU) ? 1 : 0;
}

static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
Expand Down
185 changes: 170 additions & 15 deletions drivers/net/e1000e/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,12 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
netdev_alloc_skb(netdev, length + NET_IP_ALIGN);
if (new_skb) {
skb_reserve(new_skb, NET_IP_ALIGN);
memcpy(new_skb->data - NET_IP_ALIGN,
skb->data - NET_IP_ALIGN,
length + NET_IP_ALIGN);
skb_copy_to_linear_data_offset(new_skb,
-NET_IP_ALIGN,
(skb->data -
NET_IP_ALIGN),
(length +
NET_IP_ALIGN));
/* save the skb in buffer_info as good */
buffer_info->skb = skb;
skb = new_skb;
Expand Down Expand Up @@ -1233,26 +1236,36 @@ static irqreturn_t e1000_intr(int irq, void *data)
return IRQ_HANDLED;
}

/**
* e1000_request_irq - initialize interrupts
*
* Attempts to configure interrupts using the best available
* capabilities of the hardware and kernel.
**/
static int e1000_request_irq(struct e1000_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
irq_handler_t handler = e1000_intr;
int irq_flags = IRQF_SHARED;
int err;

if (!pci_enable_msi(adapter->pdev)) {
adapter->flags |= FLAG_MSI_ENABLED;
handler = e1000_intr_msi;
irq_flags = 0;
if (!(adapter->flags & FLAG_MSI_TEST_FAILED)) {
err = pci_enable_msi(adapter->pdev);
if (!err) {
adapter->flags |= FLAG_MSI_ENABLED;
irq_flags = 0;
}
}

err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name,
netdev);
err = request_irq(adapter->pdev->irq,
((adapter->flags & FLAG_MSI_ENABLED) ?
&e1000_intr_msi : &e1000_intr),
irq_flags, netdev->name, netdev);
if (err) {
e_err("Unable to allocate %s interrupt (return: %d)\n",
adapter->flags & FLAG_MSI_ENABLED ? "MSI":"INTx", err);
if (adapter->flags & FLAG_MSI_ENABLED)
if (adapter->flags & FLAG_MSI_ENABLED) {
pci_disable_msi(adapter->pdev);
adapter->flags &= ~FLAG_MSI_ENABLED;
}
e_err("Unable to allocate interrupt, Error: %d\n", err);
}

return err;
Expand Down Expand Up @@ -2591,6 +2604,135 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
return -ENOMEM;
}

/**
* e1000_intr_msi_test - Interrupt Handler
* @irq: interrupt number
* @data: pointer to a network interface device structure
**/
static irqreturn_t e1000_intr_msi_test(int irq, void *data)
{
struct net_device *netdev = data;
struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
u32 icr = er32(ICR);

e_dbg("%s: icr is %08X\n", netdev->name, icr);
if (icr & E1000_ICR_RXSEQ) {
adapter->flags &= ~FLAG_MSI_TEST_FAILED;
wmb();
}

return IRQ_HANDLED;
}

/**
* e1000_test_msi_interrupt - Returns 0 for successful test
* @adapter: board private struct
*
* code flow taken from tg3.c
**/
static int e1000_test_msi_interrupt(struct e1000_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
struct e1000_hw *hw = &adapter->hw;
int err;

/* poll_enable hasn't been called yet, so don't need disable */
/* clear any pending events */
er32(ICR);

/* free the real vector and request a test handler */
e1000_free_irq(adapter);

/* Assume that the test fails, if it succeeds then the test
* MSI irq handler will unset this flag */
adapter->flags |= FLAG_MSI_TEST_FAILED;

err = pci_enable_msi(adapter->pdev);
if (err)
goto msi_test_failed;

err = request_irq(adapter->pdev->irq, &e1000_intr_msi_test, 0,
netdev->name, netdev);
if (err) {
pci_disable_msi(adapter->pdev);
goto msi_test_failed;
}

wmb();

e1000_irq_enable(adapter);

/* fire an unusual interrupt on the test handler */
ew32(ICS, E1000_ICS_RXSEQ);
e1e_flush();
msleep(50);

e1000_irq_disable(adapter);

rmb();

if (adapter->flags & FLAG_MSI_TEST_FAILED) {
err = -EIO;
e_info("MSI interrupt test failed!\n");
}

free_irq(adapter->pdev->irq, netdev);
pci_disable_msi(adapter->pdev);

if (err == -EIO)
goto msi_test_failed;

/* okay so the test worked, restore settings */
e_dbg("%s: MSI interrupt test succeeded!\n", netdev->name);
msi_test_failed:
/* restore the original vector, even if it failed */
e1000_request_irq(adapter);
return err;
}

/**
* e1000_test_msi - Returns 0 if MSI test succeeds or INTx mode is restored
* @adapter: board private struct
*
* code flow taken from tg3.c, called with e1000 interrupts disabled.
**/
static int e1000_test_msi(struct e1000_adapter *adapter)
{
int err;
u16 pci_cmd;

if (!(adapter->flags & FLAG_MSI_ENABLED))
return 0;

/* disable SERR in case the MSI write causes a master abort */
pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd);
pci_write_config_word(adapter->pdev, PCI_COMMAND,
pci_cmd & ~PCI_COMMAND_SERR);

err = e1000_test_msi_interrupt(adapter);

/* restore previous setting of command word */
pci_write_config_word(adapter->pdev, PCI_COMMAND, pci_cmd);

/* success ! */
if (!err)
return 0;

/* EIO means MSI test failed */
if (err != -EIO)
return err;

/* back to INTx mode */
e_warn("MSI interrupt test failed, using legacy interrupt.\n");

e1000_free_irq(adapter);

err = e1000_request_irq(adapter);

return err;
}

/**
* e1000_open - Called when a network interface is made active
* @netdev: network interface device structure
Expand Down Expand Up @@ -2649,6 +2791,19 @@ static int e1000_open(struct net_device *netdev)
if (err)
goto err_req_irq;

/*
* Work around PCIe errata with MSI interrupts causing some chipsets to
* ignore e1000e MSI messages, which means we need to test our MSI
* interrupt now
*/
{
err = e1000_test_msi(adapter);
if (err) {
e_err("Interrupt allocation failed\n");
goto err_req_irq;
}
}

/* From here on the code is the same as e1000e_up() */
clear_bit(__E1000_DOWN, &adapter->state);

Expand Down Expand Up @@ -3055,7 +3210,7 @@ static void e1000_watchdog_task(struct work_struct *work)
case SPEED_10:
txb2b = 0;
netdev->tx_queue_len = 10;
adapter->tx_timeout_factor = 14;
adapter->tx_timeout_factor = 16;
break;
case SPEED_100:
txb2b = 0;
Expand Down Expand Up @@ -3721,7 +3876,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
struct e1000_adapter *adapter = netdev_priv(netdev);
int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;

if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
if ((new_mtu < ETH_ZLEN + ETH_FCS_LEN + VLAN_HLEN) ||
(max_frame > MAX_JUMBO_FRAME_SIZE)) {
e_err("Invalid MTU setting\n");
return -EINVAL;
Expand Down
Loading

0 comments on commit b793b3a

Please sign in to comment.