Re: [PATCH 1/2] [IPV4] UDP: Always checksum even if without socket filter
From: Herbert Xu [EMAIL PROTECTED] Date: Mon, 19 Nov 2007 09:09:29 +0800 In any case, I just looked up RFC1213 and it says: udpInDatagrams OBJECT-TYPE SYNTAX Counter ACCESS read-only STATUS mandatory DESCRIPTION The total number of UDP datagrams delivered to UDP users. ::= { udp 1 } So I think incrementing it in recvmsg is acceptable. Point taken, thanks for checking that. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] [IPV4] UDP: Always checksum even if without socket filter
From: Wang Chen [EMAIL PROTECTED] Date: Mon, 19 Nov 2007 10:02:03 +0800 So if udp_queue_rcv_skb() doing sucessfully means a UDP datagrams delivered to UDP users, the InDatagrams should be increased in udp_queue_rcv_skb(). Otherwise it should be increased until the UDP datagrams is actually delivered to UDP users. I agree. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] [IPV4] UDP: Always checksum even if without socket filter
From: Herbert Xu [EMAIL PROTECTED] Date: Mon, 19 Nov 2007 12:41:17 +0800 On Sun, Nov 18, 2007 at 02:40:10PM -0800, David Miller wrote: This can be fixed, the above cannot. That's a good point. Perhaps one way of getting that info to the user without putting it in UDPInDatagrams is to create an inet_diag interface for UDP and put the number of queued packets for each socket in it. Right, if it's not what the RFC specifies, it's an auxiliary statistic we can provide some other way. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/1]: SAs created although tmpl-optional set
Although tmpl-optional is set, kernel still attempts to create a set of SAs. In xfrm_tmpl_resolve_one(), xfrm_state_find() is called to find an SA. First time, there won't be an SA, so an ACQUIRE will be sent and code then returns to xfrm_tmpl_resolv_one() who then checks tmpl-optional. Since tmpl-optional is set, the xfrm code will then allow flow to pass not transformed. I may have misinterpreted semantics of tmpl-optional, (I thought it meant use an SA only if there is one, otherwise do not transform) but do we want to create an SA as well as send flow without xfrm'ing? regards, Joy Signed-off-by: Joy Latten [EMAIL PROTECTED] diff -urpN linux-2.6.orig/net/xfrm/xfrm_state.c linux-2.6.spd/net/xfrm/xfrm_state.c --- linux-2.6.orig/net/xfrm/xfrm_state.c2007-11-18 16:53:16.0 -0600 +++ linux-2.6.spd/net/xfrm/xfrm_state.c 2007-11-18 23:38:08.0 -0600 @@ -814,6 +814,12 @@ xfrm_state_find(xfrm_address_t *daddr, x error = -EEXIST; goto out; } + + if (tmpl-optional) { + error = 0; + goto out; + } + x = xfrm_state_alloc(); if (x == NULL) { error = -ENOMEM; - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: r8169 crash
Maybe it is good idea to print some registers/etc in watchdog message? I will try to reproduce problem with debug enabled, maybe it will be possible to catch problem with more debug. On Sun, 18 Nov 2007 22:00:38 +0100, Francois Romieu wrote Denys [EMAIL PROTECTED] : Before it happens on 2.6.22, i tried to attach good cable, plug-unplug, whatever, interface up/down - card still remains dead. A few things have changed since 2.6.22 but I'll take that it is a real bug and that 2.6.23 would not recover either. Can you fill a PR at http://bugzilla.kernel.org, add a lspci -vvv and a dmesg ? A dmesg including the watchdog message would be nice but if you can not retrieve one, a dmesg from your current 2.6.23.x kernel should be enough. I'll take care of it once I am done with the sis190 watchdog failure (nothing hard, simply ugly). [...] I try to plug cable to laptop with rtl8139 and pc with e100 - it is worked when i shake bad cable(interface was going up/down as well), and good cable also worked fine, and never crashed. On 2.6.22 i was able to reproduce it easily, but later i can't cause it is server in internet cafe, and customers going crazy. :o/ -- Ueimor - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html -- Denys Fedoryshchenko Technical Manager Virtual ISP S.A.L. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH][PKTGEN] Fix double unlock of xfrm_state-lock
The pktgen_output_ipsec() function can unlock this lock twice due to merged error and plain paths. Remove one of the calls to spin_unlock. Other possible solution would be to place return 0 right after the first unlock, but at this place the err is known to be 0, so these solutions are the same except for this one makes the code shorter. Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED] --- diff --git a/net/core/pktgen.c b/net/core/pktgen.c index de33f36..285ec3e 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -2463,8 +2463,6 @@ static int pktgen_output_ipsec(struct sk_buff *skb, struct pktgen_dev *pkt_dev) x-curlft.bytes +=skb-len; x-curlft.packets++; - spin_unlock(x-lock); - error: spin_unlock(x-lock); return err; - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1]: SAs created although tmpl-optional set
On Mon, Nov 19, 2007 at 02:53:50AM -0600, Joy Latten wrote: Although tmpl-optional is set, kernel still attempts to create a set of SAs. Heh I made the same mistake when I first read this piece of code too :) The optional flag isn't saying that it doesn't need to be protected, but rather that the SA may not be present on input. It's only used for IPComp where we may skip the IPComp if the data is not compressible. In other words the optional flag is really only meaningful on inbuond policy checks. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED] Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
HTB/HSFC shaping precision
Hi 2 all again This is not a bug report this time :-) Just it is very interesting question, about using Linux shaping technologies in serious jobs. What i realised few days ago, many ISP's set on their STM-1(15552 bits/s) links (over Cisco) packet buffer/queue 40 packets(for example). It means 103680 pps with 1500 byte packets, and if buffer is only 40 packets, it means it require at least 0.3ms scheduler precision? Otherwise i can have buffer overflow and as result packetloss(what is much worse than delay in most of situations). What i am interested - to utilise such links nearby 100%. So anything not precise will kill idea. Thats important, cause price for links in my area is about $1000-$1500 Mbit/s, and just 1% lost/not utilised on STM-1 is up to $2325/USD lost per month. I have to count also overhead, LAN jitter, and etc. As far as i test, on HFSC if i set dmax 1ms-10ms it works much better (i am talking about precision) than HTB with quantum 1514 (it is over ethernet). Anybody have ideas what is the precision of bandwidth shaping in HFSC/HTB? -- Denys Fedoryshchenko Technical Manager Virtual ISP S.A.L. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH][IPVS] Relax the module get/put in ip_vs_app.c
Both try_module_get/module_put already handle the module == NULL case, so no need in manual checking. This patch fits both net-2.6 and net-2.6.25. Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED] --- diff --git a/net/ipv4/ipvs/ip_vs_app.c b/net/ipv4/ipvs/ip_vs_app.c index 664cb8e..535abe0 100644 --- a/net/ipv4/ipvs/ip_vs_app.c +++ b/net/ipv4/ipvs/ip_vs_app.c @@ -51,18 +51,13 @@ static DEFINE_MUTEX(__ip_vs_app_mutex); */ static inline int ip_vs_app_get(struct ip_vs_app *app) { - /* test and get the module atomically */ - if (app-module) - return try_module_get(app-module); - else - return 1; + return try_module_get(app-module); } static inline void ip_vs_app_put(struct ip_vs_app *app) { - if (app-module) - module_put(app-module); + module_put(app-module); } - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] virtio: free transmit skbs when notified, not on next xmit.
Am Montag, 19. November 2007 schrieb Rusty Russell: This fixes a potential dangling xmit problem. We also suppress refill interrupts until we need them. (Anthony and I have been working on performance recently, so this is a WIP). Signed-off-by: Rusty Russell [EMAIL PROTECTED] Thanks Rusty, that was the 2nd next item on my todo list :-) Acked-by: Christian Borntraeger [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH][net-2.6.25][NETNS] make netns cleanup to run in a separate workqueue
Subject: make netns cleanup to run in a separate queue From: Benjamin Thery [EMAIL PROTECTED] This patch adds a separate workqueue for cleaning up a network namespace. If we use the keventd workqueue to execute cleanup_net(), there is a problem to unregister devices in IPv6. Indeed the code that cleans up also schedule work in keventd: as long as cleanup_net() hasn't return, dst_gc_task() cannot run and as long as dst_gc_task() has not run, there are still some references pending on the net devices and cleanup_net() can not unregister and exit the keventd workqueue. Signed-off-by: Daniel Lezcano [EMAIL PROTECTED] Signed-off-by: Benjamin Thery [EMAIL PROTECTED] Acked-by: Denis V. Lunev [EMAIL PROTECTED] --- net/core/net_namespace.c |9 - 1 file changed, 8 insertions(+), 1 deletion(-) Index: net-2.6.25/net/core/net_namespace.c === --- net-2.6.25.orig/net/core/net_namespace.c +++ net-2.6.25/net/core/net_namespace.c @@ -58,6 +58,7 @@ out_undo: #ifdef CONFIG_NET_NS static struct kmem_cache *net_cachep; +static struct workqueue_struct *netns_wq; static struct net *net_alloc(void) { @@ -149,7 +150,7 @@ void __put_net(struct net *net) { /* Cleanup the network namespace in process context */ INIT_WORK(net-work, cleanup_net); - schedule_work(net-work); + queue_work(netns_wq, net-work); } EXPORT_SYMBOL_GPL(__put_net); @@ -171,7 +172,13 @@ static int __init net_ns_init(void) net_cachep = kmem_cache_create(net_namespace, sizeof(struct net), SMP_CACHE_BYTES, SLAB_PANIC, NULL); + + /* Create workqueue for cleanup */ + netns_wq = create_singlethread_workqueue(netns); + if (!netns_wq) + panic(Could not create netns workq); #endif + mutex_lock(net_mutex); err = setup_net(init_net);
Re: [PATCH][net-2.6.25][NETNS] make netns cleanup to run in a separate workqueue
Ah, sorry. Didn't notice it's called only on boot. Acked-By: Kirill Korotaev [EMAIL PROTECTED] Kirill Korotaev wrote: imho panic() is too much. create_singlethread_workqueue() can fail e.g. due to out of memory... Thanks, Kirill Daniel Lezcano wrote: Subject: make netns cleanup to run in a separate queue From: Benjamin Thery [EMAIL PROTECTED] This patch adds a separate workqueue for cleaning up a network namespace. If we use the keventd workqueue to execute cleanup_net(), there is a problem to unregister devices in IPv6. Indeed the code that cleans up also schedule work in keventd: as long as cleanup_net() hasn't return, dst_gc_task() cannot run and as long as dst_gc_task() has not run, there are still some references pending on the net devices and cleanup_net() can not unregister and exit the keventd workqueue. Signed-off-by: Daniel Lezcano [EMAIL PROTECTED] Signed-off-by: Benjamin Thery [EMAIL PROTECTED] Acked-by: Denis V. Lunev [EMAIL PROTECTED] --- net/core/net_namespace.c |9 - 1 file changed, 8 insertions(+), 1 deletion(-) Index: net-2.6.25/net/core/net_namespace.c === --- net-2.6.25.orig/net/core/net_namespace.c +++ net-2.6.25/net/core/net_namespace.c @@ -58,6 +58,7 @@ out_undo: #ifdef CONFIG_NET_NS static struct kmem_cache *net_cachep; +static struct workqueue_struct *netns_wq; static struct net *net_alloc(void) { @@ -149,7 +150,7 @@ void __put_net(struct net *net) { /* Cleanup the network namespace in process context */ INIT_WORK(net-work, cleanup_net); - schedule_work(net-work); + queue_work(netns_wq, net-work); } EXPORT_SYMBOL_GPL(__put_net); @@ -171,7 +172,13 @@ static int __init net_ns_init(void) net_cachep = kmem_cache_create(net_namespace, sizeof(struct net), SMP_CACHE_BYTES, SLAB_PANIC, NULL); + + /* Create workqueue for cleanup */ + netns_wq = create_singlethread_workqueue(netns); + if (!netns_wq) + panic(Could not create netns workq); #endif + mutex_lock(net_mutex); err = setup_net(init_net); ___ Containers mailing list [EMAIL PROTECTED] https://lists.linux-foundation.org/mailman/listinfo/containers ___ Containers mailing list [EMAIL PROTECTED] https://lists.linux-foundation.org/mailman/listinfo/containers - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] [IPV4] UDP: Always checksum even if without socket filter
Em Mon, Nov 19, 2007 at 12:41:17PM +0800, Herbert Xu escreveu: On Sun, Nov 18, 2007 at 02:40:10PM -0800, David Miller wrote: This can be fixed, the above cannot. That's a good point. Perhaps one way of getting that info to the user without putting it in UDPInDatagrams is to create an inet_diag interface for UDP and put the number of queued packets for each socket in it. This is something I would love to see: UDP refactored so that it gets its hash tables/lookup code more and more looking like what we have in inet_hashtables (struct inet_hashinfo, etc) so that udp_diag would just fit in the inet_diag infrastructure, like dccp, that is in some aspects like TCP and in others like UDP and already uses this infrastructure. - Arnaldo - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Compact sk_stream_mem_schedule() code
This function references sk-sk_prot-xxx for many times. It turned out, that there's so many code in it, that gcc cannot always optimize access to sk-sk_prot's fields. After saving the sk-sk_prot on the stack and comparing disassembled code, it turned out that the function became ~10 bytes shorter and made less dereferences (on i386 and x86_64). Stack consumption didn't grow. Besides, this patch drives most of this function into the 80 columns limit. Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED] --- diff --git a/net/core/stream.c b/net/core/stream.c index 755bacb..b2fb846 100644 --- a/net/core/stream.c +++ b/net/core/stream.c @@ -210,35 +210,36 @@ EXPORT_SYMBOL(__sk_stream_mem_reclaim); int sk_stream_mem_schedule(struct sock *sk, int size, int kind) { int amt = sk_stream_pages(size); + struct proto *prot = sk-sk_prot; sk-sk_forward_alloc += amt * SK_STREAM_MEM_QUANTUM; - atomic_add(amt, sk-sk_prot-memory_allocated); + atomic_add(amt, prot-memory_allocated); /* Under limit. */ - if (atomic_read(sk-sk_prot-memory_allocated) sk-sk_prot-sysctl_mem[0]) { - if (*sk-sk_prot-memory_pressure) - *sk-sk_prot-memory_pressure = 0; + if (atomic_read(prot-memory_allocated) prot-sysctl_mem[0]) { + if (*prot-memory_pressure) + *prot-memory_pressure = 0; return 1; } /* Over hard limit. */ - if (atomic_read(sk-sk_prot-memory_allocated) sk-sk_prot-sysctl_mem[2]) { - sk-sk_prot-enter_memory_pressure(); + if (atomic_read(prot-memory_allocated) prot-sysctl_mem[2]) { + prot-enter_memory_pressure(); goto suppress_allocation; } /* Under pressure. */ - if (atomic_read(sk-sk_prot-memory_allocated) sk-sk_prot-sysctl_mem[1]) - sk-sk_prot-enter_memory_pressure(); + if (atomic_read(prot-memory_allocated) prot-sysctl_mem[1]) + prot-enter_memory_pressure(); if (kind) { - if (atomic_read(sk-sk_rmem_alloc) sk-sk_prot-sysctl_rmem[0]) + if (atomic_read(sk-sk_rmem_alloc) prot-sysctl_rmem[0]) return 1; - } else if (sk-sk_wmem_queued sk-sk_prot-sysctl_wmem[0]) + } else if (sk-sk_wmem_queued prot-sysctl_wmem[0]) return 1; - if (!*sk-sk_prot-memory_pressure || - sk-sk_prot-sysctl_mem[2] atomic_read(sk-sk_prot-sockets_allocated) * + if (!*prot-memory_pressure || + prot-sysctl_mem[2] atomic_read(prot-sockets_allocated) * sk_stream_pages(sk-sk_wmem_queued + atomic_read(sk-sk_rmem_alloc) + sk-sk_forward_alloc)) @@ -258,7 +259,7 @@ suppress_allocation: /* Alas. Undo changes. */ sk-sk_forward_alloc -= amt * SK_STREAM_MEM_QUANTUM; - atomic_sub(amt, sk-sk_prot-memory_allocated); + atomic_sub(amt, prot-memory_allocated); return 0; } - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] net/ipv4/arp.c: Fix arp reply when sender ip 0 (was: Strange behavior in arp probe reply, bug or feature?)
Hello! Is there a reason that the target hardware address isn't the target hardware address? It is bound only to the fact that linux uses protocol address of the machine, which responds. It would be highly confusing (more than confusing :-)), if we used our protocol address and hardware address of requestor. But if you use zero protocol address as source, you really can use any hw address. The dhcp clients I examined, and the implementation of the arpcheck that I use will compare the target hardware field of the arp-reply and match it against its own mac, to verify the reply. And this fails with the current implementation in the kernel. 1. Do not do this. Mainly, because you already know that this does not work with linux. :-) Logically, target hw address in arp reply is just a nonsensial redundancy, it should not be checked and even looked at. 2. What's about your suggestion, I thought about this and I am going to agree. Arguments, which convinced me are: - arping still works. - any piece of reasonable software should work. - if Windows understands DaD (is it really true? I cannot believe) and it is unhappy about our responce and does not block use of duplicate address only due to this, we _must_ accomodate ASAP. - if we do,we have to use 0 protocol address, no choice. Alexey - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-2.6] [TCP] MTUprobe: fix potential sk_send_head corruption
When the abstraction functions got added, conversion was made here incorrectly. As a result, the skb may end up pointing to skb which got included to the probe skb and then was freed. For it to trigger, however, transmit_skb must fail sending as well. Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED] --- include/net/tcp.h |3 +++ net/ipv4/tcp_output.c |1 - 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index decd8f3..c11b613 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1342,6 +1342,9 @@ static inline void tcp_insert_write_queue_before(struct sk_buff *new, { __skb_insert(new, skb-prev, skb, sk-sk_write_queue); tcp_rb_insert(new, tcp_sk(sk)-write_queue_rb); + + if (sk-sk_send_head == skb) + sk-sk_send_head = new; } static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 8fe3ee2..1654fac 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1343,7 +1343,6 @@ static int tcp_mtu_probe(struct sock *sk) TCP_SKB_CB(nskb)-seq = TCP_SKB_CB(skb)-seq; TCP_SKB_CB(nskb)-end_seq = TCP_SKB_CB(skb)-seq + probe_size; tcp_insert_write_queue_before(nskb, skb, sk); - tcp_advance_send_head(sk, skb); TCP_SKB_CB(nskb)-flags = TCPCB_FLAG_ACK; TCP_SKB_CB(nskb)-sacked = 0; -- 1.5.0.6
[PATCH net-2.6 (2nd try)] [TCP] MTUprobe: fix potential sk_send_head corruption
Please ignore the previous version, it had an rbtree artifact which made it to not apply cleanly, here's the corrected version: -- [PATCH] [TCP] MTUprobe: fix potential sk_send_head corruption When the abstraction functions got added, conversion here was made incorrectly. As a result, the skb may end up pointing to skb which got included to the probe skb and then was freed. For it to trigger, however, skb_transmit must fail sending as well. Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED] --- include/net/tcp.h |3 +++ net/ipv4/tcp_output.c |1 - 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 1bceca8..f0c5e7a 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1290,6 +1290,9 @@ static inline void tcp_insert_write_queue_before(struct sk_buff *new, struct sock *sk) { __skb_insert(new, skb-prev, skb, sk-sk_write_queue); + + if (sk-sk_send_head == skb) + sk-sk_send_head = new; } static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index b0ece43..30d6737 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1346,7 +1346,6 @@ static int tcp_mtu_probe(struct sock *sk) skb = tcp_send_head(sk); tcp_insert_write_queue_before(nskb, skb, sk); - tcp_advance_send_head(sk, skb); TCP_SKB_CB(nskb)-seq = TCP_SKB_CB(skb)-seq; TCP_SKB_CB(nskb)-end_seq = TCP_SKB_CB(skb)-seq + probe_size; -- 1.5.0.6
Get the IP address of an interface with a given name
/* returns in *addr the internet address having the name ifname */ int get_ifaddr_by_name(const char *ifname, __u32 * addr) { struct net_device *pnet_device; struct in_device *pin_device; struct in_ifaddr* inet_ifaddr; read_lock_bh(dev_base_lock); #if LINUX_VERSION_CODE KERNEL_VERSION(2,6,22) pnet_device = dev_base; #else pnet_device = first_net_device(); #endif while (pnet_device != NULL) { if ((netif_running(pnet_device)) (pnet_device-ip_ptr != NULL) (strcmp(pnet_device-name, ifname) == 0)) { pin_device = (struct in_device *) pnet_device-ip_ptr; inet_ifaddr = pin_device-ifa_list; if(inet_ifaddr == NULL) { printk(ifa_list is null!\n); break; } /* ifa_local: ifa_address is the remote point in ppp */ *addr = (inet_ifaddr-ifa_local); read_unlock_bh(dev_base_lock); return 1; } #if LINUX_VERSION_CODE KERNEL_VERSION(2,6,22) pnet_device = pnet_device-next; #else pnet_device = next_net_device(pnet_device); #endif } read_unlock_bh(dev_base_lock); return -1; /* address not found! */ } -- Giacomo S. http://www.giacomos.it - - - - - - - - - - - - - - - - - - - - - - IPFIREwall (http://www.giacomos.it/ipfire) viene presentato all'Universita` degli Studi di Udine, il 28 ottobre, in occasione del Linux Day 2006: http://iglu.cc.uniud.it/linuxday - - - - - - - - - - - - - - - - - - - - - - . '' `. : :': `. ` ' `- Debian GNU/Linux -- The power of freedom http://www.debian.org - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] [IPV4] UDP: Always checksum even if without socket filter
All of our options suck, we just have to choose the least sucking one and right now to me that's decrementing the counter as much as I empathize with the SNMP application overflow detection issue. If the SNMP monitor detects an false overflow the error it reports will be much worse than a single missing packet. So you would replace one error with a worse error. This can be fixed, the above cannot. I don't see how, short of breaking the interface (e.g. reporting 64bit or separate overflow counts) -Andi - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH][PKTGEN] Fix double unlock of xfrm_state-lock
On Mon, 2007-19-11 at 12:47 +0300, Pavel Emelyanov wrote: The pktgen_output_ipsec() function can unlock this lock twice due to merged error and plain paths. Remove one of the calls to spin_unlock. Good catch. Acked-by: Jamal Hadi Salim [EMAIL PROTECTED] cheers, jamal - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: HTB/HSFC shaping precision
Denys, You certainly make a very compelling case. It is always compelling if you can translate a bug/feature into $$;-. So in your measurements, what kind of clock sources did you use? I think the parameters to worry about are: packet size, rate and clock source. I know that based on very old measurements i did on CBQ, regardless of the clock source if you have a long-lived flow the bandwidth measurement corrects itself. I wouldnt recommend going to CBQ, but a good start is to test and post some results. cheers, jamal On Mon, 2007-19-11 at 10:55 +0200, Denys Fedoryshchenko wrote: Hi 2 all again This is not a bug report this time :-) Just it is very interesting question, about using Linux shaping technologies in serious jobs. What i realised few days ago, many ISP's set on their STM-1(15552 bits/s) links (over Cisco) packet buffer/queue 40 packets(for example). It means 103680 pps with 1500 byte packets, and if buffer is only 40 packets, it means it require at least 0.3ms scheduler precision? Otherwise i can have buffer overflow and as result packetloss(what is much worse than delay in most of situations). What i am interested - to utilise such links nearby 100%. So anything not precise will kill idea. Thats important, cause price for links in my area is about $1000-$1500 Mbit/s, and just 1% lost/not utilised on STM-1 is up to $2325/USD lost per month. I have to count also overhead, LAN jitter, and etc. As far as i test, on HFSC if i set dmax 1ms-10ms it works much better (i am talking about precision) than HTB with quantum 1514 (it is over ethernet). Anybody have ideas what is the precision of bandwidth shaping in HFSC/HTB? - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] dm9601: Fix printk
A printk in the error handling code of dm9601.c was missing a newline. Signed-off-by: Peter Korsgaard [EMAIL PROTECTED] --- drivers/net/usb/dm9601.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 2c68573..1ffdd10 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c @@ -94,7 +94,7 @@ static void dm_write_async_callback(struct urb *urb) struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb-context; if (urb-status 0) - printk(KERN_DEBUG dm_write_async_callback() failed with %d, + printk(KERN_DEBUG dm_write_async_callback() failed with %d\n, urb-status); kfree(req); -- 1.5.3.4 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] dm9601: Consolidate common parts of dm_write_*_async
dm_write_async and dm_write_reg_async are almost identical. Move common functionality to dm_write_async_helper (saves ~256b). Signed-off-by: Peter Korsgaard [EMAIL PROTECTED] --- drivers/net/usb/dm9601.c | 53 +++-- 1 files changed, 13 insertions(+), 40 deletions(-) diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 1ffdd10..633a511 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c @@ -101,17 +101,16 @@ static void dm_write_async_callback(struct urb *urb) usb_free_urb(urb); } -static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data) +static void dm_write_async_helper(struct usbnet *dev, u8 reg, u8 value, + u16 length, void *data) { struct usb_ctrlrequest *req; struct urb *urb; int status; - devdbg(dev, dm_write_async() reg=0x%02x length=%d, reg, length); - urb = usb_alloc_urb(0, GFP_ATOMIC); if (!urb) { - deverr(dev, Error allocating URB in dm_write_async!); + deverr(dev, Error allocating URB in dm_write_async_helper!); return; } @@ -123,8 +122,8 @@ static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data) } req-bRequestType = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE; - req-bRequest = DM_WRITE_REGS; - req-wValue = 0; + req-bRequest = length ? DM_WRITE_REGS : DM_WRITE_REG; + req-wValue = cpu_to_le16(value); req-wIndex = cpu_to_le16(reg); req-wLength = cpu_to_le16(length); @@ -142,45 +141,19 @@ static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data) } } -static void dm_write_reg_async(struct usbnet *dev, u8 reg, u8 value) +static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data) { - struct usb_ctrlrequest *req; - struct urb *urb; - int status; + devdbg(dev, dm_write_async() reg=0x%02x length=%d, reg, length); + dm_write_async_helper(dev, reg, 0, length, data); +} + +static void dm_write_reg_async(struct usbnet *dev, u8 reg, u8 value) +{ devdbg(dev, dm_write_reg_async() reg=0x%02x value=0x%02x, reg, value); - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!urb) { - deverr(dev, Error allocating URB in dm_write_async!); - return; - } - - req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC); - if (!req) { - deverr(dev, Failed to allocate memory for control request); - usb_free_urb(urb); - return; - } - - req-bRequestType = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE; - req-bRequest = DM_WRITE_REG; - req-wValue = cpu_to_le16(value); - req-wIndex = cpu_to_le16(reg); - req-wLength = 0; - - usb_fill_control_urb(urb, dev-udev, -usb_sndctrlpipe(dev-udev, 0), -(void *)req, NULL, 0, dm_write_async_callback, req); - - status = usb_submit_urb(urb, GFP_ATOMIC); - if (status 0) { - deverr(dev, Error submitting the control message: status=%d, - status); - kfree(req); - usb_free_urb(urb); - } + dm_write_async_helper(dev, reg, value, 0, NULL); } static int dm_read_shared_word(struct usbnet *dev, int phy, u8 reg, u16 *value) -- 1.5.3.4 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Netfilter: kernel panic with REDIRECT target. (2.6.23 and 2.6.23.8)
On Mon, Nov 19, 2007 at 06:51:38PM +, David ([EMAIL PROTECTED]) wrote: Patrick McHardy wrote: iptables -t nat -A PREROUTING -j REDIRECT -i eth2 -p udp --dport 5061 --to-ports 5060 Also post the kernel panic log. Please try if this patch fixes the problem. No luck with the patch I'm afraid, panic log attached (of patched kernel). Ok, let's try it hard way. Please check attached patch and tell if it helped (it will produce some debug though). What is a load on this machine? Is it simple enough to reproduce? I will take closer look tomorrow if this will not help. Thanks. diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index 70e7997..7dc3496 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c @@ -607,13 +607,13 @@ static void nf_nat_move_storage(struct nf_conn *conntrack, void *old) struct nf_conn_nat *new_nat = nf_ct_ext_find(conntrack, NF_CT_EXT_NAT); struct nf_conn_nat *old_nat = (struct nf_conn_nat *)old; struct nf_conn *ct = old_nat-ct; - unsigned int srchash; + + printk(conntrack: %p, new: %p, old: %p, ct: %p.\n, + conntrack, new_nat, old_nat, ct); - if (!(ct-status IPS_NAT_DONE_MASK)) + if (!ct || !(ct-status IPS_NAT_DONE_MASK)) return; - srchash = hash_by_src(ct-tuplehash[IP_CT_DIR_ORIGINAL].tuple); - write_lock_bh(nf_nat_lock); hlist_replace_rcu(old_nat-bysource, new_nat-bysource); new_nat-ct = ct; -- Evgeniy Polyakov - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Compact sk_stream_mem_schedule() code
Em Mon, Nov 19, 2007 at 03:13:44PM +0300, Pavel Emelyanov escreveu: This function references sk-sk_prot-xxx for many times. It turned out, that there's so many code in it, that gcc cannot always optimize access to sk-sk_prot's fields. After saving the sk-sk_prot on the stack and comparing disassembled code, it turned out that the function became ~10 bytes shorter and made less dereferences (on i386 and x86_64). Stack consumption didn't grow. Besides, this patch drives most of this function into the 80 columns limit. Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED] I wonder if making it 'const struct proto *prot = sk-sk_prot;' would make any difference. Acked-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Netfilter: kernel panic with REDIRECT target. (2.6.23 and 2.6.23.8)
On Mon, Nov 19, 2007 at 10:24:23PM +0300, Evgeniy Polyakov ([EMAIL PROTECTED]) wrote: On Mon, Nov 19, 2007 at 06:51:38PM +, David ([EMAIL PROTECTED]) wrote: Patrick McHardy wrote: iptables -t nat -A PREROUTING -j REDIRECT -i eth2 -p udp --dport 5061 --to-ports 5060 Also post the kernel panic log. Please try if this patch fixes the problem. No luck with the patch I'm afraid, panic log attached (of patched kernel). Ok, let's try it hard way. Please check attached patch and tell if it helped (it will produce some debug though). With both patches applied - one Patrick showed and this one. -- Evgeniy Polyakov - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Netfilter: kernel panic with REDIRECT target. (2.6.23 and 2.6.23.8)
Evgeniy Polyakov wrote: On Mon, Nov 19, 2007 at 10:24:23PM +0300, Evgeniy Polyakov ([EMAIL PROTECTED]) wrote: On Mon, Nov 19, 2007 at 06:51:38PM +, David ([EMAIL PROTECTED]) wrote: Patrick McHardy wrote: iptables -t nat -A PREROUTING -j REDIRECT -i eth2 -p udp --dport 5061 --to-ports 5060 Also post the kernel panic log. Please try if this patch fixes the problem. No luck with the patch I'm afraid, panic log attached (of patched kernel). Ok, let's try it hard way. Please check attached patch and tell if it helped (it will produce some debug though). With both patches applied - one Patrick showed and this one. Now works, with this in dmesg conntrack: ea94159c, new: ead4d7c4, old: ead4d7d0, ct: . Cheers David - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] forcedeth boot delay fix
This patch fixes a long boot delay in the forcedeth driver. During initialization, the timeout for the handshake between mgmt unit and driver can be very long. The patch reduces the timeout by eliminating a extra loop around the timeout logic. Signed-off-by: Ayaz Abdulla [EMAIL PROTECTED] --- old/drivers/net/forcedeth.c 2007-11-08 17:33:00.0 -0500 +++ new/drivers/net/forcedeth.c 2007-11-08 17:34:25.0 -0500 @@ -5286,20 +5286,17 @@ if (readl(base + NvRegTransmitterControl) NVREG_XMITCTL_SYNC_PHY_INIT) { np-mac_in_use = readl(base + NvRegTransmitterControl) NVREG_XMITCTL_MGMT_ST; dprintk(KERN_INFO %s: mgmt unit is running. mac in use %x.\n, pci_name(pci_dev), np-mac_in_use); - for (i = 0; i 5000; i++) { - msleep(1); - if (nv_mgmt_acquire_sema(dev)) { - /* management unit setup the phy already? */ - if ((readl(base + NvRegTransmitterControl) NVREG_XMITCTL_SYNC_MASK) == - NVREG_XMITCTL_SYNC_PHY_INIT) { - /* phy is inited by mgmt unit */ - phyinitialized = 1; - dprintk(KERN_INFO %s: Phy already initialized by mgmt unit.\n, pci_name(pci_dev)); - } else { - /* we need to init the phy */ - } - break; + if (nv_mgmt_acquire_sema(dev)) { + /* management unit setup the phy already? */ + if ((readl(base + NvRegTransmitterControl) NVREG_XMITCTL_SYNC_MASK) == + NVREG_XMITCTL_SYNC_PHY_INIT) { + /* phy is inited by mgmt unit */ + phyinitialized = 1; + dprintk(KERN_INFO %s: Phy already initialized by mgmt unit.\n, pci_name(pci_dev)); + } else { + /* we need to init the phy */ } + break; } } }
Re: [PATCH 2.6.25 6/6] net: consolidate net namespace related proc files creation
Denis V. Lunev [EMAIL PROTECTED] writes: net: consolidate net namespace related proc files creation Signed-off-by: Denis V. Lunev [EMAIL PROTECTED] Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED] Acked-by: Eric W. Biederman [EMAIL PROTECTED] Looks good to me, and it looks like there are a lot more places we can use this as more code is converted. Eric - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2.6.24 2/2]S2io: Fix to aggregate vlan tagged packets
- Fix to aggregate vlan packets. IP offset is incremented by 4 bytes if the packet contains vlan header. Signed-off-by: Santoshkumar Rastapur [EMAIL PROTECTED] Signed-off-by: Ramkrishna Vepa [EMAIL PROTECTED] --- diff -Nurp 2.0.26.8P1/drivers/net/s2io.c 2.0.26.8P2/drivers/net/s2io.c --- 2.0.26.8P1/drivers/net/s2io.c 2007-11-15 18:15:00.0 -0800 +++ 2.0.26.8P2/drivers/net/s2io.c 2007-11-15 18:17:41.0 -0800 @@ -84,7 +84,7 @@ #include s2io.h #include s2io-regs.h -#define DRV_VERSION 2.0.26.6 +#define DRV_VERSION 2.0.26.8 /* S2io Driver name version. */ static char s2io_driver_name[] = Neterion; @@ -2926,7 +2926,7 @@ static void rx_intr_handler(struct ring_ struct lro *lro = nic-lro0_n[i]; if (lro-in_use) { update_L3L4_header(nic, lro); - queue_rx_frame(lro-parent); + queue_rx_frame(lro-parent, lro-vlan_tag); clear_lro_session(lro); } } @@ -7163,7 +7163,8 @@ static int rx_osm_handler(struct ring_in { lro_append_pkt(sp, lro, skb, tcp_len); - queue_rx_frame(lro-parent); + queue_rx_frame(lro-parent, + lro-vlan_tag); clear_lro_session(lro); sp-mac_control.stats_info- sw_stat.flush_max_pkts++; @@ -7174,7 +7175,8 @@ static int rx_osm_handler(struct ring_in lro-frags_len; sp-mac_control.stats_info- sw_stat.sending_both++; - queue_rx_frame(lro-parent); + queue_rx_frame(lro-parent, + lro-vlan_tag); clear_lro_session(lro); goto send_up; case 0: /* sessions exceeded */ @@ -7204,27 +7206,8 @@ static int rx_osm_handler(struct ring_in skb-ip_summed = CHECKSUM_NONE; } sp-mac_control.stats_info-sw_stat.mem_freed += skb-truesize; - if (!sp-lro) { - skb-protocol = eth_type_trans(skb, dev); - if ((sp-vlan_strip_flag == S2IO_STRIP_VLAN_TAG) - RXD_GET_VLAN_TAG(rxdp-Control_2)) { - /* Queueing the vlan frame to the upper layer */ - if (napi) - vlan_hwaccel_receive_skb(skb, sp-vlgrp, - RXD_GET_VLAN_TAG(rxdp-Control_2)); - else - vlan_hwaccel_rx(skb, sp-vlgrp, - RXD_GET_VLAN_TAG(rxdp-Control_2)); - } else { - if (napi) - netif_receive_skb(skb); - else - netif_rx(skb); - } - } else { send_up: - queue_rx_frame(skb); - } + queue_rx_frame(skb, RXD_GET_VLAN_TAG(rxdp-Control_2)); dev-last_rx = jiffies; aggregate: atomic_dec(sp-rx_bufs_left[ring_no]); @@ -7855,7 +7838,8 @@ module_init(s2io_starter); module_exit(s2io_closer); static int check_L2_lro_capable(u8 *buffer, struct iphdr **ip, - struct tcphdr **tcp, struct RxD_t *rxdp) + struct tcphdr **tcp, struct RxD_t *rxdp, + struct s2io_nic *sp) { int ip_off; u8 l2_type = (u8)((rxdp-Control_1 37) 0x7), ip_len; @@ -7866,19 +7850,19 @@ static int check_L2_lro_capable(u8 *buff return -1; } - /* TODO: -* By default the VLAN field in the MAC is stripped by the card, if this -* feature is turned off in rx_pa_cfg register, then the ip_off field -* has to be shifted by a further 2 bytes -*/ - switch (l2_type) { - case 0: /* DIX type */ - case 4: /* DIX type with VLAN */ - ip_off = HEADER_ETHERNET_II_802_3_SIZE; - break; + if ((l2_type == 0) ||/* DIX type */ + (l2_type == 4)) {/* DIX type with VLAN */ + ip_off = HEADER_ETHERNET_II_802_3_SIZE; + /* + * If vlan stripping is disabled and the frame is VLAN tagged, + * shift the offset by the
[PATCH 2.6.24 1/2]S2io: Strip the vlan tag if the vlan group is not NULL
- Updated the vlan tag stripping code as per Dave Johnson's patch [EMAIL PROTECTED] Below is the driver behaviour for vlan_tag_strip loadable paramter, vlan_tag_strip - 0: Don't strip the vlan tag vlan_tag_strip - 1: Always strip the vlan tag vlan_tag_strip - 2 (default): strip the vlan tag if the vlan group is not NULL. Signed-off-by: Santoshkumar Rastapur [EMAIL PROTECTED] Signed-off-by: Ramkrishna Vepa [EMAIL PROTECTED] --- diff -Nurp 2.0.26.6/drivers/net/s2io.c 2.0.26.8P1/drivers/net/s2io.c --- 2.0.26.6/drivers/net/s2io.c 2007-11-15 18:19:42.0 -0800 +++ 2.0.26.8P1/drivers/net/s2io.c 2007-11-15 18:15:00.0 -0800 @@ -46,10 +46,10 @@ * Possible values '1' for enable and '0' for disable. Default is '1' * ufo: This parameter used to enable/disable UDP Fragmentation Offload(UFO) * Possible values '1' for enable and '0' for disable. Default is '0' - * vlan_tag_strip: This can be used to enable or disable vlan stripping. - * Possible values '1' for enable , '0' for disable. - * Default is '2' - which means disable in promisc mode - * and enable in non-promiscuous mode. + * vlan_tag_strip: This can be used to enable or disable vlan tag stripping. + * Possible values '2' for driver default, '1' for enable and + * '0' for disable + * Default is '2' - VLAN tag stripping enabled if vlan group present / #include linux/module.h @@ -365,20 +365,57 @@ static void do_s2io_copy_mac_addr(struct sp-def_mac_addr[offset].mac_addr[1] = (u8) (mac_addr 32); sp-def_mac_addr[offset].mac_addr[0] = (u8) (mac_addr 40); } + +/* Progran the hardware to Enable/Disable vlan tag strippng dynamically */ +static void s2io_handle_vlan_tag_strip(struct s2io_nic *nic, int flag) +{ + struct XENA_dev_config __iomem *bar0 = nic-bar0; + u64 val64; + + val64 = readq(bar0-rx_pa_cfg); + if (flag == S2IO_DO_NOT_STRIP_VLAN_TAG) + val64 = ~RX_PA_CFG_STRIP_VLAN_TAG; + else + val64 |= RX_PA_CFG_STRIP_VLAN_TAG; + + writeq(val64, bar0-rx_pa_cfg); +} + /* Add the vlan */ static void s2io_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) { struct s2io_nic *nic = dev-priv; unsigned long flags; + struct config_param *config = nic-config; spin_lock_irqsave(nic-tx_lock, flags); nic-vlgrp = grp; + + /* if vlgrp is NULL disable VLAN stripping */ + if (config-vlan_tag_strip == S2IO_DEFAULT_STRIP_MODE_VLAN_TAG) { + if (!grp) + nic-vlan_strip_flag = S2IO_DO_NOT_STRIP_VLAN_TAG; + else + nic-vlan_strip_flag = S2IO_STRIP_VLAN_TAG; + } + + s2io_handle_vlan_tag_strip(nic, nic-vlan_strip_flag); spin_unlock_irqrestore(nic-tx_lock, flags); } -/* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or not */ -static int vlan_strip_flag; +/* Unregister the vlan */ +static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid) +{ + unsigned long flags; + struct s2io_nic *nic = dev-priv; + + spin_lock_irqsave(nic-tx_lock, flags); + if (nic-vlgrp) + vlan_group_set_device(nic-vlgrp, vid, NULL); + + spin_unlock_irqrestore(nic-tx_lock, flags); +} /* * Constants to be programmed into the Xena's registers, to configure @@ -479,7 +516,7 @@ S2IO_PARM_INT(indicate_max_pkts, 0); S2IO_PARM_INT(napi, 1); S2IO_PARM_INT(ufo, 0); -S2IO_PARM_INT(vlan_tag_strip, NO_STRIP_IN_PROMISC); +S2IO_PARM_INT(vlan_tag_strip, S2IO_DEFAULT_STRIP_MODE_VLAN_TAG); static unsigned int tx_fifo_len[MAX_TX_FIFOS] = {DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN}; @@ -2147,12 +2184,7 @@ static int start_nic(struct s2io_nic *ni writeq(val64, bar0-rx_pa_cfg); } - if (vlan_tag_strip == 0) { - val64 = readq(bar0-rx_pa_cfg); - val64 = ~RX_PA_CFG_STRIP_VLAN_TAG; - writeq(val64, bar0-rx_pa_cfg); - vlan_strip_flag = 0; - } + s2io_handle_vlan_tag_strip(nic, nic-vlan_strip_flag); /* * Enabling MC-RLDRAM. After enabling the device, we timeout @@ -4766,13 +4798,6 @@ static void s2io_set_multicast(struct ne writeq(RMAC_CFG_KEY(0x4C0D), bar0-rmac_cfg_key); writel((u32) (val64 32), (add + 4)); - if (vlan_tag_strip != 1) { - val64 = readq(bar0-rx_pa_cfg); - val64 = ~RX_PA_CFG_STRIP_VLAN_TAG; - writeq(val64, bar0-rx_pa_cfg); - vlan_strip_flag = 0; - } - val64 = readq(bar0-mac_cfg); sp-promisc_flg = 1;
[patch 17/22] NET: DM9000: Remove cal_CRC() and use ether_crc_le instead
Remove the cal_CRC as this is basically wrappering the ether_crc_le function, and is only being used by the multicast hash table functions. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -1221,24 +1221,6 @@ dm9000_write_eeprom(board_info_t *db, in } /* - * Calculate the CRC valude of the Rx packet - * flag = 1 : return the reverse CRC (for the received packet CRC) - * 0 : return the normal CRC (for Hash Table index) - */ - -static unsigned long -cal_CRC(unsigned char *Data, unsigned int Len, u8 flag) -{ - - u32 crc = ether_crc_le(Len, Data); - - if (flag) - return ~crc; - - return crc; -} - -/* * Set DM9000 multicast address */ static void @@ -1247,15 +1229,16 @@ dm9000_hash_table(struct net_device *dev board_info_t *db = (board_info_t *) dev-priv; struct dev_mc_list *mcptr = dev-mc_list; int mc_cnt = dev-mc_count; + int i, oft; u32 hash_val; - u16 i, oft, hash_table[4]; + u16 hash_table[4]; unsigned long flags; dm9000_dbg(db, 1, entering %s\n, __func__); - spin_lock_irqsave(db-lock,flags); + spin_lock_irqsave(db-lock, flags); - for (i = 0, oft = 0x10; i 6; i++, oft++) + for (i = 0, oft = DM9000_PAR; i 6; i++, oft++) iow(db, oft, dev-dev_addr[i]); /* Clear Hash Table */ @@ -1267,17 +1250,17 @@ dm9000_hash_table(struct net_device *dev /* the multicast address in Hash Table : 64 bits */ for (i = 0; i mc_cnt; i++, mcptr = mcptr-next) { - hash_val = cal_CRC((char *) mcptr-dmi_addr, 6, 0) 0x3f; + hash_val = ether_crc_le(6, mcptr-dmi_addr) 0x3f; hash_table[hash_val / 16] |= (u16) 1 (hash_val % 16); } /* Write the hash table to MAC MD table */ - for (i = 0, oft = 0x16; i 4; i++) { - iow(db, oft++, hash_table[i] 0xff); - iow(db, oft++, (hash_table[i] 8) 0xff); + for (i = 0, oft = DM9000_MAR; i 4; i++) { + iow(db, oft++, hash_table[i]); + iow(db, oft++, hash_table[i] 8); } - spin_unlock_irqrestore(db-lock,flags); + spin_unlock_irqrestore(db-lock, flags); } -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 04/22] NET: DM9000: Add initial ethtool support
Add support for ethtool operations for the DM9000. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -63,6 +63,7 @@ #include linux/spinlock.h #include linux/crc32.h #include linux/mii.h +#include linux/ethtool.h #include linux/dm9000.h #include linux/delay.h #include linux/platform_device.h @@ -79,6 +80,7 @@ #define CARDNAME dm9000 #define PFX CARDNAME : +#define DRV_VERSION1.30 #define DM9000_TIMER_WUT jiffies+(HZ*2) /* timer wakeup time : 2 second */ @@ -147,6 +149,11 @@ typedef struct board_info { } \ } while (0) +static inline board_info_t *to_dm9000_board(struct net_device *dev) +{ + return dev-priv; +} + /* function declaration - */ static int dm9000_probe(struct platform_device *); static int dm9000_open(struct net_device *); @@ -348,6 +355,64 @@ static void dm9000_poll_controller(struc } #endif +/* ethtool ops */ + +static void dm9000_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info) +{ + board_info_t *dm = to_dm9000_board(dev); + + strcpy(info-driver, CARDNAME); + strcpy(info-version, DRV_VERSION); + strcpy(info-bus_info, to_platform_device(dm-dev)-name); +} + +static int dm9000_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) +{ + board_info_t *dm = to_dm9000_board(dev); + unsigned long flags; + + spin_lock_irqsave(dm-lock, flags); + mii_ethtool_gset(dm-mii, cmd); + spin_lock_irqsave(dm-lock, flags); + + return 0; +} + +static int dm9000_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) +{ + board_info_t *dm = to_dm9000_board(dev); + unsigned long flags; + int rc; + + spin_lock_irqsave(dm-lock, flags); + rc = mii_ethtool_sset(dm-mii, cmd); + spin_lock_irqsave(dm-lock, flags); + + return rc; +} + +static int dm9000_nway_reset(struct net_device *dev) +{ + board_info_t *dm = to_dm9000_board(dev); + return mii_nway_restart(dm-mii); +} + +static u32 dm9000_get_link(struct net_device *dev) +{ + board_info_t *dm = to_dm9000_board(dev); + return mii_link_ok(dm-mii); +} + +static const struct ethtool_ops dm9000_ethtool_ops = { + .get_drvinfo= dm9000_get_drvinfo, + .get_settings = dm9000_get_settings, + .set_settings = dm9000_set_settings, + .nway_reset = dm9000_nway_reset, + .get_link = dm9000_get_link, +}; + + /* dm9000_release_board * * release a board, and any mapped resources @@ -555,6 +620,8 @@ dm9000_probe(struct platform_device *pde ndev-stop = dm9000_stop; ndev-get_stats = dm9000_get_stats; ndev-set_multicast_list = dm9000_hash_table; + ndev-ethtool_ops= dm9000_ethtool_ops; + #ifdef CONFIG_NET_POLL_CONTROLLER ndev-poll_controller= dm9000_poll_controller; #endif @@ -1211,7 +1278,7 @@ static struct platform_driver dm9000_dri static int __init dm9000_init(void) { - printk(KERN_INFO %s Ethernet Driver\n, CARDNAME); + printk(KERN_INFO %s Ethernet Driver, V%s\n, CARDNAME, DRV_VERSION); return platform_driver_register(dm9000_driver);/* search board and register */ } -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 21/22] NET: DM9000: Update retry count whilst identifying chip
Reading the ID register does not always return the correct ID from the device, so we retry several times to see if we get a correct value. These failures seem to be excaserbated by the speed of the access to the chip (possibly time between issuing the address and then the data cycle). Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -652,7 +652,7 @@ dm9000_probe(struct platform_device *pde dm9000_reset(db); /* try two times, DM9000 sometimes gets the first read wrong */ - for (i = 0; i 2; i++) { + for (i = 0; i 8; i++) { id_val = ior(db, DM9000_VIDL); id_val |= (u32)ior(db, DM9000_VIDH) 8; id_val |= (u32)ior(db, DM9000_PIDL) 16; -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 18/22] NET: DM9000: Remove redudant use of 0xff
The writing of the data should implicitly truncate the data to 8bits, so do not bother with the ands in the code. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -840,8 +840,8 @@ dm9000_start_xmit(struct sk_buff *skb, s /* TX control: First packet immediately send, second packet queue */ if (db-tx_pkt_cnt == 1) { /* Set TX length to DM9000 */ - iow(db, DM9000_TXPLL, skb-len 0xff); - iow(db, DM9000_TXPLH, (skb-len 8) 0xff); + iow(db, DM9000_TXPLL, skb-len); + iow(db, DM9000_TXPLH, skb-len 8); /* Issue TX polling command */ iow(db, DM9000_TCR, TCR_TXREQ); /* Cleared after TX complete */ @@ -919,8 +919,8 @@ dm9000_tx_done(struct net_device *dev, b /* Queue packet check send */ if (db-tx_pkt_cnt 0) { - iow(db, DM9000_TXPLL, db-queue_pkt_len 0xff); - iow(db, DM9000_TXPLH, (db-queue_pkt_len 8) 0xff); + iow(db, DM9000_TXPLL, db-queue_pkt_len); + iow(db, DM9000_TXPLH, db-queue_pkt_len 8); iow(db, DM9000_TCR, TCR_TXREQ); dev-trans_start = jiffies; } @@ -1341,8 +1341,8 @@ dm9000_phy_write(struct net_device *dev, iow(db, DM9000_EPAR, DM9000_PHY | reg); /* Fill the written data into REG_0D REG_0E */ - iow(db, DM9000_EPDRL, (value 0xff)); - iow(db, DM9000_EPDRH, ((value 8) 0xff)); + iow(db, DM9000_EPDRL, value); + iow(db, DM9000_EPDRH, value 8); iow(db, DM9000_EPCR, 0xa); /* Issue phyxcer write command */ -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 11/22] NET: DM9000: Add ethtool control of msg_enable value
Allow the msg_enable value to be read and written by the ethtool interface. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -388,6 +388,20 @@ static void dm9000_get_drvinfo(struct ne strcpy(info-bus_info, to_platform_device(dm-dev)-name); } +static u32 dm9000_get_msglevel(struct net_device *dev) +{ + board_info_t *dm = to_dm9000_board(dev); + + return dm-msg_enable; +} + +static void dm9000_set_msglevel(struct net_device *dev, u32 value) +{ + board_info_t *dm = to_dm9000_board(dev); + + dm-msg_enable = value; +} + static int dm9000_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { board_info_t *dm = to_dm9000_board(dev); @@ -469,6 +483,8 @@ static const struct ethtool_ops dm9000_e .get_drvinfo= dm9000_get_drvinfo, .get_settings = dm9000_get_settings, .set_settings = dm9000_set_settings, + .get_msglevel = dm9000_get_msglevel, + .set_msglevel = dm9000_set_msglevel, .nway_reset = dm9000_nway_reset, .get_link = dm9000_get_link, .get_eeprom_len = dm9000_get_eeprom_len, -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 06/22] NET: DM9000: Use kthread to probe MII status when device open
When the device is open, we have to probe the PHY's MII status periodically as there is no status change interrupt. As the phy code is going to change to using calls which might sleep we move to using a kthread instead of a timer. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -66,6 +66,8 @@ #include linux/ethtool.h #include linux/dm9000.h #include linux/delay.h +#include linux/kthread.h +#include linux/freezer.h #include linux/platform_device.h #include asm/delay.h @@ -82,8 +84,6 @@ #define PFX CARDNAME : #define DRV_VERSION1.30 -#define DM9000_TIMER_WUT jiffies+(HZ*2) /* timer wakeup time : 2 second */ - #ifdef CONFIG_BLACKFIN #define readsb insb #define readsw insw @@ -131,7 +131,7 @@ typedef struct board_info { struct resource *data_req; struct resource *irq_res; - struct timer_list timer; + struct task_struct *thread; struct net_device_stats stats; unsigned char srom[128]; spinlock_t lock; @@ -159,9 +159,8 @@ static int dm9000_probe(struct platform_ static int dm9000_open(struct net_device *); static int dm9000_start_xmit(struct sk_buff *, struct net_device *); static int dm9000_stop(struct net_device *); +static int dm9000_mii_thread(void *data); - -static void dm9000_timer(unsigned long); static void dm9000_init_dm9000(struct net_device *); static struct net_device_stats *dm9000_get_stats(struct net_device *); @@ -679,6 +678,27 @@ dm9000_probe(struct platform_device *pde return ret; } +static void dm9000_start_thread(struct net_device *dev) +{ + board_info_t *db = (board_info_t *) dev-priv; + + /* Create a thread to keep track of the state of the phy +* as we do not get an interrupt when the PHY state changes. +* +* Note, we do not abort the open if we fail to create the +* thread, as this is mainly to ensure the user is kept up to +* date with the device's state. PHY accesses will still work +* via the MII read and write methods. +*/ + + db-thread = kthread_create(dm9000_mii_thread, db, dev-name); + if (IS_ERR(db-thread)) { + dev_err(db-dev, failed to create MII thread\n); + db-thread = NULL; + } else + wake_up_process(db-thread); +} + /* * Open the interface. * The interface is opened whenever ifconfig actives it. @@ -704,12 +724,7 @@ dm9000_open(struct net_device *dev) /* Init driver variable */ db-dbug_cnt = 0; - /* set and active a timer process */ - init_timer(db-timer); - db-timer.expires = DM9000_TIMER_WUT; - db-timer.data = (unsigned long) dev; - db-timer.function = dm9000_timer; - add_timer(db-timer); + dm9000_start_thread(dev); mii_check_media(db-mii, netif_msg_link(db), 1); netif_start_queue(dev); @@ -833,7 +848,7 @@ dm9000_stop(struct net_device *ndev) dm9000_dbg(db, 1, entering %s\n, __func__); /* deleted timer */ - del_timer(db-timer); + kthread_stop(db-thread); netif_stop_queue(ndev); netif_carrier_off(ndev); @@ -925,24 +940,31 @@ dm9000_get_stats(struct net_device *dev) return db-stats; } +#define DM9000_MII_POLLFREQ(2000) -/* - * A periodic timer routine - * Dynamic media sense, allocated Rx buffer... - */ -static void -dm9000_timer(unsigned long data) +static int +dm9000_mii_thread(void *pw) { - struct net_device *dev = (struct net_device *) data; - board_info_t *db = (board_info_t *) dev-priv; + board_info_t *db = pw; + unsigned long next = jiffies + msecs_to_jiffies(DM9000_MII_POLLFREQ); dm9000_dbg(db, 3, entering %s\n, __func__); - mii_check_media(db-mii, netif_msg_link(db), 0); + while (!kthread_should_stop()) { + set_current_state(TASK_INTERRUPTIBLE); + try_to_freeze(); + + if (time_after(jiffies, next)) { + mii_check_media(db-mii, netif_msg_link(db), 0); + next = jiffies; + next += msecs_to_jiffies(DM9000_MII_POLLFREQ); + } + + msleep_interruptible(DM9000_MII_POLLFREQ); + } - /* Set timer again */ - db-timer.expires = DM9000_TIMER_WUT; - add_timer(db-timer); + dm9000_dbg(db, 3, leaving %s\n, __func__); + return 0; } struct dm9000_rxhdr { -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 22/22] NET: DM9000: Show the MAC address source after printing MAC
Show whether the MAC address was read from the EEPROM or the onboard PAR registers. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt5/drivers/net/dm9000.c === --- linux-2.6.23-quilt5.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt5/drivers/net/dm9000.c @@ -515,6 +515,7 @@ dm9000_probe(struct platform_device *pde struct dm9000_plat_data *pdata = pdev-dev.platform_data; struct board_info *db; /* Point a board information structure */ struct net_device *ndev; + const unsigned char *mac_src; unsigned long base; int ret = 0; int iosize; @@ -696,13 +697,16 @@ dm9000_probe(struct platform_device *pde db-mii.mdio_read= dm9000_phy_read; db-mii.mdio_write = dm9000_phy_write; + mac_src = eeprom; + /* try reading the node address from the attached EEPROM */ for (i = 0; i 6; i += 2) dm9000_read_eeprom(db, i / 2, ndev-dev_addr+i); if (!is_valid_ether_addr(ndev-dev_addr)) { /* try reading from mac */ - + + mac_src = chip; for (i = 0; i 6; i++) ndev-dev_addr[i] = ior(db, i+DM9000_PAR); } @@ -719,7 +723,7 @@ dm9000_probe(struct platform_device *pde ndev-name, db-io_addr, db-io_data, ndev-irq); for (i = 0; i 5; i++) printk(%02x:, ndev-dev_addr[i]); - printk(%02x\n, ndev-dev_addr[5]); + printk(%02x (%s)\n, ndev-dev_addr[5], mac_src); } return 0; -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 20/22] NET: DM9000: Add support for MII ioctl() calls
Add entry to handle the MII ioctl() calls via the generic_mii_ioctl call. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -148,6 +148,8 @@ static int dm9000_mii_thread(void *data) static void dm9000_init_dm9000(struct net_device *); +static int dm9000_ioctl(struct net_device *dev, struct ifreq *req, int cmd); + static struct net_device_stats *dm9000_get_stats(struct net_device *); static irqreturn_t dm9000_interrupt(int, void *); @@ -337,6 +339,16 @@ static void dm9000_poll_controller(struc } #endif +static int dm9000_ioctl(struct net_device *dev, struct ifreq *req, int cmd) +{ + board_info_t *dm = to_dm9000_board(dev); + + if (!netif_running(dev)) + return -EINVAL; + + return generic_mii_ioctl(dm-mii, if_mii(req), cmd, NULL); +} + /* ethtool ops */ static void dm9000_get_drvinfo(struct net_device *dev, @@ -669,6 +681,7 @@ dm9000_probe(struct platform_device *pde ndev-get_stats = dm9000_get_stats; ndev-set_multicast_list = dm9000_hash_table; ndev-ethtool_ops= dm9000_ethtool_ops; + ndev-do_ioctl = dm9000_ioctl; #ifdef CONFIG_NET_POLL_CONTROLLER ndev-poll_controller= dm9000_poll_controller; -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 09/22] NET: DM9000: Add mutex to protect access
Add a mutex to serialise access to the chip functions from entries such as the ethtool and the MII code. This should reduce the amount of time the spinlock is held to protect the address register. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -100,6 +100,24 @@ static int watchdog = 5000; module_param(watchdog, int, 0400); MODULE_PARM_DESC(watchdog, transmit timeout in milliseconds); +/* DM9000 register address locking. + * + * The DM9000 uses an address register to control where data written + * to the data register goes. This means that the address register + * must be preserved over interrupts or similar calls. + * + * During interrupt and other critical calls, a spinlock is used to + * protect the system, but the calls themselves save the address + * in the address register in case they are interrupting another + * access to the device. + * + * For general accesses a lock is provided so that calls which are + * allowed to sleep are serialised so that the address register does + * not need to be saved. This lock also serves to serialise access + * to the EEPROM and PHY access registers which are shared between + * these two devices. + */ + /* Structure/enum declaration --- */ typedef struct board_info { @@ -132,6 +150,8 @@ typedef struct board_info { struct resource *data_req; struct resource *irq_res; + struct mutexaddr_lock; /* phy and eeprom access lock */ + struct task_struct *thread; struct net_device_stats stats; spinlock_t lock; @@ -370,26 +390,16 @@ static void dm9000_get_drvinfo(struct ne static int dm9000_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { board_info_t *dm = to_dm9000_board(dev); - unsigned long flags; - spin_lock_irqsave(dm-lock, flags); mii_ethtool_gset(dm-mii, cmd); - spin_lock_irqsave(dm-lock, flags); - return 0; } static int dm9000_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) { board_info_t *dm = to_dm9000_board(dev); - unsigned long flags; - int rc; - - spin_lock_irqsave(dm-lock, flags); - rc = mii_ethtool_sset(dm-mii, cmd); - spin_lock_irqsave(dm-lock, flags); - return rc; + return mii_ethtool_sset(dm-mii, cmd); } static int dm9000_nway_reset(struct net_device *dev) @@ -481,6 +491,7 @@ dm9000_probe(struct platform_device *pde db-dev = pdev-dev; spin_lock_init(db-lock); + mutex_init(db-addr_lock); if (pdev-num_resources 2) { ret = -ENODEV; @@ -1063,8 +1074,10 @@ dm9000_rx(struct net_device *dev) * Read a word data from EEPROM */ static void -dm9000_read_eeprom(board_info_t * db, int offset, unsigned char *to) +dm9000_read_eeprom(board_info_t *db, int offset, unsigned char *to) { + mutex_lock(db-addr_lock); + iow(db, DM9000_EPAR, offset); iow(db, DM9000_EPCR, EPCR_ERPRR); mdelay(8); /* according to the datasheet 200us should be enough, @@ -1073,6 +1086,8 @@ dm9000_read_eeprom(board_info_t * db, in to[0] = ior(db, DM9000_EPDRL); to[1] = ior(db, DM9000_EPDRH); + + mutex_unlock(db-addr_lock); } #ifdef DM9000_PROGRAM_EEPROM @@ -1082,12 +1097,16 @@ dm9000_read_eeprom(board_info_t * db, in static void write_srom_word(board_info_t * db, int offset, u16 val) { + mutex_lock(db-addr_lock); + iow(db, DM9000_EPAR, offset); iow(db, DM9000_EPDRH, ((val 8) 0xff)); iow(db, DM9000_EPDRL, (val 0xff)); iow(db, DM9000_EPCR, EPCR_WEP | EPCR_ERPRW); mdelay(8); /* same shit */ iow(db, DM9000_EPCR, 0); + + mutex_unlock(db-addr_lock); } /* @@ -1195,6 +1214,8 @@ dm9000_phy_read(struct net_device *dev, unsigned int reg_save; int ret; + mutex_lock(db-addr_lock); + spin_lock_irqsave(db-lock,flags); /* Save previous register address */ @@ -1222,6 +1243,7 @@ dm9000_phy_read(struct net_device *dev, writeb(reg_save, db-io_addr); spin_unlock_irqrestore(db-lock,flags); + mutex_unlock(db-addr_lock); return ret; } @@ -1235,6 +1257,8 @@ dm9000_phy_write(struct net_device *dev, unsigned long flags; unsigned long reg_save; + mutex_lock(db-addr_lock); + spin_lock_irqsave(db-lock,flags); /* Save previous register address */ @@ -1250,7 +1274,7 @@ dm9000_phy_write(struct net_device *dev, iow(db, DM9000_EPCR, 0xa); /* Issue phyxcer write command */ writeb(reg_save, db-io_addr); - spin_unlock_irqrestore(db-lock,flags); + spin_unlock_irqrestore(db-lock, flags); dm9000_msleep(db, 1); /* Wait write
[patch 13/22] NET: DM9000: Ensure spinlock held whilst accessing EEPROM registers
Ensure we hold the spinlock whilst the registers and being modified even though we hold the overall lock. This should protect against an interrupt happening whilst we are using the device. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -1139,17 +1139,29 @@ dm9000_rx(struct net_device *dev) static void dm9000_read_eeprom(board_info_t *db, int offset, u8 *to) { + unsigned long flags; + mutex_lock(db-addr_lock); + spin_lock_irqsave(db-lock, flags); + iow(db, DM9000_EPAR, offset); iow(db, DM9000_EPCR, EPCR_ERPRR); + + spin_unlock_irqrestore(db-lock, flags); + mdelay(8); /* according to the datasheet 200us should be enough, but it doesn't work */ + + spin_lock_irqsave(db-lock, flags); + iow(db, DM9000_EPCR, 0x0); to[0] = ior(db, DM9000_EPDRL); to[1] = ior(db, DM9000_EPDRH); + spin_unlock_irqrestore(db-lock, flags); + mutex_unlock(db-addr_lock); } @@ -1159,14 +1171,22 @@ dm9000_read_eeprom(board_info_t *db, int static void dm9000_write_eeprom(board_info_t *db, int offset, u8 *data) { + unsigned long flags; + mutex_lock(db-addr_lock); + spin_lock_irqsave(db-lock, flags); iow(db, DM9000_EPAR, offset); iow(db, DM9000_EPDRH, data[1]); iow(db, DM9000_EPDRL, data[0]); iow(db, DM9000_EPCR, EPCR_WEP | EPCR_ERPRW); + spin_unlock_irqrestore(db-lock, flags); + mdelay(8); /* same shit */ + + spin_lock_irqsave(db-lock, flags); iow(db, DM9000_EPCR, 0); + spin_unlock_irqrestore(db-lock, flags); mutex_unlock(db-addr_lock); } -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 19/22] NET: DM9000: Add platform flag for no attached EEPROM
Allow the platform data to specify to the DM9000 driver that there is no posibility of an attached EEPROM on the device, so default all reads to 0xff and ignore any write operations. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -410,6 +410,9 @@ static int dm9000_get_eeprom(struct net_ if ((len 1) != 0 || (offset 1) != 0) return -EINVAL; + if (dm-flags DM9000_PLATF_NO_EEPROM) + return -ENOENT; + ee-magic = DM_EEPROM_MAGIC; for (i = 0; i len; i += 2) @@ -431,6 +434,9 @@ static int dm9000_set_eeprom(struct net_ if ((len 1) != 0 || (offset 1) != 0) return -EINVAL; + if (dm-flags DM9000_PLATF_NO_EEPROM) + return -ENOENT; + if (ee-magic != DM_EEPROM_MAGIC) return -EINVAL; @@ -1166,6 +1172,12 @@ dm9000_read_eeprom(board_info_t *db, int { unsigned long flags; + if (db-flags DM9000_PLATF_NO_EEPROM) { + to[0] = 0xff; + to[1] = 0xff; + return; + } + mutex_lock(db-addr_lock); spin_lock_irqsave(db-lock, flags); @@ -1200,6 +1212,9 @@ dm9000_write_eeprom(board_info_t *db, in { unsigned long flags; + if (db-flags DM9000_PLATF_NO_EEPROM) + return; + mutex_lock(db-addr_lock); spin_lock_irqsave(db-lock, flags); Index: linux-2.6.23-quilt3/include/linux/dm9000.h === --- linux-2.6.23-quilt3.orig/include/linux/dm9000.h +++ linux-2.6.23-quilt3/include/linux/dm9000.h @@ -20,6 +20,7 @@ #define DM9000_PLATF_16BITONLY (0x0002) #define DM9000_PLATF_32BITONLY (0x0004) #define DM9000_PLATF_EXT_PHY (0x0008) +#define DM9000_PLATF_NO_EEPROM (0x0010) /* platfrom data for platfrom device structure's platfrom_data field */ -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 15/22] NET: DM9000: Use netif_msg to enable debugging options
Use the netif_msg_*() macros to enable the debugging based on the board's msg_enable field. The output still goes via the dev_dbg() macros, so will be tagged and output as appropriate. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt4/drivers/net/dm9000.c === --- linux-2.6.23-quilt4.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt4/drivers/net/dm9000.c @@ -745,7 +745,8 @@ dm9000_open(struct net_device *dev) board_info_t *db = (board_info_t *) dev-priv; unsigned long irqflags = IRQF_SHARED; - dev_dbg(db-dev, entering %s\n, __func__); + if (netif_msg_ifup(db)) + dev_dbg(db-dev, enabling %s\n, dev-name); if (db-platdata) irqflags |= db-platdata-irqflags; @@ -881,7 +882,8 @@ dm9000_stop(struct net_device *ndev) { board_info_t *db = (board_info_t *) ndev-priv; - dm9000_dbg(db, 1, entering %s\n, __func__); + if (netif_msg_ifdown(db)) + dev_dbg(db-dev, shutting down %s\n, ndev-name); /* deleted timer */ kthread_stop(db-thread); @@ -912,6 +914,9 @@ dm9000_tx_done(struct net_device *dev, b db-tx_pkt_cnt--; db-stats.tx_packets++; + if (netif_msg_tx_done(db)) + dev_dbg(db-dev, tx done, NSR %02x\n, tx_status); + /* Queue packet check send */ if (db-tx_pkt_cnt 0) { iow(db, DM9000_TXPLL, db-queue_pkt_len 0xff); @@ -947,6 +952,9 @@ dm9000_interrupt(int irq, void *dev_id) int_status = ior(db, DM9000_ISR); /* Got ISR */ iow(db, DM9000_ISR, int_status);/* Clear ISR status */ + if (netif_msg_intr(db)) + dev_dbg(db-dev, interrupt status %02x\n, int_status); + /* Received the coming packet */ if (int_status ISR_PRS) dm9000_rx(dev); @@ -1048,10 +1056,15 @@ dm9000_rx(struct net_device *dev) RxLen = le16_to_cpu(rxhdr.RxLen); + if (netif_msg_rx_status(db)) + dev_dbg(db-dev, RX: status %02x, length %04x\n, + rxhdr.RxStatus, RxLen); + /* Packet Status check */ if (RxLen 0x40) { GoodPacket = false; - dev_dbg(db-dev, Bad Packet received (runt)\n); + if (netif_msg_rx_err(db)) + dev_dbg(db-dev, RX: Bad Packet (runt)\n); } if (RxLen DM9000_PKT_MAX) { @@ -1061,15 +1074,18 @@ dm9000_rx(struct net_device *dev) if (rxhdr.RxStatus 0xbf) { GoodPacket = false; if (rxhdr.RxStatus 0x01) { - dev_dbg(db-dev, fifo error\n); + if (netif_msg_rx_err(db)) + dev_dbg(db-dev, fifo error\n); db-stats.rx_fifo_errors++; } if (rxhdr.RxStatus 0x02) { - dev_dbg(db-dev, crc error\n); + if (netif_msg_rx_err(db)) + dev_dbg(db-dev, crc error\n); db-stats.rx_crc_errors++; } if (rxhdr.RxStatus 0x80) { - dev_dbg(db-dev, length error\n); + if (netif_msg_rx_err(db)) + dev_dbg(db-dev, length error\n); db-stats.rx_length_errors++; } } -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 05/22] NET: DM9000: Do not sleep with spinlock and IRQs held
The phy read and write routines call udelay() with the board lock held, and with the posibility of IRQs being disabled. Since these delays can be up to 500usec, and are only required as we have to save the chip's address register. To improve the behaviour, hold the lock whilst we are writing and then restore the state before the delay and then repeat the process once the delay has happened. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -1171,7 +1171,15 @@ dm9000_phy_read(struct net_device *dev, iow(db, DM9000_EPAR, DM9000_PHY | reg); iow(db, DM9000_EPCR, 0xc); /* Issue phyxcer read command */ + + writeb(reg_save, db-io_addr); + spin_unlock_irqrestore(db-lock,flags); + udelay(100);/* Wait read complete */ + + spin_lock_irqsave(db-lock,flags); + reg_save = readb(db-io_addr); + iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */ /* The read data keeps on REG_0D REG_0E */ @@ -1179,7 +1187,6 @@ dm9000_phy_read(struct net_device *dev, /* restore the previous address */ writeb(reg_save, db-io_addr); - spin_unlock_irqrestore(db-lock,flags); return ret; @@ -1208,7 +1215,15 @@ dm9000_phy_write(struct net_device *dev, iow(db, DM9000_EPDRH, ((value 8) 0xff)); iow(db, DM9000_EPCR, 0xa); /* Issue phyxcer write command */ + + writeb(reg_save, db-io_addr); + spin_unlock_irqrestore(db-lock,flags); + udelay(500);/* Wait write complete */ + + spin_lock_irqsave(db-lock,flags); + reg_save = readb(db-io_addr); + iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */ /* restore the previous address */ -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 00/22] DM9000 updates for 2.6.25
This is my current proposed patch series to the DM9000 driver for both general cleanups, support for ethtool and to make the code better. -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 08/22] NET: DM9000: Remove barely used SROM array read.
The srom array in the board data is only being used in the device probe routines. The probe also only uses the first 6 bytes of an array we spend 512ms reading 128 bytes from. Change to reading the MAC area directly to the MAC address structure. As a side product, we rename the read_srom_word to dm9000_read_eeprom to bring it into line with the rest of the driver. No change is made to the delay in this function, which will be dealt with in a later patch. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt5/drivers/net/dm9000.c === --- linux-2.6.23-quilt5.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt5/drivers/net/dm9000.c @@ -134,7 +134,6 @@ typedef struct board_info { struct task_struct *thread; struct net_device_stats stats; - unsigned char srom[128]; spinlock_t lock; struct mii_if_info mii; @@ -171,7 +170,8 @@ static irqreturn_t dm9000_interrupt(int, static int dm9000_phy_read(struct net_device *dev, int phyaddr_unsused, int reg); static void dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value); -static u16 read_srom_word(board_info_t *, int); + +static void dm9000_read_eeprom(board_info_t *, int addr, unsigned char *to); static void dm9000_rx(struct net_device *); static void dm9000_hash_table(struct net_device *); @@ -638,13 +638,9 @@ dm9000_probe(struct platform_device *pde db-mii.mdio_read= dm9000_phy_read; db-mii.mdio_write = dm9000_phy_write; - /* Read SROM content */ - for (i = 0; i 64; i++) - ((u16 *) db-srom)[i] = read_srom_word(db, i); - - /* Set Node Address */ - for (i = 0; i 6; i++) - ndev-dev_addr[i] = db-srom[i]; + /* try reading the node address from the attached EEPROM */ + for (i = 0; i 6; i += 2) + dm9000_read_eeprom(db, i / 2, ndev-dev_addr+i); if (!is_valid_ether_addr(ndev-dev_addr)) { /* try reading from mac */ @@ -1064,17 +1060,19 @@ dm9000_rx(struct net_device *dev) } /* - * Read a word data from SROM + * Read a word data from EEPROM */ -static u16 -read_srom_word(board_info_t * db, int offset) +static void +dm9000_read_eeprom(board_info_t * db, int offset, unsigned char *to) { iow(db, DM9000_EPAR, offset); iow(db, DM9000_EPCR, EPCR_ERPRR); mdelay(8); /* according to the datasheet 200us should be enough, but it doesn't work */ iow(db, DM9000_EPCR, 0x0); - return (ior(db, DM9000_EPDRL) + (ior(db, DM9000_EPDRH) 8)); + + to[0] = ior(db, DM9000_EPDRL); + to[1] = ior(db, DM9000_EPDRH); } #ifdef DM9000_PROGRAM_EEPROM -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 16/22] NET: DM9000: Fix delays used by EEPROM read and write
The code was using a delay of 8ms, when it should have been using the EEPROM status flag from the device to indicate the EEPROM transaction had finished. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -1114,6 +1114,50 @@ dm9000_rx(struct net_device *dev) } while (rxbyte == DM9000_PKT_RDY); } +static unsigned int +dm9000_read_locked(board_info_t *db, int reg) +{ + unsigned long flags; + unsigned int ret; + + spin_lock_irqsave(db-lock, flags); + ret = ior(db, reg); + spin_unlock_irqrestore(db-lock, flags); + + return ret; +} + +static int dm9000_wait_eeprom(board_info_t *db) +{ + unsigned int status; + int timeout = 8;/* wait max 8msec */ + + /* The DM9000 data sheets say we should be able to +* poll the ERRE bit in EPCR to wait for the EEPROM +* operation. From testing several chips, this bit +* does not seem to work. +* +* We attempt to use the bit, but fall back to the +* timeout (which is why we do not return an error +* on expiry) to say that the EEPROM operation has +* completed. +*/ + + while (1) { + status = dm9000_read_locked(db, DM9000_EPCR); + + if ((status EPCR_ERRE) == 0) + break; + + if (timeout-- 0) { + dev_dbg(db-dev, timeout waiting EEPROM\n); + break; + } + } + + return 0; +} + /* * Read a word data from EEPROM */ @@ -1131,8 +1175,10 @@ dm9000_read_eeprom(board_info_t *db, int spin_unlock_irqrestore(db-lock, flags); - mdelay(8); /* according to the datasheet 200us should be enough, - but it doesn't work */ + dm9000_wait_eeprom(db); + + /* delay for at-least 150uS */ + msleep(1); spin_lock_irqsave(db-lock, flags); @@ -1163,7 +1209,9 @@ dm9000_write_eeprom(board_info_t *db, in iow(db, DM9000_EPCR, EPCR_WEP | EPCR_ERPRW); spin_unlock_irqrestore(db-lock, flags); - mdelay(8); /* same shit */ + dm9000_wait_eeprom(db); + + mdelay(1); /* wait at least 150uS to clear */ spin_lock_irqsave(db-lock, flags); iow(db, DM9000_EPCR, 0); -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 02/22] NET: DM9000 update debugging macros to use debug level
Change the debug macros to use the compiler to elide any unnecessary debug level, and to allow device configurable debug control. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt1/drivers/net/Kconfig === --- linux-2.6.23-quilt1.orig/drivers/net/Kconfig +++ linux-2.6.23-quilt1/drivers/net/Kconfig @@ -940,6 +940,14 @@ config DM9000 file:Documentation/networking/net-modules.txt. The module will be called dm9000. +config DM9000_DEBUGLEVEL + int DM9000 maximum debug level + depends on DM9000 + default 4 + help + The maximum level of debugging code compiled into the DM9000 + driver. + config SMC911X tristate SMSC LAN911[5678] support select CRC32 Index: linux-2.6.23-quilt1/drivers/net/dm9000.c === --- linux-2.6.23-quilt1.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt1/drivers/net/dm9000.c @@ -82,28 +82,6 @@ #define DM9000_TIMER_WUT jiffies+(HZ*2) /* timer wakeup time : 2 second */ -#define DM9000_DEBUG 0 - -#if DM9000_DEBUG 2 -#define PRINTK3(args...) printk(CARDNAME : args) -#else -#define PRINTK3(args...) do { } while(0) -#endif - -#if DM9000_DEBUG 1 -#define PRINTK2(args...) printk(CARDNAME : args) -#else -#define PRINTK2(args...) do { } while(0) -#endif - -#if DM9000_DEBUG 0 -#define PRINTK1(args...) printk(CARDNAME : args) -#define PRINTK(args...) printk(CARDNAME : args) -#else -#define PRINTK1(args...) do { } while(0) -#define PRINTK(args...) printk(KERN_DEBUG args) -#endif - #ifdef CONFIG_BLACKFIN #define readsb insb #define readsw insw @@ -138,6 +116,8 @@ typedef struct board_info { u8 phy_addr; unsigned int flags; + int debug_level; + void (*inblk)(void __iomem *port, void *data, int length); void (*outblk)(void __iomem *port, void *data, int length); void (*dumpblk)(void __iomem *port, int length); @@ -159,6 +139,15 @@ typedef struct board_info { u32 msg_enable; } board_info_t; +/* debug code */ + +#define dm9000_dbg(db, lev, msg...) do { \ + if ((lev) CONFIG_DM9000_DEBUGLEVEL \ + (lev) db-debug_level) { \ + dev_dbg(db-dev, msg); \ + } \ +} while (0) + /* function declaration - */ static int dm9000_probe(struct platform_device *); static int dm9000_open(struct net_device *); @@ -664,7 +653,7 @@ dm9000_init_dm9000(struct net_device *de { board_info_t *db = (board_info_t *) dev-priv; - PRINTK1(entering %s\n,__FUNCTION__); + dm9000_dbg(db, 1, entering %s\n, __func__); /* I/O mode */ db-io_mode = ior(db, DM9000_ISR) 6; /* ISR bit7:6 keeps I/O mode */ @@ -710,7 +699,7 @@ dm9000_start_xmit(struct sk_buff *skb, s unsigned long flags; board_info_t *db = (board_info_t *) dev-priv; - PRINTK3(dm9000_start_xmit\n); + dm9000_dbg(db, 3, %s:\n, __func__); if (db-tx_pkt_cnt 1) return 1; @@ -769,7 +758,7 @@ dm9000_stop(struct net_device *ndev) { board_info_t *db = (board_info_t *) ndev-priv; - PRINTK1(entering %s\n,__FUNCTION__); + dm9000_dbg(db, 1, entering %s\n, __func__); /* deleted timer */ del_timer(db-timer); @@ -815,19 +804,14 @@ static irqreturn_t dm9000_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; - board_info_t *db; + board_info_t *db = (board_info_t *) dev-priv; int int_status; u8 reg_save; - PRINTK3(entering %s\n,__FUNCTION__); - - if (!dev) { - PRINTK1(dm9000_interrupt() without DEVICE arg\n); - return IRQ_HANDLED; - } + dm9000_dbg(db, 3, entering %s\n, __func__); /* A real interrupt coming */ - db = (board_info_t *) dev-priv; + spin_lock(db-lock); /* Save previous register address */ @@ -880,7 +864,7 @@ dm9000_timer(unsigned long data) struct net_device *dev = (struct net_device *) data; board_info_t *db = (board_info_t *) dev-priv; - PRINTK3(dm9000_timer()\n); + dm9000_dbg(db, 3, entering %s\n, __func__); mii_check_media(db-mii, netif_msg_link(db), 0); @@ -1065,7 +1049,7 @@ dm9000_hash_table(struct net_device *dev u16 i, oft, hash_table[4]; unsigned long flags; - PRINTK2(dm9000_hash_table()\n); + dm9000_dbg(db, 1, entering %s\n, __func__); spin_lock_irqsave(db-lock,flags); -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 10/22] NET: DM9000: Add ethtool support for reading and writing EEPROM
Add ethtool support to access the configuration EEPROM connected to the DM9000. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -191,7 +191,8 @@ static int dm9000_phy_read(struct net_de static void dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value); -static void dm9000_read_eeprom(board_info_t *, int addr, unsigned char *to); +static void dm9000_read_eeprom(board_info_t *, int addr, u8 *to); +static void dm9000_write_eeprom(board_info_t *, int addr, u8 *dp); static void dm9000_rx(struct net_device *); static void dm9000_hash_table(struct net_device *); @@ -414,12 +415,65 @@ static u32 dm9000_get_link(struct net_de return mii_link_ok(dm-mii); } +#define DM_EEPROM_MAGIC(0x444D394B) + +static int dm9000_get_eeprom_len(struct net_device *dev) +{ + return 128; +} + +static int dm9000_get_eeprom(struct net_device *dev, +struct ethtool_eeprom *ee, u8 *data) +{ + board_info_t *dm = to_dm9000_board(dev); + int offset = ee-offset; + int len = ee-len; + int i; + + /* EEPROM access is aligned to two bytes */ + + if ((len 1) != 0 || (offset 1) != 0) + return -EINVAL; + + ee-magic = DM_EEPROM_MAGIC; + + for (i = 0; i len; i += 2) + dm9000_read_eeprom(dm, (offset + i) / 2, data + i); + + return 0; +} + +static int dm9000_set_eeprom(struct net_device *dev, +struct ethtool_eeprom *ee, u8 *data) +{ + board_info_t *dm = to_dm9000_board(dev); + int offset = ee-offset; + int len = ee-len; + int i; + + /* EEPROM access is aligned to two bytes */ + + if ((len 1) != 0 || (offset 1) != 0) + return -EINVAL; + + if (ee-magic != DM_EEPROM_MAGIC) + return -EINVAL; + + for (i = 0; i len; i += 2) + dm9000_write_eeprom(dm, (offset + i) / 2, data + i); + + return 0; +} + static const struct ethtool_ops dm9000_ethtool_ops = { .get_drvinfo= dm9000_get_drvinfo, .get_settings = dm9000_get_settings, .set_settings = dm9000_set_settings, .nway_reset = dm9000_nway_reset, .get_link = dm9000_get_link, + .get_eeprom_len = dm9000_get_eeprom_len, + .get_eeprom = dm9000_get_eeprom, + .set_eeprom = dm9000_set_eeprom, }; @@ -1074,7 +1128,7 @@ dm9000_rx(struct net_device *dev) * Read a word data from EEPROM */ static void -dm9000_read_eeprom(board_info_t *db, int offset, unsigned char *to) +dm9000_read_eeprom(board_info_t *db, int offset, u8 *to) { mutex_lock(db-addr_lock); @@ -1090,18 +1144,17 @@ dm9000_read_eeprom(board_info_t *db, int mutex_unlock(db-addr_lock); } -#ifdef DM9000_PROGRAM_EEPROM /* * Write a word data to SROM */ static void -write_srom_word(board_info_t * db, int offset, u16 val) +dm9000_write_eeprom(board_info_t *db, int offset, u8 *data) { mutex_lock(db-addr_lock); iow(db, DM9000_EPAR, offset); - iow(db, DM9000_EPDRH, ((val 8) 0xff)); - iow(db, DM9000_EPDRL, (val 0xff)); + iow(db, DM9000_EPDRH, data[1]); + iow(db, DM9000_EPDRL, data[0]); iow(db, DM9000_EPCR, EPCR_WEP | EPCR_ERPRW); mdelay(8); /* same shit */ iow(db, DM9000_EPCR, 0); @@ -1109,6 +1162,7 @@ write_srom_word(board_info_t * db, int o mutex_unlock(db-addr_lock); } +#ifdef DM9000_PROGRAM_EEPROM /* * Only for development: * Here we write static data to the eeprom in case -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 03/22] NET: DM9000: Pass IRQ flags via platform data
Use the platform data to pass modifications to the flags passed to request_irq() to alter the behaviour of the IRQ. This can be used to specify IRQ type for the platform the DM9000 is connected to. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.22-quilt6/drivers/net/dm9000.c === --- linux-2.6.22-quilt6.orig/drivers/net/dm9000.c 2007-08-20 18:26:22.0 +0100 +++ linux-2.6.22-quilt6/drivers/net/dm9000.c2007-08-20 18:37:54.0 +0100 @@ -89,9 +89,6 @@ #define writesboutsb #define writeswoutsw #define writesloutsl -#define DM9000_IRQ_FLAGS (IRQF_SHARED | IRQF_TRIGGER_HIGH) -#else -#define DM9000_IRQ_FLAGS IRQF_SHARED #endif /* @@ -124,6 +121,8 @@ typedef struct board_info { struct device *dev;/* parent device */ + struct dm9000_plat_data *platdata; + struct resource *addr_res; /* resources found */ struct resource *data_res; struct resource *addr_req; /* resources requested */ @@ -496,9 +495,11 @@ dm9000_probe(struct platform_device *pde /* check to see if anything is being over-ridden */ if (pdata != NULL) { + db-platdata = pdata; + /* check to see if the driver wants to over-ride the * default IO width */ - + if (pdata-flags DM9000_PLATF_8BITONLY) dm9000_set_io(db, 1); @@ -619,10 +620,14 @@ static int dm9000_open(struct net_device *dev) { board_info_t *db = (board_info_t *) dev-priv; + unsigned long irqflags = IRQF_SHARED; dev_dbg(db-dev, entering %s\n, __func__); - if (request_irq(dev-irq, dm9000_interrupt, DM9000_IRQ_FLAGS, dev-name, dev)) + if (db-platdata) + irqflags |= db-platdata-irqflags; + + if (request_irq(dev-irq, dm9000_interrupt, irqflags, dev-name, dev)) return -EAGAIN; /* Initialize DM9000 board */ Index: linux-2.6.22-quilt6/include/linux/dm9000.h === --- linux-2.6.22-quilt6.orig/include/linux/dm9000.h 2007-08-20 18:19:04.0 +0100 +++ linux-2.6.22-quilt6/include/linux/dm9000.h 2007-08-20 18:28:37.0 +0100 @@ -25,6 +25,7 @@ struct dm9000_plat_data { unsigned intflags; + unsigned long irqflags; /* to pass to request_irq() */ /* allow replacement IO routines */ -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 07/22] NET: DM9000: Use msleep() instead of udelay()
We can use sleeping functions when reading and writing the PHY registers, so let us sleep instead of busy waiting for the PHY. Note, this also fixes a bug reading the PHY where only 100uS was being used instead of 150uS Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -114,6 +114,7 @@ typedef struct board_info { u8 io_mode; /* 0:word, 2:byte */ u8 phy_addr; unsigned int flags; + unsigned int in_suspend :1; int debug_level; @@ -1174,6 +1175,18 @@ dm9000_hash_table(struct net_device *dev /* + * Sleep, either by using msleep() or if we are suspending, then + * use mdelay() to sleep. + */ +static void dm9000_msleep(board_info_t *db, unsigned int ms) +{ + if (db-in_suspend) + mdelay(ms); + else + msleep(ms); +} + +/* * Read a word from phyxcer */ static int @@ -1197,7 +1210,7 @@ dm9000_phy_read(struct net_device *dev, writeb(reg_save, db-io_addr); spin_unlock_irqrestore(db-lock,flags); - udelay(100);/* Wait read complete */ + dm9000_msleep(db, 1); /* Wait read complete */ spin_lock_irqsave(db-lock,flags); reg_save = readb(db-io_addr); @@ -1241,7 +1254,7 @@ dm9000_phy_write(struct net_device *dev, writeb(reg_save, db-io_addr); spin_unlock_irqrestore(db-lock,flags); - udelay(500);/* Wait write complete */ + dm9000_msleep(db, 1); /* Wait write complete */ spin_lock_irqsave(db-lock,flags); reg_save = readb(db-io_addr); @@ -1258,8 +1271,12 @@ static int dm9000_drv_suspend(struct platform_device *dev, pm_message_t state) { struct net_device *ndev = platform_get_drvdata(dev); + board_info_t *db; if (ndev) { + db = (board_info_t *) ndev-priv; + db-in_suspend = 1; + if (netif_running(ndev)) { netif_device_detach(ndev); dm9000_shutdown(ndev); @@ -1282,6 +1299,8 @@ dm9000_drv_resume(struct platform_device netif_device_attach(ndev); } + + db-in_suspend = 0; } return 0; } -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 14/22] NET: DM9000: Remove unnecessary changelog in header comment
We have a perfectly good version control system, so we do not need to duplicate change comments in the header for this code. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt2/drivers/net/dm9000.c === --- linux-2.6.23-quilt2.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt2/drivers/net/dm9000.c @@ -1,7 +1,5 @@ /* - * dm9000.c: Version 1.2 03/18/2003 - * - * A Davicom DM9000 ISA NIC fast Ethernet driver for Linux. + * Davicom DM9000 Fast Ethernet driver for Linux. * Copyright (C) 1997 Sten Wang * * This program is free software; you can redistribute it and/or @@ -14,44 +12,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * (C)Copyright 1997-1998 DAVICOM Semiconductor,Inc. All Rights Reserved. - * - * V0.11 06/20/2001 REG_0A bit3=1, default enable BP with DA match - * 06/22/2001 Support DM9801 progrmming - * E3: R25 = ((R24 + NF) 0x00ff) | 0xf000 - * E4: R25 = ((R24 + NF) 0x00ff) | 0xc200 - * R17 = (R17 0xfff0) | NF + 3 - * E5: R25 = ((R24 + NF - 3) 0x00ff) | 0xc200 - * R17 = (R17 0xfff0) | NF - * - * v1.00 modify by simon 2001.9.5 - * change for kernel 2.4.x - * - * v1.1 11/09/2001 fix force mode bug - * - * v1.2 03/18/2003 Weilun Huang [EMAIL PROTECTED]: - * Fixed phy reset. - * Added tx/rx 32 bit mode. - * Cleaned up for kernel merge. - * - *03/03/2004Sascha Hauer [EMAIL PROTECTED] - * Port to 2.6 kernel - * - * 24-Sep-2004 Ben Dooks [EMAIL PROTECTED] - * Cleanup of code to remove ifdefs - * Allowed platform device data to influence access width - * Reformatting areas of code - * - *17-Mar-2005 Sascha Hauer [EMAIL PROTECTED] - * * removed 2.4 style module parameters - * * removed removed unused stat counter and fixed - *net_device_stats - * * introduced tx_timeout function - * * reworked locking + * (C) Copyright 1997-1998 DAVICOM Semiconductor,Inc. All Rights Reserved. * - * 01-Jul-2005 Ben Dooks [EMAIL PROTECTED] - * * fixed spinlock call without pointer - * * ensure spinlock is initialised + * Additional updates, Copyright: + * Ben Dooks [EMAIL PROTECTED] + * Sascha Hauer [EMAIL PROTECTED] */ #include linux/module.h -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 01/22] NET: DM9000 use dev_xxx() instead of printk for output.
Move to using dev_dbg() and friends for the output of information to the user. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.22-quilt4/drivers/net/dm9000.c === --- linux-2.6.22-quilt4.orig/drivers/net/dm9000.c +++ linux-2.6.22-quilt4/drivers/net/dm9000.c @@ -142,6 +142,8 @@ typedef struct board_info { void (*outblk)(void __iomem *port, void *data, int length); void (*dumpblk)(void __iomem *port, int length); + struct device *dev;/* parent device */ + struct resource *addr_res; /* resources found */ struct resource *data_res; struct resource *addr_req; /* resources requested */ @@ -187,7 +189,8 @@ static void program_eeprom(board_info_t static void dm9000_reset(board_info_t * db) { - PRINTK1(dm9000x: resetting\n); + dev_dbg(db-dev, resetting device\n); + /* RESET device */ writeb(DM9000_NCR, db-io_addr); udelay(200); @@ -303,14 +306,10 @@ static void dm9000_set_io(struct board_i db-inblk = dm9000_inblk_8bit; break; - case 2: - db-dumpblk = dm9000_dumpblk_16bit; - db-outblk = dm9000_outblk_16bit; - db-inblk = dm9000_inblk_16bit; - break; case 3: - printk(KERN_ERR PFX : 3 byte IO, falling back to 16bit\n); + dev_dbg(db-dev, : 3 byte IO, falling back to 16bit\n); + case 2: db-dumpblk = dm9000_dumpblk_16bit; db-outblk = dm9000_outblk_16bit; db-inblk = dm9000_inblk_16bit; @@ -413,19 +412,21 @@ dm9000_probe(struct platform_device *pde /* Init network device */ ndev = alloc_etherdev(sizeof (struct board_info)); if (!ndev) { - printk(%s: could not allocate device.\n, CARDNAME); + dev_err(pdev-dev, could not allocate device.\n); return -ENOMEM; } SET_MODULE_OWNER(ndev); SET_NETDEV_DEV(ndev, pdev-dev); - PRINTK2(dm9000_probe()); + dev_dbg(pdev-dev, probing device\n); /* setup board info structure */ db = (struct board_info *) ndev-priv; memset(db, 0, sizeof (*db)); + db-dev = pdev-dev; + spin_lock_init(db-lock); if (pdev-num_resources 2) { @@ -454,7 +455,7 @@ dm9000_probe(struct platform_device *pde if (db-addr_res == NULL || db-data_res == NULL || db-irq_res == NULL) { - printk(KERN_ERR PFX insufficient resources\n); + dev_err(db-dev, insufficient resources\n); ret = -ENOENT; goto out; } @@ -464,7 +465,7 @@ dm9000_probe(struct platform_device *pde pdev-name); if (db-addr_req == NULL) { - printk(KERN_ERR PFX cannot claim address reg area\n); + dev_err(db-dev, cannot claim address reg area\n); ret = -EIO; goto out; } @@ -472,7 +473,7 @@ dm9000_probe(struct platform_device *pde db-io_addr = ioremap(db-addr_res-start, i); if (db-io_addr == NULL) { - printk(KERN_ERR failed to ioremap address reg\n); + dev_err(db-dev, failed to ioremap address reg\n); ret = -EINVAL; goto out; } @@ -482,7 +483,7 @@ dm9000_probe(struct platform_device *pde pdev-name); if (db-data_req == NULL) { - printk(KERN_ERR PFX cannot claim data reg area\n); + dev_err(db-dev, cannot claim data reg area\n); ret = -EIO; goto out; } @@ -490,7 +491,7 @@ dm9000_probe(struct platform_device *pde db-io_data = ioremap(db-data_res-start, iosize); if (db-io_data == NULL) { - printk(KERN_ERR failed to ioremap data reg\n); + dev_err(db-dev,failed to ioremap data reg\n); ret = -EINVAL; goto out; } @@ -544,11 +545,11 @@ dm9000_probe(struct platform_device *pde if (id_val == DM9000_ID) break; - printk(%s: read wrong id 0x%08x\n, CARDNAME, id_val); + dev_err(db-dev, read wrong id 0x%08x\n, id_val); } if (id_val != DM9000_ID) { - printk(%s: wrong id: 0x%08x\n, CARDNAME, id_val); + dev_err(db-dev, wrong id: 0x%08x\n, id_val); goto release; } @@ -596,8 +597,8 @@ dm9000_probe(struct platform_device *pde } if
[patch 12/22] NET: DM9000: Remove EEPROM initialisation code.
Remove the old hack to program an initial EEPROM setting into the DM9000 as we now have ethtool support for reading and writing the EEPROM. Signed-off-by: Ben Dooks [EMAIL PROTECTED] Index: linux-2.6.23-quilt3/drivers/net/dm9000.c === --- linux-2.6.23-quilt3.orig/drivers/net/dm9000.c +++ linux-2.6.23-quilt3/drivers/net/dm9000.c @@ -196,10 +196,6 @@ static void dm9000_write_eeprom(board_in static void dm9000_rx(struct net_device *); static void dm9000_hash_table(struct net_device *); -//#define DM9000_PROGRAM_EEPROM -#ifdef DM9000_PROGRAM_EEPROM -static void program_eeprom(board_info_t * db); -#endif /* DM9000 network board routine */ static void @@ -707,9 +703,6 @@ dm9000_probe(struct platform_device *pde ndev-poll_controller= dm9000_poll_controller; #endif -#ifdef DM9000_PROGRAM_EEPROM - program_eeprom(db); -#endif db-msg_enable = NETIF_MSG_LINK; db-mii.phy_id_mask = 0x1f; db-mii.reg_num_mask = 0x1f; @@ -1178,28 +1171,6 @@ dm9000_write_eeprom(board_info_t *db, in mutex_unlock(db-addr_lock); } -#ifdef DM9000_PROGRAM_EEPROM -/* - * Only for development: - * Here we write static data to the eeprom in case - * we don't have valid content on a new board - */ -static void -program_eeprom(board_info_t * db) -{ - u16 eeprom[] = { 0x0c00, 0x007f, 0x1300,/* MAC Address */ - 0x, /* Autoload: accept nothing */ - 0x0a46, 0x9000, /* Vendor / Product ID */ - 0x, /* pin control */ - 0x, - }; /* Wake-up mode control */ - int i; - for (i = 0; i 8; i++) - write_srom_word(db, i, eeprom[i]); -} -#endif - - /* * Calculate the CRC valude of the Rx packet * flag = 1 : return the reverse CRC (for the received packet CRC) -- Ben ([EMAIL PROTECTED], http://www.fluff.org/) 'a smiley only costs 4 bytes' - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: 2.6.24-rc3: find complains about /proc/net
On Monday, 19 of November 2007, Pavel Machek wrote: Hi! I think that this worked before: [EMAIL PROTECTED]:/proc# find . -name timer_info find: WARNING: Hard link count is wrong for ./net: this may be a bug in your filesystem driver. Automatically turning on find's -noleaf option. Earlier results may have failed to include directories that should have been searched. [EMAIL PROTECTED]:/proc# I'm seeing that too. Rafael - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] [IPV4] UDP: Always checksum even if without socket filter
From: Andi Kleen [EMAIL PROTECTED] Date: Mon, 19 Nov 2007 16:29:33 +0100 All of our options suck, we just have to choose the least sucking one and right now to me that's decrementing the counter as much as I empathize with the SNMP application overflow detection issue. If the SNMP monitor detects an false overflow the error it reports will be much worse than a single missing packet. So you would replace one error with a worse error. This can be fixed, the above cannot. I don't see how, short of breaking the interface (e.g. reporting 64bit or separate overflow counts) As someone who just spent an entire weekend working on cpu performance counter code, I know it's possible. When you overflow, the new value is a lot less than the last sampled one. When the value backtracks like we're discussing it could here, it only decrease a very little bit. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 00/22] DM9000 updates for 2.6.25
On Mon, 19 Nov 2007 20:39:10 + Ben Dooks [EMAIL PROTECTED] wrote: This is my current proposed patch series to the DM9000 driver for both general cleanups, support for ethtool and to make the code better. You could also change all instances of dev-priv with netdev_priv(dev). -- Stephen Hemminger [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: r8169 crash
Denys [EMAIL PROTECTED] : Maybe it is good idea to print some registers/etc in watchdog message? I will try to reproduce problem with debug enabled, maybe it will be possible to catch problem with more debug. Your customers will not necessarily like it but it could be useful to trace the Rx/Tx descriptor ring content and the irq status word. If your make it dependent on tp-msg_enable (settable via 'ethtool -s ethX msglvl 65535), you can enable it at will and catch some bit of normal traffic just before you experiment with the magic cable. On Sun, 18 Nov 2007 22:00:38 +0100, Francois Romieu wrote Denys [EMAIL PROTECTED] : [...] I'll take care of it once I am done with the sis190 watchdog failure (nothing hard, simply ugly). Actually I lack a reliable indication that the Tx process is stuck. My hack seems able to recover but it can be quite slow to trigger. A contact at SiS would be welcome. -- Ueimor - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/5] fixups for mpc8360 rev. 2.1 erratum #2 (RGMII Timing)
On Mon, 5 Nov 2007 12:15:30 -0600 Kim Phillips [EMAIL PROTECTED] wrote: Hello all, the following patches fix RGMII timing for rev. 2.1 of the mpc8360, according to erratum #2 (erratum text included below). Basically the most intrusive part is the addition of two new RGMII Internal Delay modes; one for TX delay only, and the other for RX delay only (i.e, not both at the same time). Please review, and since this affects both netdev and powerpc trees, one maintainer should ack them for the other to push upstream (i.e, Kumar acks them, and Leo picks them up to go through netdev or the other way around; either way is fine with me). I'm hoping they're trivial enough to go in 2.6.24. Kumar, Leo, re-ping due to (a) it's been 2 weeks and (b) Anton Vorontsov has since issued his Tested-by. Might I suggest Kumar ack the powerpc patches, and Leo/Jeff apply 5/5 to go through netdev? Kim - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Problem with sysctl_tcp_congestion_control function
sysctl_tcp_congestion_control seems to have a bug that prevents it from actually calling the tcp_set_default_congestion_control function. This is not so apparent because it does not return an error and generally the /proc interface is used to configure the default TCP congestion control algorithm. This is present in 2.6.18 onwards and probably earlier, though I have not inspected 2.6.15--2.6.17. sysctl_tcp_congestion_control calls sysctl_string and expects a successful return code of 0. In such a case it actually sets the congestion control algorithm with tcp_set_default_congestion_control. Otherwise, it returns the value returned by sysctl_string. This was correct in 2.6.14, as sysctl_string returned 0 on success. However, sysctl_string was updated to return 1 on success around about 2.6.15 and sysctl_tcp_congestion_control was not updated. Even though sysctl_tcp_congestion_control returns 1, do_sysctl_strategy converts this return code to '0', so the caller never notices the error. A sample program that shows this behaviour is attached. It is hardcoded to set the congestion control algorithm to reno. Running it multiple times shows that it succeeds, yet does not modify the default TCP congestion control algorithm. e.g., $ make sysctl $ sudo /tmp/sysctl; sudo /tmp/sysctl old value='bic', new value should be='reno' old value='bic', new value should be='reno' A simple patch is also attached that modifies the if statement in sysctl_tcp_congestion_control. #include linux/unistd.h #include linux/types.h #include linux/sysctl.h #include stdio.h _syscall1(int, _sysctl, struct __sysctl_args *, args); int sysctl(int *name, int nlen, void *oldval, size_t *oldlenp, void *newval, size_t newlen) { struct __sysctl_args args={name,nlen,oldval,oldlenp,newval,newlen}; return _sysctl(args); } #define SIZE(x) sizeof(x)/sizeof(x[0]) #ifndef NET_TCO_CONG_CONTROL #define NET_TCP_CONG_CONTROL 110 #endif int main() { char oldname[100]; size_t oldnamelen = SIZE(oldname); char newval[] = reno; size_t newvallen = SIZE(newval); int name[] = { CTL_NET, NET_IPV4, NET_TCP_CONG_CONTROL }; if (sysctl(name, SIZE(name), oldname, oldnamelen, newval, newvallen)) perror(sysctl); else printf(old value='%s', new value should be='%s'\n, oldname, newval); return 0; } --- /tmp/net/ipv4/sysctl_net_ipv4.c 2007-10-05 11:07:25.0 -0700 +++ net/ipv4/sysctl_net_ipv4.c 2007-11-19 16:05:16.0 -0800 @@ -129,7 +129,7 @@ tcp_get_default_congestion_control(val); ret = sysctl_string(tbl, name, nlen, oldval, oldlenp, newval, newlen, context); - if (ret == 0 newval newlen) + if (ret == 1 newval newlen) ret = tcp_set_default_congestion_control(val); return ret; }
[PATCH 36/59] drivers/net: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- drivers/net/3c507.c |4 ++-- drivers/net/amd8111e.c |4 ++-- drivers/net/at1700.c|2 +- drivers/net/pppol2tp.c |2 +- drivers/net/qla3xxx.c |2 +- drivers/net/rrunner.c |2 +- drivers/net/s2io.c |6 +++--- drivers/net/sis900.c|6 +++--- drivers/net/smc9194.c |2 +- drivers/net/via-rhine.c |2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c index 964d31a..f90ede9 100644 --- a/drivers/net/3c507.c +++ b/drivers/net/3c507.c @@ -747,7 +747,7 @@ static void init_82586_mem(struct net_device *dev) int boguscnt = 50; while (readw(shmem+iSCB_STATUS) == 0) if (--boguscnt == 0) { - printk(%s: i82586 initialization timed out with status %04x, + printk(%s: i82586 initialization timed out with status %04x, cmd %04x.\n, dev-name, readw(shmem+iSCB_STATUS), readw(shmem+iSCB_CMD)); break; @@ -832,7 +832,7 @@ static void el16_rx(struct net_device *dev) if (rfd_cmd != 0 || data_buffer_addr != rx_head + 22 || (pkt_len 0xC000) != 0xC000) { - printk(%s: Rx frame at %#x corrupted, status %04x cmd %04x + printk(%s: Rx frame at %#x corrupted, status %04x cmd %04x next %04x data-buf @%04x %04x.\n, dev-name, rx_head, frame_status, rfd_cmd, next_rx_frame, data_buffer_addr, pkt_len); diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c index eebf5bb..3430cc3 100644 --- a/drivers/net/amd8111e.c +++ b/drivers/net/amd8111e.c @@ -1939,13 +1939,13 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev, err = pci_enable_device(pdev); if(err){ - printk(KERN_ERR amd8111e: Cannot enable new PCI device, + printk(KERN_ERR amd8111e: Cannot enable new PCI device, exiting.\n); return err; } if(!(pci_resource_flags(pdev, 0) IORESOURCE_MEM)){ - printk(KERN_ERR amd8111e: Cannot find PCI base address + printk(KERN_ERR amd8111e: Cannot find PCI base address, exiting.\n); err = -ENODEV; goto err_disable_pdev; diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c index b032c1b..9704171 100644 --- a/drivers/net/at1700.c +++ b/drivers/net/at1700.c @@ -465,7 +465,7 @@ found: /* Snarf the interrupt vector now. */ ret = request_irq(irq, net_interrupt, 0, DRV_NAME, dev); if (ret) { - printk ( AT1700 at %#3x is unusable due to a conflict on + printk ( AT1700 at %#3x is unusable due to a conflict on IRQ %d.\n, ioaddr, irq); goto err_mca; } diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index a7556cd..1b51bb6 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c @@ -2489,7 +2489,7 @@ static void __exit pppol2tp_exit(void) module_init(pppol2tp_init); module_exit(pppol2tp_exit); -MODULE_AUTHOR(Martijn van Oosterhout [EMAIL PROTECTED], +MODULE_AUTHOR(Martijn van Oosterhout [EMAIL PROTECTED], James Chapman [EMAIL PROTECTED]); MODULE_DESCRIPTION(PPP over L2TP over UDP); MODULE_LICENSE(GPL); diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c index a579111..4f5d3d4 100644 --- a/drivers/net/qla3xxx.c +++ b/drivers/net/qla3xxx.c @@ -711,7 +711,7 @@ static int ql_mii_write_reg_ex(struct ql3_adapter *qdev, if (ql_wait_for_mii_ready(qdev)) { if (netif_msg_link(qdev)) printk(KERN_WARNING PFX - %s: Timed out waiting for management port to + %s: Timed out waiting for management port to get free before issuing command.\n, qdev-ndev-name); return -1; diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index 73a7e65..379ded5 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c @@ -878,7 +878,7 @@ static u32 rr_handle_event(struct net_device *dev, u32 prodidx, u32 eidx) dev-name); goto drop; case E_FLG_SYN_ERR: - printk(KERN_WARNING %s: Flag sync. lost during + printk(KERN_WARNING %s: Flag sync. lost during packet\n, dev-name); goto drop; case E_RX_INV_BUF: diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index
[PATCH 34/59] drivers/net/wan: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- drivers/net/wan/wanxl.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c index 8e320b7..ad8c865 100644 --- a/drivers/net/wan/wanxl.c +++ b/drivers/net/wan/wanxl.c @@ -743,7 +743,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, }while (time_after(timeout, jiffies)); if (!stat) { - printk(KERN_WARNING wanXL %s: timeout while initializing card + printk(KERN_WARNING wanXL %s: timeout while initializing card firmware\n, pci_name(pdev)); wanxl_pci_remove_one(pdev); return -ENODEV; -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 35/59] drivers/net/wireless: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- drivers/net/wireless/b43/phy.c |2 +- drivers/net/wireless/b43legacy/phy.c |2 +- drivers/net/wireless/bcm43xx/bcm43xx_phy.c |2 +- drivers/net/wireless/libertas/wext.c |2 +- drivers/net/wireless/netwave_cs.c |2 +- drivers/net/wireless/p54usb.c |2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/b43/phy.c b/drivers/net/wireless/b43/phy.c index 3d4ed64..7ff091e 100644 --- a/drivers/net/wireless/b43/phy.c +++ b/drivers/net/wireless/b43/phy.c @@ -2214,7 +2214,7 @@ int b43_phy_init_tssi2dbm_table(struct b43_wldev *dev) } dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); if (dyn_tssi2dbm == NULL) { - b43err(dev-wl, Could not allocate memory + b43err(dev-wl, Could not allocate memory for tssi2dbm table\n); return -ENOMEM; } diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c index 22a4b3d..491e518 100644 --- a/drivers/net/wireless/b43legacy/phy.c +++ b/drivers/net/wireless/b43legacy/phy.c @@ -2020,7 +2020,7 @@ int b43legacy_phy_init_tssi2dbm_table(struct b43legacy_wldev *dev) phy-idle_tssi = 62; dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); if (dyn_tssi2dbm == NULL) { - b43legacyerr(dev-wl, Could not allocate memory + b43legacyerr(dev-wl, Could not allocate memory for tssi2dbm table\n); return -ENOMEM; } diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index b37f1e3..af3de33 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c @@ -2149,7 +2149,7 @@ int bcm43xx_phy_init_tssi2dbm_table(struct bcm43xx_private *bcm) } dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); if (dyn_tssi2dbm == NULL) { - printk(KERN_ERR PFX Could not allocate memory + printk(KERN_ERR PFX Could not allocate memory for tssi2dbm table\n); return -ENOMEM; } diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index c6f5aa3..395b788 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c @@ -1528,7 +1528,7 @@ static int wlan_set_encodeext(struct net_device *dev, (ext-key_len != KEY_LEN_WPA_TKIP)) || ((alg == IW_ENCODE_ALG_CCMP) (ext-key_len != KEY_LEN_WPA_AES))) { - lbs_deb_wext(invalid size %d for key of alg + lbs_deb_wext(invalid size %d for key of alg type %d\n, ext-key_len, alg); diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index 2402cb8..d2fa079 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c @@ -806,7 +806,7 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { for (i = 0; i 6; i++) dev-dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i); -printk(KERN_INFO %s: Netwave: port %#3lx, irq %d, mem %lx +printk(KERN_INFO %s: Netwave: port %#3lx, irq %d, mem %lx, id %c%c, hw_addr %s\n, dev-name, dev-base_addr, dev-irq, (u_long) ramBase, diff --git a/drivers/net/wireless/p54usb.c b/drivers/net/wireless/p54usb.c index 755482a..60d286e 100644 --- a/drivers/net/wireless/p54usb.c +++ b/drivers/net/wireless/p54usb.c @@ -308,7 +308,7 @@ static int p54u_read_eeprom(struct ieee80211_hw *dev) buf = kmalloc(0x2020, GFP_KERNEL); if (!buf) { - printk(KERN_ERR prism54usb: cannot allocate memory for + printk(KERN_ERR prism54usb: cannot allocate memory for eeprom readback!\n); return -ENOMEM; } -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 31/59] drivers/net/ixgb: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- drivers/net/ixgbe/ixgbe_common.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c index 512e3b2..b7e50bc 100644 --- a/drivers/net/ixgbe/ixgbe_common.c +++ b/drivers/net/ixgbe/ixgbe_common.c @@ -950,7 +950,7 @@ s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num) u32 rmcs_reg; if (packetbuf_num 0 || packetbuf_num 7) - hw_dbg(hw, Invalid packet buffer number [%d], expected range + hw_dbg(hw, Invalid packet buffer number [%d], expected range is 0-7\n, packetbuf_num); frctl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL); -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/5] fixups for mpc8360 rev. 2.1 erratum #2 (RGMII Timing)
Kim Phillips wrote: On Mon, 5 Nov 2007 12:15:30 -0600 Kim Phillips [EMAIL PROTECTED] wrote: Hello all, the following patches fix RGMII timing for rev. 2.1 of the mpc8360, according to erratum #2 (erratum text included below). Basically the most intrusive part is the addition of two new RGMII Internal Delay modes; one for TX delay only, and the other for RX delay only (i.e, not both at the same time). Please review, and since this affects both netdev and powerpc trees, one maintainer should ack them for the other to push upstream (i.e, Kumar acks them, and Leo picks them up to go through netdev or the other way around; either way is fine with me). I'm hoping they're trivial enough to go in 2.6.24. Kumar, Leo, re-ping due to (a) it's been 2 weeks and (b) Anton Vorontsov has since issued his Tested-by. Might I suggest Kumar ack the powerpc patches, and Leo/Jeff apply 5/5 to go through netdev? FWIW I just got back from vacation... I'm grabbing what DaveM has collected into davem/netdev-2.6.git, and then going from there... Jeff - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 29/59] drivers/net/chelsio: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- drivers/net/chelsio/cxgb2.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c index 2dbf8dc..3eca4e3 100644 --- a/drivers/net/chelsio/cxgb2.c +++ b/drivers/net/chelsio/cxgb2.c @@ -1006,7 +1006,7 @@ static int __devinit init_one(struct pci_dev *pdev, pci_using_dac = 1; if (pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) { - CH_ERR(%s: unable to obtain 64-bit DMA for + CH_ERR(%s: unable to obtain 64-bit DMA for consistent allocations\n, pci_name(pdev)); err = -ENODEV; goto out_disable_pdev; -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 30/59] drivers/net/cxgb3: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- drivers/net/cxgb3/cxgb3_offload.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c index bd25421..7086f76 100644 --- a/drivers/net/cxgb3/cxgb3_offload.c +++ b/drivers/net/cxgb3/cxgb3_offload.c @@ -1004,7 +1004,7 @@ void cxgb_redirect(struct dst_entry *old, struct dst_entry *new) if (!is_offloading(olddev)) return; if (!is_offloading(newdev)) { - printk(KERN_WARNING %s: Redirect to non-offload + printk(KERN_WARNING %s: Redirect to non-offload device ignored.\n, __FUNCTION__); return; } -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 32/59] drivers/net/netxen: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- drivers/net/netxen/netxen_nic_hw.c |2 +- drivers/net/netxen/netxen_nic_init.c |4 ++-- drivers/net/netxen/netxen_nic_main.c |6 +++--- drivers/net/netxen/netxen_nic_niu.c |4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 2c19b8d..8d692e2 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c @@ -664,7 +664,7 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw) NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW_F3)); break; default: - printk(KERN_INFO Changing the window for PCI function + printk(KERN_INFO Changing the window for PCI function %d\n, adapter-ahw.pci_func); offset = PCI_OFFSET_SECOND_RANGE(adapter, NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW)); diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 3758926..89d9b53 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c @@ -1102,8 +1102,8 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, } if (buffer-lro_current_frags != buffer-lro_expected_frags) { if (buffer-lro_expected_frags != 0) { - printk(LRO: (refhandle:%x) recv frag. - wait for last. flags: %x expected:%d + printk(LRO: (refhandle:%x) recv frag. + wait for last. flags: %x expected:%d have:%d\n, index, netxen_get_sts_desc_lro_last_frag(desc), buffer-lro_expected_frags, diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index a80f0cd..f648d43 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c @@ -287,7 +287,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) printk(KERN_INFO %s \n, netxen_nic_driver_string); if (pdev-class != 0x02) { - printk(KERN_ERRNetXen function %d, class %x will not + printk(KERN_ERRNetXen function %d, class %x will not be enabled.\n,pci_func_id, pdev-class); return -ENODEV; } @@ -511,7 +511,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) vmalloc(RCV_BUFFSIZE); if (rcv_desc-rx_buf_arr == NULL) { - printk(KERN_ERR %s: Could not allocate + printk(KERN_ERR %s: Could not allocate rcv_desc-rx_buf_arr memory:%d\n, netxen_nic_driver_name, (int)RCV_BUFFSIZE); @@ -983,7 +983,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) } if (frag_count MAX_BUFFERS_PER_CMD) { - printk(%s: %s netxen_nic_xmit_frame: frag_count (%d) + printk(%s: %s netxen_nic_xmit_frame: frag_count (%d) too large, can handle only %d frags\n, netxen_nic_driver_name, netdev-name, frag_count, MAX_BUFFERS_PER_CMD); diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c index 5b9e1b3..155429d 100644 --- a/drivers/net/netxen/netxen_nic_niu.c +++ b/drivers/net/netxen/netxen_nic_niu.c @@ -544,8 +544,8 @@ int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter, port, enable); } else { - printk(KERN_ERR PFX ERROR reading - PHY status. Illegal speed.\n); + printk(KERN_ERR PFX ERROR reading + PHY status. Invalid speed.\n); result = -1; } } else { -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 33/59] drivers/net/sk98lin: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- drivers/net/sk98lin/skgepnmi.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/sk98lin/skgepnmi.c b/drivers/net/sk98lin/skgepnmi.c index b36dd9a..678659f 100644 --- a/drivers/net/sk98lin/skgepnmi.c +++ b/drivers/net/sk98lin/skgepnmi.c @@ -383,7 +383,7 @@ int Level) /* Initialization level */ SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR049, SK_PNMI_ERR049MSG); SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_INIT | SK_DBGCAT_FATAL, - (CounterOffset struct size (%d) differs from + (CounterOffset struct size (%d) differs from SK_PNMI_MAX_IDX (%d)\n, SK_PNMI_CNT_NO, SK_PNMI_MAX_IDX)); } -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 50/59] net/bridge: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- net/bridge/netfilter/ebt_among.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c index 392d877..6436d30 100644 --- a/net/bridge/netfilter/ebt_among.c +++ b/net/bridge/netfilter/ebt_among.c @@ -187,7 +187,7 @@ static int ebt_among_check(const char *tablename, unsigned int hookmask, if (datalen != EBT_ALIGN(expected_length)) { printk(KERN_WARNING - ebtables: among: wrong size: %d + ebtables: among: wrong size: %d against expected %d, rounded to %Zd\n, datalen, expected_length, EBT_ALIGN(expected_length)); -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 51/59] net/dccp: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- net/dccp/ccids/lib/loss_interval.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/dccp/ccids/lib/loss_interval.c b/net/dccp/ccids/lib/loss_interval.c index 40ad428..d26b88d 100644 --- a/net/dccp/ccids/lib/loss_interval.c +++ b/net/dccp/ccids/lib/loss_interval.c @@ -166,7 +166,7 @@ static u32 dccp_li_calc_first_li(struct sock *sk, } if (unlikely(interval == 0)) { - DCCP_WARN(%s(%p), Could not find a win_count interval 0. + DCCP_WARN(%s(%p), Could not find a win_count interval 0. Defaulting to 1\n, dccp_role(sk), sk); interval = 1; } -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 53/59] net/ipv6: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- net/ipv6/addrconf.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 1bd8d81..567664e 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -967,7 +967,7 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev, if (unlikely(score.addr_type == IPV6_ADDR_ANY || score.addr_type IPV6_ADDR_MULTICAST)) { LIMIT_NETDEBUG(KERN_DEBUG - ADDRCONF: unspecified / multicast address + ADDRCONF: unspecified / multicast address assigned as unicast address on %s, dev-name); continue; -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 55/59] net/sctp: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- net/sctp/sm_statefuns.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 5ebbe80..b8bbb96 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -1146,7 +1146,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep, /* Check if the timestamp looks valid. */ if (time_after(hbinfo-sent_at, jiffies) || time_after(jiffies, hbinfo-sent_at + max_interval)) { - SCTP_DEBUG_PRINTK(%s: HEARTBEAT ACK with invalid timestamp + SCTP_DEBUG_PRINTK(%s: HEARTBEAT ACK with invalid timestamp received for transport: %p\n, __FUNCTION__, link); return SCTP_DISPOSITION_DISCARD; -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 56/59] net/sunrpc: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- net/sunrpc/auth_gss/auth_gss.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 53995af..22906b8 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c @@ -967,7 +967,7 @@ gss_validate(struct rpc_task *task, __be32 *p) if (maj_stat == GSS_S_CONTEXT_EXPIRED) clear_bit(RPCAUTH_CRED_UPTODATE, cred-cr_flags); if (maj_stat) { - dprintk(RPC: %5u gss_validate: gss_verify_mic returned + dprintk(RPC: %5u gss_validate: gss_verify_mic returned error 0x%08x\n, task-tk_pid, maj_stat); goto out_bad; } -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 54/59] net/irda: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- net/irda/iriap.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/irda/iriap.c b/net/irda/iriap.c index dc5e34a..a86a5d8 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c @@ -928,7 +928,7 @@ void iriap_call_indication(struct iriap_cb *self, struct sk_buff *skb) opcode = fp[0]; if (~opcode 0x80) { - IRDA_WARNING(%s: IrIAS multiframe commands or results + IRDA_WARNING(%s: IrIAS multiframe commands or results is not implemented yet!\n, __FUNCTION__); return; } -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 52/59] net/ipv4: Add missing space
Signed-off-by: Joe Perches [EMAIL PROTECTED] --- net/ipv4/ipvs/ip_vs_core.c |2 +- net/ipv4/netfilter/iptable_raw.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c index 20c884a..8fba202 100644 --- a/net/ipv4/ipvs/ip_vs_core.c +++ b/net/ipv4/ipvs/ip_vs_core.c @@ -637,7 +637,7 @@ static int ip_vs_out_icmp(struct sk_buff *skb, int *related) verdict = NF_DROP; if (IP_VS_FWD_METHOD(cp) != 0) { - IP_VS_ERR(shouldn't reach here, because the box is on the + IP_VS_ERR(shouldn't reach here, because the box is on the half connection in the tun/dr module.\n); } diff --git a/net/ipv4/netfilter/iptable_raw.c b/net/ipv4/netfilter/iptable_raw.c index 5de6e57..f867865 100644 --- a/net/ipv4/netfilter/iptable_raw.c +++ b/net/ipv4/netfilter/iptable_raw.c @@ -66,7 +66,7 @@ ipt_local_hook(unsigned int hook, if (skb-len sizeof(struct iphdr) || ip_hdrlen(skb) sizeof(struct iphdr)) { if (net_ratelimit()) - printk(iptable_raw: ignoring short SOCK_RAW + printk(iptable_raw: ignoring short SOCK_RAW packet.\n); return NF_ACCEPT; } -- 1.5.3.5.652.gf192c - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: reproducible cxgb kernel panic in FC8 kernel 2.6.23.1-49
Divy Le Ray wrote: Ben Greear wrote: This panic happens (almost?) immediately after starting TCP traffic between the cxgb nic on this system and another. We also got at least one crash on a custom/tainted 2.6.20.12 kernel, but it would run for at least a few minutes at ~1Gbps first. I think my serial console chomped some of this..but it's very reproducible, so if you need more info I can make the terminal wider and do it again. Hi Ben, I just posted a patch fixing this T2 crash. It appeared in 2.6.22, when eth_type_trans() was modified to set skb-dev. cxgb3 got fixed at the time, but I obviously forgot the chelsio driver. I'm a bit behind on T2 updates. I will get to it in a few days. Thanks, that seems to have fixed the crash. A few other bugs to report: 1) tx/rx pkt counters remain an zero, even though I know it is passing packets. 2) There are lots of errors about inadequate headroom in Tx. I had TCP working at one point, but then it stopped answering ARP for whatever reason. Never got UDP to work at all, even when TCP was working. 3) After resetting the interface (ifdown, ifup), one machine suddenly had a BUG (null pointer exception) and rebooted. The listing in /var/log/messages is not complete (has no stack-trace or module), so I do not include it here. This 2.6.23 kernel is patched with some of my own hackings, and it's possible that my changes are causing the problem (but, it works fine with e1000 NICs). If you have any patches you would like us to try, we'll be happy to do so. Thanks, Ben -- Ben Greear [EMAIL PROTECTED] Candela Technologies Inc http://www.candelatech.com - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH][IPVS] Relax the module get/put in ip_vs_app.c
On Mon, Nov 19, 2007 at 12:58:14PM +0300, Pavel Emelyanov wrote: Both try_module_get/module_put already handle the module == NULL case, so no need in manual checking. This patch fits both net-2.6 and net-2.6.25. Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED] Thanks, that looks fine to me. Acked-by: Simon Horman [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 04/11] netpoll: alternative implementation of dropping
From: Stephen Hemminger [EMAIL PROTECTED] Date: Sat, 03 Nov 2007 11:43:18 -0700 Signed-off-by: Stephen Hemminger [EMAIL PROTECTED] Applied to net-2.6.25, but I gave the changelog a more descriptive headline: [NETPOLL]: Kill NETPOLL_RX_DROP, set but never tested. Thanks. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 03/11] netpoll: no need to store local_mac
From: Stephen Hemminger [EMAIL PROTECTED] Date: Sat, 03 Nov 2007 11:43:17 -0700 The local_mac is managed by the network device, no need to keep a spare copy and all the management problems that could cause. Signed-off-by: Stephen Hemminger [EMAIL PROTECTED] Applied to net-2.6.25, thanks! - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 02/11] netpoll: netpoll_poll cleanup
From: Stephen Hemminger [EMAIL PROTECTED] Date: Sat, 03 Nov 2007 11:43:16 -0700 Restructure code slightly to improve readability: * dereference device once * change obvious while() loop * let poll_napi() handle null list itself Signed-off-by: Stephen Hemminger [EMAIL PROTECTED] Applied to net-2.6.25, but I made some coding style fixups, one of which is a huge pet peeve of mine. When declaring local variables for a function I always list the longest lines down gradually to the shortest lines. It is nicer to the eye and naturally it means that all the complicated structure assignments and dereferences sit at the top and the simpler iterators and counters like 'i' end up at the bottom making local variable lists that much easier to read and search when learning how a function works. You explicitly changed this one I had set up: { - struct netpoll_info *npinfo = np-dev-npinfo; - struct napi_struct *napi; int budget = 16; + struct napi_struct *napi; And I thus reverted it back to the correct order: struct napi_struct *napi; int budget = 16; I also got rid of the mid-parens spaces in: + while ( (skb = skb_dequeue(npi-arp_tx)) ) Thanks. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/11] netpoll: use skb_queue_purge
From: Stephen Hemminger [EMAIL PROTECTED] Date: Sat, 03 Nov 2007 11:43:15 -0700 Use standard route for flushing queue. Signed-off-by: Stephen Hemminger [EMAIL PROTECTED] Applied to net-2.6.25, thanks! - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ibm_newemac: Fix possible lockup on close
It's a bad idea to call flush_scheduled_work from within a netdev-stop because the linkwatch will occasionally take the rtnl lock from a workqueue context, and thus that can deadlock. This reworks things a bit in that area to avoid the problem. Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED] --- drivers/net/ibm_newemac/core.c | 31 --- drivers/net/ibm_newemac/core.h |1 + 2 files changed, 21 insertions(+), 11 deletions(-) Index: linux-work/drivers/net/ibm_newemac/core.c === --- linux-work.orig/drivers/net/ibm_newemac/core.c 2007-11-20 14:42:50.0 +1100 +++ linux-work/drivers/net/ibm_newemac/core.c 2007-11-20 14:46:51.0 +1100 @@ -642,9 +642,11 @@ static void emac_reset_work(struct work_ DBG(dev, reset_work NL); mutex_lock(dev-link_lock); - emac_netif_stop(dev); - emac_full_tx_reset(dev); - emac_netif_start(dev); + if (dev-opened) { + emac_netif_stop(dev); + emac_full_tx_reset(dev); + emac_netif_start(dev); + } mutex_unlock(dev-link_lock); } @@ -1063,10 +1065,9 @@ static int emac_open(struct net_device * dev-rx_sg_skb = NULL; mutex_lock(dev-link_lock); + dev-opened = 1; - /* XXX Start PHY polling now. Shouldn't wr do like sungem instead and -* always poll the PHY even when the iface is down ? That would allow -* things like laptop-net to work. --BenH + /* Start PHY polling now. */ if (dev-phy.address = 0) { int link_poll_interval; @@ -1145,9 +1146,11 @@ static void emac_link_timer(struct work_ int link_poll_interval; mutex_lock(dev-link_lock); - DBG2(dev, link timer NL); + if (!dev-opened) + goto bail; + if (dev-phy.def-ops-poll_link(dev-phy)) { if (!netif_carrier_ok(dev-ndev)) { /* Get new link parameters */ @@ -1170,13 +1173,14 @@ static void emac_link_timer(struct work_ link_poll_interval = PHY_POLL_LINK_OFF; } schedule_delayed_work(dev-link_work, link_poll_interval); - + bail: mutex_unlock(dev-link_lock); } static void emac_force_link_update(struct emac_instance *dev) { netif_carrier_off(dev-ndev); + smp_rmb(); if (dev-link_polling) { cancel_rearming_delayed_work(dev-link_work); if (dev-link_polling) @@ -1191,11 +1195,14 @@ static int emac_close(struct net_device DBG(dev, close NL); - if (dev-phy.address = 0) + if (dev-phy.address = 0) { + dev-link_polling = 0; cancel_rearming_delayed_work(dev-link_work); - + } + mutex_lock(dev-link_lock); emac_netif_stop(dev); - flush_scheduled_work(); + dev-opened = 0; + mutex_unlock(dev-link_lock); emac_rx_disable(dev); emac_tx_disable(dev); @@ -2756,6 +2763,8 @@ static int __devexit emac_remove(struct unregister_netdev(dev-ndev); + flush_scheduled_work(); + if (emac_has_feature(dev, EMAC_FTR_HAS_TAH)) tah_detach(dev-tah_dev, dev-tah_port); if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII)) Index: linux-work/drivers/net/ibm_newemac/core.h === --- linux-work.orig/drivers/net/ibm_newemac/core.h 2007-11-20 14:42:50.0 +1100 +++ linux-work/drivers/net/ibm_newemac/core.h 2007-11-20 14:46:51.0 +1100 @@ -258,6 +258,7 @@ struct emac_instance { int stop_timeout; /* in us */ int no_mcast; int mcast_pending; + int opened; struct work_struct reset_work; spinlock_t lock; }; - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 08/11] netpoll: NETPOLL_TRAP configuration change
From: Stephen Hemminger [EMAIL PROTECTED] Date: Sat, 03 Nov 2007 11:43:22 -0700 --- a/drivers/net/Kconfig 2007-11-03 11:30:57.0 -0700 +++ b/drivers/net/Kconfig 2007-11-03 11:30:59.0 -0700 @@ -3118,8 +3118,8 @@ config NETCONSOLE_DYNAMIC config NETPOLL def_bool NETCONSOLE +# If needed use select to enable config NETPOLL_TRAP - bool Netpoll traffic trapping default n depends on NETPOLL I'm not applying this. This change means that allmodconfig doesn't pick up this symbol anymore and therefore it's way to difficult to make sure these code segments still get build tested. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 10/11] netpoll: rx optimization
From: Stephen Hemminger [EMAIL PROTECTED] Date: Sat, 03 Nov 2007 11:43:24 -0700 This patch makes netpoll work for non-NAPI devices that call netif_receive_skb. Devices are allowed to call netif_receive_skb if they are receiving packets in softirq (ie in tasklet). One side effect of this is that received packets will be looked at twice for the non-NAPI case, but this is harmless. Move the locking out of the inline hook and into the internal function. Signed-off-by: Stephen Hemminger [EMAIL PROTECTED] This one looks OK but it no longer applied, please respin. Thanks. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 11/11] netpoll: rx use RCU
From: Stephen Hemminger [EMAIL PROTECTED] Date: Sat, 03 Nov 2007 11:43:25 -0700 Get rid of rx_lock and use Read-Copy-Update to make sure that netpoll info and rx handle are not used after free. Signed-off-by: Stephen Hemminger [EMAIL PROTECTED] Please also respin this one too, thanks. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 06/11] netpoll: remove dev_name for npinfo
From: Stephen Hemminger [EMAIL PROTECTED] Date: Sat, 03 Nov 2007 11:43:20 -0700 The device name was only in npinfo for netconsole target configuration, so move it to netconsole. Netconsole only needs the value during config, so no need to do all the device name tracking etc.. Make functions for common code for instantiation and start up. Signed-off-by: Stephen Hemminger [EMAIL PROTECTED] Sigh... return -EUNTESTED; In netpoll_parse_options() np-dev isn't setup yet, so if you had tested this patch you would have gotten an immediate OOPS. That's why it needs the npinfo-dev_name in the first place, because it has to be parsed in order to even know what device to attach to. The np-dev usually isn't setup until netpoll_setup() is called. I appreciate all the work you are doing trying to clean up this beast but you have to start testing this stuff and audit the transformations you are making, instead of always relying on me or someone else to do it for you. That's why I let these particular patches sit in my inbox for two weeks, I knew half of them would have bugs and most if not all of them were totally untested, so I dreaded reviewing them. I might have to toss some of the rest of these netconsole things if there are dependencies on this bogus change. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 05/11] netpoll: dont need rx_flags
From: Stephen Hemminger [EMAIL PROTECTED] Date: Sat, 03 Nov 2007 11:43:19 -0700 The rx_flags variable is redundant. Turning rx on/off is done via setting the rx_np pointer. Signed-off-by: Stephen Hemminger [EMAIL PROTECTED] Not all of these transformations are equivalent, and as a result you're adding a bug. @@ -51,12 +50,11 @@ static inline int netpoll_rx(struct sk_b unsigned long flags; int ret = 0; - if (!npinfo || (!npinfo-rx_np !npinfo-rx_flags)) + if (!npinfo || !npinfo-rx_np) return 0; spin_lock_irqsave(npinfo-rx_lock, flags); - /* check rx_flags again with the lock held */ - if (npinfo-rx_flags __netpoll_rx(skb)) + if (__netpoll_rx(skb)) ret = 1; spin_unlock_irqrestore(npinfo-rx_lock, flags); If you're using -rx_np == NULL as your new guard, you have to duplicate that test inside of holding the lock. -rx_np goes to NULL under the lock, but in the previous code if the rx_flags is set we know that -rx_np is also NULL, that's why it was OK to only recheck -rx_flags in the lock and not -rx_np as well. Therefore we have to replace the test on -rx_flags with -rx_np in all spots to retain correct semantics. I've made this correction to your patch and applied it to net-2.6.25 Thanks. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/11] netpoll: ethernet devices only
On Mon, 19 Nov 2007 19:55:15 -0800 (PST) David Miller [EMAIL PROTECTED] wrote: From: Stephen Hemminger [EMAIL PROTECTED] Date: Sat, 03 Nov 2007 11:43:23 -0700 Netpoll only works on Ethernet devices, so check during setup rather than just failing silently later. Signed-off-by: Stephen Hemminger [EMAIL PROTECTED] --- a/net/core/netpoll.c2007-11-03 11:05:33.0 -0700 +++ b/net/core/netpoll.c2007-11-03 11:08:23.0 -0700 @@ -653,6 +653,12 @@ int netpoll_setup(struct netpoll *np, st unsigned long flags; int err; + if (ndev-type != ARPHRD_ETHER) { + printk(KERN_ERR netpoll: %s is not an ethernet device\n, + ndev-name); + return -EINVAL; + } + np-dev = ndev; This patch depends upon the broken np-dev_name one, and I also would rather fix the limitations in netpoll. Existing netpoll depends on Ethernet and IPV4. Doing the right thing might be hard because it would mean going through more inside irq. Probably the right thing to do would be to build a header through the normal path and cache it some how. -- Stephen Hemminger [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 07/11] netpoll: get rid of name parameter
From: Stephen Hemminger [EMAIL PROTECTED] Date: Sat, 03 Nov 2007 11:43:21 -0700 The name was being stored and used only for error messages. The same effect can be had by just passing it in where needed during config. Signed-off-by: Stephen Hemminger [EMAIL PROTECTED] The whole world of netpoll is not netconsole even though it just happens to be that way currently. Otherwise we can just eliminate the modularity completely and merge all of netconsole into net/core/netpoll.c but of course we won't do that. If another user of netpoll comes by we'll just have to add this thing back again. I'm dropping this patch. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 06/11] netpoll: remove dev_name for npinfo
On Mon, 19 Nov 2007 19:47:50 -0800 (PST) David Miller [EMAIL PROTECTED] wrote: From: Stephen Hemminger [EMAIL PROTECTED] Date: Sat, 03 Nov 2007 11:43:20 -0700 The device name was only in npinfo for netconsole target configuration, so move it to netconsole. Netconsole only needs the value during config, so no need to do all the device name tracking etc.. Make functions for common code for instantiation and start up. Signed-off-by: Stephen Hemminger [EMAIL PROTECTED] Sigh... return -EUNTESTED; In netpoll_parse_options() np-dev isn't setup yet, so if you had tested this patch you would have gotten an immediate OOPS. Sorry, I missed the boot up case, I was testing with modprobe and dyanmic reconfig stuff. Places that store the name (and then get confused by renames) are one of the lingering mis-features of the whole network device infrastructure. -- Stephen Hemminger [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/11] netpoll: ethernet devices only
From: Stephen Hemminger [EMAIL PROTECTED] Date: Sat, 03 Nov 2007 11:43:23 -0700 Netpoll only works on Ethernet devices, so check during setup rather than just failing silently later. Signed-off-by: Stephen Hemminger [EMAIL PROTECTED] --- a/net/core/netpoll.c 2007-11-03 11:05:33.0 -0700 +++ b/net/core/netpoll.c 2007-11-03 11:08:23.0 -0700 @@ -653,6 +653,12 @@ int netpoll_setup(struct netpoll *np, st unsigned long flags; int err; + if (ndev-type != ARPHRD_ETHER) { + printk(KERN_ERR netpoll: %s is not an ethernet device\n, +ndev-name); + return -EINVAL; + } + np-dev = ndev; This patch depends upon the broken np-dev_name one, and I also would rather fix the limitations in netpoll. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Add packet filtering based on process\'s security context.
This patch allows LSM modules filter incoming connections/datagrams based on the process's security context who is attempting to pick up. There are already hooks to filter incoming connections/datagrams based on the socket's security context, but these hooks are not applicable when one wants to do TCP Wrapper-like filtering (e.g. App1 is permitted to accept TCP connections from 192.168.0.0/16). There is a side effect which unlikely occurs. If a socket is shared by multiple processes with different policy, the process who should be able to accept this connection will not be able to accept this connection because socket_post_accept() aborts this connection. But if socket_post_accept() doesn't abort this connection, the process who must not be able to accept this connection will repeat accept() forever, which is a worse side effect. Similarly, if a socket is shared by multiple processes with different policy, the process who should be able to pick up this datagram will not be able to pick up this datagram because socket_post_recv_datagram() discards this datagram. But if socket_post_recv_datagram() doesn't discard this datagram, the process who must not be able to pick up this datagram will repeat recvmsg() forever, which is a worse side effect. Signed-off-by: Kentaro Takeda [EMAIL PROTECTED] Signed-off-by: Tetsuo Handa [EMAIL PROTECTED] include/linux/security.h | 34 +- net/core/datagram.c | 26 -- net/socket.c |7 +-- security/dummy.c | 13 ++--- security/security.c | 10 -- 5 files changed, 76 insertions(+), 14 deletions(-) --- linux-2.6.24-rc2-mm1.orig/include/linux/security.h +++ linux-2.6.24-rc2-mm1/include/linux/security.h @@ -778,8 +778,12 @@ struct request_sock; * @socket_post_accept: * This hook allows a security module to copy security * information into the newly created socket's inode. + * This hook also allows a security module to filter connections + * from unwanted peers based on the process accepting this connection. + * The connection will be aborted if this hook returns nonzero. * @sock contains the listening socket structure. * @newsock contains the newly created server socket for connection. + * Return 0 if permission is granted. * @socket_sendmsg: * Check permission before transmitting a message to another socket. * @sock contains the socket structure. @@ -793,6 +797,15 @@ struct request_sock; * @size contains the size of message structure. * @flags contains the operational flags. * Return 0 if permission is granted. + * @socket_post_recv_datagram: + * Check permission after receiving a datagram. + * This hook allows a security module to filter packets + * from unwanted peers based on the process receiving this datagram. + * The packet will be discarded if this hook returns nonzero. + * @sk contains the socket. + * @skb contains the socket buffer (may be NULL). + * @flags contains the operational flags. + * Return 0 if permission is granted. * @socket_getsockname: * Check permission before the local address (name) of the socket object * @sock is retrieved. @@ -1384,12 +1397,13 @@ struct security_operations { struct sockaddr * address, int addrlen); int (*socket_listen) (struct socket * sock, int backlog); int (*socket_accept) (struct socket * sock, struct socket * newsock); - void (*socket_post_accept) (struct socket * sock, - struct socket * newsock); + int (*socket_post_accept) (struct socket *sock, struct socket *newsock); int (*socket_sendmsg) (struct socket * sock, struct msghdr * msg, int size); int (*socket_recvmsg) (struct socket * sock, struct msghdr * msg, int size, int flags); + int (*socket_post_recv_datagram) (struct sock *sk, struct sk_buff *skb, + unsigned int flags); int (*socket_getsockname) (struct socket * sock); int (*socket_getpeername) (struct socket * sock); int (*socket_getsockopt) (struct socket * sock, int level, int optname); @@ -2294,10 +2308,12 @@ int security_socket_bind(struct socket * int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen); int security_socket_listen(struct socket *sock, int backlog); int security_socket_accept(struct socket *sock, struct socket *newsock); -void security_socket_post_accept(struct socket *sock, struct socket *newsock); +int security_socket_post_accept(struct socket *sock, struct socket *newsock); int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size); int security_socket_recvmsg(struct socket *sock, struct msghdr *msg, int size, int flags); +int
Re: [PATCH] LRO ack aggregation
From: Andrew Gallatin [EMAIL PROTECTED] Date: Tue, 23 Oct 2007 11:11:55 -0400 I've attached a patch which adds support to inet_lro for aggregating pure acks. I've applied this patch to net-2.6.25... but! This needs some serious thinking. What this patch ends up doing is creating big stretch-ACKs, and those can hurt performance. Stretch ACKs are particularly harmful when either the receiver is cpu weak (lacking enough cpu power to fill the pipe completely no matter what optimizations are applied) or when there is packet loss (less feedback information and ACK clocking). It also means that the sender will be more bursty, because it will now swallow ACKs covering huge portions of the send window, and then have large chunks of it's send queue it can send out all at once. Fundamentally, I really don't like this change, it batches to the point where it begins to erode the natural ACK clocking of TCP, and I therefore am very likely to revert it before merging to Linus. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1]: SAs created although tmpl-optional set
Heh I made the same mistake when I first read this piece of code too :) The optional flag isn't saying that it doesn't need to be protected, but rather that the SA may not be present on input. It's only used for IPComp where we may skip the IPComp if the data is not compressible. In other words the optional flag is really only meaningful on inbuond policy checks. Thanks for clearing that up for me. :-) I think it is not documented clearly in ipsec-tools. Joy - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Please pull 'upstream-davem' branch of wireless-2.6
From: John W. Linville [EMAIL PROTECTED] Date: Tue, 6 Nov 2007 22:08:53 -0500 Individual patches are available here: http://www.kernel.org/pub/linux/kernel/people/linville/wireless-2.6/upstream-davem ... Mattias Nissler (1): mac80211: Accept auto txpower setting Michael Wu (1): ieee80211: Add IEEE80211_MAX_FRAME_LEN to linux/ieee80211.h I've applied these two changes as patches to net-2.6.25, thanks John. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: build #337 failed for 2.6.24-rc1-gb1d08ac In function `usbnet_set_settings':
From: Adrian Bunk [EMAIL PROTECTED] Date: Thu, 8 Nov 2007 04:30:10 +0100 @davem: Please look at net/ipv4/arp.c:arp_process() Am I right that CONFIG_NET_ETHERNET=n and CONFIG_NETDEV_1000=y or CONFIG_NETDEV_1=y will not be handled correctly there? And the best solution is to nuke all #ifdef's in this function and make the code unconditionally available? I think removing those specific ifdefs in arp_process() is the best option, yes. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] [IPV4] UDP: Always checksum even if without socket filter
On Mon, 19 Nov 2007, David Miller wrote: From: Andi Kleen [EMAIL PROTECTED] Date: Mon, 19 Nov 2007 16:29:33 +0100 All of our options suck, we just have to choose the least sucking one and right now to me that's decrementing the counter as much as I empathize with the SNMP application overflow detection issue. If the SNMP monitor detects an false overflow the error it reports will be much worse than a single missing packet. So you would replace one error with a worse error. This can be fixed, the above cannot. I don't see how, short of breaking the interface (e.g. reporting 64bit or separate overflow counts) As someone who just spent an entire weekend working on cpu performance counter code, I know it's possible. When you overflow, the new value is a lot less than the last sampled one. When the value backtracks like we're discussing it could here, it only decrease a very little bit. While I agree with your analysis that it could be worked around, who knows how all the various SNMP monitoring applications out there would interpret such an unusual event. I liked Stephen's suggestion of a deferred decrement that would insure the counter didn't ever run backwards. But the best approach seems to be just not to count it in the first place until tha application has actually received the packet, since as Herbert pointed out, that's what the RFC actually specifies for the meaning of the udpInDatagrams counter. -Bill - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] net/ipv4/arp.c: Fix arp reply when sender ip 0 (was: Strange behavior in arp probe reply, bug or feature?)
On Mon, 19 Nov 2007, Alexey Kuznetsov wrote: Hello! Is there a reason that the target hardware address isn't the target hardware address? It is bound only to the fact that linux uses protocol address of the machine, which responds. It would be highly confusing (more than confusing :-)), if we used our protocol address and hardware address of requestor. But if you use zero protocol address as source, you really can use any hw address. The dhcp clients I examined, and the implementation of the arpcheck that I use will compare the target hardware field of the arp-reply and match it against its own mac, to verify the reply. And this fails with the current implementation in the kernel. 1. Do not do this. Mainly, because you already know that this does not work with linux. :-) Logically, target hw address in arp reply is just a nonsensial redundancy, it should not be checked and even looked at. Repeating what I posted earlier from the ARP RFC 826: The target hardware address is included for completeness and network monitoring. It has no meaning in the request form, since it is this number that the machine is requesting. Its meaning in the reply form is the address of the machine making the request. In some implementations (which do not get to look at the 14.byte ethernet header, for example) this may save some register shuffling or stack space by sending this field to the hardware driver as the hardware destination address of the packet. Unless there is some other RFC that supercedes this, which doesn't appear to be the case since it's also STD37, it appears to me that the current Linux behavior is wrong. It clearly states that for the ARP reply, the target hardware address is the address of the machine making the request, and not the address of the machine making the reply as Linux is apparently doing. 2. What's about your suggestion, I thought about this and I am going to agree. Arguments, which convinced me are: - arping still works. - any piece of reasonable software should work. - if Windows understands DaD (is it really true? I cannot believe) and it is unhappy about our responce and does not block use of duplicate address only due to this, we _must_ accomodate ASAP. - if we do,we have to use 0 protocol address, no choice. I agree the target protocol address should be 0 in this case. -Bill - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-2.6.25 1/4] include - Convert IP4 address class macros to inline functions
From: David Stevens [EMAIL PROTECTED] Date: Wed, 14 Nov 2007 08:53:13 -0800 Maybe I'm more used to hex, but I personally don't think those are more readable. It replaces 1-line macroes with 4-line functions, and I think more vgrepping to pick out the relevant constant data. Yes, the readability is agruable but I like the type checking. I would also change the names, it's a better idea to prefix the names with a namespace for the stuff being operated on, therefore I'd prefer names like ipv4_is_loopback() etc. I'm dropping these patches for now. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html