* Re: [PATCH 2.6.30-rc4] r8169: avoid losing MSI interrupts
From: David Dillow @ 2009-08-22 20:43 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Michael Riepe, Michael Buesch, Francois Romieu, Rui Santos,
Michael Büker, linux-kernel, netdev
In-Reply-To: <m18whcf3w2.fsf@fess.ebiederm.org>
On Sat, 2009-08-22 at 05:07 -0700, Eric W. Biederman wrote:
> ebiederm@xmission.com (Eric W. Biederman) writes:
>
> > David Dillow <dave@thedillows.org> writes:
> >
> >>
> >> Re-looking at the code, I'd guess that some IRQ status line is getting
> >> stuck high, but I don't see why -- we should acknowledge all outstanding
> >> interrupts each time through the loop, whether we care about them or
> >> not.
> >>
> >> Could reproduce a problem with the following patch applied, and send the
> >> full dmesg, please?
> >
> > Here is what I get.
> >
> > r8169 screaming irq status 00000085 mask 0000ffff event 0000803f napi 0000001d
>
> And now that the machine has come out of it, that was followed by:
> Looks like the soft lockup did not manage to trigger in this case.
I need some more context, please. What is the network load through this
NIC when you have the issues? Light, heavy? Can you give me more details
about the machine? A full dmesg from boot until this happens would help
quite a bit. At a minimum it would help answer which version of the chip
we're dealing with and what the machine it is in looks like.
Can you reproduce this with pci=nomsi? I'm assuming it the chip running
in MSI mode.
Also, can you reproduce it when booting UP (or maxcpus=1)? I'm thinking
about a race between rtl8169_interrupt() and rtl8169_poll(), but it
isn't jumping out at me.
Also, I'm having connectivity troubles this weekend, so my response may
be spotty. :(
^ permalink raw reply
* Re: [PATCH -next 1/8] bnx2: Zero out status block before chip reset.
From: David Miller @ 2009-08-23 0:50 UTC (permalink / raw)
To: mchan; +Cc: netdev
In-Reply-To: <1250907650-24672-1-git-send-email-mchan@broadcom.com>
All of these patches look good, applied to net-next-2.6
Thanks!
^ permalink raw reply
* Re: [PATCH 1/2]: pkt_sched: Convert qdisc_watchdog to tasklet_hrtimer
From: David Miller @ 2009-08-23 0:54 UTC (permalink / raw)
To: jarkao2; +Cc: netdev, tglx
In-Reply-To: <4A8FDECF.3040601@gmail.com>
From: Jarek Poplawski <jarkao2@gmail.com>
Date: Sat, 22 Aug 2009 14:04:31 +0200
> David Miller wrote, On 08/22/2009 02:03 AM:
>
>> None of this stuff should execute in hw IRQ context, therefore
>> use a tasklet_hrtimer so that it runs in softirq context.
>
> Do you mean __netif_schedule()?
No, that works fine from HW irq context.
> Could you explain it more?
It's that throttled flag bit setting. It's still unsafe but at least
we're in a position now to use softirq locking or atomic bitops to
maintain it properly.
^ permalink raw reply
* Re: [PATCH 2/2]: pkt_sched: Convert CBQ to tasklet_hrtimer.
From: David Miller @ 2009-08-23 1:08 UTC (permalink / raw)
To: tglx; +Cc: netdev
In-Reply-To: <alpine.LFD.2.00.0908221041290.1769@localhost.localdomain>
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sat, 22 Aug 2009 11:17:53 +0200 (CEST)
> On Fri, 21 Aug 2009, David Miller wrote:
>> This code expects to run in softirq context, and bare hrtimers
>> run in hw IRQ context.
>>
>> Signed-off-by: David S. Miller <davem@davemloft.net>
>
>> @@ -510,12 +512,12 @@ static void cbq_ovl_delay(struct cbq_class *cl)
>>
>> expires = ktime_set(0, 0);
>> expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched));
>> - if (hrtimer_try_to_cancel(&q->delay_timer) &&
>> - ktime_to_ns(ktime_sub(
>> - hrtimer_get_expires(&q->delay_timer),
>> - expires)) > 0)
>> - hrtimer_set_expires(&q->delay_timer, expires);
>> - hrtimer_restart(&q->delay_timer);
>> + ht = &q->delay_timer.timer;
>> + if (hrtimer_try_to_cancel(ht) &&
>> + ktime_to_ns(ktime_sub(hrtimer_get_expires(ht),
>> + expires)) > 0)
>> + hrtimer_set_expires(ht, expires);
>> + hrtimer_restart(ht);
>
> This code looks still wrong.
I'm not convinced either way, the code logic here has been like
this since at least 2.2.x, where it reads:
if (!cl->delayed) {
unsigned long sched = jiffies;
...
if (delay > 0) {
sched += PSCHED_US2JIFFIE(delay) + cl->penalty;
...
if (del_timer(&q->delay_timer) &&
(long)(q->delay_timer.expires - sched) > 0)
q->delay_timer.expires = sched;
add_timer(&q->delay_timer);
And what we have there now is a conversion to hrtimers. The intention
to always schedule the timer is very clear in the above code snippet.
Furthermore, fixing this logic is a seperate change from dealing with
the softirq context issue.
So please review my patch in the context of a straight conversion to
tasklet_hrtimer, and let's deal with the timer offset logic here
seperately (and in -next, not 2.6.31-rcX)
Thanks.
^ permalink raw reply
* Re: [PATCH 1/2]: pkt_sched: Convert qdisc_watchdog to tasklet_hrtimer
From: David Miller @ 2009-08-23 1:08 UTC (permalink / raw)
To: tglx; +Cc: netdev
In-Reply-To: <alpine.LFD.2.00.0908221040450.1769@localhost.localdomain>
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sat, 22 Aug 2009 10:41:18 +0200 (CEST)
> On Fri, 21 Aug 2009, David Miller wrote:
>
>>
>> None of this stuff should execute in hw IRQ context, therefore
>> use a tasklet_hrtimer so that it runs in softirq context.
>>
>> Signed-off-by: David S. Miller <davem@davemloft.net>
>
> Acked-by: Thomas Gleixner <tglx@linutronix.de>
Thanks for reviewing.
^ permalink raw reply
* Re: E100 RX ring buffers continued...
From: David Miller @ 2009-08-23 1:15 UTC (permalink / raw)
To: khc
Cc: netdev, jeffrey.t.kirsher, jesse.brandeburg, bruce.w.allan,
peter.p.waskiewicz.jr, john.ronciak
In-Reply-To: <m38whchrer.fsf@intrepid.localdomain>
From: Krzysztof Halasa <khc@pm.waw.pl>
Date: Sat, 22 Aug 2009 16:09:00 +0200
> E100 RX buffers seem more problematic than I though. The descriptor
> doesn't contain the address of the data buffer. Instead, the
> descriptor is to be followed by the data buffer immediately. It's
> not only the driver invention :-(
I'm happy we can now see now why nobody has "fixed" this for more than
15 years :-)
I think going down the road of trying to use the flexible mode is a
dead end. I doubt any other OS driver is using it, and that means
that there are likely many other errata hiding in the bushes which you
will unearth by trying to use this new descriptor mode. And it won't
show up when you test it, it will show up when some random person in
some remote data center somewhere updates their kernel, and they won't
send us a bug report, they'll replace their card or downgrade their
kernel instead.
And that's why it's inappropiate to approach this problem in this way
for a driver this old, and for hardware that's been around so long.
Just make the driver use consistent buffers for RX, and when packets
arrive an SKB is allocated and the packet data is copied into the SKB
from the consistent buffer.
And for 2.6.31-rcX we probably have to simply revert your change.
^ permalink raw reply
* Re: [PATCH 2/2]: pkt_sched: Convert CBQ to tasklet_hrtimer.
From: Thomas Gleixner @ 2009-08-23 7:22 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20090822.180836.34851176.davem@davemloft.net>
B1;2005;0cOn Sat, 22 Aug 2009, David Miller wrote:
> From: Thomas Gleixner <tglx@linutronix.de>
> Date: Sat, 22 Aug 2009 11:17:53 +0200 (CEST)
>
> > On Fri, 21 Aug 2009, David Miller wrote:
> >> This code expects to run in softirq context, and bare hrtimers
> >> run in hw IRQ context.
> >>
> >> Signed-off-by: David S. Miller <davem@davemloft.net>
> >
> >> @@ -510,12 +512,12 @@ static void cbq_ovl_delay(struct cbq_class *cl)
> >>
> >> expires = ktime_set(0, 0);
> >> expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched));
> >> - if (hrtimer_try_to_cancel(&q->delay_timer) &&
> >> - ktime_to_ns(ktime_sub(
> >> - hrtimer_get_expires(&q->delay_timer),
> >> - expires)) > 0)
> >> - hrtimer_set_expires(&q->delay_timer, expires);
> >> - hrtimer_restart(&q->delay_timer);
> >> + ht = &q->delay_timer.timer;
> >> + if (hrtimer_try_to_cancel(ht) &&
> >> + ktime_to_ns(ktime_sub(hrtimer_get_expires(ht),
> >> + expires)) > 0)
> >> + hrtimer_set_expires(ht, expires);
> >> + hrtimer_restart(ht);
> >
> > This code looks still wrong.
>
> I'm not convinced either way, the code logic here has been like
> this since at least 2.2.x, where it reads:
>
> if (!cl->delayed) {
> unsigned long sched = jiffies;
> ...
> if (delay > 0) {
> sched += PSCHED_US2JIFFIE(delay) + cl->penalty;
> ...
> if (del_timer(&q->delay_timer) &&
> (long)(q->delay_timer.expires - sched) > 0)
> q->delay_timer.expires = sched;
> add_timer(&q->delay_timer);
That does not make more sense than the hrtimer version :)
> And what we have there now is a conversion to hrtimers. The intention
> to always schedule the timer is very clear in the above code snippet.
>
> Furthermore, fixing this logic is a seperate change from dealing with
> the softirq context issue.
Sure. Just mentioned it as a reminder.
> So please review my patch in the context of a straight conversion to
> tasklet_hrtimer, and let's deal with the timer offset logic here
> seperately (and in -next, not 2.6.31-rcX)
The straight conversion looks fine. Add my Acked-by.
Thanks,
tglx
^ permalink raw reply
* [PATCH 04/13] TProxy: split off ipv6 defragmentation to a separate module
From: Balazs Scheidler @ 2009-08-23 9:11 UTC (permalink / raw)
To: netfilter-devel, netdev
Like with IPv4, TProxy needs IP defragmentation but does not
require connection tracking. Since defragmentation was coupled
with conntrack, I split off the two, creating an nf_defrag_ipv6 module,
similar to the already existing nf_defrag_ipv4.
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
---
include/net/netfilter/ipv6/nf_defrag_ipv6.h | 6 ++
net/ipv6/netfilter/Makefile | 5 +-
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 58 +------------
net/ipv6/netfilter/nf_conntrack_reasm.c | 12 ++-
net/ipv6/netfilter/nf_defrag_ipv6_hooks.c | 109 ++++++++++++++++++++++++
5 files changed, 131 insertions(+), 59 deletions(-)
create mode 100644 include/net/netfilter/ipv6/nf_defrag_ipv6.h
create mode 100644 net/ipv6/netfilter/nf_defrag_ipv6_hooks.c
diff --git a/include/net/netfilter/ipv6/nf_defrag_ipv6.h b/include/net/netfilter/ipv6/nf_defrag_ipv6.h
new file mode 100644
index 0000000..94dd54d
--- /dev/null
+++ b/include/net/netfilter/ipv6/nf_defrag_ipv6.h
@@ -0,0 +1,6 @@
+#ifndef _NF_DEFRAG_IPV6_H
+#define _NF_DEFRAG_IPV6_H
+
+extern void nf_defrag_ipv6_enable(void);
+
+#endif /* _NF_DEFRAG_IPV6_H */
diff --git a/net/ipv6/netfilter/Makefile b/net/ipv6/netfilter/Makefile
index aafbba3..a78ee59 100644
--- a/net/ipv6/netfilter/Makefile
+++ b/net/ipv6/netfilter/Makefile
@@ -11,10 +11,11 @@ obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o
obj-$(CONFIG_IP6_NF_SECURITY) += ip6table_security.o
# objects for l3 independent conntrack
-nf_conntrack_ipv6-objs := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o nf_conntrack_reasm.o
+nf_conntrack_ipv6-objs := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o
+nf_defrag_ipv6-objs := nf_defrag_ipv6_hooks.o nf_conntrack_reasm.o
# l3 independent conntrack
-obj-$(CONFIG_NF_CONNTRACK_IPV6) += nf_conntrack_ipv6.o
+obj-$(CONFIG_NF_CONNTRACK_IPV6) += nf_conntrack_ipv6.o nf_defrag_ipv6.o
# matches
obj-$(CONFIG_IP6_NF_MATCH_AH) += ip6t_ah.o
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index 2a15c2d..158d14c 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -27,6 +27,7 @@
#include <net/netfilter/nf_conntrack_l3proto.h>
#include <net/netfilter/nf_conntrack_core.h>
#include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
+#include <net/netfilter/ipv6/nf_defrag_ipv6.h>
static bool ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff,
struct nf_conntrack_tuple *tuple)
@@ -183,34 +184,6 @@ out:
return nf_conntrack_confirm(skb);
}
-static unsigned int ipv6_defrag(unsigned int hooknum,
- struct sk_buff *skb,
- const struct net_device *in,
- const struct net_device *out,
- int (*okfn)(struct sk_buff *))
-{
- struct sk_buff *reasm;
-
- /* Previously seen (loopback)? */
- if (skb->nfct)
- return NF_ACCEPT;
-
- reasm = nf_ct_frag6_gather(skb);
-
- /* queued */
- if (reasm == NULL)
- return NF_STOLEN;
-
- /* error occured or not fragmented */
- if (reasm == skb)
- return NF_ACCEPT;
-
- nf_ct_frag6_output(hooknum, reasm, (struct net_device *)in,
- (struct net_device *)out, okfn);
-
- return NF_STOLEN;
-}
-
static unsigned int __ipv6_conntrack_in(struct net *net,
unsigned int hooknum,
struct sk_buff *skb,
@@ -263,13 +236,6 @@ static unsigned int ipv6_conntrack_local(unsigned int hooknum,
static struct nf_hook_ops ipv6_conntrack_ops[] __read_mostly = {
{
- .hook = ipv6_defrag,
- .owner = THIS_MODULE,
- .pf = PF_INET6,
- .hooknum = NF_INET_PRE_ROUTING,
- .priority = NF_IP6_PRI_CONNTRACK_DEFRAG,
- },
- {
.hook = ipv6_conntrack_in,
.owner = THIS_MODULE,
.pf = PF_INET6,
@@ -284,13 +250,6 @@ static struct nf_hook_ops ipv6_conntrack_ops[] __read_mostly = {
.priority = NF_IP6_PRI_CONNTRACK,
},
{
- .hook = ipv6_defrag,
- .owner = THIS_MODULE,
- .pf = PF_INET6,
- .hooknum = NF_INET_LOCAL_OUT,
- .priority = NF_IP6_PRI_CONNTRACK_DEFRAG,
- },
- {
.hook = ipv6_confirm,
.owner = THIS_MODULE,
.pf = PF_INET6,
@@ -362,10 +321,6 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6 __read_mostly = {
.nlattr_to_tuple = ipv6_nlattr_to_tuple,
.nla_policy = ipv6_nla_policy,
#endif
-#ifdef CONFIG_SYSCTL
- .ctl_table_path = nf_net_netfilter_sysctl_path,
- .ctl_table = nf_ct_ipv6_sysctl_table,
-#endif
.me = THIS_MODULE,
};
@@ -378,16 +333,12 @@ static int __init nf_conntrack_l3proto_ipv6_init(void)
int ret = 0;
need_conntrack();
+ nf_defrag_ipv6_enable();
- ret = nf_ct_frag6_init();
- if (ret < 0) {
- printk("nf_conntrack_ipv6: can't initialize frag6.\n");
- return ret;
- }
ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_tcp6);
if (ret < 0) {
printk("nf_conntrack_ipv6: can't register tcp.\n");
- goto cleanup_frag6;
+ return ret;
}
ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_udp6);
@@ -425,8 +376,6 @@ static int __init nf_conntrack_l3proto_ipv6_init(void)
nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_udp6);
cleanup_tcp:
nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_tcp6);
- cleanup_frag6:
- nf_ct_frag6_cleanup();
return ret;
}
@@ -438,7 +387,6 @@ static void __exit nf_conntrack_l3proto_ipv6_fini(void)
nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_icmpv6);
nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_udp6);
nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_tcp6);
- nf_ct_frag6_cleanup();
}
module_init(nf_conntrack_l3proto_ipv6_init);
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index f3aba25..b7b08fe 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -73,8 +73,8 @@ struct nf_ct_frag6_queue
static struct inet_frags nf_frags;
static struct netns_frags nf_init_frags;
-#ifdef CONFIG_SYSCTL
-struct ctl_table nf_ct_ipv6_sysctl_table[] = {
+#if defined(CONFIG_SYSCTL)
+struct ctl_table nf_ct_frag6_sysctl_table[] = {
{
.procname = "nf_conntrack_frag6_timeout",
.data = &nf_init_frags.timeout,
@@ -100,6 +100,8 @@ struct ctl_table nf_ct_ipv6_sysctl_table[] = {
},
{ .ctl_name = 0 }
};
+
+static struct ctl_table_header *nf_ct_frag6_sysctl_header = NULL;
#endif
static unsigned int nf_hashfn(struct inet_frag_queue *q)
@@ -675,11 +677,17 @@ int nf_ct_frag6_init(void)
inet_frags_init_net(&nf_init_frags);
inet_frags_init(&nf_frags);
+ if (!(nf_ct_frag6_sysctl_header = register_sysctl_paths(nf_net_netfilter_sysctl_path, nf_ct_frag6_sysctl_table))) {
+ return -ENOMEM;
+ }
return 0;
}
void nf_ct_frag6_cleanup(void)
{
+ unregister_sysctl_table(nf_ct_frag6_sysctl_header);
+ nf_ct_frag6_sysctl_header = NULL;
+
inet_frags_fini(&nf_frags);
nf_init_frags.low_thresh = 0;
diff --git a/net/ipv6/netfilter/nf_defrag_ipv6_hooks.c b/net/ipv6/netfilter/nf_defrag_ipv6_hooks.c
new file mode 100644
index 0000000..6f07971
--- /dev/null
+++ b/net/ipv6/netfilter/nf_defrag_ipv6_hooks.c
@@ -0,0 +1,109 @@
+/* (C) 1999-2001 Paul `Rusty' Russell
+ * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/types.h>
+#include <linux/ipv6.h>
+#include <linux/in6.h>
+#include <linux/netfilter.h>
+#include <linux/module.h>
+#include <linux/skbuff.h>
+#include <linux/icmp.h>
+#include <linux/sysctl.h>
+#include <net/ipv6.h>
+#include <net/inet_frag.h>
+
+#include <linux/netfilter_ipv6.h>
+#include <net/netfilter/nf_conntrack.h>
+#include <net/netfilter/nf_conntrack_helper.h>
+#include <net/netfilter/nf_conntrack_l4proto.h>
+#include <net/netfilter/nf_conntrack_l3proto.h>
+#include <net/netfilter/nf_conntrack_core.h>
+#include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
+#include <net/netfilter/ipv6/nf_defrag_ipv6.h>
+
+static unsigned int ipv6_defrag(unsigned int hooknum,
+ struct sk_buff *skb,
+ const struct net_device *in,
+ const struct net_device *out,
+ int (*okfn)(struct sk_buff *))
+{
+ struct sk_buff *reasm;
+
+ /* Previously seen (loopback)? */
+ if (skb->nfct)
+ return NF_ACCEPT;
+
+ reasm = nf_ct_frag6_gather(skb);
+
+ /* queued */
+ if (reasm == NULL)
+ return NF_STOLEN;
+
+ /* error occured or not fragmented */
+ if (reasm == skb)
+ return NF_ACCEPT;
+
+ nf_ct_frag6_output(hooknum, reasm, (struct net_device *)in,
+ (struct net_device *)out, okfn);
+
+ return NF_STOLEN;
+}
+
+static struct nf_hook_ops ipv6_defrag_ops[] = {
+ {
+ .hook = ipv6_defrag,
+ .owner = THIS_MODULE,
+ .pf = PF_INET6,
+ .hooknum = NF_INET_PRE_ROUTING,
+ .priority = NF_IP6_PRI_CONNTRACK_DEFRAG,
+ },
+ {
+ .hook = ipv6_defrag,
+ .owner = THIS_MODULE,
+ .pf = PF_INET6,
+ .hooknum = NF_INET_LOCAL_OUT,
+ .priority = NF_IP6_PRI_CONNTRACK_DEFRAG,
+ },
+};
+
+static int __init nf_defrag_init(void)
+{
+ int ret = 0;
+
+ ret = nf_ct_frag6_init();
+ if (ret < 0) {
+ printk("nf_conntrack_ipv6: can't initialize frag6.\n");
+ return ret;
+ }
+ ret = nf_register_hooks(ipv6_defrag_ops, ARRAY_SIZE(ipv6_defrag_ops));
+ if (ret < 0) {
+ printk("nf_defrag_ipv6: can't register hooks\n");
+ goto cleanup_frag6;
+ }
+ return ret;
+ cleanup_frag6:
+ nf_ct_frag6_cleanup();
+ return ret;
+
+}
+
+static void __exit nf_defrag_fini(void)
+{
+ nf_unregister_hooks(ipv6_defrag_ops, ARRAY_SIZE(ipv6_defrag_ops));
+ nf_ct_frag6_cleanup();
+}
+
+void nf_defrag_ipv6_enable(void)
+{
+}
+EXPORT_SYMBOL_GPL(nf_defrag_ipv6_enable);
+
+module_init(nf_defrag_init);
+module_exit(nf_defrag_fini);
+
+MODULE_LICENSE("GPL");
--
1.6.0.4
^ permalink raw reply related
* [PATCH 05/13] TProxy: added const specifiers to udp lookup functions
From: Balazs Scheidler @ 2009-08-23 9:16 UTC (permalink / raw)
To: netfilter-devel, netdev
The parameters for various UDP lookup functions were non-const, even though
they could be const. TProxy has some const references and instead of
downcasting it, I added const specifiers along the path.
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
---
net/ipv6/udp.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 33b59bd..9c9b24b 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -88,8 +88,8 @@ int udp_v6_get_port(struct sock *sk, unsigned short snum)
static inline int compute_score(struct sock *sk, struct net *net,
unsigned short hnum,
- struct in6_addr *saddr, __be16 sport,
- struct in6_addr *daddr, __be16 dport,
+ const struct in6_addr *saddr, __be16 sport,
+ const struct in6_addr *daddr, __be16 dport,
int dif)
{
int score = -1;
@@ -125,8 +125,8 @@ static inline int compute_score(struct sock *sk, struct net *net,
}
static struct sock *__udp6_lib_lookup(struct net *net,
- struct in6_addr *saddr, __be16 sport,
- struct in6_addr *daddr, __be16 dport,
+ const struct in6_addr *saddr, __be16 sport,
+ const struct in6_addr *daddr, __be16 dport,
int dif, struct udp_table *udptable)
{
struct sock *sk, *result;
--
1.6.0.4
^ permalink raw reply related
* r8189 mac address changes persist across reboot (was: duplicate MAC addresses)
From: Alan Jenkins @ 2009-08-23 10:14 UTC (permalink / raw)
To: Francois Romieu; +Cc: marty, linux-hotplug, netdev, linux-kernel
On 8/23/09, marty <marty@goodoldmarty.com> wrote:
> Greg KH wrote:
>> > On Tue, Aug 18, 2009 at 04:27:04PM -0400, marty wrote:
>>> >> I got trouble...
>>> >> (duplicate MAC addresses)
>> >
>> > That's a bug in your hardware, have you asked your manufacturer to
>> > resolve this for you? That violates the ethernet spec...
>
> I have resolved that problem as of today. I found this was caused
> by the software I had been using. If a hardware issue remains, it is moot.
>
> The bonding driver/utilities normally sets the bond address to the MAC of
> the
> first NIC. But it also set the MAC of the slave (eth3) to the MAC of the
> first
> NIC. This persists through reboots so that is how my MACs got duplicated.
>
> Resetting the MAC corrected those problems and everything works fine now.
>
> Marty B.
Hmm. <Documentation/networking/bonding.txt>
"To restore your slaves' MAC addresses, you need to detach them
from the bond (`ifenslave -d bond0 eth0'). The bonding driver will
then restore the MAC addresses that the slaves had before they were
enslaved."
In which case one would hope that a clean shutdown would restore the
MAC addresses in the same way as ifenslave -d.
I found that snippet via Google, which pointed me to the 2.4 version
of the same document [1]. It suggests that your hardware or driver is
a little unusual.
"To restore your slaves' MAC addresses, you need to detach them
from the bond (`ifenslave -d bond0 eth0'), set them down
(`ifconfig eth0 down'), unload the drivers (`rmmod 3c59x', for
example) and reload them to get the MAC addresses from their
eeproms."
So other drivers would not have this problem, because they always
reset the MAC address at load time. That would explain why the the
kernel doesn't bother resetting the MAC addresses on shutdown.
Looking at r8169.c confirms this. It doesn't appear to initialize the
MAC address register from elsewhere; it just uses the current value.
It will also report this initial value as the "permanent" MAC address,
which your report suggests is wrong. I think your problem is a bug in
r8169.
Francois, I found a datasheet for the 8139; it was claimed to be
similar and it does indeed appear so. The datasheet suggests that the
driver needs to provoke "auto-load" from the EEPROM at load time.
Could you please have a look at fixing this, so that MAC address
changes do not persist over a reboot?
Thanks
Alan
"1. Features
Uses 93C46 (64*16-bit EEPROM) to store resource
configuration, ID parameter, and VPD data
...
5. Register Descriptions
The RTL8139D(L) provides the following set of operational registers
mapped into PCI memory space or I/O space.
Offset R/W Tag
Description
0000h R/W IDR0 ID Register 0,
The ID register0-5 are only permitted to read/write by
4-byte access.
Read access can be byte, word, or double word access.
The initial value
is autoloaded from EEPROM EthernetID field.
...
5.9 9346CR: 93C46 Command Register
(Offset 0050h, R/W)
This register is used for issuing commands to the RTL8139D(L). These
commands are issued by setting the corresponding bits for the
function. A warm software reset along with individual reset and
enable/disable for transmitter and receiver are provided as well.
Bit R/W Symbol Description
7-6 R/W EEM1-0 Operating Mode: These 2 bits select the RTL8139D(L) operating
mode.
EEM1 EEM0 Operating Mode
0 0 Normal (RTL8139D(L) network/host communication
mode)
0 1 Auto-load: Entering this mode will make the
RTL8139D(L) load the contents of 93C46
like when the
RSTB signal is asserted. This
auto-load operation will
take about 2 ms. After it is
completed, the RTL8139D(L)
goes back to the normal mode
automatically (EEM1 =
EEM0 = 0) and all the other registers
are reset to default
values."
[1] Bonding mini-howto for 2.4 kernel
<http://www.kernel.org/pub/linux/kernel/people/marcelo/linux-2.4/Documentation/networking/bonding.txt>
^ permalink raw reply
* RX/TX bytes counter differences in eth0 and eth1 when using NAT
From: Jar @ 2009-08-23 10:32 UTC (permalink / raw)
To: netdev
Hello
It seems that RX/TX bytes counters doesn't increase at the same speed in
eth0 side than they do in eth1 side, even physically the same data which
is coming in via eth1 should be coming out via eth0. Is this excepted?
Kernel is 2.6.27.30-170.2.82.fc10.i686 and eth0 (lan) and eth1 (wan) and
there is iptables nat between lan and wan interfaces.
--
Best Regards, Jar
^ permalink raw reply
* Re: E100 RX ring buffers continued...
From: Krzysztof Halasa @ 2009-08-23 15:30 UTC (permalink / raw)
To: David Miller, Walt Holman
Cc: netdev, jeffrey.t.kirsher, jesse.brandeburg, bruce.w.allan,
peter.p.waskiewicz.jr, john.ronciak
In-Reply-To: <20090822.181552.152398363.davem@davemloft.net>
David Miller <davem@davemloft.net> writes:
> I think going down the road of trying to use the flexible mode is a
> dead end. I doubt any other OS driver is using it, and that means
> that there are likely many other errata hiding in the bushes which you
> will unearth by trying to use this new descriptor mode. And it won't
> show up when you test it, it will show up when some random person in
> some remote data center somewhere updates their kernel, and they won't
> send us a bug report, they'll replace their card or downgrade their
> kernel instead.
Well, I'm afraid it's a possible scenario. I won't touch the flexible
mode unless Intel folks tell me it's safe.
OTOH it seems it was used by less common software, at least in the
82557-9 times. Not sure about Windows driver.
(It seems the simplified mode was meant for Linux-alike "1 buffer per
packet" approach while the flexible mode was to support systems using
mbuf-like structures).
> Just make the driver use consistent buffers for RX, and when packets
> arrive an SKB is allocated and the packet data is copied into the SKB
>>From the consistent buffer.
That would be a performance hit, wouldn't it? Especially in older
machines, where e100 was typically installed. I think it should be the
last resort.
> And for 2.6.31-rcX we probably have to simply revert your change.
Unfortunately it seems that reverting will not fix operation completely
on a system with swiotlb (checking the descriptor status isn't the only
racy operation which depends on the cache behaviour, though it's the
most frequent). And it will break all non-coherent archs again, they
will either need to use the patch or still stick to (already removed)
eepro100.c
I looked at the eepro100.c sources. It uses BIDIR mapping the same way
as e100.c does, but then syncs using FROM_DEVICE/TO_DEVICE instead of
e100's always-BIDIR. I think the same in e100.c would work on all
platforms (though still violating the DMA API a bit). Perhaps we should
do that instead?
Walt, can you check if 2.6.30.5 with the following patch applied still
breaks e100 with the 6 GB of RAM, please? TIA.
(This patch makes swiotlb aware that the CPU didn't alter the buffer,
though I don't know if swiotlb will use this info).
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 014dfb6..53e8252 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1764,7 +1764,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
nic->ru_running = RU_SUSPENDED;
pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr,
sizeof(struct rfd),
- PCI_DMA_BIDIRECTIONAL);
+ PCI_DMA_FROMDEVICE);
return -ENODATA;
}
--
Krzysztof Halasa
^ permalink raw reply related
* Re: [PATCH 2.6.30-rc4] r8169: avoid losing MSI interrupts
From: Jarek Poplawski @ 2009-08-23 17:17 UTC (permalink / raw)
To: David Dillow
Cc: Eric W. Biederman, Michael Riepe, Michael Buesch, Francois Romieu,
Rui Santos, Michael Büker, linux-kernel, netdev,
Michal Soltys
In-Reply-To: <1250973787.3582.14.camel@obelisk.thedillows.org>
David Dillow wrote, On 08/22/2009 10:43 PM:
> On Sat, 2009-08-22 at 05:07 -0700, Eric W. Biederman wrote:
>> ebiederm@xmission.com (Eric W. Biederman) writes:
>>
>>> David Dillow <dave@thedillows.org> writes:
>>>
>>>> Re-looking at the code, I'd guess that some IRQ status line is getting
>>>> stuck high, but I don't see why -- we should acknowledge all outstanding
>>>> interrupts each time through the loop, whether we care about them or
>>>> not.
>>>>
>>>> Could reproduce a problem with the following patch applied, and send the
>>>> full dmesg, please?
>>> Here is what I get.
>>>
>>> r8169 screaming irq status 00000085 mask 0000ffff event 0000803f napi 0000001d
>> And now that the machine has come out of it, that was followed by:
>> Looks like the soft lockup did not manage to trigger in this case.
>
> I need some more context, please. What is the network load through this
> NIC when you have the issues? Light, heavy? Can you give me more details
> about the machine? A full dmesg from boot until this happens would help
> quite a bit. At a minimum it would help answer which version of the chip
> we're dealing with and what the machine it is in looks like.
>
> Can you reproduce this with pci=nomsi? I'm assuming it the chip running
> in MSI mode.
>
> Also, can you reproduce it when booting UP (or maxcpus=1)? I'm thinking
> about a race between rtl8169_interrupt() and rtl8169_poll(), but it
> isn't jumping out at me.
>
> Also, I'm having connectivity troubles this weekend, so my response may
> be spotty. :(
>
BTW, FYI, it seems Michal stopped tracking this problem, but he
found this commit problematic as well.
From: Michal Soltys <soltys@ziu.info>
Subject: Re: r8169 (+others ?) and note_interrupt performance hit on 2.6.30.x
Date: Wed, 05 Aug 2009 20:54:47 +0200
http://marc.info/?l=linux-netdev&m=124949848110710&w=2
Jarek P.
^ permalink raw reply
* Re: [PATCH 2.6.30-rc4] r8169: avoid losing MSI interrupts
From: Michal Soltys @ 2009-08-23 17:43 UTC (permalink / raw)
To: Jarek Poplawski
Cc: David Dillow, Eric W. Biederman, Michael Riepe, Michael Buesch,
Francois Romieu, Rui Santos, Michael Büker, linux-kernel,
netdev
In-Reply-To: <4A91799D.7090802@gmail.com>
Jarek Poplawski wrote:
> David Dillow wrote, On 08/22/2009 10:43 PM:
>
>> On Sat, 2009-08-22 at 05:07 -0700, Eric W. Biederman wrote:
>>> ebiederm@xmission.com (Eric W. Biederman) writes:
>>>
>>>> David Dillow <dave@thedillows.org> writes:
>>>>
>>>>> Re-looking at the code, I'd guess that some IRQ status line is getting
>>>>> stuck high, but I don't see why -- we should acknowledge all outstanding
>>>>> interrupts each time through the loop, whether we care about them or
>>>>> not.
>>>>>
>>>>> Could reproduce a problem with the following patch applied, and send the
>>>>> full dmesg, please?
>>>> Here is what I get.
>>>>
>>>> r8169 screaming irq status 00000085 mask 0000ffff event 0000803f napi 0000001d
>>> And now that the machine has come out of it, that was followed by:
>>> Looks like the soft lockup did not manage to trigger in this case.
>>
>> I need some more context, please. What is the network load through this
>> NIC when you have the issues? Light, heavy? Can you give me more details
>> about the machine? A full dmesg from boot until this happens would help
>> quite a bit. At a minimum it would help answer which version of the chip
>> we're dealing with and what the machine it is in looks like.
>>
>> Can you reproduce this with pci=nomsi? I'm assuming it the chip running
>> in MSI mode.
>>
>> Also, can you reproduce it when booting UP (or maxcpus=1)? I'm thinking
>> about a race between rtl8169_interrupt() and rtl8169_poll(), but it
>> isn't jumping out at me.
>>
>> Also, I'm having connectivity troubles this weekend, so my response may
>> be spotty. :(
>>
>
>
> BTW, FYI, it seems Michal stopped tracking this problem, but he
> found this commit problematic as well.
>
> From: Michal Soltys <soltys@ziu.info>
> Subject: Re: r8169 (+others ?) and note_interrupt performance hit on 2.6.30.x
> Date: Wed, 05 Aug 2009 20:54:47 +0200
> http://marc.info/?l=linux-netdev&m=124949848110710&w=2
>
Well - not really stopped, but not sure what to look at before that
particular commit (as cpu load for the tests I've done increased rather
significantly as well before that, and after 2.6.29 - but it doesn't
seem to be related to the driver). And I was away for over a week...
As fot the changes that commit introduced, here's is link to the mail
with the oprofile I did back then:
http://www.spinics.net/lists/netdev/msg102709.html
I'm happy to assist any way I can.
^ permalink raw reply
* Re: [PATCH 2.6.30-rc4] r8169: avoid losing MSI interrupts
From: Jarek Poplawski @ 2009-08-23 17:54 UTC (permalink / raw)
To: Michal Soltys
Cc: David Dillow, Eric W. Biederman, Michael Riepe, Michael Buesch,
Francois Romieu, Rui Santos, Michael Büker, linux-kernel,
netdev
In-Reply-To: <4A917FD8.6030201@ziu.info>
On Sun, Aug 23, 2009 at 07:43:52PM +0200, Michal Soltys wrote:
> Jarek Poplawski wrote:
>> David Dillow wrote, On 08/22/2009 10:43 PM:
>>
>>> On Sat, 2009-08-22 at 05:07 -0700, Eric W. Biederman wrote:
>>>> ebiederm@xmission.com (Eric W. Biederman) writes:
>>>>
>>>>> David Dillow <dave@thedillows.org> writes:
>>>>>
>>>>>> Re-looking at the code, I'd guess that some IRQ status line is getting
>>>>>> stuck high, but I don't see why -- we should acknowledge all outstanding
>>>>>> interrupts each time through the loop, whether we care about them or
>>>>>> not.
>>>>>>
>>>>>> Could reproduce a problem with the following patch applied, and send the
>>>>>> full dmesg, please?
>>>>> Here is what I get.
>>>>>
>>>>> r8169 screaming irq status 00000085 mask 0000ffff event 0000803f napi 0000001d
>>>> And now that the machine has come out of it, that was followed by:
>>>> Looks like the soft lockup did not manage to trigger in this case.
>>>
>>> I need some more context, please. What is the network load through this
>>> NIC when you have the issues? Light, heavy? Can you give me more details
>>> about the machine? A full dmesg from boot until this happens would help
>>> quite a bit. At a minimum it would help answer which version of the chip
>>> we're dealing with and what the machine it is in looks like.
>>>
>>> Can you reproduce this with pci=nomsi? I'm assuming it the chip running
>>> in MSI mode.
>>>
>>> Also, can you reproduce it when booting UP (or maxcpus=1)? I'm thinking
>>> about a race between rtl8169_interrupt() and rtl8169_poll(), but it
>>> isn't jumping out at me.
>>>
>>> Also, I'm having connectivity troubles this weekend, so my response may
>>> be spotty. :(
>>>
>>
>>
>> BTW, FYI, it seems Michal stopped tracking this problem, but he
>> found this commit problematic as well.
>>
>> From: Michal Soltys <soltys@ziu.info>
>> Subject: Re: r8169 (+others ?) and note_interrupt performance hit on 2.6.30.x
>> Date: Wed, 05 Aug 2009 20:54:47 +0200
>> http://marc.info/?l=linux-netdev&m=124949848110710&w=2
>>
>
> Well - not really stopped, but not sure what to look at before that
> particular commit (as cpu load for the tests I've done increased rather
> significantly as well before that, and after 2.6.29 - but it doesn't
> seem to be related to the driver). And I was away for over a week...
>
> As fot the changes that commit introduced, here's is link to the mail
> with the oprofile I did back then:
>
> http://www.spinics.net/lists/netdev/msg102709.html
>
> I'm happy to assist any way I can.
Very nice :-) I guess David might be interested in your dmesg etc.
(as above) too.
Jarek P.
^ permalink raw reply
* Re: [PATCH] pxaficp-ir - remove incorrect net_device_ops
From: Alexander Beregalov @ 2009-08-23 17:55 UTC (permalink / raw)
To: David Miller
Cc: Eric Miao, linux-arm-kernel, Russell King - ARM Linux, samuel,
netdev, linux-arm-kernel, Marek Vasut
In-Reply-To: <200908220054.31438.marek.vasut@gmail.com>
2009/8/22 Marek Vasut <marek.vasut@gmail.com>:
> Dne St 5. srpna 2009 16:02:34 Marek Vasut napsal(a):
>> Dne St 29. července 2009 13:16:25 Alexander Beregalov napsal(a):
>> > 2009/7/28 Eric Miao <eric.y.miao@gmail.com>:
>> > > Marek Vasut wrote:
>> > >> Hi!
>> > >>
>> > >> This patch fixes broken pxaficp-ir. The problem was in incorrect
>> > >> net_device_ops being specified which prevented the driver from
>> > >> operating. The symptoms were:
>> > >> - failing ifconfig for IrLAN, resulting in
>> > >> SIOCSIFFLAGS: Cannot assign requested address
>> > >> - irattach working for IrCOMM, but the port stayed disabled
>> > >>
>> > >> Moreover this patch corrects missing sysfs device link.
>> > >>
>> > >> btw. guys, be honest, when did you last tested pxaficp-ir on real
>> > >> hardware? ;-)
>> > >
>> > > Well, this seems to be brought by the net_device_ops change, which
>> > > seems to happen silently without any of us being notified.
>> > >
>> > > OK, netdev and Alex are copied, so that we can look into this issue a
>> > > bit deeper:
>> > >
>> > > 1. it looks to me that SIOCSIFFLAGS actually returned -EADDRNOTAVAIL,
>> > > which is likely caused by eth_validate_addr, the default eth_addr comes
>> > > with irda should be "00:00:00:00:00:00" if not explicitly specified
>> > > (kzalloc), and this should be the problem, solution ? Either give a
>> > > valid address to the irda net_device or remove this
>> > > 'ndo_validate_addr'. And which is a correct fix will impact on the
>> > > .ndo_set_mac_address
>> > >
>> > > 2. '.ndo_change_mtu' ? It looks to me that Irda device doesn't care too
>> > > much about the MTU, eth_change_mtu is supposed to work just fine and
>> > > not to cause any side effects, and may just benefit later irda device
>> > > drivers if there is a weird device happens to care about MTU
>> > >
>> > > - eric
>> > >
>> > > Marek's original patch in attachment.
>> >
>> > Sorry about that and thanks.
>> > Then we should fix the rest of irda drivers in the same way.
>>
>> Hi!
>> Was my patch applied or what's the current status? Thanks
>
> Hi!
> any updates ? Are we letting this into .32 in current broken state?
>
David, please have a look. Will you apply it?
^ permalink raw reply
* Re: E100 RX ring buffers continued...
From: Walt Holman @ 2009-08-23 18:20 UTC (permalink / raw)
To: Krzysztof Halasa
Cc: netdev, jeffrey t kirsher, jesse brandeburg, bruce w allan,
peter p waskiewicz jr, john ronciak, David Miller
In-Reply-To: <m3tyzytun6.fsf@intrepid.localdomain>
----- "Krzysztof Halasa" <khc@pm.waw.pl> wrote:
> David Miller <davem@davemloft.net> writes:
>
> > I think going down the road of trying to use the flexible mode is a
> > dead end. I doubt any other OS driver is using it, and that means
> > that there are likely many other errata hiding in the bushes which
> you
> > will unearth by trying to use this new descriptor mode. And it
> won't
> > show up when you test it, it will show up when some random person
> in
> > some remote data center somewhere updates their kernel, and they
> won't
> > send us a bug report, they'll replace their card or downgrade their
> > kernel instead.
>
> Well, I'm afraid it's a possible scenario. I won't touch the flexible
> mode unless Intel folks tell me it's safe.
> OTOH it seems it was used by less common software, at least in the
> 82557-9 times. Not sure about Windows driver.
> (It seems the simplified mode was meant for Linux-alike "1 buffer per
> packet" approach while the flexible mode was to support systems using
> mbuf-like structures).
>
> > Just make the driver use consistent buffers for RX, and when
> packets
> > arrive an SKB is allocated and the packet data is copied into the
> SKB
> >>From the consistent buffer.
>
> That would be a performance hit, wouldn't it? Especially in older
> machines, where e100 was typically installed. I think it should be
> the
> last resort.
>
> > And for 2.6.31-rcX we probably have to simply revert your change.
>
> Unfortunately it seems that reverting will not fix operation
> completely
> on a system with swiotlb (checking the descriptor status isn't the
> only
> racy operation which depends on the cache behaviour, though it's the
> most frequent). And it will break all non-coherent archs again, they
> will either need to use the patch or still stick to (already removed)
> eepro100.c
>
> I looked at the eepro100.c sources. It uses BIDIR mapping the same
> way
> as e100.c does, but then syncs using FROM_DEVICE/TO_DEVICE instead of
> e100's always-BIDIR. I think the same in e100.c would work on all
> platforms (though still violating the DMA API a bit). Perhaps we
> should
> do that instead?
>
> Walt, can you check if 2.6.30.5 with the following patch applied
> still
> breaks e100 with the 6 GB of RAM, please? TIA.
> (This patch makes swiotlb aware that the CPU didn't alter the buffer,
> though I don't know if swiotlb will use this info).
>
> diff --git a/drivers/net/e100.c b/drivers/net/e100.c
> index 014dfb6..53e8252 100644
> --- a/drivers/net/e100.c
> +++ b/drivers/net/e100.c
> @@ -1764,7 +1764,7 @@ static int e100_rx_indicate(struct nic *nic,
> struct rx *rx,
> nic->ru_running = RU_SUSPENDED;
> pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr,
> sizeof(struct rfd),
> - PCI_DMA_BIDIRECTIONAL);
> + PCI_DMA_FROMDEVICE);
> return -ENODATA;
> }
>
> --
> Krzysztof Halasa
Krzystof,
I've tested this under 2.6.31-rc7 (which was also broken to begin with) and this appears to have fixed it. It's a fairly limited test at this point, as I've just been downloading a large file for the past 15 mins. or so, but this was normally enough to have multiple stoppages. Do you still need 2.6.30.5 tested as well?
-Walt
^ permalink raw reply
* [PATCH resend] drivers/net: use printk_once
From: Marcin Slusarz @ 2009-08-23 18:26 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, LKML, Andrew Morton
From: Marcin Slusarz <marcin.slusarz@gmail.com>
Subject: drivers/net: use printk_once
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
diff --git a/drivers/net/mlx4/en_main.c b/drivers/net/mlx4/en_main.c
index 9ed4a15..18e9e4f 100644
--- a/drivers/net/mlx4/en_main.c
+++ b/drivers/net/mlx4/en_main.c
@@ -151,15 +151,11 @@ static void mlx4_en_remove(struct mlx4_dev *dev, void *endev_ptr)
static void *mlx4_en_add(struct mlx4_dev *dev)
{
- static int mlx4_en_version_printed;
struct mlx4_en_dev *mdev;
int i;
int err;
- if (!mlx4_en_version_printed) {
- printk(KERN_INFO "%s", mlx4_en_version);
- mlx4_en_version_printed++;
- }
+ printk_once(KERN_INFO "%s", mlx4_en_version);
mdev = kzalloc(sizeof *mdev, GFP_KERNEL);
if (!mdev) {
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 0f32db3..dbb1d9c 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -2622,14 +2622,12 @@ static void infer_hw_params(struct mv643xx_eth_shared_private *msp)
static int mv643xx_eth_shared_probe(struct platform_device *pdev)
{
- static int mv643xx_eth_version_printed;
struct mv643xx_eth_shared_platform_data *pd = pdev->dev.platform_data;
struct mv643xx_eth_shared_private *msp;
struct resource *res;
int ret;
- if (!mv643xx_eth_version_printed++)
- printk(KERN_NOTICE "MV-643xx 10/100/1000 ethernet "
+ printk_once(KERN_NOTICE "MV-643xx 10/100/1000 ethernet "
"driver version %s\n", mv643xx_eth_driver_version);
ret = -EINVAL;
^ permalink raw reply related
* [PATCH resend] net: use printk_once
From: Marcin Slusarz @ 2009-08-23 18:29 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, LKML, Andrew Morton
From: Marcin Slusarz <marcin.slusarz@gmail.com>
Subject: net: use printk_once
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index da0f64f..39c895b 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1792,12 +1792,8 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
/* old structure? */
if (cmd == SIOCAX25GETINFOOLD) {
- static int warned = 0;
- if (!warned) {
- printk(KERN_INFO "%s uses old SIOCAX25GETINFO\n",
+ printk_once(KERN_INFO "%s uses old SIOCAX25GETINFO\n",
current->comm);
- warned=1;
- }
if (copy_to_user(argp, &ax25_info, sizeof(struct ax25_info_struct_deprecated))) {
res = -EFAULT;
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 71489f6..ecd2dfb 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -302,14 +302,12 @@ static struct net_device *dev_to_net_device(struct device *dev)
static int dsa_probe(struct platform_device *pdev)
{
- static int dsa_version_printed;
struct dsa_platform_data *pd = pdev->dev.platform_data;
struct net_device *dev;
struct dsa_switch_tree *dst;
int i;
- if (!dsa_version_printed++)
- printk(KERN_NOTICE "Distributed Switch Architecture "
+ printk_once(KERN_NOTICE "Distributed Switch Architecture "
"driver version %s\n", dsa_driver_version);
if (pd == NULL || pd->netdev == NULL)
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 2979f14..f919925 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -470,10 +470,8 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
if (msg->msg_namelen < sizeof(*usin))
goto out;
if (usin->sin_family != AF_INET) {
- static int complained;
- if (!complained++)
- printk(KERN_INFO "%s forgot to set AF_INET in "
- "raw sendmsg. Fix it!\n",
+ printk_once(KERN_INFO "%s forgot to set AF_INET in "
+ "raw sendmsg. Fix it!\n",
current->comm);
err = -EAFNOSUPPORT;
if (usin->sin_family)
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index eb0ceb8..d60d317 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -456,13 +456,9 @@ static int recent_seq_open(struct inode *inode, struct file *file)
#ifdef CONFIG_NETFILTER_XT_MATCH_RECENT_PROC_COMPAT
static int recent_old_seq_open(struct inode *inode, struct file *filp)
{
- static bool warned_of_old;
-
- if (unlikely(!warned_of_old)) {
- printk(KERN_INFO KBUILD_MODNAME ": Use of /proc/net/ipt_recent"
- " is deprecated; use /proc/net/xt_recent.\n");
- warned_of_old = true;
- }
+ printk_once(KERN_INFO KBUILD_MODNAME ": "
+ "Use of /proc/net/ipt_recent is deprecated; "
+ "use /proc/net/xt_recent.\n");
return recent_seq_open(inode, filp);
}
diff --git a/net/socket.c b/net/socket.c
index 791d71a..1d07f69 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1161,12 +1161,8 @@ static int __sock_create(struct net *net, int family, int type, int protocol,
deadlock in module load.
*/
if (family == PF_INET && type == SOCK_PACKET) {
- static int warned;
- if (!warned) {
- warned = 1;
- printk(KERN_INFO "%s uses obsolete (PF_INET,SOCK_PACKET)\n",
- current->comm);
- }
+ printk_once(KERN_INFO "%s uses obsolete (PF_INET,SOCK_PACKET)\n",
+ current->comm);
family = PF_PACKET;
}
^ permalink raw reply related
* [PATCH NEXT 4/5] netxen: implement pci driver shutdown
From: Dhananjay Phadke @ 2009-08-23 18:35 UTC (permalink / raw)
To: davem; +Cc: netdev, Amit Kumar Salecha
In-Reply-To: <1251052513-27618-1-git-send-email-dhananjay@netxen.com>
From: Amit Kumar Salecha <amit@qlogic.com>
Implement pci driver shutdown functionality, this helps
quiescing all PCI transaction before chipset is reset.
Amit Kumar Salecha <amit@qlogic.com>
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
---
drivers/net/netxen/netxen_nic_main.c | 38 ++++++++++++++++++++++++++-------
1 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index f618e7c..794c19b 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -922,6 +922,8 @@ netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev)
if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
netxen_p3_free_mac_list(adapter);
+ adapter->set_promisc(adapter, NETXEN_NIU_NON_PROMISC_MODE);
+
netxen_napi_disable(adapter);
netxen_release_tx_buffers(adapter);
@@ -1288,14 +1290,11 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
free_netdev(netdev);
}
-
-#ifdef CONFIG_PM
-static int
-netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state)
+static int __netxen_nic_shutdown(struct pci_dev *pdev)
{
-
struct netxen_adapter *adapter = pci_get_drvdata(pdev);
struct net_device *netdev = adapter->netdev;
+ int retval;
netif_device_detach(netdev);
@@ -1307,7 +1306,12 @@ netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state)
netxen_nic_detach(adapter);
- pci_save_state(pdev);
+ if (adapter->portnum == 0)
+ netxen_free_dummy_dma(adapter);
+
+ retval = pci_save_state(pdev);
+ if (retval)
+ return retval;
if (netxen_nic_wol_supported(adapter)) {
pci_enable_wake(pdev, PCI_D3cold, 1);
@@ -1315,10 +1319,27 @@ netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state)
}
pci_disable_device(pdev);
- pci_set_power_state(pdev, pci_choose_state(pdev, state));
return 0;
}
+static void netxen_nic_shutdown(struct pci_dev *pdev)
+{
+ if (__netxen_nic_shutdown(pdev))
+ return;
+}
+#ifdef CONFIG_PM
+static int
+netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+ int retval;
+
+ retval = __netxen_nic_shutdown(pdev);
+ if (retval)
+ return retval;
+
+ pci_set_power_state(pdev, pci_choose_state(pdev, state));
+ return 0;
+}
static int
netxen_nic_resume(struct pci_dev *pdev)
@@ -2068,8 +2089,9 @@ static struct pci_driver netxen_driver = {
.remove = __devexit_p(netxen_nic_remove),
#ifdef CONFIG_PM
.suspend = netxen_nic_suspend,
- .resume = netxen_nic_resume
+ .resume = netxen_nic_resume,
#endif
+ .shutdown = netxen_nic_shutdown
};
static int __init netxen_init_module(void)
--
1.6.0.2
^ permalink raw reply related
* [PATCH NEXT 3/5] netxen: refactor tx dma mapping code
From: Dhananjay Phadke @ 2009-08-23 18:35 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1251052513-27618-1-git-send-email-dhananjay@netxen.com>
Move all tx skb mapping code into netxen_map_tx_skb().
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
---
drivers/net/netxen/netxen_nic_main.c | 112 ++++++++++++++++++----------------
1 files changed, 60 insertions(+), 52 deletions(-)
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 0086574..f618e7c 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -1518,22 +1518,52 @@ netxen_tso_check(struct net_device *netdev,
barrier();
}
-static void
-netxen_clean_tx_dma_mapping(struct pci_dev *pdev,
- struct netxen_cmd_buffer *pbuf, int last)
+static int
+netxen_map_tx_skb(struct pci_dev *pdev,
+ struct sk_buff *skb, struct netxen_cmd_buffer *pbuf)
{
- int k;
- struct netxen_skb_frag *buffrag;
+ struct netxen_skb_frag *nf;
+ struct skb_frag_struct *frag;
+ int i, nr_frags;
+ dma_addr_t map;
+
+ nr_frags = skb_shinfo(skb)->nr_frags;
+ nf = &pbuf->frag_array[0];
+
+ map = pci_map_single(pdev, skb->data,
+ skb_headlen(skb), PCI_DMA_TODEVICE);
+ if (pci_dma_mapping_error(pdev, map))
+ goto out_err;
- buffrag = &pbuf->frag_array[0];
- pci_unmap_single(pdev, buffrag->dma,
- buffrag->length, PCI_DMA_TODEVICE);
+ nf->dma = map;
+ nf->length = skb_headlen(skb);
+
+ for (i = 0; i < nr_frags; i++) {
+ frag = &skb_shinfo(skb)->frags[i];
+ nf = &pbuf->frag_array[i+1];
+
+ map = pci_map_page(pdev, frag->page, frag->page_offset,
+ frag->size, PCI_DMA_TODEVICE);
+ if (pci_dma_mapping_error(pdev, map))
+ goto unwind;
+
+ nf->dma = map;
+ nf->length = frag->size;
+ }
+
+ return 0;
- for (k = 1; k < last; k++) {
- buffrag = &pbuf->frag_array[k];
- pci_unmap_page(pdev, buffrag->dma,
- buffrag->length, PCI_DMA_TODEVICE);
+unwind:
+ while (i > 0) {
+ nf = &pbuf->frag_array[i];
+ pci_unmap_page(pdev, nf->dma, nf->length, PCI_DMA_TODEVICE);
}
+
+ nf = &pbuf->frag_array[0];
+ pci_unmap_single(pdev, nf->dma, skb_headlen(skb), PCI_DMA_TODEVICE);
+
+out_err:
+ return -ENOMEM;
}
static inline void
@@ -1548,17 +1578,14 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
{
struct netxen_adapter *adapter = netdev_priv(netdev);
struct nx_host_tx_ring *tx_ring = adapter->tx_ring;
- struct skb_frag_struct *frag;
struct netxen_cmd_buffer *pbuf;
struct netxen_skb_frag *buffrag;
struct cmd_desc_type0 *hwdesc, *first_desc;
struct pci_dev *pdev;
- dma_addr_t temp_dma;
int i, k;
- unsigned long offset;
u32 producer;
- int len, frag_count, no_of_desc;
+ int frag_count, no_of_desc;
u32 num_txd = tx_ring->num_desc;
frag_count = skb_shinfo(skb)->nr_frags + 1;
@@ -1572,72 +1599,53 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
}
producer = tx_ring->producer;
+ pbuf = &tx_ring->cmd_buf_arr[producer];
pdev = adapter->pdev;
- len = skb->len - skb->data_len;
- temp_dma = pci_map_single(pdev, skb->data, len, PCI_DMA_TODEVICE);
- if (pci_dma_mapping_error(pdev, temp_dma))
+ if (netxen_map_tx_skb(pdev, skb, pbuf))
goto drop_packet;
- pbuf = &tx_ring->cmd_buf_arr[producer];
pbuf->skb = skb;
pbuf->frag_count = frag_count;
- buffrag = &pbuf->frag_array[0];
- buffrag->dma = temp_dma;
- buffrag->length = len;
-
first_desc = hwdesc = &tx_ring->desc_head[producer];
netxen_clear_cmddesc((u64 *)hwdesc);
- netxen_set_tx_frags_len(hwdesc, frag_count, skb->len);
- netxen_set_tx_port(hwdesc, adapter->portnum);
- hwdesc->buffer_length[0] = cpu_to_le16(len);
- hwdesc->addr_buffer1 = cpu_to_le64(temp_dma);
+ netxen_set_tx_frags_len(first_desc, frag_count, skb->len);
+ netxen_set_tx_port(first_desc, adapter->portnum);
- for (i = 1, k = 1; i < frag_count; i++, k++) {
+ for (i = 0; i < frag_count; i++) {
- /* move to next desc. if there is a need */
- if ((i & 0x3) == 0) {
- k = 0;
+ k = i % 4;
+
+ if ((k == 0) && (i > 0)) {
+ /* move to next desc.*/
producer = get_next_index(producer, num_txd);
hwdesc = &tx_ring->desc_head[producer];
netxen_clear_cmddesc((u64 *)hwdesc);
- pbuf = &tx_ring->cmd_buf_arr[producer];
- pbuf->skb = NULL;
- }
- buffrag = &pbuf->frag_array[i];
- frag = &skb_shinfo(skb)->frags[i - 1];
- len = frag->size;
- offset = frag->page_offset;
-
- temp_dma = pci_map_page(pdev, frag->page, offset,
- len, PCI_DMA_TODEVICE);
- if (pci_dma_mapping_error(pdev, temp_dma)) {
- netxen_clean_tx_dma_mapping(pdev, pbuf, i);
- goto drop_packet;
+ tx_ring->cmd_buf_arr[producer].skb = NULL;
}
- buffrag->dma = temp_dma;
- buffrag->length = len;
+ buffrag = &pbuf->frag_array[i];
- hwdesc->buffer_length[k] = cpu_to_le16(len);
+ hwdesc->buffer_length[k] = cpu_to_le16(buffrag->length);
switch (k) {
case 0:
- hwdesc->addr_buffer1 = cpu_to_le64(temp_dma);
+ hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma);
break;
case 1:
- hwdesc->addr_buffer2 = cpu_to_le64(temp_dma);
+ hwdesc->addr_buffer2 = cpu_to_le64(buffrag->dma);
break;
case 2:
- hwdesc->addr_buffer3 = cpu_to_le64(temp_dma);
+ hwdesc->addr_buffer3 = cpu_to_le64(buffrag->dma);
break;
case 3:
- hwdesc->addr_buffer4 = cpu_to_le64(temp_dma);
+ hwdesc->addr_buffer4 = cpu_to_le64(buffrag->dma);
break;
}
}
+
tx_ring->producer = get_next_index(producer, num_txd);
netxen_tso_check(netdev, tx_ring, first_desc, skb);
--
1.6.0.2
^ permalink raw reply related
* [PATCH NEXT 5/5] netxen: remove netxen_nic_phan_reg.h
From: Dhananjay Phadke @ 2009-08-23 18:35 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1251052513-27618-1-git-send-email-dhananjay@netxen.com>
Consolidate register definitions in netxen_nic_hdr.h
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
---
drivers/net/netxen/netxen_nic.h | 31 +++--
drivers/net/netxen/netxen_nic_ctx.c | 1 -
drivers/net/netxen/netxen_nic_ethtool.c | 1 -
drivers/net/netxen/netxen_nic_hdr.h | 85 ++++++++++++++-
drivers/net/netxen/netxen_nic_hw.c | 1 -
drivers/net/netxen/netxen_nic_hw.h | 18 ---
drivers/net/netxen/netxen_nic_init.c | 1 -
drivers/net/netxen/netxen_nic_main.c | 1 -
drivers/net/netxen/netxen_nic_phan_reg.h | 178 ------------------------------
9 files changed, 102 insertions(+), 215 deletions(-)
delete mode 100644 drivers/net/netxen/netxen_nic_phan_reg.h
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index fa43aa0..7a93f82 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -53,6 +53,7 @@
#include <asm/io.h>
#include <asm/byteorder.h>
+#include "netxen_nic_hdr.h"
#include "netxen_nic_hw.h"
#define _NETXEN_NIC_LINUX_MAJOR 4
@@ -227,8 +228,6 @@
#define MPORT_SINGLE_FUNCTION_MODE 0x1111
#define MPORT_MULTI_FUNCTION_MODE 0x2222
-#include "netxen_nic_phan_reg.h"
-
/*
* NetXen host-peg signal message structure
*
@@ -503,17 +502,11 @@ struct netxen_skb_frag {
u64 length;
};
-#define _netxen_set_bits(config_word, start, bits, val) {\
- unsigned long long __tmask = (((1ULL << (bits)) - 1) << (start));\
- unsigned long long __tvalue = (val); \
- (config_word) &= ~__tmask; \
- (config_word) |= (((__tvalue) << (start)) & __tmask); \
-}
-
-#define _netxen_clear_bits(config_word, start, bits) {\
- unsigned long long __tmask = (((1ULL << (bits)) - 1) << (start)); \
- (config_word) &= ~__tmask; \
-}
+struct netxen_recv_crb {
+ u32 crb_rcv_producer[NUM_RCV_DESC_RINGS];
+ u32 crb_sts_consumer[NUM_STS_DESC_RINGS];
+ u32 sw_int_mask[NUM_STS_DESC_RINGS];
+};
/* Following defines are for the state of the buffers */
#define NETXEN_BUFFER_FREE 0
@@ -1194,6 +1187,18 @@ struct netxen_adapter {
const struct firmware *fw;
};
+/* Set promiscuous mode for a GbE interface */
+int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, u32 mode);
+int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter,
+ u32 mode);
+/* Generic enable for GbE ports. Will detect the speed of the link. */
+int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port);
+int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port);
+
+/* Disable a GbE interface */
+int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter);
+int netxen_niu_disable_xg_port(struct netxen_adapter *adapter);
+
int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter);
int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter);
int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter);
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c
index 9e04696..3d676fe 100644
--- a/drivers/net/netxen/netxen_nic_ctx.c
+++ b/drivers/net/netxen/netxen_nic_ctx.c
@@ -30,7 +30,6 @@
#include "netxen_nic_hw.h"
#include "netxen_nic.h"
-#include "netxen_nic_phan_reg.h"
#define NXHAL_VERSION 1
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index db66e70..3886135 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -37,7 +37,6 @@
#include "netxen_nic.h"
#include "netxen_nic_hw.h"
-#include "netxen_nic_phan_reg.h"
struct netxen_nic_stats {
char stat_string[ETH_GSTRING_LEN];
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index a732858..c4a4a8b 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -723,9 +723,92 @@ enum {
#define NETXEN_FW_VERSION_MINOR (NETXEN_CAM_RAM(0x154))
#define NETXEN_FW_VERSION_SUB (NETXEN_CAM_RAM(0x158))
#define NETXEN_ROM_LOCK_ID (NETXEN_CAM_RAM(0x100))
+#define NETXEN_PHY_LOCK_ID (NETXEN_CAM_RAM(0x120))
#define NETXEN_CRB_WIN_LOCK_ID (NETXEN_CAM_RAM(0x124))
-#define NETXEN_PHY_LOCK_ID (NETXEN_CAM_RAM(0x120))
+#define NIC_CRB_BASE (NETXEN_CAM_RAM(0x200))
+#define NIC_CRB_BASE_2 (NETXEN_CAM_RAM(0x700))
+#define NETXEN_NIC_REG(X) (NIC_CRB_BASE+(X))
+#define NETXEN_NIC_REG_2(X) (NIC_CRB_BASE_2+(X))
+
+#define NX_CDRP_CRB_OFFSET (NETXEN_NIC_REG(0x18))
+#define NX_ARG1_CRB_OFFSET (NETXEN_NIC_REG(0x1c))
+#define NX_ARG2_CRB_OFFSET (NETXEN_NIC_REG(0x20))
+#define NX_ARG3_CRB_OFFSET (NETXEN_NIC_REG(0x24))
+#define NX_SIGN_CRB_OFFSET (NETXEN_NIC_REG(0x28))
+
+#define CRB_HOST_DUMMY_BUF_ADDR_HI (NETXEN_NIC_REG(0x3c))
+#define CRB_HOST_DUMMY_BUF_ADDR_LO (NETXEN_NIC_REG(0x40))
+
+#define CRB_CMDPEG_STATE (NETXEN_NIC_REG(0x50))
+#define CRB_RCVPEG_STATE (NETXEN_NIC_REG(0x13c))
+
+#define CRB_XG_STATE (NETXEN_NIC_REG(0x94))
+#define CRB_XG_STATE_P3 (NETXEN_NIC_REG(0x98))
+#define CRB_PF_LINK_SPEED_1 (NETXEN_NIC_REG(0xe8))
+#define CRB_PF_LINK_SPEED_2 (NETXEN_NIC_REG(0xec))
+
+#define CRB_MPORT_MODE (NETXEN_NIC_REG(0xc4))
+#define CRB_DMA_SHIFT (NETXEN_NIC_REG(0xcc))
+#define CRB_INT_VECTOR (NETXEN_NIC_REG(0xd4))
+
+#define CRB_CMD_PRODUCER_OFFSET (NETXEN_NIC_REG(0x08))
+#define CRB_CMD_CONSUMER_OFFSET (NETXEN_NIC_REG(0x0c))
+#define CRB_CMD_PRODUCER_OFFSET_1 (NETXEN_NIC_REG(0x1ac))
+#define CRB_CMD_CONSUMER_OFFSET_1 (NETXEN_NIC_REG(0x1b0))
+#define CRB_CMD_PRODUCER_OFFSET_2 (NETXEN_NIC_REG(0x1b8))
+#define CRB_CMD_CONSUMER_OFFSET_2 (NETXEN_NIC_REG(0x1bc))
+#define CRB_CMD_PRODUCER_OFFSET_3 (NETXEN_NIC_REG(0x1d0))
+#define CRB_CMD_CONSUMER_OFFSET_3 (NETXEN_NIC_REG(0x1d4))
+#define CRB_TEMP_STATE (NETXEN_NIC_REG(0x1b4))
+
+#define CRB_V2P_0 (NETXEN_NIC_REG(0x290))
+#define CRB_V2P(port) (CRB_V2P_0+((port)*4))
+#define CRB_DRIVER_VERSION (NETXEN_NIC_REG(0x2a0))
+
+#define CRB_SW_INT_MASK_0 (NETXEN_NIC_REG(0x1d8))
+#define CRB_SW_INT_MASK_1 (NETXEN_NIC_REG(0x1e0))
+#define CRB_SW_INT_MASK_2 (NETXEN_NIC_REG(0x1e4))
+#define CRB_SW_INT_MASK_3 (NETXEN_NIC_REG(0x1e8))
+
+#define CRB_FW_CAPABILITIES_1 (NETXEN_CAM_RAM(0x128))
+#define CRB_MAC_BLOCK_START (NETXEN_CAM_RAM(0x1c0))
+
+/*
+ * capabilities register, can be used to selectively enable/disable features
+ * for backward compability
+ */
+#define CRB_NIC_CAPABILITIES_HOST NETXEN_NIC_REG(0x1a8)
+#define CRB_NIC_CAPABILITIES_FW NETXEN_NIC_REG(0x1dc)
+#define CRB_NIC_MSI_MODE_HOST NETXEN_NIC_REG(0x270)
+#define CRB_NIC_MSI_MODE_FW NETXEN_NIC_REG(0x274)
+
+#define INTR_SCHEME_PERPORT 0x1
+#define MSI_MODE_MULTIFUNC 0x1
+
+/* used for ethtool tests */
+#define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280)
+
+/*
+ * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address
+ * which can be read by the Phantom host to get producer/consumer indexes from
+ * Phantom/Casper. If it is not HOST_SHARED_MEMORY, then the following
+ * registers will be used for the addresses of the ring's shared memory
+ * on the Phantom.
+ */
+
+#define nx_get_temp_val(x) ((x) >> 16)
+#define nx_get_temp_state(x) ((x) & 0xffff)
+#define nx_encode_temp(val, state) (((val) << 16) | (state))
+
+/*
+ * Temperature control.
+ */
+enum {
+ NX_TEMP_NORMAL = 0x1, /* Normal operating range */
+ NX_TEMP_WARN, /* Sound alert, temperature getting high */
+ NX_TEMP_PANIC /* Fatal error, hardware has shut down. */
+};
/* Lock IDs for PHY lock */
#define PHY_LOCK_DRIVER 0x44524956
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 965f783..9138bbc 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -30,7 +30,6 @@
#include "netxen_nic.h"
#include "netxen_nic_hw.h"
-#include "netxen_nic_phan_reg.h"
#include <net/ip.h>
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h
index d4e8333..fc0638f 100644
--- a/drivers/net/netxen/netxen_nic_hw.h
+++ b/drivers/net/netxen/netxen_nic_hw.h
@@ -31,8 +31,6 @@
#ifndef __NETXEN_NIC_HW_H_
#define __NETXEN_NIC_HW_H_
-#include "netxen_nic_hdr.h"
-
/* Hardware memory size of 128 meg */
#define NETXEN_MEMADDR_MAX (128 * 1024 * 1024)
@@ -387,22 +385,6 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter);
#define netxen_xg_soft_reset(config_word) \
((config_word) |= 1 << 4)
-/* Set promiscuous mode for a GbE interface */
-int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter,
- u32 mode);
-int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter,
- u32 mode);
-
-/* Generic enable for GbE ports. Will detect the speed of the link. */
-int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port);
-
-int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port);
-
-/* Disable a GbE interface */
-int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter);
-
-int netxen_niu_disable_xg_port(struct netxen_adapter *adapter);
-
typedef struct {
unsigned valid;
unsigned start_128M;
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index c3609e4..474c568 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -32,7 +32,6 @@
#include <linux/delay.h>
#include "netxen_nic.h"
#include "netxen_nic_hw.h"
-#include "netxen_nic_phan_reg.h"
struct crb_addr_pair {
u32 addr;
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 794c19b..bd4589f 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -33,7 +33,6 @@
#include "netxen_nic_hw.h"
#include "netxen_nic.h"
-#include "netxen_nic_phan_reg.h"
#include <linux/dma-mapping.h>
#include <linux/if_vlan.h>
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h
deleted file mode 100644
index b73a62c..0000000
--- a/drivers/net/netxen/netxen_nic_phan_reg.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2003 - 2009 NetXen, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
- *
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.
- *
- * Contact Information:
- * info@netxen.com
- * NetXen Inc,
- * 18922 Forge Drive
- * Cupertino, CA 95014-0701
- *
- */
-
-#ifndef __NIC_PHAN_REG_H_
-#define __NIC_PHAN_REG_H_
-
-/*
- * CRB Registers or queue message done only at initialization time.
- */
-#define NIC_CRB_BASE NETXEN_CAM_RAM(0x200)
-#define NETXEN_NIC_REG(X) (NIC_CRB_BASE+(X))
-#define NIC_CRB_BASE_2 NETXEN_CAM_RAM(0x700)
-#define NETXEN_NIC_REG_2(X) (NIC_CRB_BASE_2+(X))
-
-#define CRB_PHAN_CNTRL_LO_OFFSET NETXEN_NIC_REG(0x00)
-#define CRB_PHAN_CNTRL_HI_OFFSET NETXEN_NIC_REG(0x04)
-#define CRB_CMD_PRODUCER_OFFSET NETXEN_NIC_REG(0x08)
-#define CRB_CMD_CONSUMER_OFFSET NETXEN_NIC_REG(0x0c)
-#define CRB_PAUSE_ADDR_LO NETXEN_NIC_REG(0x10)
-#define CRB_PAUSE_ADDR_HI NETXEN_NIC_REG(0x14)
-#define NX_CDRP_CRB_OFFSET NETXEN_NIC_REG(0x18)
-#define NX_ARG1_CRB_OFFSET NETXEN_NIC_REG(0x1c)
-#define NX_ARG2_CRB_OFFSET NETXEN_NIC_REG(0x20)
-#define NX_ARG3_CRB_OFFSET NETXEN_NIC_REG(0x24)
-#define NX_SIGN_CRB_OFFSET NETXEN_NIC_REG(0x28)
-#define CRB_CMD_INTR_LOOP NETXEN_NIC_REG(0x20)
-#define CRB_CMD_DMA_LOOP NETXEN_NIC_REG(0x24)
-#define CRB_RCV_INTR_LOOP NETXEN_NIC_REG(0x28)
-#define CRB_RCV_DMA_LOOP NETXEN_NIC_REG(0x2c)
-#define CRB_ENABLE_TX_INTR NETXEN_NIC_REG(0x30)
-#define CRB_MMAP_ADDR_3 NETXEN_NIC_REG(0x34)
-#define CRB_CMDPEG_CMDRING NETXEN_NIC_REG(0x38)
-#define CRB_HOST_DUMMY_BUF_ADDR_HI NETXEN_NIC_REG(0x3c)
-#define CRB_HOST_DUMMY_BUF_ADDR_LO NETXEN_NIC_REG(0x40)
-#define CRB_MMAP_ADDR_0 NETXEN_NIC_REG(0x44)
-#define CRB_MMAP_ADDR_1 NETXEN_NIC_REG(0x48)
-#define CRB_MMAP_ADDR_2 NETXEN_NIC_REG(0x4c)
-#define CRB_CMDPEG_STATE NETXEN_NIC_REG(0x50)
-#define CRB_MMAP_SIZE_0 NETXEN_NIC_REG(0x54)
-#define CRB_MMAP_SIZE_1 NETXEN_NIC_REG(0x58)
-#define CRB_MMAP_SIZE_2 NETXEN_NIC_REG(0x5c)
-#define CRB_MMAP_SIZE_3 NETXEN_NIC_REG(0x60)
-#define CRB_GLOBAL_INT_COAL NETXEN_NIC_REG(0x64)
-#define CRB_INT_COAL_MODE NETXEN_NIC_REG(0x68)
-#define CRB_MAX_RCV_BUFS NETXEN_NIC_REG(0x6c)
-#define CRB_TX_INT_THRESHOLD NETXEN_NIC_REG(0x70)
-#define CRB_RX_PKT_TIMER NETXEN_NIC_REG(0x74)
-#define CRB_TX_PKT_TIMER NETXEN_NIC_REG(0x78)
-#define CRB_RX_PKT_CNT NETXEN_NIC_REG(0x7c)
-#define CRB_RX_TMR_CNT NETXEN_NIC_REG(0x80)
-#define CRB_RX_LRO_TIMER NETXEN_NIC_REG(0x84)
-#define CRB_RX_LRO_MID_TIMER NETXEN_NIC_REG(0x88)
-#define CRB_DMA_MAX_RCV_BUFS NETXEN_NIC_REG(0x8c)
-#define CRB_MAX_DMA_ENTRIES NETXEN_NIC_REG(0x90)
-#define CRB_XG_STATE NETXEN_NIC_REG(0x94) /* XG Link status */
-#define CRB_XG_STATE_P3 NETXEN_NIC_REG(0x98) /* XG PF Link status */
-#define CRB_AGENT_TX_SIZE NETXEN_NIC_REG(0x9c)
-#define CRB_AGENT_TX_TYPE NETXEN_NIC_REG(0xa0)
-#define CRB_AGENT_TX_ADDR NETXEN_NIC_REG(0xa4)
-#define CRB_AGENT_TX_MSS NETXEN_NIC_REG(0xa8)
-#define CRB_TX_STATE NETXEN_NIC_REG(0xac)
-#define CRB_TX_COUNT NETXEN_NIC_REG(0xb0)
-#define CRB_RX_STATE NETXEN_NIC_REG(0xb4)
-#define CRB_RX_PERF_DEBUG_1 NETXEN_NIC_REG(0xb8)
-#define CRB_RX_LRO_CONTROL NETXEN_NIC_REG(0xbc)
-#define CRB_RX_LRO_START_NUM NETXEN_NIC_REG(0xc0)
-#define CRB_MPORT_MODE NETXEN_NIC_REG(0xc4)
-#define CRB_CMD_RING_SIZE NETXEN_NIC_REG(0xc8)
-#define CRB_DMA_SHIFT NETXEN_NIC_REG(0xcc)
-#define CRB_INT_VECTOR NETXEN_NIC_REG(0xd4)
-#define CRB_CTX_RESET NETXEN_NIC_REG(0xd8)
-#define CRB_HOST_STS_PROD NETXEN_NIC_REG(0xdc)
-#define CRB_HOST_STS_CONS NETXEN_NIC_REG(0xe0)
-#define CRB_PEG_CMD_PROD NETXEN_NIC_REG(0xe4)
-#define CRB_PF_LINK_SPEED_1 NETXEN_NIC_REG(0xe8)
-#define CRB_PF_LINK_SPEED_2 NETXEN_NIC_REG(0xec)
-#define CRB_HOST_BUFFER_CONS NETXEN_NIC_REG(0xf0)
-#define CRB_JUMBO_BUFFER_PROD NETXEN_NIC_REG(0xf4)
-#define CRB_JUMBO_BUFFER_CONS NETXEN_NIC_REG(0xf8)
-#define CRB_HOST_DUMMY_BUF NETXEN_NIC_REG(0xfc)
-
-#define CRB_RCVPEG_STATE NETXEN_NIC_REG(0x13c)
-#define CRB_CMD_PRODUCER_OFFSET_1 NETXEN_NIC_REG(0x1ac)
-#define CRB_CMD_CONSUMER_OFFSET_1 NETXEN_NIC_REG(0x1b0)
-#define CRB_CMD_PRODUCER_OFFSET_2 NETXEN_NIC_REG(0x1b8)
-#define CRB_CMD_CONSUMER_OFFSET_2 NETXEN_NIC_REG(0x1bc)
-#define CRB_CMD_PRODUCER_OFFSET_3 NETXEN_NIC_REG(0x1d0)
-#define CRB_CMD_CONSUMER_OFFSET_3 NETXEN_NIC_REG(0x1d4)
-#define CRB_TEMP_STATE NETXEN_NIC_REG(0x1b4)
-
-#define CRB_V2P_0 NETXEN_NIC_REG(0x290)
-#define CRB_V2P_1 NETXEN_NIC_REG(0x294)
-#define CRB_V2P_2 NETXEN_NIC_REG(0x298)
-#define CRB_V2P_3 NETXEN_NIC_REG(0x29c)
-#define CRB_V2P(port) (CRB_V2P_0+((port)*4))
-#define CRB_DRIVER_VERSION NETXEN_NIC_REG(0x2a0)
-#define CRB_SW_INT_MASK_0 NETXEN_NIC_REG(0x1d8)
-#define CRB_SW_INT_MASK_1 NETXEN_NIC_REG(0x1e0)
-#define CRB_SW_INT_MASK_2 NETXEN_NIC_REG(0x1e4)
-#define CRB_SW_INT_MASK_3 NETXEN_NIC_REG(0x1e8)
-
-#define CRB_FW_CAPABILITIES_1 NETXEN_CAM_RAM(0x128)
-#define CRB_MAC_BLOCK_START NETXEN_CAM_RAM(0x1c0)
-
-/*
- * capabilities register, can be used to selectively enable/disable features
- * for backward compability
- */
-#define CRB_NIC_CAPABILITIES_HOST NETXEN_NIC_REG(0x1a8)
-#define CRB_NIC_CAPABILITIES_FW NETXEN_NIC_REG(0x1dc)
-#define CRB_NIC_MSI_MODE_HOST NETXEN_NIC_REG(0x270)
-#define CRB_NIC_MSI_MODE_FW NETXEN_NIC_REG(0x274)
-
-#define INTR_SCHEME_PERPORT 0x1
-#define MSI_MODE_MULTIFUNC 0x1
-
-/* used for ethtool tests */
-#define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280)
-
-/*
- * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address
- * which can be read by the Phantom host to get producer/consumer indexes from
- * Phantom/Casper. If it is not HOST_SHARED_MEMORY, then the following
- * registers will be used for the addresses of the ring's shared memory
- * on the Phantom.
- */
-
-#define nx_get_temp_val(x) ((x) >> 16)
-#define nx_get_temp_state(x) ((x) & 0xffff)
-#define nx_encode_temp(val, state) (((val) << 16) | (state))
-
-/*
- * CRB registers used by the receive peg logic.
- */
-
-struct netxen_recv_crb {
- u32 crb_rcv_producer[NUM_RCV_DESC_RINGS];
- u32 crb_sts_consumer[NUM_STS_DESC_RINGS];
- u32 sw_int_mask[NUM_STS_DESC_RINGS];
-};
-
-/*
- * Temperature control.
- */
-enum {
- NX_TEMP_NORMAL = 0x1, /* Normal operating range */
- NX_TEMP_WARN, /* Sound alert, temperature getting high */
- NX_TEMP_PANIC /* Fatal error, hardware has shut down. */
-};
-
-#endif /* __NIC_PHAN_REG_H_ */
--
1.6.0.2
^ permalink raw reply related
* [PATCH NEXT 2/5] netxen: fix firmware reset logic
From: Dhananjay Phadke @ 2009-08-23 18:35 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1251052513-27618-1-git-send-email-dhananjay@netxen.com>
If netxen_need_fw_reset() return 0 [ implies firmware is up
and running], still go through dma mask check, etc.
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
---
drivers/net/netxen/netxen_nic_main.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index de67e42..0086574 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -754,8 +754,10 @@ netxen_start_firmware(struct netxen_adapter *adapter, int request_fw)
netxen_request_firmware(adapter);
err = netxen_need_fw_reset(adapter);
- if (err <= 0)
+ if (err < 0)
return err;
+ if (err == 0)
+ goto wait_init;
if (first_boot != 0x55555555) {
NXWR32(adapter, CRB_CMDPEG_STATE, 0);
--
1.6.0.2
^ permalink raw reply related
* [PATCH NEXT 1/5] netxen: ethtool statistics and control for LRO
From: Dhananjay Phadke @ 2009-08-23 18:35 UTC (permalink / raw)
To: davem; +Cc: netdev, Narender Kumar
From: Narender Kumar <narender.kumar@qlogic.com>
Add ethtool -K knob to control LRO in firmware.
LRO path is completely separated from GRO, LRO packets
are still fed with netif_receive_skb().
Also fix ethtool statistics to include LRO packets.
Also use correct message type while configuring interrupt coalescing.
Signed-off-by: Narender Kumar <narender.kumar@qlogic.com>
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
---
drivers/net/netxen/netxen_nic.h | 22 +++++++++++-
drivers/net/netxen/netxen_nic_ctx.c | 2 -
drivers/net/netxen/netxen_nic_ethtool.c | 27 ++++++++++++++-
drivers/net/netxen/netxen_nic_hw.c | 56 ++++++++++++++++++++++++++++++-
drivers/net/netxen/netxen_nic_init.c | 7 +++-
drivers/net/netxen/netxen_nic_main.c | 8 ++++-
6 files changed, 114 insertions(+), 8 deletions(-)
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 5abb41e..fa43aa0 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -576,7 +576,8 @@ struct netxen_adapter_stats {
u64 rxdropped;
u64 txdropped;
u64 csummed;
- u64 no_rcv;
+ u64 rx_pkts;
+ u64 lro_pkts;
u64 rxbytes;
u64 txbytes;
};
@@ -958,7 +959,8 @@ typedef struct {
#define NX_NIC_H2C_OPCODE_PROXY_STOP_DONE 20
#define NX_NIC_H2C_OPCODE_GET_LINKEVENT 21
#define NX_NIC_C2C_OPCODE 22
-#define NX_NIC_H2C_OPCODE_LAST 23
+#define NX_NIC_H2C_OPCODE_CONFIG_HW_LRO 24
+#define NX_NIC_H2C_OPCODE_LAST 25
/*
* Firmware --> Driver
@@ -984,6 +986,19 @@ typedef struct {
#define VPORT_MISS_MODE_ACCEPT_ALL 1 /* accept all packets */
#define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */
+#define NX_NIC_LRO_REQUEST_FIRST 0
+#define NX_NIC_LRO_REQUEST_ADD_FLOW 1
+#define NX_NIC_LRO_REQUEST_DELETE_FLOW 2
+#define NX_NIC_LRO_REQUEST_TIMER 3
+#define NX_NIC_LRO_REQUEST_CLEANUP 4
+#define NX_NIC_LRO_REQUEST_ADD_FLOW_SCHEDULED 5
+#define NX_TOE_LRO_REQUEST_ADD_FLOW 6
+#define NX_TOE_LRO_REQUEST_ADD_FLOW_RESPONSE 7
+#define NX_TOE_LRO_REQUEST_DELETE_FLOW 8
+#define NX_TOE_LRO_REQUEST_DELETE_FLOW_RESPONSE 9
+#define NX_TOE_LRO_REQUEST_TIMER 10
+#define NX_NIC_LRO_REQUEST_LAST 11
+
#define NX_FW_CAPABILITY_LINK_NOTIFICATION (1 << 5)
#define NX_FW_CAPABILITY_SWITCHING (1 << 6)
#define NX_FW_CAPABILITY_PEXQ (1 << 7)
@@ -1064,6 +1079,7 @@ typedef struct {
#define NETXEN_NIC_MSI_ENABLED 0x02
#define NETXEN_NIC_MSIX_ENABLED 0x04
+#define NETXEN_NIC_LRO_ENABLED 0x08
#define NETXEN_IS_MSI_FAMILY(adapter) \
((adapter)->flags & (NETXEN_NIC_MSI_ENABLED | NETXEN_NIC_MSIX_ENABLED))
@@ -1290,6 +1306,8 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup);
int nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu);
int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu);
+int netxen_config_hw_lro(struct netxen_adapter *adapter, int enable);
+int netxen_send_lro_cleanup(struct netxen_adapter *adapter);
int netxen_nic_set_mac(struct net_device *netdev, void *p);
struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev);
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c
index 412d658..9e04696 100644
--- a/drivers/net/netxen/netxen_nic_ctx.c
+++ b/drivers/net/netxen/netxen_nic_ctx.c
@@ -203,8 +203,6 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
cap = (NX_CAP0_LEGACY_CONTEXT | NX_CAP0_LEGACY_MN);
cap |= (NX_CAP0_JUMBO_CONTIGUOUS | NX_CAP0_LRO_CONTIGUOUS);
- if (adapter->capabilities & NX_FW_CAPABILITY_HW_LRO)
- cap |= NX_CAP0_HW_LRO;
prq->capabilities[0] = cpu_to_le32(cap);
prq->host_int_crb_mode =
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 39a308c..db66e70 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -57,7 +57,8 @@ static const struct netxen_nic_stats netxen_nic_gstrings_stats[] = {
{"rx_dropped", NETXEN_NIC_STAT(stats.rxdropped)},
{"tx_dropped", NETXEN_NIC_STAT(stats.txdropped)},
{"csummed", NETXEN_NIC_STAT(stats.csummed)},
- {"no_rcv", NETXEN_NIC_STAT(stats.no_rcv)},
+ {"rx_pkts", NETXEN_NIC_STAT(stats.rx_pkts)},
+ {"lro_pkts", NETXEN_NIC_STAT(stats.lro_pkts)},
{"rx_bytes", NETXEN_NIC_STAT(stats.rxbytes)},
{"tx_bytes", NETXEN_NIC_STAT(stats.txbytes)},
};
@@ -941,6 +942,28 @@ static int netxen_get_intr_coalesce(struct net_device *netdev,
return 0;
}
+static int netxen_nic_set_flags(struct net_device *netdev, u32 data)
+{
+ struct netxen_adapter *adapter = netdev_priv(netdev);
+ int hw_lro;
+
+ if (!(adapter->capabilities & NX_FW_CAPABILITY_HW_LRO))
+ return -EINVAL;
+
+ ethtool_op_set_flags(netdev, data);
+
+ hw_lro = (data & ETH_FLAG_LRO) ? NETXEN_NIC_LRO_ENABLED : 0;
+
+ if (netxen_config_hw_lro(adapter, hw_lro))
+ return -EIO;
+
+ if ((hw_lro == 0) && netxen_send_lro_cleanup(adapter))
+ return -EIO;
+
+
+ return 0;
+}
+
struct ethtool_ops netxen_nic_ethtool_ops = {
.get_settings = netxen_nic_get_settings,
.set_settings = netxen_nic_set_settings,
@@ -968,4 +991,6 @@ struct ethtool_ops netxen_nic_ethtool_ops = {
.set_rx_csum = netxen_nic_set_rx_csum,
.get_coalesce = netxen_get_intr_coalesce,
.set_coalesce = netxen_set_intr_coalesce,
+ .get_flags = ethtool_op_get_flags,
+ .set_flags = netxen_nic_set_flags,
};
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 673dcf5..965f783 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -643,7 +643,7 @@ int netxen_config_intr_coalesce(struct netxen_adapter *adapter)
memset(&req, 0, sizeof(nx_nic_req_t));
- req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23);
+ req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23);
word = NETXEN_CONFIG_INTR_COALESCE | ((u64)adapter->portnum << 16);
req.req_hdr = cpu_to_le64(word);
@@ -659,6 +659,35 @@ int netxen_config_intr_coalesce(struct netxen_adapter *adapter)
return rv;
}
+int netxen_config_hw_lro(struct netxen_adapter *adapter, int enable)
+{
+ nx_nic_req_t req;
+ u64 word;
+ int rv = 0;
+
+ if ((adapter->flags & NETXEN_NIC_LRO_ENABLED) == enable)
+ return 0;
+
+ memset(&req, 0, sizeof(nx_nic_req_t));
+
+ req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23);
+
+ word = NX_NIC_H2C_OPCODE_CONFIG_HW_LRO | ((u64)adapter->portnum << 16);
+ req.req_hdr = cpu_to_le64(word);
+
+ req.words[0] = cpu_to_le64(enable);
+
+ rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
+ if (rv != 0) {
+ printk(KERN_ERR "ERROR. Could not send "
+ "configure hw lro request\n");
+ }
+
+ adapter->flags ^= NETXEN_NIC_LRO_ENABLED;
+
+ return rv;
+}
+
#define RSS_HASHTYPE_IP_TCP 0x3
int netxen_config_rss(struct netxen_adapter *adapter, int enable)
@@ -752,6 +781,29 @@ int netxen_linkevent_request(struct netxen_adapter *adapter, int enable)
return rv;
}
+int netxen_send_lro_cleanup(struct netxen_adapter *adapter)
+{
+ nx_nic_req_t req;
+ u64 word;
+ int rv;
+
+ memset(&req, 0, sizeof(nx_nic_req_t));
+ req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23);
+
+ word = NX_NIC_H2C_OPCODE_LRO_REQUEST |
+ ((u64)adapter->portnum << 16) |
+ ((u64)NX_NIC_LRO_REQUEST_CLEANUP << 56) ;
+
+ req.req_hdr = cpu_to_le64(word);
+
+ rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
+ if (rv != 0) {
+ printk(KERN_ERR "%s: could not cleanup lro flows\n",
+ adapter->netdev->name);
+ }
+ return rv;
+}
+
/*
* netxen_nic_change_mtu - Change the Maximum Transfer Unit
* @returns 0 on success, negative on failure
@@ -2066,6 +2118,8 @@ void netxen_nic_get_firmware_info(struct netxen_adapter *adapter)
if (adapter->fw_version >= NETXEN_VERSION_CODE(4, 0, 222))
adapter->capabilities = NXRD32(adapter, CRB_FW_CAPABILITIES_1);
+
+ adapter->flags &= ~NETXEN_NIC_LRO_ENABLED;
}
int
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index e8bdbf9..c3609e4 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -1277,7 +1277,7 @@ netxen_process_rcv(struct netxen_adapter *adapter,
napi_gro_receive(&sds_ring->napi, skb);
- adapter->stats.no_rcv++;
+ adapter->stats.rx_pkts++;
adapter->stats.rxbytes += length;
return buffer;
@@ -1350,8 +1350,13 @@ netxen_process_lro(struct netxen_adapter *adapter,
th->psh = push;
th->seq = htonl(seq_number);
+ length = skb->len;
+
netif_receive_skb(skb);
+ adapter->stats.lro_pkts++;
+ adapter->stats.rxbytes += length;
+
return buffer;
}
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 4e3fb30..de67e42 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -892,6 +892,9 @@ netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev)
if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
netxen_config_intr_coalesce(adapter);
+ if (adapter->capabilities & NX_FW_CAPABILITY_HW_LRO)
+ netxen_config_hw_lro(adapter, NETXEN_NIC_LRO_ENABLED);
+
netxen_napi_enable(adapter);
if (adapter->capabilities & NX_FW_CAPABILITY_LINK_NOTIFICATION)
@@ -1077,6 +1080,9 @@ netxen_setup_netdev(struct netxen_adapter *adapter,
if (adapter->capabilities & NX_FW_CAPABILITY_FVLANTX)
netdev->features |= (NETIF_F_HW_VLAN_TX);
+ if (adapter->capabilities & NX_FW_CAPABILITY_HW_LRO)
+ netdev->features |= NETIF_F_LRO;
+
netdev->irq = adapter->msix_entries[0].vector;
err = netxen_napi_add(adapter, netdev);
@@ -1812,7 +1818,7 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev)
memset(stats, 0, sizeof(*stats));
- stats->rx_packets = adapter->stats.no_rcv;
+ stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts;
stats->tx_packets = adapter->stats.xmitfinished;
stats->rx_bytes = adapter->stats.rxbytes;
stats->tx_bytes = adapter->stats.txbytes;
--
1.6.0.2
^ permalink raw reply related
* Re: Strange network timeouts w/ 2.6.30.5
From: Aviv Greenberg @ 2009-08-23 19:18 UTC (permalink / raw)
To: Krzysztof Halasa; +Cc: Walt Holman, David Miller, linux-kernel, netdev
In-Reply-To: <m3skfmk39q.fsf@intrepid.localdomain>
On Thu, Aug 20, 2009 at 03:45:21PM +0200, Krzysztof Halasa wrote:
> Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
>
> diff --git a/drivers/net/e100.c b/drivers/net/e100.c
> index 014dfb6..b610088 100644
> --- a/drivers/net/e100.c
> +++ b/drivers/net/e100.c
> @@ -1762,9 +1762,12 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
>
> if (ioread8(&nic->csr->scb.status) & rus_no_res)
> nic->ru_running = RU_SUSPENDED;
> +#ifndef CONFIG_X86
> + /* FIXME interferes with swiotlb. */
> pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr,
> sizeof(struct rfd),
> PCI_DMA_BIDIRECTIONAL);
> +#endif
> return -ENODATA;
> }
>
> --
Why do you use PCI_DMA_BIDIRECTIONAL? From what i get, the device writes and the
cpu reads - so the direction should be PCI_DMA_FROMDEVICE. Maybe just maybe the
bi-directionality bites you in the swiotlb case.
> Krzysztof Halasa
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ 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;
as well as URLs for NNTP newsgroup(s).