* Re: [PATCH] net: allow netdev_wait_allrefs() to run faster
From: Ben Greear @ 2010-08-09 17:23 UTC (permalink / raw)
To: Benjamin LaHaise
Cc: Eric W. Biederman, Eric Dumazet, Octavian Purdila, netdev,
Cosmin Ratiu
In-Reply-To: <20091029233848.GV3141@kvack.org>
On 10/29/2009 04:38 PM, Benjamin LaHaise wrote:
> On Thu, Oct 29, 2009 at 04:07:18PM -0700, Eric W. Biederman wrote:
>> Could you keep me in the loop with that. I have some pending cleanups for
>> all of those pieces of code and may be able to help/advice/review.
>
> Here are the sysfs scaling improvements. I have to break them up, as there
> are 3 separate changes in this patch: 1. use an rbtree for name lookup in
> sysfs, 2. keep track of the number of directories for the purpose of
> generating the link count, as otherwise too much cpu time is spent in
> sysfs_count_nlink when new entries are added, and 3. when adding a new
> sysfs_dirent, walk the list backwards when linking it in, as higher
> numbered inodes tend to be at the end of the list, not the beginning.
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.
Specifically, there is still that msleep(250) in
netdev_wait_allrefs
Is anyone still trying to get the improvements needed for adding/deleting
lots of interfaces into the kernel?
Thanks,
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: Ben Greear @ 2010-08-09 17:44 UTC (permalink / raw)
To: Benjamin LaHaise
Cc: Eric W. Biederman, Eric Dumazet, Octavian Purdila, netdev,
Cosmin Ratiu
In-Reply-To: <20100809173429.GR30010@kvack.org>
On 08/09/2010 10:34 AM, Benjamin LaHaise wrote:
> 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.
>
> 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. :-/
>
> Btw, one thing I noticed but haven't been able to come up with a fix for
> yet is that iptables has scaling issues with lots of interfaces.
> Specifically, we had to start adding one iptables rule per interface for smtp
> filtering (not all subscribers are permitted to send smtp directly out to
> the net, so it has to be per-interface). It seems that those all get
> dumped into a giant list. What I'd like to do is to be able to attach rules
> directly to the interface, but I haven't really had the time to do a mergable
> set of changes for that. Thoughts anyone?
We also have a few rules per interface, and notice that it takes around 10ms
per rule when we are removing them, even when using batching in 'ip':
This is on a high-end core i7, otherwise lightly loaded.
Total IPv4 rule listings: 2097
Cleaning 2094 rules with ip -batch...
time -p ip -4 -force -batch /tmp/crr_batch_cmds_4.txt
real 17.81
user 0.05
sys 0.00
Patrick thought had an idea, but I don't think he had time to
look at it further:
"Its probably the synchronize_rcu() in fib_nl_delrule() and
the route flushing happening after rule removal."
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Missing device binding relating to tcp_v4_send_reset?
From: Ben Greear @ 2010-08-09 17:46 UTC (permalink / raw)
To: NetDev, Patrick McHardy
This snippet is from some patches Patrick did for me some time
back. I think the rest of his work has been merged upstream, but
this patch was not. I'm honestly not sure if it's needed or not,
but we've been running with it for at least a year or so and it's
been working fine for us.
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 0207662..1af47db 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -641,6 +641,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
arg.iov[0].iov_len, IPPROTO_TCP, 0);
arg.csumoffset = offsetof(struct tcphdr, check) / 2;
arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0;
+ arg.bound_dev_if = skb_rtable(skb)->fl.iif;
net = dev_net(skb_dst(skb)->dev);
ip_send_reply(net->ipv4.tcp_sock, skb,
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply related
* Re: [PATCH] net: allow netdev_wait_allrefs() to run faster
From: Benjamin LaHaise @ 2010-08-09 17:48 UTC (permalink / raw)
To: Ben Greear
Cc: Eric W. Biederman, Eric Dumazet, Octavian Purdila, netdev,
Cosmin Ratiu
In-Reply-To: <4C603E6E.1060309@candelatech.com>
On Mon, Aug 09, 2010 at 10:44:14AM -0700, Ben Greear wrote:
> We also have a few rules per interface, and notice that it takes around 10ms
> per rule when we are removing them, even when using batching in 'ip':
...
> Patrick thought had an idea, but I don't think he had time to
> look at it further:
>
> "Its probably the synchronize_rcu() in fib_nl_delrule() and
> the route flushing happening after rule removal."
Yes, that would be a problem, but the issue is deeper than that -- if I'm
not mistaken it's on the packet processing path that iptables doesn't scale
for 100k interfaces with 1 rule per interface. It's been a while since I
ran the tests, but I don't think it's changed much.
-ben
^ permalink raw reply
* Re: [PATCH] net: allow netdev_wait_allrefs() to run faster
From: Benjamin LaHaise @ 2010-08-09 17:34 UTC (permalink / raw)
To: Ben Greear
Cc: Eric W. Biederman, Eric Dumazet, Octavian Purdila, netdev,
Cosmin Ratiu
In-Reply-To: <4C603999.1030801@candelatech.com>
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.
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. :-/
Btw, one thing I noticed but haven't been able to come up with a fix for
yet is that iptables has scaling issues with lots of interfaces.
Specifically, we had to start adding one iptables rule per interface for smtp
filtering (not all subscribers are permitted to send smtp directly out to
the net, so it has to be per-interface). It seems that those all get
dumped into a giant list. What I'd like to do is to be able to attach rules
directly to the interface, but I haven't really had the time to do a mergable
set of changes for that. Thoughts anyone?
-ben
^ permalink raw reply
* Re: [PATCH] net: allow netdev_wait_allrefs() to run faster
From: Ben Greear @ 2010-08-09 18:03 UTC (permalink / raw)
To: Benjamin LaHaise
Cc: Eric W. Biederman, Eric Dumazet, Octavian Purdila, netdev,
Cosmin Ratiu
In-Reply-To: <20100809174856.GS30010@kvack.org>
On 08/09/2010 10:48 AM, Benjamin LaHaise wrote:
> On Mon, Aug 09, 2010 at 10:44:14AM -0700, Ben Greear wrote:
>> We also have a few rules per interface, and notice that it takes around 10ms
>> per rule when we are removing them, even when using batching in 'ip':
> ...
>> Patrick thought had an idea, but I don't think he had time to
>> look at it further:
>>
>> "Its probably the synchronize_rcu() in fib_nl_delrule() and
>> the route flushing happening after rule removal."
>
> Yes, that would be a problem, but the issue is deeper than that -- if I'm
> not mistaken it's on the packet processing path that iptables doesn't scale
> for 100k interfaces with 1 rule per interface. It's been a while since I
> ran the tests, but I don't think it's changed much.
It would be nice to tie the rules based on 'iif' to a specific
interface. Seems it should give near constant time lookup for rules
if we only have a few per interface....
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [patch 2/2] qlcnic: using too much stack
From: Dan Carpenter @ 2010-08-09 18:42 UTC (permalink / raw)
To: Anirban Chakraborty
Cc: Amit Salecha, Linux Driver, David S. Miller, Sucheta Chakraborty,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
In-Reply-To: <0081C370-65E2-434F-BBC6-C688F6F39750@qlogic.com>
On Mon, Aug 09, 2010 at 09:46:32AM -0700, Anirban Chakraborty wrote:
>
> It looks fine except that I'd use kzalloc instead of kcalloc above.
>
It's no problem to do that, and I'm already respinning the patches but
I'm confused. It looks like pci_info gets initialized correctly. What
am I missing?
regards,
dan carpenter
> thanks,
> -Anirban
^ permalink raw reply
* [net-next] net: Use NET_XMIT_SUCCESS where possible.
From: Ben Greear @ 2010-08-09 18:43 UTC (permalink / raw)
To: netdev; +Cc: Ben Greear
This is based on work originally done by Patric McHardy.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 e114f23... 3406627... M net/sched/sch_atm.c
:100644 100644 c657628... a5a2915... M net/sched/sch_sfq.c
:100644 100644 0991c64... 641a30d... M net/sched/sch_tbf.c
:100644 100644 807643b... feaabc1... M net/sched/sch_teql.c
net/sched/sch_atm.c | 4 ++--
net/sched/sch_sfq.c | 2 +-
net/sched/sch_tbf.c | 4 ++--
net/sched/sch_teql.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index e114f23..3406627 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -418,7 +418,7 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
}
ret = qdisc_enqueue(skb, flow->q);
- if (ret != 0) {
+ if (ret != NET_XMIT_SUCCESS) {
drop: __maybe_unused
if (net_xmit_drop_count(ret)) {
sch->qstats.drops++;
@@ -442,7 +442,7 @@ drop: __maybe_unused
*/
if (flow == &p->link) {
sch->q.qlen++;
- return 0;
+ return NET_XMIT_SUCCESS;
}
tasklet_schedule(&p->task);
return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index c657628..a5a2915 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -323,7 +323,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
if (++sch->q.qlen <= q->limit) {
sch->bstats.bytes += qdisc_pkt_len(skb);
sch->bstats.packets++;
- return 0;
+ return NET_XMIT_SUCCESS;
}
sfq_drop(sch);
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index 0991c64..641a30d 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -127,7 +127,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
return qdisc_reshape_fail(skb, sch);
ret = qdisc_enqueue(skb, q->qdisc);
- if (ret != 0) {
+ if (ret != NET_XMIT_SUCCESS) {
if (net_xmit_drop_count(ret))
sch->qstats.drops++;
return ret;
@@ -136,7 +136,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
sch->q.qlen++;
sch->bstats.bytes += qdisc_pkt_len(skb);
sch->bstats.packets++;
- return 0;
+ return NET_XMIT_SUCCESS;
}
static unsigned int tbf_drop(struct Qdisc* sch)
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 807643b..feaabc1 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -85,7 +85,7 @@ teql_enqueue(struct sk_buff *skb, struct Qdisc* sch)
__skb_queue_tail(&q->q, skb);
sch->bstats.bytes += qdisc_pkt_len(skb);
sch->bstats.packets++;
- return 0;
+ return NET_XMIT_SUCCESS;
}
kfree_skb(skb);
--
1.6.2.5
^ permalink raw reply related
* Question: Is multipath routing supported for IPv6
From: Mahesh Kelkar @ 2010-08-09 18:48 UTC (permalink / raw)
To: netdev
I tried configuring multipath Ipv6 route using "iproute2" tool and it failed:
> ip route add 143:2:3:4::/64 nexthop dev eth0
RTNETLINK answers: No such device
Same Command works for Ipv4. I looked into the source code and I don't
see support for RTA_MULTIPATH in IPV6 codebase.
I wonder if netlink configuration part is missing, or entire support
for multipath is missing. Is there any historical reason for not
supporting it?
Thanks
Mahesh
^ permalink raw reply
* [net-next] net: More verbose message for too-many-orphans.
From: Ben Greear @ 2010-08-09 19:00 UTC (permalink / raw)
To: netdev; +Cc: Ben Greear
The original message doesn't give much clue as to what
is actually going wrong or how to fix it.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 808bb92... 96a7ec2... M net/ipv4/tcp_timer.c
net/ipv4/tcp_timer.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 808bb92..96a7ec2 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -79,7 +79,11 @@ static int tcp_out_of_resources(struct sock *sk, int do_reset)
if (tcp_too_many_orphans(sk, orphans)) {
if (net_ratelimit())
- printk(KERN_INFO "Out of socket memory\n");
+ printk(KERN_INFO "Out of socket memory, orphans: %d/%d"
+ " tcp_memory_allocated: %d/%d\n",
+ orphans, sysctl_tcp_max_orphans,
+ atomic_read(&tcp_memory_allocated),
+ sysctl_tcp_mem[2]);
/* Catch exceptional cases, when connection requires reset.
* 1. Last segment was sent recently. */
--
1.6.2.5
^ permalink raw reply related
* [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
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