Skip to content

Commit

Permalink
Merge branch 'upstream-linus' 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

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6:
  pcnet32: remove private net_device_stats structure
  vortex_up should initialize "err"
  pcnet32: remove compile warnings in non-napi mode
  pcnet32: fix non-napi packet reception
  fix EMAC driver for proper napi_synchronize API
  sky2: shutdown cleanup
  napi_synchronize: waiting for NAPI
  forcedeth msi bugfix
  gianfar: fix obviously wrong #ifdef CONFIG_GFAR_NAPI placement
  fs_enet: Update for API changes
  gianfar: remove orphan struct.
  forcedeth: fix rx-work condition in nv_rx_process_optimized() too
  • Loading branch information
Linus Torvalds committed Oct 19, 2007
2 parents a9e82d3 + 4f1e5ba commit 4fa4d23
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 79 deletions.
2 changes: 1 addition & 1 deletion drivers/net/3c59x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ vortex_up(struct net_device *dev)
struct vortex_private *vp = netdev_priv(dev);
void __iomem *ioaddr = vp->ioaddr;
unsigned int config;
int i, mii_reg1, mii_reg5, err;
int i, mii_reg1, mii_reg5, err = 0;

if (VORTEX_PCI(vp)) {
pci_set_power_state(VORTEX_PCI(vp), PCI_D0); /* Go active */
Expand Down
27 changes: 16 additions & 11 deletions drivers/net/forcedeth.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ static void nv_enable_irq(struct net_device *dev)
if (np->msi_flags & NV_MSI_X_ENABLED)
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
else
enable_irq(dev->irq);
enable_irq(np->pci_dev->irq);
} else {
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector);
Expand All @@ -1008,7 +1008,7 @@ static void nv_disable_irq(struct net_device *dev)
if (np->msi_flags & NV_MSI_X_ENABLED)
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
else
disable_irq(dev->irq);
disable_irq(np->pci_dev->irq);
} else {
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector);
Expand Down Expand Up @@ -1607,7 +1607,7 @@ static void nv_do_rx_refill(unsigned long data)
if (np->msi_flags & NV_MSI_X_ENABLED)
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
else
disable_irq(dev->irq);
disable_irq(np->pci_dev->irq);
} else {
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
}
Expand All @@ -1625,7 +1625,7 @@ static void nv_do_rx_refill(unsigned long data)
if (np->msi_flags & NV_MSI_X_ENABLED)
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
else
enable_irq(dev->irq);
enable_irq(np->pci_dev->irq);
} else {
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
}
Expand Down Expand Up @@ -2408,13 +2408,13 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
struct fe_priv *np = netdev_priv(dev);
u32 flags;
u32 vlanflags = 0;
u32 rx_processed_cnt = 0;
int rx_work = 0;
struct sk_buff *skb;
int len;

while((np->get_rx.ex != np->put_rx.ex) &&
!((flags = le32_to_cpu(np->get_rx.ex->flaglen)) & NV_RX2_AVAIL) &&
(rx_processed_cnt++ < limit)) {
(rx_work < limit)) {

dprintk(KERN_DEBUG "%s: nv_rx_process_optimized: flags 0x%x.\n",
dev->name, flags);
Expand Down Expand Up @@ -2517,9 +2517,11 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
np->get_rx.ex = np->first_rx.ex;
if (unlikely(np->get_rx_ctx++ == np->last_rx_ctx))
np->get_rx_ctx = np->first_rx_ctx;

rx_work++;
}

return rx_processed_cnt;
return rx_work;
}

static void set_bufsize(struct net_device *dev)
Expand Down Expand Up @@ -3558,10 +3560,12 @@ static int nv_request_irq(struct net_device *dev, int intr_test)
if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) {
if ((ret = pci_enable_msi(np->pci_dev)) == 0) {
np->msi_flags |= NV_MSI_ENABLED;
dev->irq = np->pci_dev->irq;
if (request_irq(np->pci_dev->irq, handler, IRQF_SHARED, dev->name, dev) != 0) {
printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret);
pci_disable_msi(np->pci_dev);
np->msi_flags &= ~NV_MSI_ENABLED;
dev->irq = np->pci_dev->irq;
goto out_err;
}

Expand Down Expand Up @@ -3624,7 +3628,7 @@ static void nv_do_nic_poll(unsigned long data)
if (np->msi_flags & NV_MSI_X_ENABLED)
disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
else
disable_irq_lockdep(dev->irq);
disable_irq_lockdep(np->pci_dev->irq);
mask = np->irqmask;
} else {
if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) {
Expand All @@ -3642,6 +3646,8 @@ static void nv_do_nic_poll(unsigned long data)
}
np->nic_poll_irq = 0;

/* disable_irq() contains synchronize_irq, thus no irq handler can run now */

if (np->recover_error) {
np->recover_error = 0;
printk(KERN_INFO "forcedeth: MAC in recoverable error state\n");
Expand Down Expand Up @@ -3678,7 +3684,6 @@ static void nv_do_nic_poll(unsigned long data)
}
}

/* FIXME: Do we need synchronize_irq(dev->irq) here? */

writel(mask, base + NvRegIrqMask);
pci_push(base);
Expand All @@ -3691,7 +3696,7 @@ static void nv_do_nic_poll(unsigned long data)
if (np->msi_flags & NV_MSI_X_ENABLED)
enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
else
enable_irq_lockdep(dev->irq);
enable_irq_lockdep(np->pci_dev->irq);
} else {
if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) {
nv_nic_irq_rx(0, dev);
Expand Down Expand Up @@ -4948,7 +4953,7 @@ static int nv_close(struct net_device *dev)
#ifdef CONFIG_FORCEDETH_NAPI
napi_disable(&np->napi);
#endif
synchronize_irq(dev->irq);
synchronize_irq(np->pci_dev->irq);

del_timer_sync(&np->oom_kick);
del_timer_sync(&np->nic_poll);
Expand Down
28 changes: 16 additions & 12 deletions drivers/net/fs_enet/fs_enet-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static void skb_align(struct sk_buff *skb, int align)
static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
{
struct fs_enet_private *fep = container_of(napi, struct fs_enet_private, napi);
struct net_device *dev = to_net_dev(fep->dev);
struct net_device *dev = fep->ndev;
const struct fs_platform_info *fpi = fep->fpi;
cbd_t __iomem *bdp;
struct sk_buff *skb, *skbn, *skbt;
Expand Down Expand Up @@ -217,7 +217,7 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget)

fep->cur_rx = bdp;

if (received >= budget) {
if (received < budget) {
/* done */
netif_rx_complete(dev, napi);
(*fep->ops->napi_enable_rx)(dev);
Expand Down Expand Up @@ -807,20 +807,23 @@ static int fs_enet_open(struct net_device *dev)
int r;
int err;

napi_enable(&fep->napi);
if (fep->fpi->use_napi)
napi_enable(&fep->napi);

/* Install our interrupt handler. */
r = fs_request_irq(dev, fep->interrupt, "fs_enet-mac", fs_enet_interrupt);
if (r != 0) {
printk(KERN_ERR DRV_MODULE_NAME
": %s Could not allocate FS_ENET IRQ!", dev->name);
napi_disable(&fep->napi);
if (fep->fpi->use_napi)
napi_disable(&fep->napi);
return -EINVAL;
}

err = fs_init_phy(dev);
if(err) {
napi_disable(&fep->napi);
if (err) {
if (fep->fpi->use_napi)
napi_disable(&fep->napi);
return err;
}
phy_start(fep->phydev);
Expand Down Expand Up @@ -1232,7 +1235,7 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
fpi->rx_ring = 32;
fpi->tx_ring = 32;
fpi->rx_copybreak = 240;
fpi->use_napi = 0;
fpi->use_napi = 1;
fpi->napi_weight = 17;

ret = find_phy(ofdev->node, fpi);
Expand All @@ -1249,11 +1252,11 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
goto out_free_fpi;
}

SET_MODULE_OWNER(ndev);
dev_set_drvdata(&ofdev->dev, ndev);

fep = netdev_priv(ndev);
fep->dev = &ofdev->dev;
fep->ndev = ndev;
fep->fpi = fpi;
fep->ops = match->data;

Expand Down Expand Up @@ -1288,10 +1291,11 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
ndev->stop = fs_enet_close;
ndev->get_stats = fs_enet_get_stats;
ndev->set_multicast_list = fs_set_multicast_list;
if (fpi->use_napi) {
ndev->poll = fs_enet_rx_napi;
ndev->weight = fpi->napi_weight;
}

if (fpi->use_napi)
netif_napi_add(ndev, &fep->napi, fs_enet_rx_napi,
fpi->napi_weight);

ndev->ethtool_ops = &fs_ethtool_ops;
ndev->do_ioctl = fs_ioctl;

Expand Down
1 change: 1 addition & 0 deletions drivers/net/fs_enet/fs_enet.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct phy_info {
struct fs_enet_private {
struct napi_struct napi;
struct device *dev; /* pointer back to the device (must be initialized first) */
struct net_device *ndev;
spinlock_t lock; /* during all ops except TX pckt processing */
spinlock_t tx_lock; /* during fs_start_xmit and fs_tx */
struct fs_platform_info *fpi;
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/gianfar.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,10 +956,12 @@ static int gfar_enet_open(struct net_device *dev)
}

err = startup_gfar(dev);
if (err)
if (err) {
#ifdef CONFIG_GFAR_NAPI
napi_disable(&priv->napi);
#endif
return err;
}

netif_start_queue(dev);

Expand Down
1 change: 0 additions & 1 deletion drivers/net/gianfar.h
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,6 @@ struct gfar_private {
uint32_t msg_enable;

/* Network Statistics */
struct net_device_stats stats;
struct gfar_extra_stats extra_stats;
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ibm_newemac/mal.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void mal_poll_disable(struct mal_instance *mal, struct mal_commac *commac)
msleep(1);

/* Synchronize with the MAL NAPI poller */
__napi_synchronize(&mal->napi);
napi_synchronize(&mal->napi);
}

void mal_poll_enable(struct mal_instance *mal, struct mal_commac *commac)
Expand Down
Loading

0 comments on commit 4fa4d23

Please sign in to comment.