* [net-next] net: Provide details on watchdog timeout.
From: Ben Greear @ 2010-08-09 19:16 UTC (permalink / raw)
To: netdev; +Cc: Ben Greear
This also makes it printed under net_ratelimit instead
of WARN_ON_ONCE. The backtrace never helped me much.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 2aeb3a4... b52c450... M net/sched/sch_generic.c
net/sched/sch_generic.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 2aeb3a4..b52c450 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -253,9 +253,15 @@ static void dev_watchdog(unsigned long arg)
}
if (some_queue_timedout) {
- char drivername[64];
- WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out\n",
- dev->name, netdev_drivername(dev, drivername, 64), i);
+ if (net_ratelimit()) {
+ char drivername[64];
+ printk(KERN_INFO "NETDEV WATCHDOG: %s (%s): "
+ "transmit queue %u timed out"
+ " trans-start: %lu jiffies: %lu\n",
+ dev->name,
+ netdev_drivername(dev, drivername, 64),
+ i, trans_start, jiffies);
+ }
dev->netdev_ops->ndo_tx_timeout(dev);
}
if (!mod_timer(&dev->watchdog_timer,
--
1.6.2.5
^ permalink raw reply related
* Re: [net-next] net: Provide details on watchdog timeout.
From: Stephen Hemminger @ 2010-08-09 19:28 UTC (permalink / raw)
To: Ben Greear; +Cc: netdev
In-Reply-To: <1281381401-5554-1-git-send-email-greearb@candelatech.com>
On Mon, 9 Aug 2010 12:16:41 -0700
Ben Greear <greearb@candelatech.com> wrote:
> This also makes it printed under net_ratelimit instead
> of WARN_ON_ONCE. The backtrace never helped me much.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
>
Please don't remove the WARN_ because it is used by oops.kernel.org
automated tracking.
^ permalink raw reply
* [PATCH 06/18 v2] isdn: avm: call disable_pci_device() if pci_probe() failed
From: Kulikov Vasiliy @ 2010-08-09 19:50 UTC (permalink / raw)
To: kernel-janitors
Cc: Karsten Keil, David S. Miller, Alexey Dobriyan, Tilman Schmidt,
Tejun Heo, netdev
Driver should call disable_pci_device() if it returns from pci_probe()
with error.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
drivers/isdn/hardware/avm/c4.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c
index 7715d32..d3530f6 100644
--- a/drivers/isdn/hardware/avm/c4.c
+++ b/drivers/isdn/hardware/avm/c4.c
@@ -1273,6 +1273,7 @@ static int __devinit c4_probe(struct pci_dev *dev,
if (retval != 0) {
printk(KERN_ERR "c4: no AVM-C%d at i/o %#x, irq %d detected, mem %#x\n",
nr, param.port, param.irq, param.membase);
+ pci_disable_device(dev);
return -ENODEV;
}
return 0;
--
1.7.0.4
^ permalink raw reply related
* [PATCH 07/18 v2] isdn: avm: call disable_pci_device() if pci_probe() failed
From: Kulikov Vasiliy @ 2010-08-09 19:50 UTC (permalink / raw)
To: kernel-janitors
Cc: Karsten Keil, David S. Miller, Alexey Dobriyan, Tilman Schmidt,
netdev
Driver should call disable_pci_device() if it returns from pci_probe()
with error.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
drivers/isdn/hardware/avm/t1pci.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/isdn/hardware/avm/t1pci.c b/drivers/isdn/hardware/avm/t1pci.c
index 5a3f830..a79eb5a 100644
--- a/drivers/isdn/hardware/avm/t1pci.c
+++ b/drivers/isdn/hardware/avm/t1pci.c
@@ -210,6 +210,7 @@ static int __devinit t1pci_probe(struct pci_dev *dev,
if (retval != 0) {
printk(KERN_ERR "t1pci: no AVM-T1-PCI at i/o %#x, irq %d detected, mem %#x\n",
param.port, param.irq, param.membase);
+ pci_disable_device(dev);
return -ENODEV;
}
return 0;
--
1.7.0.4
^ permalink raw reply related
* [PATCH 09/18 v2] isdn: mISDN: call disable_pci_device() if pci_probe() failed
From: Kulikov Vasiliy @ 2010-08-09 19:50 UTC (permalink / raw)
To: kernel-janitors
Cc: Karsten Keil, David S. Miller, Andrew Morton,
Uwe Kleine-König, Peter Huewe, Tejun Heo, netdev
Driver should call disable_pci_device() if it returns from pci_probe()
with error.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
drivers/isdn/hardware/mISDN/mISDNinfineon.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/isdn/hardware/mISDN/mISDNinfineon.c b/drivers/isdn/hardware/mISDN/mISDNinfineon.c
index d2dd61d..af25e1f 100644
--- a/drivers/isdn/hardware/mISDN/mISDNinfineon.c
+++ b/drivers/isdn/hardware/mISDN/mISDNinfineon.c
@@ -1094,6 +1094,7 @@ inf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pr_info("mISDN: do not have informations about adapter at %s\n",
pci_name(pdev));
kfree(card);
+ pci_disable_device(pdev);
return -EINVAL;
} else
pr_notice("mISDN: found adapter %s at %s\n",
@@ -1103,7 +1104,7 @@ inf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_set_drvdata(pdev, card);
err = setup_instance(card);
if (err) {
- pci_disable_device(card->pdev);
+ pci_disable_device(pdev);
kfree(card);
pci_set_drvdata(pdev, NULL);
} else if (ent->driver_data == INF_SCT_1) {
@@ -1114,6 +1115,7 @@ inf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
sc = kzalloc(sizeof(struct inf_hw), GFP_KERNEL);
if (!sc) {
release_card(card);
+ pci_disable_device(pdev);
return -ENOMEM;
}
sc->irq = card->irq;
@@ -1121,6 +1123,7 @@ inf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
sc->ci = card->ci + i;
err = setup_instance(sc);
if (err) {
+ pci_disable_device(pdev);
kfree(sc);
release_card(card);
break;
--
1.7.0.4
^ permalink raw reply related
* [net-next] net: Provide details on watchdog timeout.
From: Ben Greear @ 2010-08-09 19:59 UTC (permalink / raw)
To: netdev; +Cc: Ben Greear
This keeps the WARN_ON but will also log normal kernel messages
after the WARN_ON logic has happened once.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 2aeb3a4... 66e6154... M net/sched/sch_generic.c
net/sched/sch_generic.c | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 2aeb3a4..66e6154 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -253,9 +253,26 @@ static void dev_watchdog(unsigned long arg)
}
if (some_queue_timedout) {
- char drivername[64];
- WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out\n",
- dev->name, netdev_drivername(dev, drivername, 64), i);
+ static bool do_once = true;
+ if (do_once || net_ratelimit()) {
+ char drivername[64];
+ if (unlikely(do_once)) {
+ WARN(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): "
+ "transmit queue %u timed out"
+ " trans-start: %lu jiffies: %lu\n",
+ dev->name,
+ netdev_drivername(dev, drivername, 64),
+ i, trans_start, jiffies);
+ do_once = false;
+ }
+ else
+ printk(KERN_INFO "NETDEV WATCHDOG: %s (%s): "
+ "transmit queue %u timed out"
+ " trans-start: %lu jiffies: %lu\n",
+ dev->name,
+ netdev_drivername(dev, drivername, 64),
+ i, trans_start, jiffies);
+ }
dev->netdev_ops->ndo_tx_timeout(dev);
}
if (!mod_timer(&dev->watchdog_timer,
--
1.6.2.5
^ permalink raw reply related
* Re: [PATCH] net: allow netdev_wait_allrefs() to run faster
From: Eric W. Biederman @ 2010-08-09 19:59 UTC (permalink / raw)
To: Benjamin LaHaise
Cc: Ben Greear, Eric Dumazet, Octavian Purdila, netdev, Cosmin Ratiu
In-Reply-To: <20100809173429.GR30010@kvack.org>
Benjamin LaHaise <bcrl@lhnet.ca> writes:
> Hello Ben,
>
> On Mon, Aug 09, 2010 at 10:23:37AM -0700, Ben Greear wrote:
>> I was just comparing my out-of-tree patch set to .35, and it appears
>> little or none of the patches discussed in this thread are in the
>> upstream kernel yet.
The network device deletion batching code has gone in, which is
a big help, as have some dev_put deletions, so we hit that 250ms
delay less often.
> I was waiting on Eric's sysfs changes for namespaces to settle down, but
> ended up getting busy on other things. I guess now is a good time to pick
> this back up and try to merge my changes for improving interface scaling.
> I'll send out a new version of the patches sometime in the next couple of
> days. I'm also about to make a new Babylon release as well, I just need
> to write some more documentation. :-/
sysfs feature wise has now settled down, and the regressions have all
been stamped out so now should be a good time to work on scaling.
I still have some preliminary patches in my tree, that I will dig up
as time goes by.
Eric
^ permalink raw reply
* Re: [net-next] net: Provide details on watchdog timeout.
From: Ben Greear @ 2010-08-09 19:59 UTC (permalink / raw)
To: Ben Greear; +Cc: netdev
In-Reply-To: <1281383954-23765-1-git-send-email-greearb@candelatech.com>
On 08/09/2010 12:59 PM, Ben Greear wrote:
> This keeps the WARN_ON but will also log normal kernel messages
> after the WARN_ON logic has happened once.
This is compile-tested only, by the way.
Thanks,
Ben
>
> Signed-off-by: Ben Greear<greearb@candelatech.com>
> ---
> :100644 100644 2aeb3a4... 66e6154... M net/sched/sch_generic.c
> net/sched/sch_generic.c | 23 ++++++++++++++++++++---
> 1 files changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
> index 2aeb3a4..66e6154 100644
> --- a/net/sched/sch_generic.c
> +++ b/net/sched/sch_generic.c
> @@ -253,9 +253,26 @@ static void dev_watchdog(unsigned long arg)
> }
>
> if (some_queue_timedout) {
> - char drivername[64];
> - WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out\n",
> - dev->name, netdev_drivername(dev, drivername, 64), i);
> + static bool do_once = true;
> + if (do_once || net_ratelimit()) {
> + char drivername[64];
> + if (unlikely(do_once)) {
> + WARN(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): "
> + "transmit queue %u timed out"
> + " trans-start: %lu jiffies: %lu\n",
> + dev->name,
> + netdev_drivername(dev, drivername, 64),
> + i, trans_start, jiffies);
> + do_once = false;
> + }
> + else
> + printk(KERN_INFO "NETDEV WATCHDOG: %s (%s): "
> + "transmit queue %u timed out"
> + " trans-start: %lu jiffies: %lu\n",
> + dev->name,
> + netdev_drivername(dev, drivername, 64),
> + i, trans_start, jiffies);
> + }
> dev->netdev_ops->ndo_tx_timeout(dev);
> }
> if (!mod_timer(&dev->watchdog_timer,
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* [PATCH 1/6] au1000-eth: typedefs removal
From: Florian Fainelli @ 2010-08-09 20:03 UTC (permalink / raw)
To: netdev, David Miller
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 386d4fe..8b79635 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -460,9 +460,9 @@ static int au1000_mii_probe (struct net_device *dev)
* has the virtual and dma address of a buffer suitable for
* both, receive and transmit operations.
*/
-static db_dest_t *au1000_GetFreeDB(struct au1000_private *aup)
+static struct db_dest *au1000_GetFreeDB(struct au1000_private *aup)
{
- db_dest_t *pDB;
+ struct db_dest *pDB;
pDB = aup->pDBfree;
if (pDB) {
@@ -471,9 +471,9 @@ static db_dest_t *au1000_GetFreeDB(struct au1000_private *aup)
return pDB;
}
-void au1000_ReleaseDB(struct au1000_private *aup, db_dest_t *pDB)
+void au1000_ReleaseDB(struct au1000_private *aup, struct db_dest *pDB)
{
- db_dest_t *pDBfree = aup->pDBfree;
+ struct db_dest *pDBfree = aup->pDBfree;
if (pDBfree)
pDBfree->pnext = pDB;
aup->pDBfree = pDB;
@@ -532,11 +532,11 @@ au1000_setup_hw_rings(struct au1000_private *aup, u32 rx_base, u32 tx_base)
for (i = 0; i < NUM_RX_DMA; i++) {
aup->rx_dma_ring[i] =
- (volatile rx_dma_t *) (rx_base + sizeof(rx_dma_t)*i);
+ (volatile struct rx_dma *) (rx_base + sizeof(struct rx_dma)*i);
}
for (i = 0; i < NUM_TX_DMA; i++) {
aup->tx_dma_ring[i] =
- (volatile tx_dma_t *) (tx_base + sizeof(tx_dma_t)*i);
+ (volatile struct tx_dma *) (tx_base + sizeof(struct tx_dma)*i);
}
}
@@ -689,9 +689,9 @@ static int au1000_rx(struct net_device *dev)
{
struct au1000_private *aup = netdev_priv(dev);
struct sk_buff *skb;
- volatile rx_dma_t *prxd;
+ volatile struct rx_dma *prxd;
u32 buff_stat, status;
- db_dest_t *pDB;
+ struct db_dest *pDB;
u32 frmlen;
netif_dbg(aup, rx_status, dev, "au1000_rx head %d\n", aup->rx_head);
@@ -782,7 +782,7 @@ static void au1000_update_tx_stats(struct net_device *dev, u32 status)
static void au1000_tx_ack(struct net_device *dev)
{
struct au1000_private *aup = netdev_priv(dev);
- volatile tx_dma_t *ptxd;
+ volatile struct tx_dma *ptxd;
ptxd = aup->tx_dma_ring[aup->tx_tail];
@@ -881,9 +881,9 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
{
struct au1000_private *aup = netdev_priv(dev);
struct net_device_stats *ps = &dev->stats;
- volatile tx_dma_t *ptxd;
+ volatile struct tx_dma *ptxd;
u32 buff_stat;
- db_dest_t *pDB;
+ struct db_dest *pDB;
int i;
netif_dbg(aup, tx_queued, dev, "tx: aup %x len=%d, data=%p, head %d\n",
@@ -999,7 +999,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
struct au1000_private *aup = NULL;
struct au1000_eth_platform_data *pd;
struct net_device *dev = NULL;
- db_dest_t *pDB, *pDBfree;
+ struct db_dest *pDB, *pDBfree;
int irq, i, err = 0;
struct resource *base, *macen;
char ethaddr[6];
@@ -1063,7 +1063,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
}
/* aup->mac is the base address of the MAC's registers */
- aup->mac = (volatile mac_reg_t *)ioremap_nocache(base->start, resource_size(base));
+ aup->mac = (volatile struct mac_reg *)ioremap_nocache(base->start, resource_size(base));
if (!aup->mac) {
dev_err(&pdev->dev, "failed to ioremap MAC registers\n");
err = -ENXIO;
diff --git a/drivers/net/au1000_eth.h b/drivers/net/au1000_eth.h
index d06ec00..44003e4 100644
--- a/drivers/net/au1000_eth.h
+++ b/drivers/net/au1000_eth.h
@@ -44,34 +44,34 @@
* Data Buffer Descriptor. Data buffers must be aligned on 32 byte
* boundary for both, receive and transmit.
*/
-typedef struct db_dest {
+struct db_dest {
struct db_dest *pnext;
volatile u32 *vaddr;
dma_addr_t dma_addr;
-} db_dest_t;
+};
/*
* The transmit and receive descriptors are memory
* mapped registers.
*/
-typedef struct tx_dma {
+struct tx_dma {
u32 status;
u32 buff_stat;
u32 len;
u32 pad;
-} tx_dma_t;
+};
-typedef struct rx_dma {
+struct rx_dma {
u32 status;
u32 buff_stat;
u32 pad[2];
-} rx_dma_t;
+};
/*
* MAC control registers, memory mapped.
*/
-typedef struct mac_reg {
+struct mac_reg {
u32 control;
u32 mac_addr_high;
u32 mac_addr_low;
@@ -82,16 +82,16 @@ typedef struct mac_reg {
u32 flow_control;
u32 vlan1_tag;
u32 vlan2_tag;
-} mac_reg_t;
+};
struct au1000_private {
- db_dest_t *pDBfree;
- db_dest_t db[NUM_RX_BUFFS+NUM_TX_BUFFS];
- volatile rx_dma_t *rx_dma_ring[NUM_RX_DMA];
- volatile tx_dma_t *tx_dma_ring[NUM_TX_DMA];
- db_dest_t *rx_db_inuse[NUM_RX_DMA];
- db_dest_t *tx_db_inuse[NUM_TX_DMA];
+ struct db_dest *pDBfree;
+ struct db_dest db[NUM_RX_BUFFS+NUM_TX_BUFFS];
+ volatile struct rx_dma *rx_dma_ring[NUM_RX_DMA];
+ volatile struct tx_dma *tx_dma_ring[NUM_TX_DMA];
+ struct db_dest *rx_db_inuse[NUM_RX_DMA];
+ struct db_dest *tx_db_inuse[NUM_TX_DMA];
u32 rx_head;
u32 tx_head;
u32 tx_tail;
@@ -118,7 +118,7 @@ struct au1000_private {
int phy_irq;
/* These variables are just for quick access to certain regs addresses. */
- volatile mac_reg_t *mac; /* mac registers */
+ volatile struct mac_reg *mac; /* mac registers */
volatile u32 *enable; /* address of MAC Enable Register */
u32 vaddr; /* virtual address of rx/tx buffers */
^ permalink raw reply related
* [PATCH 2/6] au1000-eth: stylistic fixes
From: Florian Fainelli @ 2010-08-09 20:03 UTC (permalink / raw)
To: netdev, David Miller
This patch fixes the following checkpatch.pl warnings:
- spaces after tabs
- space between function and arguments
- one-line statement braces
- tabs instead of spaces
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 8b79635..b5f992a 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -13,7 +13,7 @@
* converted to use linux-2.6.x's PHY framework
*
* Author: MontaVista Software, Inc.
- * ppopov@mvista.com or source@mvista.com
+ * ppopov@mvista.com or source@mvista.com
*
* ########################################################################
*
@@ -160,7 +160,7 @@ static void au1000_enable_mac(struct net_device *dev, int force_reset)
spin_lock_irqsave(&aup->lock, flags);
- if(force_reset || (!aup->mac_enabled)) {
+ if (force_reset || (!aup->mac_enabled)) {
*aup->enable = MAC_EN_CLOCK_ENABLE;
au_sync_delay(2);
*aup->enable = (MAC_EN_RESET0 | MAC_EN_RESET1 | MAC_EN_RESET2
@@ -361,7 +361,7 @@ au1000_adjust_link(struct net_device *dev)
}
}
-static int au1000_mii_probe (struct net_device *dev)
+static int au1000_mii_probe(struct net_device *dev)
{
struct au1000_private *const aup = netdev_priv(dev);
struct phy_device *phydev = NULL;
@@ -465,9 +465,9 @@ static struct db_dest *au1000_GetFreeDB(struct au1000_private *aup)
struct db_dest *pDB;
pDB = aup->pDBfree;
- if (pDB) {
+ if (pDB)
aup->pDBfree = pDB->pnext;
- }
+
return pDB;
}
@@ -515,7 +515,7 @@ static void au1000_reset_mac(struct net_device *dev)
spin_lock_irqsave(&aup->lock, flags);
- au1000_reset_mac_unlocked (dev);
+ au1000_reset_mac_unlocked(dev);
spin_unlock_irqrestore(&aup->lock, flags);
}
@@ -633,9 +633,9 @@ static int au1000_init(struct net_device *dev)
aup->mac->mac_addr_low = dev->dev_addr[3]<<24 | dev->dev_addr[2]<<16 |
dev->dev_addr[1]<<8 | dev->dev_addr[0];
- for (i = 0; i < NUM_RX_DMA; i++) {
+ for (i = 0; i < NUM_RX_DMA; i++)
aup->rx_dma_ring[i]->buff_stat |= RX_DMA_ENABLE;
- }
+
au_sync();
control = MAC_RX_ENABLE | MAC_TX_ENABLE;
@@ -862,7 +862,7 @@ static int au1000_close(struct net_device *dev)
spin_lock_irqsave(&aup->lock, flags);
- au1000_reset_mac_unlocked (dev);
+ au1000_reset_mac_unlocked(dev);
/* stop the device */
netif_stop_queue(dev);
@@ -910,9 +910,9 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
pDB = aup->tx_db_inuse[aup->tx_head];
skb_copy_from_linear_data(skb, (void *)pDB->vaddr, skb->len);
if (skb->len < ETH_ZLEN) {
- for (i = skb->len; i < ETH_ZLEN; i++) {
+ for (i = skb->len; i < ETH_ZLEN; i++)
((char *)pDB->vaddr)[i] = 0;
- }
+
ptxd->len = ETH_ZLEN;
} else
ptxd->len = skb->len;
@@ -1070,7 +1070,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
goto err_remap1;
}
- /* Setup some variables for quick register address access */
+ /* Setup some variables for quick register address access */
aup->enable = (volatile u32 *)ioremap_nocache(macen->start, resource_size(macen));
if (!aup->enable) {
dev_err(&pdev->dev, "failed to ioremap MAC enable register\n");
@@ -1168,17 +1168,17 @@ static int __devinit au1000_probe(struct platform_device *pdev)
for (i = 0; i < NUM_RX_DMA; i++) {
pDB = au1000_GetFreeDB(aup);
- if (!pDB) {
+ if (!pDB)
goto err_out;
- }
+
aup->rx_dma_ring[i]->buff_stat = (unsigned)pDB->dma_addr;
aup->rx_db_inuse[i] = pDB;
}
for (i = 0; i < NUM_TX_DMA; i++) {
pDB = au1000_GetFreeDB(aup);
- if (!pDB) {
+ if (!pDB)
goto err_out;
- }
+
aup->tx_dma_ring[i]->buff_stat = (unsigned)pDB->dma_addr;
aup->tx_dma_ring[i]->len = 0;
aup->tx_db_inuse[i] = pDB;
^ permalink raw reply related
* [PATCH 3/6] au1000-eth: fix all "line over 80 characters warnings"
From: Florian Fainelli @ 2010-08-09 20:03 UTC (permalink / raw)
To: netdev, David Miller
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index b5f992a..9a0515d 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -377,12 +377,15 @@ static int au1000_mii_probe(struct net_device *dev)
} else {
int phy_addr;
- /* find the first (lowest address) PHY on the current MAC's MII bus */
- for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++)
+ /* find the first (lowest address) PHY
+ * on the current MAC's MII bus */
+ for (phy_addr = 0;
+ phy_addr < PHY_MAX_ADDR; phy_addr++)
if (aup->mii_bus->phy_map[phy_addr]) {
phydev = aup->mii_bus->phy_map[phy_addr];
if (!aup->phy_search_highest_addr)
- break; /* break out with first one found */
+ /* break out with first one found */
+ break;
}
if (aup->phy1_search_mac0) {
@@ -390,22 +393,26 @@ static int au1000_mii_probe(struct net_device *dev)
if (!phydev && (aup->mac_id == 1)) {
/* no PHY found, maybe we have a dual PHY? */
dev_info(&dev->dev, ": no PHY found on MAC1, "
- "let's see if it's attached to MAC0...\n");
+ "let's see if it's attached to MAC0..."
+ "\n");
- /* find the first (lowest address) non-attached PHY on
- * the MAC0 MII bus */
- for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
+ /* find the first (lowest address) non-attached
+ * PHY on the MAC0 MII bus */
+ for (phy_addr = 0; phy_addr < PHY_MAX_ADDR;
+ phy_addr++) {
struct phy_device *const tmp_phydev =
- aup->mii_bus->phy_map[phy_addr];
+ aup->mii_bus->phy_map[phy_addr];
if (aup->mac_id == 1)
break;
+ /* no PHY here... */
if (!tmp_phydev)
- continue; /* no PHY here... */
+ continue;
+ /* already claimed by MAC0 */
if (tmp_phydev->attached_dev)
- continue; /* already claimed by MAC0 */
+ continue;
phydev = tmp_phydev;
break; /* found it */
@@ -532,11 +539,13 @@ au1000_setup_hw_rings(struct au1000_private *aup, u32 rx_base, u32 tx_base)
for (i = 0; i < NUM_RX_DMA; i++) {
aup->rx_dma_ring[i] =
- (volatile struct rx_dma *) (rx_base + sizeof(struct rx_dma)*i);
+ (volatile struct rx_dma *)
+ (rx_base + sizeof(struct rx_dma)*i);
}
for (i = 0; i < NUM_TX_DMA; i++) {
aup->tx_dma_ring[i] =
- (volatile struct tx_dma *) (tx_base + sizeof(struct tx_dma)*i);
+ (volatile struct tx_dma *)
+ (tx_base + sizeof(struct tx_dma)*i);
}
}
@@ -633,6 +642,7 @@ static int au1000_init(struct net_device *dev)
aup->mac->mac_addr_low = dev->dev_addr[3]<<24 | dev->dev_addr[2]<<16 |
dev->dev_addr[1]<<8 | dev->dev_addr[0];
+
for (i = 0; i < NUM_RX_DMA; i++)
aup->rx_dma_ring[i]->buff_stat |= RX_DMA_ENABLE;
@@ -709,7 +719,8 @@ static int au1000_rx(struct net_device *dev)
frmlen -= 4; /* Remove FCS */
skb = dev_alloc_skb(frmlen + 2);
if (skb == NULL) {
- netdev_err(dev, "Memory squeeze, dropping packet.\n");
+ netdev_err(dev, "Memory squeeze,"
+ " dropping packet.\n");
dev->stats.rx_dropped++;
continue;
}
@@ -944,8 +955,8 @@ static void au1000_multicast_list(struct net_device *dev)
{
struct au1000_private *aup = netdev_priv(dev);
- netif_dbg(aup, drv, dev, "au1000_multicast_list: flags=%x\n", dev->flags);
-
+ netif_dbg(aup, drv, dev, "au1000_multicast_list: flags=%x\n",
+ dev->flags);
if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
aup->mac->control |= MAC_PROMISCUOUS;
} else if ((dev->flags & IFF_ALLMULTI) ||
@@ -1025,14 +1036,18 @@ static int __devinit au1000_probe(struct platform_device *pdev)
goto out;
}
- if (!request_mem_region(base->start, resource_size(base), pdev->name)) {
- dev_err(&pdev->dev, "failed to request memory region for base registers\n");
+ if (!request_mem_region(base->start, resource_size(base),
+ pdev->name)) {
+ dev_err(&pdev->dev, "failed to request memory region for"
+ " base registers\n");
err = -ENXIO;
goto out;
}
- if (!request_mem_region(macen->start, resource_size(macen), pdev->name)) {
- dev_err(&pdev->dev, "failed to request memory region for MAC enable register\n");
+ if (!request_mem_region(macen->start, resource_size(macen),
+ pdev->name)) {
+ dev_err(&pdev->dev, "failed to request memory region for"
+ " MAC enable register\n");
err = -ENXIO;
goto err_request;
}
@@ -1049,7 +1064,8 @@ static int __devinit au1000_probe(struct platform_device *pdev)
aup = netdev_priv(dev);
spin_lock_init(&aup->lock);
- aup->msg_enable = (au1000_debug < 4 ? AU1000_DEF_MSG_ENABLE : au1000_debug);
+ aup->msg_enable = (au1000_debug < 4 ?
+ AU1000_DEF_MSG_ENABLE : au1000_debug);
/* Allocate the data buffers */
/* Snooping works fine with eth on all au1xxx */
@@ -1063,7 +1079,8 @@ static int __devinit au1000_probe(struct platform_device *pdev)
}
/* aup->mac is the base address of the MAC's registers */
- aup->mac = (volatile struct mac_reg *)ioremap_nocache(base->start, resource_size(base));
+ aup->mac = (volatile struct mac_reg *)
+ ioremap_nocache(base->start, resource_size(base));
if (!aup->mac) {
dev_err(&pdev->dev, "failed to ioremap MAC registers\n");
err = -ENXIO;
@@ -1071,7 +1088,8 @@ static int __devinit au1000_probe(struct platform_device *pdev)
}
/* Setup some variables for quick register address access */
- aup->enable = (volatile u32 *)ioremap_nocache(macen->start, resource_size(macen));
+ aup->enable = (volatile u32 *)ioremap_nocache(macen->start,
+ resource_size(macen));
if (!aup->enable) {
dev_err(&pdev->dev, "failed to ioremap MAC enable register\n");
err = -ENXIO;
@@ -1081,7 +1099,8 @@ static int __devinit au1000_probe(struct platform_device *pdev)
if (pdev->id == 0) {
if (prom_get_ethernet_addr(ethaddr) == 0)
- memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
+ memcpy(au1000_mac_addr, ethaddr,
+ sizeof(au1000_mac_addr));
else {
netdev_info(dev, "No MAC address found\n");
/* Use the hard coded MAC addresses */
@@ -1103,7 +1122,8 @@ static int __devinit au1000_probe(struct platform_device *pdev)
pd = pdev->dev.platform_data;
if (!pd) {
- dev_info(&pdev->dev, "no platform_data passed, PHY search on MAC0\n");
+ dev_info(&pdev->dev, "no platform_data passed,"
+ " PHY search on MAC0\n");
aup->phy1_search_mac0 = 1;
} else {
aup->phy_static_config = pd->phy_static_config;
@@ -1116,7 +1136,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
if (aup->phy_busid && aup->phy_busid > 0) {
dev_err(&pdev->dev, "MAC0-associated PHY attached 2nd MACs MII"
- "bus not supported yet\n");
+ " bus not supported yet\n");
err = -ENODEV;
goto err_mdiobus_alloc;
}
diff --git a/drivers/net/au1000_eth.h b/drivers/net/au1000_eth.h
index 44003e4..38c1d88 100644
--- a/drivers/net/au1000_eth.h
+++ b/drivers/net/au1000_eth.h
@@ -99,7 +99,8 @@ struct au1000_private {
int mac_id;
- int mac_enabled; /* whether MAC is currently enabled and running (req. for mdio) */
+ int mac_enabled; /* whether MAC is currently enabled and running
+ (req. for mdio) */
int old_link; /* used by au1000_adjust_link */
int old_speed;
@@ -117,7 +118,8 @@ struct au1000_private {
int phy_busid;
int phy_irq;
- /* These variables are just for quick access to certain regs addresses. */
+ /* These variables are just for quick access
+ * to certain regs addresses. */
volatile struct mac_reg *mac; /* mac registers */
volatile u32 *enable; /* address of MAC Enable Register */
^ permalink raw reply related
* [PATCH 4/6] au1000-eth: fix bad printk usages
From: Florian Fainelli @ 2010-08-09 20:03 UTC (permalink / raw)
To: netdev, David Miller
Use pr_(info|err) and pr_cont where required instead of calls to printk.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 9a0515d..f8f1f5e 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -732,24 +732,25 @@ static int au1000_rx(struct net_device *dev)
netif_rx(skb); /* pass the packet to upper layers */
} else {
if (au1000_debug > 4) {
+ pr_err("rx_error: ");
if (status & RX_MISSED_FRAME)
- printk("rx miss\n");
+ pr_cont("rx miss\n");
if (status & RX_WDOG_TIMER)
- printk("rx wdog\n");
+ pr_cont("rx wdog\n");
if (status & RX_RUNT)
- printk("rx runt\n");
+ pr_cont("rx runt\n");
if (status & RX_OVERLEN)
- printk("rx overlen\n");
+ pr_cont("rx overlen\n");
if (status & RX_COLL)
- printk("rx coll\n");
+ pr_cont("rx coll\n");
if (status & RX_MII_ERROR)
- printk("rx mii error\n");
+ pr_cont("rx mii error\n");
if (status & RX_CRC_ERROR)
- printk("rx crc error\n");
+ pr_cont("rx crc error\n");
if (status & RX_LEN_ERROR)
- printk("rx len error\n");
+ pr_cont("rx len error\n");
if (status & RX_U_CNTRL_FRAME)
- printk("rx u control frame\n");
+ pr_cont("rx u control frame\n");
}
}
prxd->buff_stat = (u32)(pDB->dma_addr | RX_DMA_ENABLE);
@@ -1225,7 +1226,8 @@ static int __devinit au1000_probe(struct platform_device *pdev)
netdev_info(dev, "Au1xx0 Ethernet found at 0x%lx, irq %d\n",
(unsigned long)base->start, irq);
if (version_printed++ == 0)
- printk("%s version %s %s\n", DRV_NAME, DRV_VERSION, DRV_AUTHOR);
+ pr_info("%s version %s %s\n",
+ DRV_NAME, DRV_VERSION, DRV_AUTHOR);
return 0;
^ permalink raw reply related
* [PATCH 5/6] au1000-eth: fix asm -> linux headers inclusion
From: Florian Fainelli @ 2010-08-09 20:03 UTC (permalink / raw)
To: netdev, David Miller
Replace asm/io.h and asm/cpu.h wih linux/io.h and linux/cpu.h
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index f8f1f5e..4605c3d 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -56,11 +56,11 @@
#include <linux/crc32.h>
#include <linux/phy.h>
#include <linux/platform_device.h>
+#include <linux/cpu.h>
+#include <linux/io.h>
-#include <asm/cpu.h>
#include <asm/mipsregs.h>
#include <asm/irq.h>
-#include <asm/io.h>
#include <asm/processor.h>
#include <au1000.h>
^ permalink raw reply related
* [PATCH 6/6] au1000-eth: remove volatiles, switch to I/O accessors
From: Florian Fainelli @ 2010-08-09 20:03 UTC (permalink / raw)
To: netdev, David Miller
Remove all the volatile keywords where they were used, switch to using the
proper readl/writel accessors.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 4605c3d..3efb4ed 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -161,10 +161,10 @@ static void au1000_enable_mac(struct net_device *dev, int force_reset)
spin_lock_irqsave(&aup->lock, flags);
if (force_reset || (!aup->mac_enabled)) {
- *aup->enable = MAC_EN_CLOCK_ENABLE;
+ writel(MAC_EN_CLOCK_ENABLE, &aup->enable);
au_sync_delay(2);
- *aup->enable = (MAC_EN_RESET0 | MAC_EN_RESET1 | MAC_EN_RESET2
- | MAC_EN_CLOCK_ENABLE);
+ writel((MAC_EN_RESET0 | MAC_EN_RESET1 | MAC_EN_RESET2
+ | MAC_EN_CLOCK_ENABLE), &aup->enable);
au_sync_delay(2);
aup->mac_enabled = 1;
@@ -179,12 +179,12 @@ static void au1000_enable_mac(struct net_device *dev, int force_reset)
static int au1000_mdio_read(struct net_device *dev, int phy_addr, int reg)
{
struct au1000_private *aup = netdev_priv(dev);
- volatile u32 *const mii_control_reg = &aup->mac->mii_control;
- volatile u32 *const mii_data_reg = &aup->mac->mii_data;
+ u32 *const mii_control_reg = &aup->mac->mii_control;
+ u32 *const mii_data_reg = &aup->mac->mii_data;
u32 timedout = 20;
u32 mii_control;
- while (*mii_control_reg & MAC_MII_BUSY) {
+ while (readl(mii_control_reg) & MAC_MII_BUSY) {
mdelay(1);
if (--timedout == 0) {
netdev_err(dev, "read_MII busy timeout!!\n");
@@ -195,29 +195,29 @@ static int au1000_mdio_read(struct net_device *dev, int phy_addr, int reg)
mii_control = MAC_SET_MII_SELECT_REG(reg) |
MAC_SET_MII_SELECT_PHY(phy_addr) | MAC_MII_READ;
- *mii_control_reg = mii_control;
+ writel(mii_control, mii_control_reg);
timedout = 20;
- while (*mii_control_reg & MAC_MII_BUSY) {
+ while (readl(mii_control_reg) & MAC_MII_BUSY) {
mdelay(1);
if (--timedout == 0) {
netdev_err(dev, "mdio_read busy timeout!!\n");
return -1;
}
}
- return (int)*mii_data_reg;
+ return readl(mii_data_reg);
}
static void au1000_mdio_write(struct net_device *dev, int phy_addr,
int reg, u16 value)
{
struct au1000_private *aup = netdev_priv(dev);
- volatile u32 *const mii_control_reg = &aup->mac->mii_control;
- volatile u32 *const mii_data_reg = &aup->mac->mii_data;
+ u32 *const mii_control_reg = &aup->mac->mii_control;
+ u32 *const mii_data_reg = &aup->mac->mii_data;
u32 timedout = 20;
u32 mii_control;
- while (*mii_control_reg & MAC_MII_BUSY) {
+ while (readl(mii_control_reg) & MAC_MII_BUSY) {
mdelay(1);
if (--timedout == 0) {
netdev_err(dev, "mdio_write busy timeout!!\n");
@@ -228,8 +228,8 @@ static void au1000_mdio_write(struct net_device *dev, int phy_addr,
mii_control = MAC_SET_MII_SELECT_REG(reg) |
MAC_SET_MII_SELECT_PHY(phy_addr) | MAC_MII_WRITE;
- *mii_data_reg = value;
- *mii_control_reg = mii_control;
+ writel(value, mii_data_reg);
+ writel(mii_control, mii_control_reg);
}
static int au1000_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
@@ -266,20 +266,26 @@ static int au1000_mdiobus_reset(struct mii_bus *bus)
static void au1000_hard_stop(struct net_device *dev)
{
struct au1000_private *aup = netdev_priv(dev);
+ u32 reg;
netif_dbg(aup, drv, dev, "hard stop\n");
- aup->mac->control &= ~(MAC_RX_ENABLE | MAC_TX_ENABLE);
+ reg = readl(&aup->mac->control);
+ reg &= ~(MAC_RX_ENABLE | MAC_TX_ENABLE);
+ writel(reg, &aup->mac->control);
au_sync_delay(10);
}
static void au1000_enable_rx_tx(struct net_device *dev)
{
struct au1000_private *aup = netdev_priv(dev);
+ u32 reg;
netif_dbg(aup, hw, dev, "enable_rx_tx\n");
- aup->mac->control |= (MAC_RX_ENABLE | MAC_TX_ENABLE);
+ reg = readl(&aup->mac->control);
+ reg |= (MAC_RX_ENABLE | MAC_TX_ENABLE);
+ writel(reg, &aup->mac->control);
au_sync_delay(10);
}
@@ -289,6 +295,7 @@ au1000_adjust_link(struct net_device *dev)
struct au1000_private *aup = netdev_priv(dev);
struct phy_device *phydev = aup->phy_dev;
unsigned long flags;
+ u32 reg;
int status_change = 0;
@@ -320,14 +327,15 @@ au1000_adjust_link(struct net_device *dev)
/* switching duplex mode requires to disable rx and tx! */
au1000_hard_stop(dev);
- if (DUPLEX_FULL == phydev->duplex)
- aup->mac->control = ((aup->mac->control
- | MAC_FULL_DUPLEX)
- & ~MAC_DISABLE_RX_OWN);
- else
- aup->mac->control = ((aup->mac->control
- & ~MAC_FULL_DUPLEX)
- | MAC_DISABLE_RX_OWN);
+ reg = readl(&aup->mac->control);
+ if (DUPLEX_FULL == phydev->duplex) {
+ reg |= MAC_FULL_DUPLEX;
+ reg &= ~MAC_DISABLE_RX_OWN;
+ } else {
+ reg &= ~MAC_FULL_DUPLEX;
+ reg |= MAC_DISABLE_RX_OWN;
+ }
+ writel(reg, &aup->mac->control);
au_sync_delay(1);
au1000_enable_rx_tx(dev);
@@ -493,9 +501,9 @@ static void au1000_reset_mac_unlocked(struct net_device *dev)
au1000_hard_stop(dev);
- *aup->enable = MAC_EN_CLOCK_ENABLE;
+ writel(MAC_EN_CLOCK_ENABLE, &aup->enable);
au_sync_delay(2);
- *aup->enable = 0;
+ writel(0, &aup->enable);
au_sync_delay(2);
aup->tx_full = 0;
@@ -539,12 +547,12 @@ au1000_setup_hw_rings(struct au1000_private *aup, u32 rx_base, u32 tx_base)
for (i = 0; i < NUM_RX_DMA; i++) {
aup->rx_dma_ring[i] =
- (volatile struct rx_dma *)
+ (struct rx_dma *)
(rx_base + sizeof(struct rx_dma)*i);
}
for (i = 0; i < NUM_TX_DMA; i++) {
aup->tx_dma_ring[i] =
- (volatile struct tx_dma *)
+ (struct tx_dma *)
(tx_base + sizeof(struct tx_dma)*i);
}
}
@@ -633,14 +641,16 @@ static int au1000_init(struct net_device *dev)
spin_lock_irqsave(&aup->lock, flags);
- aup->mac->control = 0;
+ writel(0, &aup->mac->control);
aup->tx_head = (aup->tx_dma_ring[0]->buff_stat & 0xC) >> 2;
aup->tx_tail = aup->tx_head;
aup->rx_head = (aup->rx_dma_ring[0]->buff_stat & 0xC) >> 2;
- aup->mac->mac_addr_high = dev->dev_addr[5]<<8 | dev->dev_addr[4];
- aup->mac->mac_addr_low = dev->dev_addr[3]<<24 | dev->dev_addr[2]<<16 |
- dev->dev_addr[1]<<8 | dev->dev_addr[0];
+ writel(dev->dev_addr[5]<<8 | dev->dev_addr[4],
+ &aup->mac->mac_addr_high);
+ writel(dev->dev_addr[3]<<24 | dev->dev_addr[2]<<16 |
+ dev->dev_addr[1]<<8 | dev->dev_addr[0],
+ &aup->mac->mac_addr_low);
for (i = 0; i < NUM_RX_DMA; i++)
@@ -661,8 +671,8 @@ static int au1000_init(struct net_device *dev)
control |= MAC_FULL_DUPLEX;
}
- aup->mac->control = control;
- aup->mac->vlan1_tag = 0x8100; /* activate vlan support */
+ writel(control, &aup->mac->control);
+ writel(0x8100, &aup->mac->vlan1_tag); /* activate vlan support */
au_sync();
spin_unlock_irqrestore(&aup->lock, flags);
@@ -699,7 +709,7 @@ static int au1000_rx(struct net_device *dev)
{
struct au1000_private *aup = netdev_priv(dev);
struct sk_buff *skb;
- volatile struct rx_dma *prxd;
+ struct rx_dma *prxd;
u32 buff_stat, status;
struct db_dest *pDB;
u32 frmlen;
@@ -794,7 +804,7 @@ static void au1000_update_tx_stats(struct net_device *dev, u32 status)
static void au1000_tx_ack(struct net_device *dev)
{
struct au1000_private *aup = netdev_priv(dev);
- volatile struct tx_dma *ptxd;
+ struct tx_dma *ptxd;
ptxd = aup->tx_dma_ring[aup->tx_tail];
@@ -893,7 +903,7 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
{
struct au1000_private *aup = netdev_priv(dev);
struct net_device_stats *ps = &dev->stats;
- volatile struct tx_dma *ptxd;
+ struct tx_dma *ptxd;
u32 buff_stat;
struct db_dest *pDB;
int i;
@@ -955,15 +965,18 @@ static void au1000_tx_timeout(struct net_device *dev)
static void au1000_multicast_list(struct net_device *dev)
{
struct au1000_private *aup = netdev_priv(dev);
+ u32 reg;
netif_dbg(aup, drv, dev, "au1000_multicast_list: flags=%x\n",
dev->flags);
+
+ reg = readl(&aup->mac->control);
if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
- aup->mac->control |= MAC_PROMISCUOUS;
+ reg |= MAC_PROMISCUOUS;
} else if ((dev->flags & IFF_ALLMULTI) ||
netdev_mc_count(dev) > MULTICAST_FILTER_LIMIT) {
- aup->mac->control |= MAC_PASS_ALL_MULTI;
- aup->mac->control &= ~MAC_PROMISCUOUS;
+ reg |= MAC_PASS_ALL_MULTI;
+ reg &= ~MAC_PROMISCUOUS;
netdev_info(dev, "Pass all multicast\n");
} else {
struct netdev_hw_addr *ha;
@@ -973,11 +986,12 @@ static void au1000_multicast_list(struct net_device *dev)
netdev_for_each_mc_addr(ha, dev)
set_bit(ether_crc(ETH_ALEN, ha->addr)>>26,
(long *)mc_filter);
- aup->mac->multi_hash_high = mc_filter[1];
- aup->mac->multi_hash_low = mc_filter[0];
- aup->mac->control &= ~MAC_PROMISCUOUS;
- aup->mac->control |= MAC_HASH_MODE;
+ writel(mc_filter[1], &aup->mac->multi_hash_high);
+ writel(mc_filter[0], &aup->mac->multi_hash_low);
+ reg &= ~MAC_PROMISCUOUS;
+ reg |= MAC_HASH_MODE;
}
+ writel(reg, &aup->mac->control);
}
static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
@@ -1080,7 +1094,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
}
/* aup->mac is the base address of the MAC's registers */
- aup->mac = (volatile struct mac_reg *)
+ aup->mac = (struct mac_reg *)
ioremap_nocache(base->start, resource_size(base));
if (!aup->mac) {
dev_err(&pdev->dev, "failed to ioremap MAC registers\n");
@@ -1089,7 +1103,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
}
/* Setup some variables for quick register address access */
- aup->enable = (volatile u32 *)ioremap_nocache(macen->start,
+ aup->enable = (u32 *)ioremap_nocache(macen->start,
resource_size(macen));
if (!aup->enable) {
dev_err(&pdev->dev, "failed to ioremap MAC enable register\n");
@@ -1118,7 +1132,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));
dev->dev_addr[5] += pdev->id;
- *aup->enable = 0;
+ writel(0, &aup->enable);
aup->mac_enabled = 0;
pd = pdev->dev.platform_data;
diff --git a/drivers/net/au1000_eth.h b/drivers/net/au1000_eth.h
index 38c1d88..4b638df 100644
--- a/drivers/net/au1000_eth.h
+++ b/drivers/net/au1000_eth.h
@@ -46,7 +46,7 @@
*/
struct db_dest {
struct db_dest *pnext;
- volatile u32 *vaddr;
+ u32 *vaddr;
dma_addr_t dma_addr;
};
@@ -88,8 +88,8 @@ struct mac_reg {
struct au1000_private {
struct db_dest *pDBfree;
struct db_dest db[NUM_RX_BUFFS+NUM_TX_BUFFS];
- volatile struct rx_dma *rx_dma_ring[NUM_RX_DMA];
- volatile struct tx_dma *tx_dma_ring[NUM_TX_DMA];
+ struct rx_dma *rx_dma_ring[NUM_RX_DMA];
+ struct tx_dma *tx_dma_ring[NUM_TX_DMA];
struct db_dest *rx_db_inuse[NUM_RX_DMA];
struct db_dest *tx_db_inuse[NUM_TX_DMA];
u32 rx_head;
@@ -120,8 +120,8 @@ struct au1000_private {
/* These variables are just for quick access
* to certain regs addresses. */
- volatile struct mac_reg *mac; /* mac registers */
- volatile u32 *enable; /* address of MAC Enable Register */
+ struct mac_reg *mac; /* mac registers */
+ u32 *enable; /* address of MAC Enable Register */
u32 vaddr; /* virtual address of rx/tx buffers */
dma_addr_t dma_addr; /* dma address of rx/tx buffers */
^ permalink raw reply related
* Re: [net-next] net: Provide details on watchdog timeout.
From: David Miller @ 2010-08-09 20:08 UTC (permalink / raw)
To: shemminger; +Cc: greearb, netdev
In-Reply-To: <20100809152820.26dbffc1@s6510>
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Mon, 9 Aug 2010 15:28:20 -0400
> On Mon, 9 Aug 2010 12:16:41 -0700
> Ben Greear <greearb@candelatech.com> wrote:
>
>> This also makes it printed under net_ratelimit instead
>> of WARN_ON_ONCE. The backtrace never helped me much.
>>
>> Signed-off-by: Ben Greear <greearb@candelatech.com>
>>
>
> Please don't remove the WARN_ because it is used by oops.kernel.org
> automated tracking.
Yes, please don't change this, there are automated tools that
know about what this thing spits out and yes the backtrace
needs to be there.
^ permalink raw reply
* Re: [net-next] net: Provide details on watchdog timeout.
From: David Miller @ 2010-08-09 20:10 UTC (permalink / raw)
To: greearb; +Cc: netdev
In-Reply-To: <1281383954-23765-1-git-send-email-greearb@candelatech.com>
From: Ben Greear <greearb@candelatech.com>
Date: Mon, 9 Aug 2010 12:59:14 -0700
> This keeps the WARN_ON but will also log normal kernel messages
> after the WARN_ON logic has happened once.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
I think this warning is fine as-is.
^ permalink raw reply
* Re: [net-next] net: Provide details on watchdog timeout.
From: Ben Greear @ 2010-08-09 20:12 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20100809.131017.112606336.davem@davemloft.net>
On 08/09/2010 01:10 PM, David Miller wrote:
> From: Ben Greear<greearb@candelatech.com>
> Date: Mon, 9 Aug 2010 12:59:14 -0700
>
>> This keeps the WARN_ON but will also log normal kernel messages
>> after the WARN_ON logic has happened once.
>>
>> Signed-off-by: Ben Greear<greearb@candelatech.com>
>
> I think this warning is fine as-is.
Ok, thanks for looking.
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [PATCH] net: allow netdev_wait_allrefs() to run faster
From: Benjamin LaHaise @ 2010-08-09 21:03 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Ben Greear, Eric Dumazet, Octavian Purdila, netdev, Cosmin Ratiu
In-Reply-To: <m1tyn3v9pp.fsf@fess.ebiederm.org>
On Mon, Aug 09, 2010 at 12:59:14PM -0700, Eric W. Biederman wrote:
> The network device deletion batching code has gone in, which is
> a big help, as have some dev_put deletions, so we hit that 250ms
> delay less often.
I'll see how much that helps. Odds are I'm going to have to move the
device deletion into a separate thread. That should give me a natural
boundary to queue up deletions at, which should fix the tunnel-flap and
partial tunnel-flap cases I'm worried about. At some point I have to
figure out how to get my API needs met by the in-kernel L2TP code, but
that's a worry for another day.
> sysfs feature wise has now settled down, and the regressions have all
> been stamped out so now should be a good time to work on scaling.
>
> I still have some preliminary patches in my tree, that I will dig up
> as time goes by.
I should have some time this evening to run a few tests, and hopefully can
post some results.
-ben
^ permalink raw reply
* Re: [PATCH] net: allow netdev_wait_allrefs() to run faster
From: Eric W. Biederman @ 2010-08-09 21:17 UTC (permalink / raw)
To: Benjamin LaHaise
Cc: Ben Greear, Eric Dumazet, Octavian Purdila, netdev, Cosmin Ratiu
In-Reply-To: <20100809210311.GW30010@kvack.org>
Benjamin LaHaise <bcrl@lhnet.ca> writes:
> On Mon, Aug 09, 2010 at 12:59:14PM -0700, Eric W. Biederman wrote:
>> The network device deletion batching code has gone in, which is
>> a big help, as have some dev_put deletions, so we hit that 250ms
>> delay less often.
>
> I'll see how much that helps. Odds are I'm going to have to move the
> device deletion into a separate thread. That should give me a natural
> boundary to queue up deletions at, which should fix the tunnel-flap and
> partial tunnel-flap cases I'm worried about. At some point I have to
> figure out how to get my API needs met by the in-kernel L2TP code, but
> that's a worry for another day.
In case it is useful, if you delete a network namespace in general
all of the network device deletions can be batched.
Eric
^ permalink raw reply
* Re: [RFC] [PATCH] Don't destroy TCP sockets twice
From: Herbert Xu @ 2010-08-09 21:30 UTC (permalink / raw)
To: Andi Kleen; +Cc: netdev
In-Reply-To: <20100806110511.GA16448@basil.fritz.box>
Andi Kleen <andi@firstfloor.org> wrote:
>
> While working on something else I noticed that tcp_v4/6_destroy_sock()
> can get called twice on a socket. This happens because when a reset or
> similar happens tcp_done destroys the connection socket state, and
> then eventually when the socket is released it is destroyed again.
I'm still having problems understanding why you're getting a call
to send a FIN after tcp_done. This shouldn't happen at all because
tcp_done moves the socket to the TCP_CLOSE state, where FINs should
not be sent.
Can you clarify on how we can reproduce this problem in the
upstream kernel?
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: Yet another bridge netfilter crash
From: Herbert Xu @ 2010-08-09 21:42 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Stephen Hemminger, netdev
In-Reply-To: <4C599A6A.6050202@trash.net>
On Wed, Aug 04, 2010 at 06:50:50PM +0200, Patrick McHardy wrote:
.
> >> Until we come up with something better the best fix seems to
> >> be to perform the device lookup based on the iif.
> >
> > I don't think we can as the iif will point to the bridge device.
> > The physindev contains the original physical device where the
> > packet came in.
>
> If it originally points to the bridge device, there doesn't
> seem anything wrong with the device pointing to the bridge
> device after reassembly. Am I missing something?
It's there so that netfilter rules can filter based on the original
inbound interface.
If you set it to the bridge then those rules won't work anymore.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [PATCH 4/6] au1000-eth: fix bad printk usages
From: Joe Perches @ 2010-08-09 22:17 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, David Miller
In-Reply-To: <201008092203.41338.florian@openwrt.org>
On Mon, 2010-08-09 at 22:03 +0200, Florian Fainelli wrote:
> Use pr_(info|err) and pr_cont where required instead of calls to printk.
>
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
> ---
> diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
> index 9a0515d..f8f1f5e 100644
> --- a/drivers/net/au1000_eth.c
> +++ b/drivers/net/au1000_eth.c
> @@ -732,24 +732,25 @@ static int au1000_rx(struct net_device *dev)
> netif_rx(skb); /* pass the packet to upper layers */
> } else {
> if (au1000_debug > 4) {
> + pr_err("rx_error: ");
This should be:
pr_err("rx_error(s):");
> if (status & RX_MISSED_FRAME)
> - printk("rx miss\n");
> + pr_cont("rx miss\n");
These blocks should be "pr_cont(" value");
with a leading space and without the "\n"
> if (status & RX_WDOG_TIMER)
> - printk("rx wdog\n");
> + pr_cont("rx wdog\n");
[etc]
> if (status & RX_U_CNTRL_FRAME)
> - printk("rx u control frame\n");
> + pr_cont("rx u control frame\n");
and finally a pr_cont("\n");
It'd also be good to add
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
before any #include
^ permalink raw reply
* [PATCH 1/2] pkt_sched: sch_sfq: Add dummy unbind_tcf and put handles. Was: [PATCH] sfq: add dummy bind/unbind handles
From: Jarek Poplawski @ 2010-08-09 22:18 UTC (permalink / raw)
To: Franchoze Eric; +Cc: David Miller, shemminger, netdev
Franchoze Eric wrote, On 08/09/2010 05:01 PM:
>
> 08.08.10, 11:04, "Jarek Poplawski" <jarkao2@gmail.com>:
>
>> David Miller wrote, On 08.08.2010 07:45:
...
>> > Agreed, I can't see a way that unbind can ever be invoked
>> > if the bind call always returns zero.
>>
>> To tell the truth, I think unbind should be implemented anyway,
>> just for consistency, safety, and easier verification. But, looking
>> at a similar case of .get and .put in the same driver, Patrick
>> seemed to do it purposely, so I expected some discussion about the
>> rules yet, and made it minimal to ease merging to older kernels.
...
>
> As for me it's better to add unbind now that get unexpected null derefance in future with API changing...
Here is my proposal which adds both unbind and put, plus some early
verification (the next patch). Of course, there is still Stephen's
alternative with later checks.
Jarek P.
----------------->
Add dummy .unbind_tcf and .put qdisc class ops for easier verification.
(All other schedulers have it like this.)
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 534f332..d8e0ae5 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -519,6 +519,10 @@ static unsigned long sfq_bind(struct Qdisc *sch, unsigned long parent,
return 0;
}
+static void sfq_put(struct Qdisc *q, unsigned long cl)
+{
+}
+
static struct tcf_proto **sfq_find_tcf(struct Qdisc *sch, unsigned long cl)
{
struct sfq_sched_data *q = qdisc_priv(sch);
@@ -572,8 +576,10 @@ static void sfq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
static const struct Qdisc_class_ops sfq_class_ops = {
.get = sfq_get,
+ .put = sfq_put,
.tcf_chain = sfq_find_tcf,
.bind_tcf = sfq_bind,
+ .unbind_tcf = sfq_put,
.dump = sfq_dump_class,
.dump_stats = sfq_dump_class_stats,
.walk = sfq_walk,
^ permalink raw reply related
* [PATCH 2/2] pkt_sched: Add some basic qdisc class ops verification. Was: [PATCH] sfq: add dummy bind/unbind handles
From: Jarek Poplawski @ 2010-08-09 22:18 UTC (permalink / raw)
To: Franchoze Eric; +Cc: David Miller, shemminger, netdev
Verify in register_qdisc() some basic qdisc class handlers are present.
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index b9e8c3b..8ed2f56 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -150,22 +150,34 @@ int register_qdisc(struct Qdisc_ops *qops)
if (qops->enqueue == NULL)
qops->enqueue = noop_qdisc_ops.enqueue;
if (qops->peek == NULL) {
- if (qops->dequeue == NULL) {
+ if (qops->dequeue == NULL)
qops->peek = noop_qdisc_ops.peek;
- } else {
- rc = -EINVAL;
- goto out;
- }
+ else
+ goto out_einval;
}
if (qops->dequeue == NULL)
qops->dequeue = noop_qdisc_ops.dequeue;
+ if (qops->cl_ops) {
+ const struct Qdisc_class_ops *cops = qops->cl_ops;
+
+ if (!(cops->get && cops->put))
+ goto out_einval;
+
+ if (cops->tcf_chain && !(cops->bind_tcf && cops->unbind_tcf))
+ goto out_einval;
+ }
+
qops->next = NULL;
*qp = qops;
rc = 0;
out:
write_unlock(&qdisc_mod_lock);
return rc;
+
+out_einval:
+ rc = -EINVAL;
+ goto out;
}
EXPORT_SYMBOL(register_qdisc);
^ permalink raw reply related
* [PATCH] usbnet: rx_submit() should return an error code.
From: Elly Jones @ 2010-08-09 22:37 UTC (permalink / raw)
To: Oliver Neukum
Cc: Alan Stern, David Miller, netdev-u79uwXL29TY76Z2rM5mHXA, USB list,
Jason Glasgow
This patch makes rx_submit() return an error code, and makes some call sites
that care check the return value. This is important because it lets us properly
handle cases where the device isn't ready to handle URB submissions (e.g., when
it is autosuspended under some drivers); previously, we would attempt and fail
to submit URBs and reschedule ourselves to try and fail again. This patch is
against Linus's 2.6 repo commit 45d7f32c7a43cbb9592886d38190e379e2eb2226.
Signed-Off-By: Elizabeth Jones <ellyjones-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
---
drivers/net/usb/usbnet.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3b03794..82a992a 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -315,7 +315,7 @@ EXPORT_SYMBOL_GPL(usbnet_defer_kevent);
static void rx_complete (struct urb *urb);
-static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
+static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
{
struct sk_buff *skb;
struct skb_data *entry;
@@ -327,7 +327,7 @@ static void rx_submit (struct usbnet *dev, struct
urb *urb, gfp_t flags)
netif_dbg(dev, rx_err, dev->net, "no rx skb\n");
usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
usb_free_urb (urb);
- return;
+ return -ENOMEM;
}
skb_reserve (skb, NET_IP_ALIGN);
@@ -357,6 +357,9 @@ static void rx_submit (struct usbnet *dev, struct
urb *urb, gfp_t flags)
netif_dbg(dev, ifdown, dev->net, "device gone\n");
netif_device_detach (dev->net);
break;
+ case -EHOSTUNREACH:
+ retval = -ENOLINK;
+ break;
default:
netif_dbg(dev, rx_err, dev->net,
"rx submit, %d\n", retval);
@@ -374,6 +377,7 @@ static void rx_submit (struct usbnet *dev, struct
urb *urb, gfp_t flags)
dev_kfree_skb_any (skb);
usb_free_urb (urb);
}
+ return retval;
}
@@ -912,6 +916,7 @@ fail_halt:
/* tasklet could resubmit itself forever if memory is tight */
if (test_bit (EVENT_RX_MEMORY, &dev->flags)) {
struct urb *urb = NULL;
+ int resched = 1;
if (netif_running (dev->net))
urb = usb_alloc_urb (0, GFP_KERNEL);
@@ -922,10 +927,12 @@ fail_halt:
status = usb_autopm_get_interface(dev->intf);
if (status < 0)
goto fail_lowmem;
- rx_submit (dev, urb, GFP_KERNEL);
+ if (rx_submit (dev, urb, GFP_KERNEL) == -ENOLINK)
+ resched = 0;
usb_autopm_put_interface(dev->intf);
fail_lowmem:
- tasklet_schedule (&dev->bh);
+ if (resched)
+ tasklet_schedule (&dev->bh);
}
}
@@ -1176,7 +1183,9 @@ static void usbnet_bh (unsigned long param)
for (i = 0; i < 10 && dev->rxq.qlen < qlen; i++) {
urb = usb_alloc_urb (0, GFP_ATOMIC);
if (urb != NULL)
- rx_submit (dev, urb, GFP_ATOMIC);
+ if (rx_submit (dev, urb, GFP_ATOMIC)
+ == -ENOLINK)
+ return;
}
if (temp != dev->rxq.qlen)
netif_dbg(dev, link, dev->net,
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox