* [PATCH] IPv4: Enable use of 240/4 address space
From: Jan Engelhardt @ 2008-01-18 1:13 UTC (permalink / raw)
To: David S. Miller
Cc: Network Development Mailing List, Linux Kernel Mailing List,
Andi Kleen, YOSHIFUJI Hideaki / 吉藤英明,
Vince Fuller
In-Reply-To: <20080108011057.GA21168@cisco.com>
On Jan 7 2008 17:10, Vince Fuller wrote:
>
>This set of diffs modify the 2.6.20 kernel to enable use of the 240/4
>(aka "class-E") address space as consistent with the Internet Draft
>draft-fuller-240space-00.txt.
>
Below is a patch against davem/net-2.6.25. It might look very spartan,
but that is actually all that is needed on a sane system. No class E
macros or so needed.
Only the ipv4_is_badclass() might need renaming if you think it really
needs a name change. Or maybe a comment. Comments please :)
===
ancestor 7651a1f7ebe567f9088283f6354a5634b5dccb8e
commit 44762168d7cbefc4f8753a79d99a761cbd9875d9
Author: Jan Engelhardt <jengelh@computergmbh.de>
Date: Fri Jan 18 02:10:44 2008 +0100
IPv4: enable use of 240/4 address space
This short patch modifies the IPv4 networking to enable use of the
240.0.0.0/4 (aka "class-E") address space as propsed in the internet
draft draft-fuller-240space-00.txt.
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
diff --git a/include/linux/in.h b/include/linux/in.h
index 27d8a5a..b01bf75 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -216,9 +216,6 @@ struct sockaddr_in {
#define IN_MULTICAST(a) IN_CLASSD(a)
#define IN_MULTICAST_NET 0xF0000000
-#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
-#define IN_BADCLASS(a) IN_EXPERIMENTAL((a))
-
/* Address to accept any incoming messages. */
#define INADDR_ANY ((unsigned long int) 0x00000000)
@@ -264,7 +261,7 @@ static inline bool ipv4_is_local_multicast(__be32 addr)
static inline bool ipv4_is_badclass(__be32 addr)
{
- return (addr & htonl(0xf0000000)) == htonl(0xf0000000);
+ return addr == 0xFFFFFFFF;
}
static inline bool ipv4_is_zeronet(__be32 addr)
^ permalink raw reply related
* Re: [patch for 2.6.24? 1/1] bonding: locking fix
From: Krzysztof Oledzki @ 2008-01-18 0:58 UTC (permalink / raw)
To: Jay Vosburgh; +Cc: Andrew Morton, davem, jeff, shemminger, netdev
In-Reply-To: <24607.1200616005@death>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 65518 bytes --]
On Thu, 17 Jan 2008, Jay Vosburgh wrote:
>
> Andrew Morton <akpm@linux-foundation.org> wrote:
> [...]
>> Can we get this bug fixed please? Today? It has been known about for more
>> than two months.
>
> I just reposted the complete fix; it's #1 of the series of 7.
Bad news. :( 2.6.24-rc7 + patch #1 (bonding: fix locking in sysfs
primary/active selection):
bonding: bond0: setting mode to active-backup (1).
bonding: bond0: Setting MII monitoring interval to 100.
ADDRCONF(NETDEV_UP): bond0: link is not ready
bonding: bond0: Adding slave eth0.
e1000: eth0: e1000_watchdog: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX
bonding: bond0: making interface eth0 the new active one.
bonding: bond0: first active interface up!
bonding: bond0: enslaving eth0 as an active interface with an up link.
bonding: bond0: Adding slave eth1.
ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
=========================================================
[ INFO: possible irq lock inversion dependency detected ]
2.6.24-rc7 #1
---------------------------------------------------------
events/0/9 just changed the state of lock:
(&mc->mca_lock){-+..}, at: [<c041255a>] mld_ifc_timer_expire+0x130/0x1fb
but this lock took another, soft-read-irq-unsafe lock in the past:
(&bond->lock){-.--}
and interrupts could create inverse lock ordering between them.
other info that might help us debug this:
4 locks held by events/0/9:
#0: (events){--..}, at: [<c0133d33>] run_workqueue+0x87/0x1b6
#1: ((linkwatch_work).work){--..}, at: [<c0133d33>] run_workqueue+0x87/0x1b6
#2: (rtnl_mutex){--..}, at: [<c03ac644>] linkwatch_event+0x5/0x22
#3: (&ndev->lock){-.-+}, at: [<c0412441>] mld_ifc_timer_expire+0x17/0x1fb
the first lock's dependencies:
-> (&mc->mca_lock){-+..} ops: 10 {
initial-use at:
[<c0104ee2>] dump_trace+0x83/0x8d
[<c0142890>] __lock_acquire+0x4ba/0xc07
[<c0109ef2>] save_stack_trace+0x20/0x3a
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0412d32>] ipv6_dev_mc_inc+0x24d/0x31c
[<c0143056>] lock_acquire+0x79/0x93
[<c04129b6>] igmp6_group_added+0x18/0x11d
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c04129b6>] igmp6_group_added+0x18/0x11d
[<c04129b6>] igmp6_group_added+0x18/0x11d
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0412d32>] ipv6_dev_mc_inc+0x24d/0x31c
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c05c5ae9>] addrconf_init+0x13/0x193
[<c019a04b>] proc_net_fops_create+0x10/0x21
[<c041a418>] ip6_flowlabel_init+0x1e/0x20
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
in-softirq-W at:
[<c0142816>] __lock_acquire+0x440/0xc07
[<c013fdfe>] get_lock_stats+0xd/0x2e
[<c013fe29>] put_lock_stats+0xa/0x1e
[<c0143056>] lock_acquire+0x79/0x93
[<c041255a>] mld_ifc_timer_expire+0x130/0x1fb
[<c041242a>] mld_ifc_timer_expire+0x0/0x1fb
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c041255a>] mld_ifc_timer_expire+0x130/0x1fb
[<c041255a>] mld_ifc_timer_expire+0x130/0x1fb
[<c041242a>] mld_ifc_timer_expire+0x0/0x1fb
[<c0141f7d>] trace_hardirqs_on+0x10c/0x14c
[<c041242a>] mld_ifc_timer_expire+0x0/0x1fb
[<c012e02e>] run_timer_softirq+0xfa/0x15d
[<c012a982>] __do_softirq+0x56/0xdb
[<c0141f7d>] trace_hardirqs_on+0x10c/0x14c
[<c012a994>] __do_softirq+0x68/0xdb
[<c012aa3d>] do_softirq+0x36/0x51
[<c012af26>] local_bh_enable_ip+0xad/0xed
[<c03bfa03>] rt_run_flush+0x64/0x8b
[<c03e9b8a>] fib_netdev_event+0x61/0x65
[<c013ac34>] notifier_call_chain+0x2a/0x52
[<c013ac7e>] raw_notifier_call_chain+0x17/0x1a
[<c03a33d9>] netdev_state_change+0x18/0x29
[<c03ac611>] __linkwatch_run_queue+0x150/0x17e
[<c03ac65c>] linkwatch_event+0x1d/0x22
[<c0133d87>] run_workqueue+0xdb/0x1b6
[<c0133d33>] run_workqueue+0x87/0x1b6
[<c03ac63f>] linkwatch_event+0x0/0x22
[<c01347a7>] worker_thread+0x0/0x85
[<c0134820>] worker_thread+0x79/0x85
[<c0137255>] autoremove_wake_function+0x0/0x35
[<c013719e>] kthread+0x38/0x5e
[<c0137166>] kthread+0x0/0x5e
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
hardirq-on-W at:
[<c01417e2>] find_usage_backwards+0xbb/0xe2
[<c0104ee2>] dump_trace+0x83/0x8d
[<c014285e>] __lock_acquire+0x488/0xc07
[<c0109ef2>] save_stack_trace+0x20/0x3a
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0412d32>] ipv6_dev_mc_inc+0x24d/0x31c
[<c0143056>] lock_acquire+0x79/0x93
[<c04129b6>] igmp6_group_added+0x18/0x11d
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c04129b6>] igmp6_group_added+0x18/0x11d
[<c04129b6>] igmp6_group_added+0x18/0x11d
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0412d32>] ipv6_dev_mc_inc+0x24d/0x31c
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c05c5ae9>] addrconf_init+0x13/0x193
[<c019a04b>] proc_net_fops_create+0x10/0x21
[<c041a418>] ip6_flowlabel_init+0x1e/0x20
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
}
... key at: [<c087e2d8>] __key.30803+0x0/0x8
-> (_xmit_ETHER){-...} ops: 8 {
initial-use at:
[<c0142890>] __lock_acquire+0x4ba/0xc07
[<c0143056>] lock_acquire+0x79/0x93
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c04129f4>] igmp6_group_added+0x56/0x11d
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0410100>] icmpv6_rcv+0x6d8/0x828
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c0402717>] addrconf_notify+0x60/0x7b7
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c0439946>] mutex_lock_nested+0x286/0x2ac
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a487c>] register_netdevice_notifier+0x49/0x126
[<c05c5b83>] addrconf_init+0xad/0x193
[<c05c5af1>] addrconf_init+0x1b/0x193
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
hardirq-on-W at:
[<c014197a>] mark_lock+0x64/0x451
[<c014285e>] __lock_acquire+0x488/0xc07
[<c0143056>] lock_acquire+0x79/0x93
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c04129f4>] igmp6_group_added+0x56/0x11d
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0410100>] icmpv6_rcv+0x6d8/0x828
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c0402717>] addrconf_notify+0x60/0x7b7
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c0439946>] mutex_lock_nested+0x286/0x2ac
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a487c>] register_netdevice_notifier+0x49/0x126
[<c05c5b83>] addrconf_init+0xad/0x193
[<c05c5af1>] addrconf_init+0x1b/0x193
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
}
... key at: [<c087adc8>] netdev_xmit_lock_key+0x8/0x1c0
-> (&on_slab_l3_key){....} ops: 859 {
initial-use at:
[<c043aed5>] _spin_unlock_irqrestore+0x40/0x58
[<c0142890>] __lock_acquire+0x4ba/0xc07
[<c013ae98>] __atomic_notifier_call_chain+0x0/0x94
[<c013af43>] atomic_notifier_call_chain+0x17/0x1a
[<c015023d>] get_page_from_freelist+0x25c/0x3e6
[<c0143056>] lock_acquire+0x79/0x93
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c043a80e>] _spin_lock+0x36/0x5f
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c0155ccf>] mod_zone_page_state+0x35/0x3c
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c01659cf>] kmem_cache_alloc+0x38/0x88
[<c0165d3f>] cache_alloc_refill+0x320/0x469
[<c01659cf>] kmem_cache_alloc+0x38/0x88
[<c05b31ca>] pidmap_init+0x15/0x149
[<c05a9872>] start_kernel+0x272/0x2cf
[<c05a90e0>] unknown_bootoption+0x0/0x195
[<ffffffff>] 0xffffffff
}
... key at: [<c086574c>] on_slab_l3_key+0x0/0x8
... acquired at:
[<c0142df3>] __lock_acquire+0xa1d/0xc07
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c0143056>] lock_acquire+0x79/0x93
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c043a80e>] _spin_lock+0x36/0x5f
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c01659cf>] kmem_cache_alloc+0x38/0x88
[<c03a2666>] __dev_addr_add+0x61/0xb4
[<c03a63be>] dev_mc_add+0x43/0x6a
[<c04129f4>] igmp6_group_added+0x56/0x11d
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0410100>] icmpv6_rcv+0x6d8/0x828
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c0402717>] addrconf_notify+0x60/0x7b7
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c0439946>] mutex_lock_nested+0x286/0x2ac
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a487c>] register_netdevice_notifier+0x49/0x126
[<c05c5b83>] addrconf_init+0xad/0x193
[<c05c5af1>] addrconf_init+0x1b/0x193
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
... acquired at:
[<c0142df3>] __lock_acquire+0xa1d/0xc07
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c0143056>] lock_acquire+0x79/0x93
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c04129f4>] igmp6_group_added+0x56/0x11d
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0410100>] icmpv6_rcv+0x6d8/0x828
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c0402717>] addrconf_notify+0x60/0x7b7
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c0439946>] mutex_lock_nested+0x286/0x2ac
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a487c>] register_netdevice_notifier+0x49/0x126
[<c05c5b83>] addrconf_init+0xad/0x193
[<c05c5af1>] addrconf_init+0x1b/0x193
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
-> (&bonding_netdev_xmit_lock_key){-...} ops: 6 {
initial-use at:
[<c0142890>] __lock_acquire+0x4ba/0xc07
[<c0143056>] lock_acquire+0x79/0x93
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c04129f4>] igmp6_group_added+0x56/0x11d
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0410100>] icmpv6_rcv+0x6d8/0x828
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c0402717>] addrconf_notify+0x60/0x7b7
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c0439946>] mutex_lock_nested+0x286/0x2ac
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a487c>] register_netdevice_notifier+0x49/0x126
[<c05c5b83>] addrconf_init+0xad/0x193
[<c05c5af1>] addrconf_init+0x1b/0x193
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
hardirq-on-W at:
[<c014197a>] mark_lock+0x64/0x451
[<c014285e>] __lock_acquire+0x488/0xc07
[<c0143056>] lock_acquire+0x79/0x93
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c04129f4>] igmp6_group_added+0x56/0x11d
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0410100>] icmpv6_rcv+0x6d8/0x828
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c0402717>] addrconf_notify+0x60/0x7b7
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c0439946>] mutex_lock_nested+0x286/0x2ac
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a487c>] register_netdevice_notifier+0x49/0x126
[<c05c5b83>] addrconf_init+0xad/0x193
[<c05c5af1>] addrconf_init+0x1b/0x193
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
}
... key at: [<c0877804>] bonding_netdev_xmit_lock_key+0x0/0x8
-> (&bond->lock){-.--} ops: 99 {
initial-use at:
[<c013fe29>] put_lock_stats+0xa/0x1e
[<c0142890>] __lock_acquire+0x4ba/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c043aed5>] _spin_unlock_irqrestore+0x40/0x58
[<c0143056>] lock_acquire+0x79/0x93
[<c02edca1>] bond_get_stats+0x28/0xd0
[<c043a9fe>] _read_lock_bh+0x3b/0x64
[<c02edca1>] bond_get_stats+0x28/0xd0
[<c02edca1>] bond_get_stats+0x28/0xd0
[<c03aacdb>] rtnl_fill_ifinfo+0x2bf/0x563
[<c03ab259>] rtmsg_ifinfo+0x5d/0xdf
[<c03ab31a>] rtnetlink_event+0x3f/0x42
[<c013ac34>] notifier_call_chain+0x2a/0x52
[<c013ac7e>] raw_notifier_call_chain+0x17/0x1a
[<c03a3ad2>] register_netdevice+0x2a7/0x2e7
[<c02ed842>] bond_create+0x1f2/0x26a
[<c05bed76>] bonding_init+0x761/0x7ea
[<c05be5de>] e1000_init_module+0x45/0x7c
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
hardirq-on-W at:
[<c014285e>] __lock_acquire+0x488/0xc07
[<c01208c9>] try_to_wake_up+0x2ce/0x2d8
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0143056>] lock_acquire+0x79/0x93
[<c02eda55>] bond_set_multicast_list+0x1d/0x241
[<c043a935>] _write_lock_bh+0x3b/0x64
[<c02eda55>] bond_set_multicast_list+0x1d/0x241
[<c02eda55>] bond_set_multicast_list+0x1d/0x241
[<c013fe29>] put_lock_stats+0xa/0x1e
[<c03a1dcf>] __dev_set_rx_mode+0x7b/0x7d
[<c03a1f69>] dev_set_rx_mode+0x23/0x36
[<c03a4644>] dev_open+0x5e/0x77
[<c03a3313>] dev_change_flags+0x9d/0x14b
[<c03a2117>] __dev_get_by_name+0x68/0x73
[<c03e4142>] devinet_ioctl+0x22b/0x536
[<c03a4439>] dev_ioctl+0x46f/0x5b7
[<c039a564>] sock_ioctl+0x167/0x18b
[<c039a3fd>] sock_ioctl+0x0/0x18b
[<c0172677>] do_ioctl+0x1f/0x62
[<c01728e7>] vfs_ioctl+0x22d/0x23f
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c017292c>] sys_ioctl+0x33/0x4b
[<c0103e92>] sysenter_past_esp+0x5f/0xa5
[<ffffffff>] 0xffffffff
softirq-on-R at:
[<c014197a>] mark_lock+0x64/0x451
[<c013583a>] __kernel_text_address+0x5/0xe
[<c0104ee2>] dump_trace+0x83/0x8d
[<c014287d>] __lock_acquire+0x4a7/0xc07
[<c013fc6a>] save_trace+0x37/0x89
[<c0133d33>] run_workqueue+0x87/0x1b6
[<c0143056>] lock_acquire+0x79/0x93
[<c02eee43>] bond_mii_monitor+0x19/0x85
[<c043aa5d>] _read_lock+0x36/0x5f
[<c02eee43>] bond_mii_monitor+0x19/0x85
[<c02eee43>] bond_mii_monitor+0x19/0x85
[<c0133d87>] run_workqueue+0xdb/0x1b6
[<c0133d33>] run_workqueue+0x87/0x1b6
[<c02eee2a>] bond_mii_monitor+0x0/0x85
[<c01347a7>] worker_thread+0x0/0x85
[<c0134820>] worker_thread+0x79/0x85
[<c0137255>] autoremove_wake_function+0x0/0x35
[<c013719e>] kthread+0x38/0x5e
[<c0137166>] kthread+0x0/0x5e
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
hardirq-on-R at:
[<c013fdfe>] get_lock_stats+0xd/0x2e
[<c013fe29>] put_lock_stats+0xa/0x1e
[<c0142838>] __lock_acquire+0x462/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c043aed5>] _spin_unlock_irqrestore+0x40/0x58
[<c0143056>] lock_acquire+0x79/0x93
[<c02edca1>] bond_get_stats+0x28/0xd0
[<c043a9fe>] _read_lock_bh+0x3b/0x64
[<c02edca1>] bond_get_stats+0x28/0xd0
[<c02edca1>] bond_get_stats+0x28/0xd0
[<c03aacdb>] rtnl_fill_ifinfo+0x2bf/0x563
[<c03ab259>] rtmsg_ifinfo+0x5d/0xdf
[<c03ab31a>] rtnetlink_event+0x3f/0x42
[<c013ac34>] notifier_call_chain+0x2a/0x52
[<c013ac7e>] raw_notifier_call_chain+0x17/0x1a
[<c03a3ad2>] register_netdevice+0x2a7/0x2e7
[<c02ed842>] bond_create+0x1f2/0x26a
[<c05bed76>] bonding_init+0x761/0x7ea
[<c05be5de>] e1000_init_module+0x45/0x7c
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
}
... key at: [<c08777d0>] __key.32976+0x0/0x8
-> (_xmit_ETHER){-...} ops: 8 {
initial-use at:
[<c0142890>] __lock_acquire+0x4ba/0xc07
[<c0143056>] lock_acquire+0x79/0x93
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c04129f4>] igmp6_group_added+0x56/0x11d
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0410100>] icmpv6_rcv+0x6d8/0x828
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c0402717>] addrconf_notify+0x60/0x7b7
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c0439946>] mutex_lock_nested+0x286/0x2ac
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a487c>] register_netdevice_notifier+0x49/0x126
[<c05c5b83>] addrconf_init+0xad/0x193
[<c05c5af1>] addrconf_init+0x1b/0x193
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
hardirq-on-W at:
[<c014197a>] mark_lock+0x64/0x451
[<c014285e>] __lock_acquire+0x488/0xc07
[<c0143056>] lock_acquire+0x79/0x93
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c04129f4>] igmp6_group_added+0x56/0x11d
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0410100>] icmpv6_rcv+0x6d8/0x828
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c0402717>] addrconf_notify+0x60/0x7b7
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c0439946>] mutex_lock_nested+0x286/0x2ac
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a487c>] register_netdevice_notifier+0x49/0x126
[<c05c5b83>] addrconf_init+0xad/0x193
[<c05c5af1>] addrconf_init+0x1b/0x193
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
}
... key at: [<c087adc8>] netdev_xmit_lock_key+0x8/0x1c0
-> (&on_slab_l3_key){....} ops: 859 {
initial-use at:
[<c043aed5>] _spin_unlock_irqrestore+0x40/0x58
[<c0142890>] __lock_acquire+0x4ba/0xc07
[<c013ae98>] __atomic_notifier_call_chain+0x0/0x94
[<c013af43>] atomic_notifier_call_chain+0x17/0x1a
[<c015023d>] get_page_from_freelist+0x25c/0x3e6
[<c0143056>] lock_acquire+0x79/0x93
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c043a80e>] _spin_lock+0x36/0x5f
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c0155ccf>] mod_zone_page_state+0x35/0x3c
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c01659cf>] kmem_cache_alloc+0x38/0x88
[<c0165d3f>] cache_alloc_refill+0x320/0x469
[<c01659cf>] kmem_cache_alloc+0x38/0x88
[<c05b31ca>] pidmap_init+0x15/0x149
[<c05a9872>] start_kernel+0x272/0x2cf
[<c05a90e0>] unknown_bootoption+0x0/0x195
[<ffffffff>] 0xffffffff
}
... key at: [<c086574c>] on_slab_l3_key+0x0/0x8
... acquired at:
[<c0142df3>] __lock_acquire+0xa1d/0xc07
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c0143056>] lock_acquire+0x79/0x93
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c043a80e>] _spin_lock+0x36/0x5f
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c01659cf>] kmem_cache_alloc+0x38/0x88
[<c03a2666>] __dev_addr_add+0x61/0xb4
[<c03a63be>] dev_mc_add+0x43/0x6a
[<c04129f4>] igmp6_group_added+0x56/0x11d
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0410100>] icmpv6_rcv+0x6d8/0x828
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c0402717>] addrconf_notify+0x60/0x7b7
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c0439946>] mutex_lock_nested+0x286/0x2ac
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a487c>] register_netdevice_notifier+0x49/0x126
[<c05c5b83>] addrconf_init+0xad/0x193
[<c05c5af1>] addrconf_init+0x1b/0x193
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
... acquired at:
[<c0142df3>] __lock_acquire+0xa1d/0xc07
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043aed5>] _spin_unlock_irqrestore+0x40/0x58
[<c0109ef2>] save_stack_trace+0x20/0x3a
[<c0143056>] lock_acquire+0x79/0x93
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c02ee472>] bond_change_active_slave+0x1a9/0x3bf
[<c02ec7a3>] bond_update_speed_duplex+0x26/0x65
[<c02ee991>] bond_select_active_slave+0x97/0xd3
[<c02ed20b>] bond_compute_features+0x45/0x84
[<c02ef9a4>] bond_enslave+0x6a7/0x884
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c02f617b>] bonding_store_slaves+0x1ae/0x2fb
[<c02f5fcd>] bonding_store_slaves+0x0/0x2fb
[<c02ce8b7>] dev_attr_store+0x27/0x2c
[<c019bda1>] sysfs_write_file+0xad/0xe0
[<c019bcf4>] sysfs_write_file+0x0/0xe0
[<c0168e5c>] vfs_write+0x8a/0x10c
[<c0118562>] do_page_fault+0x0/0x54a
[<c01693e1>] sys_write+0x41/0x67
[<c0103e92>] sysenter_past_esp+0x5f/0xa5
[<ffffffff>] 0xffffffff
-> (lweventlist_lock){.+..} ops: 10 {
initial-use at:
[<c014197a>] mark_lock+0x64/0x451
[<c0142890>] __lock_acquire+0x4ba/0xc07
[<c02e363c>] e1000_read_phy_reg+0x1c7/0x1d3
[<c02e346b>] e1000_write_phy_reg+0xb9/0xc3
[<c024a82e>] delay_tsc+0x25/0x3b
[<c0143056>] lock_acquire+0x79/0x93
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c043ab8f>] _spin_lock_irqsave+0x3f/0x6c
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c03ac4af>] linkwatch_fire_event+0x25/0x37
[<c02e1c23>] e1000_probe+0xad1/0xbe8
[<c0257f1b>] pci_device_probe+0x36/0x57
[<c02d0e3f>] driver_probe_device+0xe1/0x15f
[<c043ae09>] _spin_unlock+0x25/0x3b
[<c0437e92>] klist_next+0x58/0x6d
[<c02d0f4f>] __driver_attach+0x0/0x7f
[<c02d0f98>] __driver_attach+0x49/0x7f
[<c02d03e3>] bus_for_each_dev+0x36/0x58
[<c02d0c97>] driver_attach+0x16/0x18
[<c02d0f4f>] __driver_attach+0x0/0x7f
[<c02d06da>] bus_add_driver+0x6d/0x18d
[<c0258065>] __pci_register_driver+0x53/0x7f
[<c05be5de>] e1000_init_module+0x45/0x7c
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
in-softirq-W at:
[<c011d1c0>] __wake_up_common+0x32/0x5c
[<c0142816>] __lock_acquire+0x440/0xc07
[<c043aed5>] _spin_unlock_irqrestore+0x40/0x58
[<c0143056>] lock_acquire+0x79/0x93
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c02dfee1>] e1000_watchdog+0x0/0x5c9
[<c043ab8f>] _spin_lock_irqsave+0x3f/0x6c
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c03ac4af>] linkwatch_fire_event+0x25/0x37
[<c03af436>] netif_carrier_on+0x16/0x27
[<c02e0136>] e1000_watchdog+0x255/0x5c9
[<c02dfee1>] e1000_watchdog+0x0/0x5c9
[<c012e02e>] run_timer_softirq+0xfa/0x15d
[<c012a982>] __do_softirq+0x56/0xdb
[<c0141f7d>] trace_hardirqs_on+0x10c/0x14c
[<c012a994>] __do_softirq+0x68/0xdb
[<c012aa3d>] do_softirq+0x36/0x51
[<c012abe3>] irq_exit+0x43/0x4e
[<c0114122>] smp_apic_timer_interrupt+0x74/0x80
[<c0104a01>] apic_timer_interrupt+0x29/0x38
[<c0104a0b>] apic_timer_interrupt+0x33/0x38
[<c01600d8>] sys_swapon+0x254/0x9aa
[<c01021a6>] mwait_idle_with_hints+0x3b/0x3f
[<c0102447>] mwait_idle+0x0/0xf
[<c0102581>] cpu_idle+0x99/0xc6
[<c05a98c7>] start_kernel+0x2c7/0x2cf
[<c05a90e0>] unknown_bootoption+0x0/0x195
[<ffffffff>] 0xffffffff
}
... key at: [<c058a194>] lweventlist_lock+0x14/0x40
... acquired at:
[<c0142df3>] __lock_acquire+0xa1d/0xc07
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0143056>] lock_acquire+0x79/0x93
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c043ab8f>] _spin_lock_irqsave+0x3f/0x6c
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c03ac4af>] linkwatch_fire_event+0x25/0x37
[<c03af436>] netif_carrier_on+0x16/0x27
[<c02ede0c>] bond_set_carrier+0x31/0x55
[<c02ee998>] bond_select_active_slave+0x9e/0xd3
[<c02ed20b>] bond_compute_features+0x45/0x84
[<c02ef9a4>] bond_enslave+0x6a7/0x884
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c02f617b>] bonding_store_slaves+0x1ae/0x2fb
[<c02f5fcd>] bonding_store_slaves+0x0/0x2fb
[<c02ce8b7>] dev_attr_store+0x27/0x2c
[<c019bda1>] sysfs_write_file+0xad/0xe0
[<c019bcf4>] sysfs_write_file+0x0/0xe0
[<c0168e5c>] vfs_write+0x8a/0x10c
[<c0118562>] do_page_fault+0x0/0x54a
[<c01693e1>] sys_write+0x41/0x67
[<c0103e92>] sysenter_past_esp+0x5f/0xa5
[<ffffffff>] 0xffffffff
... acquired at:
[<c0142df3>] __lock_acquire+0xa1d/0xc07
[<c02eda55>] bond_set_multicast_list+0x1d/0x241
[<c0143056>] lock_acquire+0x79/0x93
[<c02eda55>] bond_set_multicast_list+0x1d/0x241
[<c043a935>] _write_lock_bh+0x3b/0x64
[<c02eda55>] bond_set_multicast_list+0x1d/0x241
[<c02eda55>] bond_set_multicast_list+0x1d/0x241
[<c013fe29>] put_lock_stats+0xa/0x1e
[<c03a1dcf>] __dev_set_rx_mode+0x7b/0x7d
[<c03a1f69>] dev_set_rx_mode+0x23/0x36
[<c03a4644>] dev_open+0x5e/0x77
[<c03a3313>] dev_change_flags+0x9d/0x14b
[<c03a2117>] __dev_get_by_name+0x68/0x73
[<c03e4142>] devinet_ioctl+0x22b/0x536
[<c03a4439>] dev_ioctl+0x46f/0x5b7
[<c039a564>] sock_ioctl+0x167/0x18b
[<c039a3fd>] sock_ioctl+0x0/0x18b
[<c0172677>] do_ioctl+0x1f/0x62
[<c01728e7>] vfs_ioctl+0x22d/0x23f
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c017292c>] sys_ioctl+0x33/0x4b
[<c0103e92>] sysenter_past_esp+0x5f/0xa5
[<ffffffff>] 0xffffffff
... acquired at:
[<c0142df3>] __lock_acquire+0xa1d/0xc07
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c0143056>] lock_acquire+0x79/0x93
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c04129f4>] igmp6_group_added+0x56/0x11d
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0410100>] icmpv6_rcv+0x6d8/0x828
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c0402717>] addrconf_notify+0x60/0x7b7
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c0439946>] mutex_lock_nested+0x286/0x2ac
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a487c>] register_netdevice_notifier+0x49/0x126
[<c05c5b83>] addrconf_init+0xad/0x193
[<c05c5af1>] addrconf_init+0x1b/0x193
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
the second lock's dependencies:
-> (&bond->lock){-.--} ops: 99 {
initial-use at:
[<c013fe29>] put_lock_stats+0xa/0x1e
[<c0142890>] __lock_acquire+0x4ba/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c043aed5>] _spin_unlock_irqrestore+0x40/0x58
[<c0143056>] lock_acquire+0x79/0x93
[<c02edca1>] bond_get_stats+0x28/0xd0
[<c043a9fe>] _read_lock_bh+0x3b/0x64
[<c02edca1>] bond_get_stats+0x28/0xd0
[<c02edca1>] bond_get_stats+0x28/0xd0
[<c03aacdb>] rtnl_fill_ifinfo+0x2bf/0x563
[<c03ab259>] rtmsg_ifinfo+0x5d/0xdf
[<c03ab31a>] rtnetlink_event+0x3f/0x42
[<c013ac34>] notifier_call_chain+0x2a/0x52
[<c013ac7e>] raw_notifier_call_chain+0x17/0x1a
[<c03a3ad2>] register_netdevice+0x2a7/0x2e7
[<c02ed842>] bond_create+0x1f2/0x26a
[<c05bed76>] bonding_init+0x761/0x7ea
[<c05be5de>] e1000_init_module+0x45/0x7c
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
hardirq-on-W at:
[<c014285e>] __lock_acquire+0x488/0xc07
[<c01208c9>] try_to_wake_up+0x2ce/0x2d8
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0143056>] lock_acquire+0x79/0x93
[<c02eda55>] bond_set_multicast_list+0x1d/0x241
[<c043a935>] _write_lock_bh+0x3b/0x64
[<c02eda55>] bond_set_multicast_list+0x1d/0x241
[<c02eda55>] bond_set_multicast_list+0x1d/0x241
[<c013fe29>] put_lock_stats+0xa/0x1e
[<c03a1dcf>] __dev_set_rx_mode+0x7b/0x7d
[<c03a1f69>] dev_set_rx_mode+0x23/0x36
[<c03a4644>] dev_open+0x5e/0x77
[<c03a3313>] dev_change_flags+0x9d/0x14b
[<c03a2117>] __dev_get_by_name+0x68/0x73
[<c03e4142>] devinet_ioctl+0x22b/0x536
[<c03a4439>] dev_ioctl+0x46f/0x5b7
[<c039a564>] sock_ioctl+0x167/0x18b
[<c039a3fd>] sock_ioctl+0x0/0x18b
[<c0172677>] do_ioctl+0x1f/0x62
[<c01728e7>] vfs_ioctl+0x22d/0x23f
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c017292c>] sys_ioctl+0x33/0x4b
[<c0103e92>] sysenter_past_esp+0x5f/0xa5
[<ffffffff>] 0xffffffff
softirq-on-R at:
[<c014197a>] mark_lock+0x64/0x451
[<c013583a>] __kernel_text_address+0x5/0xe
[<c0104ee2>] dump_trace+0x83/0x8d
[<c014287d>] __lock_acquire+0x4a7/0xc07
[<c013fc6a>] save_trace+0x37/0x89
[<c0133d33>] run_workqueue+0x87/0x1b6
[<c0143056>] lock_acquire+0x79/0x93
[<c02eee43>] bond_mii_monitor+0x19/0x85
[<c043aa5d>] _read_lock+0x36/0x5f
[<c02eee43>] bond_mii_monitor+0x19/0x85
[<c02eee43>] bond_mii_monitor+0x19/0x85
[<c0133d87>] run_workqueue+0xdb/0x1b6
[<c0133d33>] run_workqueue+0x87/0x1b6
[<c02eee2a>] bond_mii_monitor+0x0/0x85
[<c01347a7>] worker_thread+0x0/0x85
[<c0134820>] worker_thread+0x79/0x85
[<c0137255>] autoremove_wake_function+0x0/0x35
[<c013719e>] kthread+0x38/0x5e
[<c0137166>] kthread+0x0/0x5e
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
hardirq-on-R at:
[<c013fdfe>] get_lock_stats+0xd/0x2e
[<c013fe29>] put_lock_stats+0xa/0x1e
[<c0142838>] __lock_acquire+0x462/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c043aed5>] _spin_unlock_irqrestore+0x40/0x58
[<c0143056>] lock_acquire+0x79/0x93
[<c02edca1>] bond_get_stats+0x28/0xd0
[<c043a9fe>] _read_lock_bh+0x3b/0x64
[<c02edca1>] bond_get_stats+0x28/0xd0
[<c02edca1>] bond_get_stats+0x28/0xd0
[<c03aacdb>] rtnl_fill_ifinfo+0x2bf/0x563
[<c03ab259>] rtmsg_ifinfo+0x5d/0xdf
[<c03ab31a>] rtnetlink_event+0x3f/0x42
[<c013ac34>] notifier_call_chain+0x2a/0x52
[<c013ac7e>] raw_notifier_call_chain+0x17/0x1a
[<c03a3ad2>] register_netdevice+0x2a7/0x2e7
[<c02ed842>] bond_create+0x1f2/0x26a
[<c05bed76>] bonding_init+0x761/0x7ea
[<c05be5de>] e1000_init_module+0x45/0x7c
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
}
... key at: [<c08777d0>] __key.32976+0x0/0x8
-> (_xmit_ETHER){-...} ops: 8 {
initial-use at:
[<c0142890>] __lock_acquire+0x4ba/0xc07
[<c0143056>] lock_acquire+0x79/0x93
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c04129f4>] igmp6_group_added+0x56/0x11d
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0410100>] icmpv6_rcv+0x6d8/0x828
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c0402717>] addrconf_notify+0x60/0x7b7
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c0439946>] mutex_lock_nested+0x286/0x2ac
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a487c>] register_netdevice_notifier+0x49/0x126
[<c05c5b83>] addrconf_init+0xad/0x193
[<c05c5af1>] addrconf_init+0x1b/0x193
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
hardirq-on-W at:
[<c014197a>] mark_lock+0x64/0x451
[<c014285e>] __lock_acquire+0x488/0xc07
[<c0143056>] lock_acquire+0x79/0x93
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c04129f4>] igmp6_group_added+0x56/0x11d
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0410100>] icmpv6_rcv+0x6d8/0x828
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c0402717>] addrconf_notify+0x60/0x7b7
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c0439946>] mutex_lock_nested+0x286/0x2ac
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a487c>] register_netdevice_notifier+0x49/0x126
[<c05c5b83>] addrconf_init+0xad/0x193
[<c05c5af1>] addrconf_init+0x1b/0x193
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
}
... key at: [<c087adc8>] netdev_xmit_lock_key+0x8/0x1c0
-> (&on_slab_l3_key){....} ops: 859 {
initial-use at:
[<c043aed5>] _spin_unlock_irqrestore+0x40/0x58
[<c0142890>] __lock_acquire+0x4ba/0xc07
[<c013ae98>] __atomic_notifier_call_chain+0x0/0x94
[<c013af43>] atomic_notifier_call_chain+0x17/0x1a
[<c015023d>] get_page_from_freelist+0x25c/0x3e6
[<c0143056>] lock_acquire+0x79/0x93
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c043a80e>] _spin_lock+0x36/0x5f
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c0155ccf>] mod_zone_page_state+0x35/0x3c
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c01659cf>] kmem_cache_alloc+0x38/0x88
[<c0165d3f>] cache_alloc_refill+0x320/0x469
[<c01659cf>] kmem_cache_alloc+0x38/0x88
[<c05b31ca>] pidmap_init+0x15/0x149
[<c05a9872>] start_kernel+0x272/0x2cf
[<c05a90e0>] unknown_bootoption+0x0/0x195
[<ffffffff>] 0xffffffff
}
... key at: [<c086574c>] on_slab_l3_key+0x0/0x8
... acquired at:
[<c0142df3>] __lock_acquire+0xa1d/0xc07
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c0143056>] lock_acquire+0x79/0x93
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c043a80e>] _spin_lock+0x36/0x5f
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c0165a73>] cache_alloc_refill+0x54/0x469
[<c01659cf>] kmem_cache_alloc+0x38/0x88
[<c03a2666>] __dev_addr_add+0x61/0xb4
[<c03a63be>] dev_mc_add+0x43/0x6a
[<c04129f4>] igmp6_group_added+0x56/0x11d
[<c0412d88>] ipv6_dev_mc_inc+0x2a3/0x31c
[<c0410100>] icmpv6_rcv+0x6d8/0x828
[<c0412dbd>] ipv6_dev_mc_inc+0x2d8/0x31c
[<c0412ae5>] ipv6_dev_mc_inc+0x0/0x31c
[<c0402134>] ipv6_add_dev+0x21c/0x24b
[<c040b95d>] ndisc_ifinfo_sysctl_change+0x0/0x1ef
[<c0402717>] addrconf_notify+0x60/0x7b7
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0141da0>] mark_held_locks+0x39/0x53
[<c0439946>] mutex_lock_nested+0x286/0x2ac
[<c0141f93>] trace_hardirqs_on+0x122/0x14c
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a4841>] register_netdevice_notifier+0xe/0x126
[<c03a487c>] register_netdevice_notifier+0x49/0x126
[<c05c5b83>] addrconf_init+0xad/0x193
[<c05c5af1>] addrconf_init+0x1b/0x193
[<c05c59c9>] inet6_init+0x1f0/0x2ad
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
... acquired at:
[<c0142df3>] __lock_acquire+0xa1d/0xc07
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043aed5>] _spin_unlock_irqrestore+0x40/0x58
[<c0109ef2>] save_stack_trace+0x20/0x3a
[<c0143056>] lock_acquire+0x79/0x93
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c03a6395>] dev_mc_add+0x1a/0x6a
[<c02ee472>] bond_change_active_slave+0x1a9/0x3bf
[<c02ec7a3>] bond_update_speed_duplex+0x26/0x65
[<c02ee991>] bond_select_active_slave+0x97/0xd3
[<c02ed20b>] bond_compute_features+0x45/0x84
[<c02ef9a4>] bond_enslave+0x6a7/0x884
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c02f617b>] bonding_store_slaves+0x1ae/0x2fb
[<c02f5fcd>] bonding_store_slaves+0x0/0x2fb
[<c02ce8b7>] dev_attr_store+0x27/0x2c
[<c019bda1>] sysfs_write_file+0xad/0xe0
[<c019bcf4>] sysfs_write_file+0x0/0xe0
[<c0168e5c>] vfs_write+0x8a/0x10c
[<c0118562>] do_page_fault+0x0/0x54a
[<c01693e1>] sys_write+0x41/0x67
[<c0103e92>] sysenter_past_esp+0x5f/0xa5
[<ffffffff>] 0xffffffff
-> (lweventlist_lock){.+..} ops: 10 {
initial-use at:
[<c014197a>] mark_lock+0x64/0x451
[<c0142890>] __lock_acquire+0x4ba/0xc07
[<c02e363c>] e1000_read_phy_reg+0x1c7/0x1d3
[<c02e346b>] e1000_write_phy_reg+0xb9/0xc3
[<c024a82e>] delay_tsc+0x25/0x3b
[<c0143056>] lock_acquire+0x79/0x93
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c043ab8f>] _spin_lock_irqsave+0x3f/0x6c
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c03ac4af>] linkwatch_fire_event+0x25/0x37
[<c02e1c23>] e1000_probe+0xad1/0xbe8
[<c0257f1b>] pci_device_probe+0x36/0x57
[<c02d0e3f>] driver_probe_device+0xe1/0x15f
[<c043ae09>] _spin_unlock+0x25/0x3b
[<c0437e92>] klist_next+0x58/0x6d
[<c02d0f4f>] __driver_attach+0x0/0x7f
[<c02d0f98>] __driver_attach+0x49/0x7f
[<c02d03e3>] bus_for_each_dev+0x36/0x58
[<c02d0c97>] driver_attach+0x16/0x18
[<c02d0f4f>] __driver_attach+0x0/0x7f
[<c02d06da>] bus_add_driver+0x6d/0x18d
[<c0258065>] __pci_register_driver+0x53/0x7f
[<c05be5de>] e1000_init_module+0x45/0x7c
[<c05a9499>] kernel_init+0x150/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c05a9349>] kernel_init+0x0/0x2b7
[<c0104baf>] kernel_thread_helper+0x7/0x10
[<ffffffff>] 0xffffffff
in-softirq-W at:
[<c011d1c0>] __wake_up_common+0x32/0x5c
[<c0142816>] __lock_acquire+0x440/0xc07
[<c043aed5>] _spin_unlock_irqrestore+0x40/0x58
[<c0143056>] lock_acquire+0x79/0x93
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c02dfee1>] e1000_watchdog+0x0/0x5c9
[<c043ab8f>] _spin_lock_irqsave+0x3f/0x6c
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c03ac4af>] linkwatch_fire_event+0x25/0x37
[<c03af436>] netif_carrier_on+0x16/0x27
[<c02e0136>] e1000_watchdog+0x255/0x5c9
[<c02dfee1>] e1000_watchdog+0x0/0x5c9
[<c012e02e>] run_timer_softirq+0xfa/0x15d
[<c012a982>] __do_softirq+0x56/0xdb
[<c0141f7d>] trace_hardirqs_on+0x10c/0x14c
[<c012a994>] __do_softirq+0x68/0xdb
[<c012aa3d>] do_softirq+0x36/0x51
[<c012abe3>] irq_exit+0x43/0x4e
[<c0114122>] smp_apic_timer_interrupt+0x74/0x80
[<c0104a01>] apic_timer_interrupt+0x29/0x38
[<c0104a0b>] apic_timer_interrupt+0x33/0x38
[<c01600d8>] sys_swapon+0x254/0x9aa
[<c01021a6>] mwait_idle_with_hints+0x3b/0x3f
[<c0102447>] mwait_idle+0x0/0xf
[<c0102581>] cpu_idle+0x99/0xc6
[<c05a98c7>] start_kernel+0x2c7/0x2cf
[<c05a90e0>] unknown_bootoption+0x0/0x195
[<ffffffff>] 0xffffffff
}
... key at: [<c058a194>] lweventlist_lock+0x14/0x40
... acquired at:
[<c0142df3>] __lock_acquire+0xa1d/0xc07
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c0142f95>] __lock_acquire+0xbbf/0xc07
[<c0143056>] lock_acquire+0x79/0x93
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c043ab8f>] _spin_lock_irqsave+0x3f/0x6c
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c03ac3eb>] linkwatch_add_event+0xd/0x2c
[<c03ac4af>] linkwatch_fire_event+0x25/0x37
[<c03af436>] netif_carrier_on+0x16/0x27
[<c02ede0c>] bond_set_carrier+0x31/0x55
[<c02ee998>] bond_select_active_slave+0x9e/0xd3
[<c02ed20b>] bond_compute_features+0x45/0x84
[<c02ef9a4>] bond_enslave+0x6a7/0x884
[<c0439964>] mutex_lock_nested+0x2a4/0x2ac
[<c02f617b>] bonding_store_slaves+0x1ae/0x2fb
[<c02f5fcd>] bonding_store_slaves+0x0/0x2fb
[<c02ce8b7>] dev_attr_store+0x27/0x2c
[<c019bda1>] sysfs_write_file+0xad/0xe0
[<c019bcf4>] sysfs_write_file+0x0/0xe0
[<c0168e5c>] vfs_write+0x8a/0x10c
[<c0118562>] do_page_fault+0x0/0x54a
[<c01693e1>] sys_write+0x41/0x67
[<c0103e92>] sysenter_past_esp+0x5f/0xa5
[<ffffffff>] 0xffffffff
stack backtrace:
Pid: 9, comm: events/0 Not tainted 2.6.24-rc7 #1
[<c0140b2c>] print_irq_inversion_bug+0x108/0x112
[<c0141911>] check_usage_forwards+0x3c/0x41
[<c0141afd>] mark_lock+0x1e7/0x451
[<c0142816>] __lock_acquire+0x440/0xc07
[<c013fdfe>] get_lock_stats+0xd/0x2e
[<c013fe29>] put_lock_stats+0xa/0x1e
[<c0143056>] lock_acquire+0x79/0x93
[<c041255a>] mld_ifc_timer_expire+0x130/0x1fb
[<c041242a>] mld_ifc_timer_expire+0x0/0x1fb
[<c043a872>] _spin_lock_bh+0x3b/0x64
[<c041255a>] mld_ifc_timer_expire+0x130/0x1fb
[<c041255a>] mld_ifc_timer_expire+0x130/0x1fb
[<c041242a>] mld_ifc_timer_expire+0x0/0x1fb
[<c0141f7d>] trace_hardirqs_on+0x10c/0x14c
[<c041242a>] mld_ifc_timer_expire+0x0/0x1fb
[<c012e02e>] run_timer_softirq+0xfa/0x15d
[<c012a982>] __do_softirq+0x56/0xdb
[<c0141f7d>] trace_hardirqs_on+0x10c/0x14c
[<c012a994>] __do_softirq+0x68/0xdb
[<c012aa3d>] do_softirq+0x36/0x51
[<c012af26>] local_bh_enable_ip+0xad/0xed
[<c03bfa03>] rt_run_flush+0x64/0x8b
[<c03e9b8a>] fib_netdev_event+0x61/0x65
[<c013ac34>] notifier_call_chain+0x2a/0x52
[<c013ac7e>] raw_notifier_call_chain+0x17/0x1a
[<c03a33d9>] netdev_state_change+0x18/0x29
[<c03ac611>] __linkwatch_run_queue+0x150/0x17e
[<c03ac65c>] linkwatch_event+0x1d/0x22
[<c0133d87>] run_workqueue+0xdb/0x1b6
[<c0133d33>] run_workqueue+0x87/0x1b6
[<c03ac63f>] linkwatch_event+0x0/0x22
[<c01347a7>] worker_thread+0x0/0x85
[<c0134820>] worker_thread+0x79/0x85
[<c0137255>] autoremove_wake_function+0x0/0x35
[<c013719e>] kthread+0x38/0x5e
[<c0137166>] kthread+0x0/0x5e
[<c0104baf>] kernel_thread_helper+0x7/0x10
=======================
bonding: bond0: enslaving eth1 as a backup interface with a down link.
bond0: no IPv6 routers present
No other patches were applied.
Best regards,
Krzysztof Olędzki
^ permalink raw reply
* Re: [PATCH 001/001] ipv4: enable use of 240/4 address space
From: Vince Fuller @ 2008-01-18 0:28 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: Vince Fuller, netdev, linux-kernel
In-Reply-To: <Pine.LNX.4.64.0801180003330.18447@fbirervta.pbzchgretzou.qr>
On Fri, Jan 18, 2008 at 12:04:06AM +0100, Jan Engelhardt wrote:
>
> On Jan 7 2008 17:10, Vince Fuller wrote:
> >--- net/ipv4/devinet.c.orig 2007-04-12 10:16:23.000000000 -0700
> >+++ net/ipv4/devinet.c 2008-01-07 16:55:59.000000000 -0800
> >@@ -594,6 +594,8 @@ static __inline__ int inet_abc_len(__be3
> > rc = 16;
> > else if (IN_CLASSC(haddr))
> > rc = 24;
> >+ else if (IN_CLASSE(haddr))
> >+ rc = 24;
> > }
> >
> > return rc;
>
> Any particular reason why 24?
Using the same default as old-style "class-C" seemed to be the most expedient
thing to do.
In normal practice, the mask should be explicitly configured so this case
should not be frequently encountered.
--Vince
^ permalink raw reply
* Re: [PATCH 6/7] bonding: fix lock ordering for rtnl and bonding_rwsem
From: Andrew Morton @ 2008-01-18 0:38 UTC (permalink / raw)
To: Jay Vosburgh; +Cc: netdev, jgarzik, davem, andy, fubar
In-Reply-To: <12006159123054-git-send-email-fubar@us.ibm.com>
On Thu, 17 Jan 2008 16:25:02 -0800
Jay Vosburgh <fubar@us.ibm.com> wrote:
> Fix the handling of rtnl and the bonding_rwsem to always be acquired
> in a consistent order (rtnl, then bonding_rwsem).
>
> The existing code sometimes acquired them in this order, and sometimes
> in the opposite order, which opens a window for deadlock between ifenslave
> and sysfs.
>
> ...
>
> int bond_create(char *name, struct bond_params *params, struct bonding **newbond)
> {
> struct net_device *bond_dev;
> + struct bonding *bond, *nxt;
> int res;
>
> rtnl_lock();
> + down_write(&bonding_rwsem);
> +
> + /* Check to see if the bond already exists. */
> + list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
this could (should) use list_for_each_entry().
> + if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) {
> + printk(KERN_ERR DRV_NAME
> + ": cannot add bond %s; it already exists\n",
> + name);
> + res = -EPERM;
> + goto out_rtnl;
> + }
> +
> bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
> ether_setup);
> if (!bond_dev) {
> @@ -4915,10 +4928,12 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
>
> netif_carrier_off(bond_dev);
>
> + up_write(&bonding_rwsem);
> rtnl_unlock(); /* allows sysfs registration of net device */
> res = bond_create_sysfs_entry(bond_dev->priv);
> if (res < 0) {
> rtnl_lock();
> + down_write(&bonding_rwsem);
> goto out_bond;
> }
>
> @@ -4929,6 +4944,7 @@ out_bond:
> out_netdev:
> free_netdev(bond_dev);
> out_rtnl:
> + up_write(&bonding_rwsem);
> rtnl_unlock();
> return res;
> }
> @@ -4949,6 +4965,9 @@ static int __init bonding_init(void)
> #ifdef CONFIG_PROC_FS
> bond_create_proc_dir();
> #endif
> +
> + init_rwsem(&bonding_rwsem);
It would be better to initialise this at compile time with DECLARE_RWSEM().
But neither of those things need to be done for 2.6.24.
^ permalink raw reply
* Re: [patch for 2.6.24? 1/1] bonding: locking fix
From: Jay Vosburgh @ 2008-01-18 0:26 UTC (permalink / raw)
To: Andrew Morton; +Cc: olel, davem, jeff, shemminger, netdev
In-Reply-To: <20080117154243.9ee4265c.akpm@linux-foundation.org>
Andrew Morton <akpm@linux-foundation.org> wrote:
[...]
>Can we get this bug fixed please? Today? It has been known about for more
>than two months.
I just reposted the complete fix; it's #1 of the series of 7.
-J
---
-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
^ permalink raw reply
* [PATCH 6/7] bonding: fix lock ordering for rtnl and bonding_rwsem
From: Jay Vosburgh @ 2008-01-18 0:25 UTC (permalink / raw)
To: netdev
Cc: Jeff Garzik, David Miller, Andy Gospodarek, Andrew Morton,
Jay Vosburgh
In-Reply-To: <12006159111680-git-send-email-fubar@us.ibm.com>
Fix the handling of rtnl and the bonding_rwsem to always be acquired
in a consistent order (rtnl, then bonding_rwsem).
The existing code sometimes acquired them in this order, and sometimes
in the opposite order, which opens a window for deadlock between ifenslave
and sysfs.
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
---
drivers/net/bonding/bond_main.c | 19 ++++++++++++++++
drivers/net/bonding/bond_sysfs.c | 43 ++++++++++++++-----------------------
2 files changed, 35 insertions(+), 27 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 379c5d8..2c6da49 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4874,9 +4874,22 @@ static struct lock_class_key bonding_netdev_xmit_lock_key;
int bond_create(char *name, struct bond_params *params, struct bonding **newbond)
{
struct net_device *bond_dev;
+ struct bonding *bond, *nxt;
int res;
rtnl_lock();
+ down_write(&bonding_rwsem);
+
+ /* Check to see if the bond already exists. */
+ list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
+ if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) {
+ printk(KERN_ERR DRV_NAME
+ ": cannot add bond %s; it already exists\n",
+ name);
+ res = -EPERM;
+ goto out_rtnl;
+ }
+
bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
ether_setup);
if (!bond_dev) {
@@ -4915,10 +4928,12 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
netif_carrier_off(bond_dev);
+ up_write(&bonding_rwsem);
rtnl_unlock(); /* allows sysfs registration of net device */
res = bond_create_sysfs_entry(bond_dev->priv);
if (res < 0) {
rtnl_lock();
+ down_write(&bonding_rwsem);
goto out_bond;
}
@@ -4929,6 +4944,7 @@ out_bond:
out_netdev:
free_netdev(bond_dev);
out_rtnl:
+ up_write(&bonding_rwsem);
rtnl_unlock();
return res;
}
@@ -4949,6 +4965,9 @@ static int __init bonding_init(void)
#ifdef CONFIG_PROC_FS
bond_create_proc_dir();
#endif
+
+ init_rwsem(&bonding_rwsem);
+
for (i = 0; i < max_bonds; i++) {
res = bond_create(NULL, &bonding_defaults, NULL);
if (res)
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index bff4f2b..90a1f31 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -109,11 +109,10 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
{
char command[IFNAMSIZ + 1] = {0, };
char *ifname;
- int res = count;
+ int rv, res = count;
struct bonding *bond;
struct bonding *nxt;
- down_write(&(bonding_rwsem));
sscanf(buffer, "%16s", command); /* IFNAMSIZ*/
ifname = command + 1;
if ((strlen(command) <= 1) ||
@@ -121,39 +120,28 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
goto err_no_cmd;
if (command[0] == '+') {
-
- /* Check to see if the bond already exists. */
- list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
- if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) {
- printk(KERN_ERR DRV_NAME
- ": cannot add bond %s; it already exists\n",
- ifname);
- res = -EPERM;
- goto out;
- }
-
printk(KERN_INFO DRV_NAME
": %s is being created...\n", ifname);
- if (bond_create(ifname, &bonding_defaults, &bond)) {
- printk(KERN_INFO DRV_NAME
- ": %s interface already exists. Bond creation failed.\n",
- ifname);
- res = -EPERM;
+ rv = bond_create(ifname, &bonding_defaults, &bond);
+ if (rv) {
+ printk(KERN_INFO DRV_NAME ": Bond creation failed.\n");
+ res = rv;
}
goto out;
}
if (command[0] == '-') {
+ rtnl_lock();
+ down_write(&bonding_rwsem);
+
list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) {
- rtnl_lock();
/* check the ref count on the bond's kobject.
* If it's > expected, then there's a file open,
* and we have to fail.
*/
if (atomic_read(&bond->dev->dev.kobj.kref.refcount)
> expected_refcount){
- rtnl_unlock();
printk(KERN_INFO DRV_NAME
": Unable remove bond %s due to open references.\n",
ifname);
@@ -164,6 +152,7 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
": %s is being deleted...\n",
bond->dev->name);
bond_destroy(bond);
+ up_write(&bonding_rwsem);
rtnl_unlock();
goto out;
}
@@ -171,6 +160,8 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
printk(KERN_ERR DRV_NAME
": unable to delete non-existent bond %s\n", ifname);
res = -ENODEV;
+ up_write(&bonding_rwsem);
+ rtnl_unlock();
goto out;
}
@@ -183,7 +174,6 @@ err_no_cmd:
* get called forever, which is bad.
*/
out:
- up_write(&(bonding_rwsem));
return res;
}
/* class attribute for bond_masters file. This ends up in /sys/class/net */
@@ -271,6 +261,9 @@ static ssize_t bonding_store_slaves(struct device *d,
/* Note: We can't hold bond->lock here, as bond_create grabs it. */
+ rtnl_lock();
+ down_write(&(bonding_rwsem));
+
sscanf(buffer, "%16s", command); /* IFNAMSIZ*/
ifname = command + 1;
if ((strlen(command) <= 1) ||
@@ -336,12 +329,10 @@ static ssize_t bonding_store_slaves(struct device *d,
dev->mtu = bond->dev->mtu;
}
}
- rtnl_lock();
res = bond_enslave(bond->dev, dev);
bond_for_each_slave(bond, slave, i)
if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0)
slave->original_mtu = original_mtu;
- rtnl_unlock();
if (res) {
ret = res;
}
@@ -359,12 +350,10 @@ static ssize_t bonding_store_slaves(struct device *d,
if (dev) {
printk(KERN_INFO DRV_NAME ": %s: Removing slave %s\n",
bond->dev->name, dev->name);
- rtnl_lock();
if (bond->setup_by_slave)
res = bond_release_and_destroy(bond->dev, dev);
else
res = bond_release(bond->dev, dev);
- rtnl_unlock();
if (res) {
ret = res;
goto out;
@@ -389,6 +378,8 @@ err_no_cmd:
ret = -EPERM;
out:
+ up_write(&(bonding_rwsem));
+ rtnl_unlock();
return ret;
}
@@ -1423,8 +1414,6 @@ int bond_create_sysfs(void)
int ret = 0;
struct bonding *firstbond;
- init_rwsem(&bonding_rwsem);
-
/* get the netdev class pointer */
firstbond = container_of(bond_dev_list.next, struct bonding, bond_list);
if (!firstbond)
--
1.5.3.4.206.g58ba4-dirty
^ permalink raw reply related
* [PATCH 7/7] bonding: Don't hold lock when calling rtnl_unlock
From: Jay Vosburgh @ 2008-01-18 0:25 UTC (permalink / raw)
To: netdev
Cc: Jeff Garzik, David Miller, Andy Gospodarek, Andrew Morton,
Jay Vosburgh
In-Reply-To: <12006159123054-git-send-email-fubar@us.ibm.com>
Change bond_mii_monitor to not hold any locks when calling rtnl_unlock,
as rtnl_unlock can sleep (when acquring another mutex in netdev_run_todo).
Bug reported by Makito SHIOKAWA <mshiokawa@miraclelinux.com>, who
included a different patch.
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
---
drivers/net/bonding/bond_main.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 2c6da49..49a1982 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2386,7 +2386,9 @@ void bond_mii_monitor(struct work_struct *work)
rtnl_lock();
read_lock(&bond->lock);
__bond_mii_monitor(bond, 1);
- rtnl_unlock();
+ read_unlock(&bond->lock);
+ rtnl_unlock(); /* might sleep, hold no other locks */
+ read_lock(&bond->lock);
}
delay = ((bond->params.miimon * HZ) / 1000) ? : 1;
--
1.5.3.4.206.g58ba4-dirty
^ permalink raw reply related
* [PATCH 5/7] bonding: Fix up parameter parsing
From: Jay Vosburgh @ 2008-01-18 0:25 UTC (permalink / raw)
To: netdev
Cc: Jeff Garzik, David Miller, Andy Gospodarek, Andrew Morton,
Jay Vosburgh
In-Reply-To: <12006159102124-git-send-email-fubar@us.ibm.com>
A recent change to add an additional hash policy modified
bond_parse_parm, but it now does not correctly match parameters passed in
via sysfs.
Rewrote bond_parse_parm to handle (a) parameter matches that
are substrings of one another and (b) user input with whitespace (e.g.,
sysfs input often has a trailing newline).
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
---
drivers/net/bonding/bond_main.c | 23 ++++++++++++++++-------
drivers/net/bonding/bond_sysfs.c | 8 ++++----
drivers/net/bonding/bonding.h | 4 +++-
3 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3ede0a2..379c5d8 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4540,18 +4540,27 @@ static void bond_free_all(void)
/*
* Convert string input module parms. Accept either the
- * number of the mode or its string name.
+ * number of the mode or its string name. A bit complicated because
+ * some mode names are substrings of other names, and calls from sysfs
+ * may have whitespace in the name (trailing newlines, for example).
*/
-int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl)
+int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl)
{
- int i;
+ int mode = -1, i, rv;
+ char modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, };
+
+ rv = sscanf(buf, "%d", &mode);
+ if (!rv) {
+ rv = sscanf(buf, "%20s", modestr);
+ if (!rv)
+ return -1;
+ }
for (i = 0; tbl[i].modename; i++) {
- if ((isdigit(*mode_arg) &&
- tbl[i].mode == simple_strtol(mode_arg, NULL, 0)) ||
- (strcmp(mode_arg, tbl[i].modename) == 0)) {
+ if (mode == tbl[i].mode)
+ return tbl[i].mode;
+ if (strcmp(modestr, tbl[i].modename) == 0)
return tbl[i].mode;
- }
}
return -1;
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 28a2d80..bff4f2b 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -423,7 +423,7 @@ static ssize_t bonding_store_mode(struct device *d,
goto out;
}
- new_value = bond_parse_parm((char *)buf, bond_mode_tbl);
+ new_value = bond_parse_parm(buf, bond_mode_tbl);
if (new_value < 0) {
printk(KERN_ERR DRV_NAME
": %s: Ignoring invalid mode value %.*s.\n",
@@ -478,7 +478,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d,
goto out;
}
- new_value = bond_parse_parm((char *)buf, xmit_hashtype_tbl);
+ new_value = bond_parse_parm(buf, xmit_hashtype_tbl);
if (new_value < 0) {
printk(KERN_ERR DRV_NAME
": %s: Ignoring invalid xmit hash policy value %.*s.\n",
@@ -518,7 +518,7 @@ static ssize_t bonding_store_arp_validate(struct device *d,
int new_value;
struct bonding *bond = to_bond(d);
- new_value = bond_parse_parm((char *)buf, arp_validate_tbl);
+ new_value = bond_parse_parm(buf, arp_validate_tbl);
if (new_value < 0) {
printk(KERN_ERR DRV_NAME
": %s: Ignoring invalid arp_validate value %s\n",
@@ -941,7 +941,7 @@ static ssize_t bonding_store_lacp(struct device *d,
goto out;
}
- new_value = bond_parse_parm((char *)buf, bond_lacp_tbl);
+ new_value = bond_parse_parm(buf, bond_lacp_tbl);
if ((new_value == 1) || (new_value == 0)) {
bond->params.lacp_fast = new_value;
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index e1e4734..6d83be4 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -141,6 +141,8 @@ struct bond_parm_tbl {
int mode;
};
+#define BOND_MAX_MODENAME_LEN 20
+
struct vlan_entry {
struct list_head vlan_list;
__be32 vlan_ip;
@@ -314,7 +316,7 @@ void bond_mii_monitor(struct work_struct *);
void bond_loadbalance_arp_mon(struct work_struct *);
void bond_activebackup_arp_mon(struct work_struct *);
void bond_set_mode_ops(struct bonding *bond, int mode);
-int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl);
+int bond_parse_parm(const char *mode_arg, struct bond_parm_tbl *tbl);
void bond_select_active_slave(struct bonding *bond);
void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
void bond_register_arp(struct bonding *);
--
1.5.3.4.206.g58ba4-dirty
^ permalink raw reply related
* [PATCH 1/7] bonding: fix locking in sysfs primary/active selection
From: Jay Vosburgh @ 2008-01-18 0:24 UTC (permalink / raw)
To: netdev
Cc: Jeff Garzik, David Miller, Andy Gospodarek, Andrew Morton,
Jay Vosburgh
In-Reply-To: <12006159033257-git-send-email-fubar@us.ibm.com>
Fix the functions that store the primary and active slave
options via sysfs to hold the correct locks in the correct order.
The bond_change_active_slave and bond_select_active_slave
functions both require rtnl, bond->lock for read and curr_slave_lock for
write_bh, and no other locks. This is so that the lower level
mode-specific functions (notably for balance-alb mode) can release locks
down to just rtnl in order to call, e.g., dev_set_mac_address with the
locks it expects (rtnl only).
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
---
drivers/net/bonding/bond_sysfs.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 11b76b3..28a2d80 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1075,7 +1075,10 @@ static ssize_t bonding_store_primary(struct device *d,
struct slave *slave;
struct bonding *bond = to_bond(d);
- write_lock_bh(&bond->lock);
+ rtnl_lock();
+ read_lock(&bond->lock);
+ write_lock_bh(&bond->curr_slave_lock);
+
if (!USES_PRIMARY(bond->params.mode)) {
printk(KERN_INFO DRV_NAME
": %s: Unable to set primary slave; %s is in mode %d\n",
@@ -1109,8 +1112,8 @@ static ssize_t bonding_store_primary(struct device *d,
}
}
out:
- write_unlock_bh(&bond->lock);
-
+ write_unlock_bh(&bond->curr_slave_lock);
+ read_unlock(&bond->lock);
rtnl_unlock();
return count;
@@ -1190,7 +1193,8 @@ static ssize_t bonding_store_active_slave(struct device *d,
struct bonding *bond = to_bond(d);
rtnl_lock();
- write_lock_bh(&bond->lock);
+ read_lock(&bond->lock);
+ write_lock_bh(&bond->curr_slave_lock);
if (!USES_PRIMARY(bond->params.mode)) {
printk(KERN_INFO DRV_NAME
@@ -1247,7 +1251,8 @@ static ssize_t bonding_store_active_slave(struct device *d,
}
}
out:
- write_unlock_bh(&bond->lock);
+ write_unlock_bh(&bond->curr_slave_lock);
+ read_unlock(&bond->lock);
rtnl_unlock();
return count;
--
1.5.3.4.206.g58ba4-dirty
^ permalink raw reply related
* [PATCH 4/7] bonding: release slaves when master removed via sysfs
From: Jay Vosburgh @ 2008-01-18 0:25 UTC (permalink / raw)
To: netdev
Cc: Jeff Garzik, David Miller, Andy Gospodarek, Andrew Morton,
Jay Vosburgh
In-Reply-To: <12006159081875-git-send-email-fubar@us.ibm.com>
Add a call to bond_release_all in the bonding netdev event
handler for the master. This releases the slaves for the case of, e.g.,
"echo -bond0 > /sys/class/net/bonding_masters", which otherwise will spin
forever waiting for references to be released.
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
---
drivers/net/bonding/bond_main.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 77d004d..3ede0a2 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3401,9 +3401,7 @@ static int bond_master_netdev_event(unsigned long event, struct net_device *bond
case NETDEV_CHANGENAME:
return bond_event_changename(event_bond);
case NETDEV_UNREGISTER:
- /*
- * TODO: remove a bond from the list?
- */
+ bond_release_all(event_bond->dev);
break;
default:
break;
--
1.5.3.4.206.g58ba4-dirty
^ permalink raw reply related
* [PATCH 0/7] bonding: 7 fixes for 2.6.24
From: Jay Vosburgh @ 2008-01-18 0:24 UTC (permalink / raw)
To: netdev; +Cc: Jeff Garzik, David Miller, Andy Gospodarek, Andrew Morton
Following are seven patches to fix locking problems,
silence locking-related warnings and resolve one recent regression
in the current 2.6.24-rc.
The first three patches are reposts, the rest are new.
patch 1: fix locking in sysfs primary/active selection
Call core network functions with expected locks to
eliminate potential deadlock and silence warnings.
patch 2: fix ASSERT_RTNL that produces spurious warnings
Relocate ASSERT_RTNL to remove a false warning; after patch,
ASSERT is located in code that holds only RTNL (additional locks were
causing the ASSERT to trip)
patch 3: fix locking during alb failover and slave removal
Fix all call paths into alb_fasten_mac_swap to hold only RTNL.
Eliminates potential deadlock and silences warnings.
patch 4: release slaves when master removed via sysfs
Insure that all slaves are removed when bond is destroyed via
sysfs.
patch 5: Fix up parameter parsing
Recent changes broke parameter parsing; this fixes things.
patch 6: Fix lock ordering for rtnl and bonding_rwsem
Resolves some lockdep warnings related to ordering between
rtnl and bonding_rwsem.
patch 7: Don't hold lock when calling rtnl_unlock
Since rtnl_unlock can sleep, don't hold any other locks when
calling it.
Patches are against the current netdev-2.6#upstream branch.
Please apply for 2.6.24.
-J
---
-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
^ permalink raw reply
* [PATCH 2/7] bonding: fix ASSERT_RTNL that produces spurious warnings
From: Jay Vosburgh @ 2008-01-18 0:24 UTC (permalink / raw)
To: netdev
Cc: Jeff Garzik, David Miller, Andy Gospodarek, Andrew Morton,
Jay Vosburgh
In-Reply-To: <12006159063217-git-send-email-fubar@us.ibm.com>
Move an ASSERT_RTNL down to where we should hold only RTNL;
the existing check produces spurious warnings because we hold additional
locks at _bh, tripping a debug warning in spin_lock_mutex().
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
---
drivers/net/bonding/bond_alb.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 25b8dbf..9b55a12 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -1601,9 +1601,6 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
struct slave *swap_slave;
int i;
- if (new_slave)
- ASSERT_RTNL();
-
if (bond->curr_active_slave == new_slave) {
return;
}
@@ -1649,6 +1646,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
write_unlock_bh(&bond->curr_slave_lock);
read_unlock(&bond->lock);
+ ASSERT_RTNL();
+
/* curr_active_slave must be set before calling alb_swap_mac_addr */
if (swap_slave) {
/* swap mac address */
--
1.5.3.4.206.g58ba4-dirty
^ permalink raw reply related
* [PATCH 3/7] bonding: fix locking during alb failover and slave removal
From: Jay Vosburgh @ 2008-01-18 0:24 UTC (permalink / raw)
To: netdev
Cc: Jeff Garzik, David Miller, Andy Gospodarek, Andrew Morton,
Jay Vosburgh
In-Reply-To: <12006159071917-git-send-email-fubar@us.ibm.com>
alb_fasten_mac_swap (actually rlb_teach_disabled_mac_on_primary)
requries RTNL and no other locks. This could cause dev_set_promiscuity
and/or dev_set_mac_address to be called with improper locking.
Changed callers to hold only RTNL during calls to alb_fasten_mac_swap
or functions calling it. Updated header comments in affected functions to
reflect proper reality of locking requirements.
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
---
drivers/net/bonding/bond_alb.c | 18 ++++++++++++------
drivers/net/bonding/bond_main.c | 14 ++++++++------
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 9b55a12..b57bc94 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -979,7 +979,7 @@ static void alb_swap_mac_addr(struct bonding *bond, struct slave *slave1, struct
/*
* Send learning packets after MAC address swap.
*
- * Called with RTNL and bond->lock held for read.
+ * Called with RTNL and no other locks
*/
static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
struct slave *slave2)
@@ -987,6 +987,8 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2));
struct slave *disabled_slave = NULL;
+ ASSERT_RTNL();
+
/* fasten the change in the switch */
if (SLAVE_IS_OK(slave1)) {
alb_send_learning_packets(slave1, slave1->dev->dev_addr);
@@ -1031,7 +1033,7 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
* a slave that has @slave's permanet address as its current address.
* We'll make sure that that slave no longer uses @slave's permanent address.
*
- * Caller must hold bond lock
+ * Caller must hold RTNL and no other locks
*/
static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave)
{
@@ -1542,7 +1544,12 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave)
return 0;
}
-/* Caller must hold bond lock for write */
+/*
+ * Remove slave from tlb and rlb hash tables, and fix up MAC addresses
+ * if necessary.
+ *
+ * Caller must hold RTNL and no other locks
+ */
void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave)
{
if (bond->slave_cnt > 1) {
@@ -1658,12 +1665,11 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
bond->alb_info.rlb_enabled);
}
- read_lock(&bond->lock);
-
if (swap_slave) {
alb_fasten_mac_swap(bond, swap_slave, new_slave);
+ read_lock(&bond->lock);
} else {
- /* fasten bond mac on new current slave */
+ read_lock(&bond->lock);
alb_send_learning_packets(new_slave, bond->dev->dev_addr);
}
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b0b2603..77d004d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1746,7 +1746,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
* has been cleared (if our_slave == old_current),
* but before a new active slave is selected.
*/
+ write_unlock_bh(&bond->lock);
bond_alb_deinit_slave(bond, slave);
+ write_lock_bh(&bond->lock);
}
if (oldcurrent == slave) {
@@ -1905,6 +1907,12 @@ static int bond_release_all(struct net_device *bond_dev)
slave_dev = slave->dev;
bond_detach_slave(bond, slave);
+ /* now that the slave is detached, unlock and perform
+ * all the undo steps that should not be called from
+ * within a lock.
+ */
+ write_unlock_bh(&bond->lock);
+
if ((bond->params.mode == BOND_MODE_TLB) ||
(bond->params.mode == BOND_MODE_ALB)) {
/* must be called only after the slave
@@ -1915,12 +1923,6 @@ static int bond_release_all(struct net_device *bond_dev)
bond_compute_features(bond);
- /* now that the slave is detached, unlock and perform
- * all the undo steps that should not be called from
- * within a lock.
- */
- write_unlock_bh(&bond->lock);
-
bond_destroy_slave_symlinks(bond_dev, slave_dev);
bond_del_vlans_from_slave(bond, slave_dev);
--
1.5.3.4.206.g58ba4-dirty
^ permalink raw reply related
* [PATCH] [IrDA] af_irda memory leak fixes
From: Samuel Ortiz @ 2008-01-18 7:53 UTC (permalink / raw)
To: David S. Miller; +Cc: irda-users, netdev, Jesper Juhl
Hi Dave,
Here goes an IrDA patch against your latest net-2.6 tree.
This patch fixes some af_irda memory leaks.
It also checks for irias_new_obect() return value.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
---
net/irda/af_irda.c | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
Index: net-2.6-davem/net/irda/af_irda.c
===================================================================
--- net-2.6-davem.orig/net/irda/af_irda.c 2008-01-17 06:00:10.000000000 +0100
+++ net-2.6-davem/net/irda/af_irda.c 2008-01-18 08:37:36.000000000 +0100
@@ -802,12 +802,18 @@
}
#endif /* CONFIG_IRDA_ULTRA */
+ self->ias_obj = irias_new_object(addr->sir_name, jiffies);
+ if (self->ias_obj == NULL)
+ return -ENOMEM;
+
err = irda_open_tsap(self, addr->sir_lsap_sel, addr->sir_name);
- if (err < 0)
+ if (err < 0) {
+ kfree(self->ias_obj->name);
+ kfree(self->ias_obj);
return err;
+ }
/* Register with LM-IAS */
- self->ias_obj = irias_new_object(addr->sir_name, jiffies);
irias_add_integer_attrib(self->ias_obj, "IrDA:TinyTP:LsapSel",
self->stsap_sel, IAS_KERNEL_ATTR);
irias_insert_object(self->ias_obj);
@@ -1825,7 +1831,7 @@
struct irda_ias_set *ias_opt;
struct ias_object *ias_obj;
struct ias_attrib * ias_attr; /* Attribute in IAS object */
- int opt;
+ int opt, free_ias = 0;
IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self);
@@ -1881,11 +1887,20 @@
/* Create a new object */
ias_obj = irias_new_object(ias_opt->irda_class_name,
jiffies);
+ if (ias_obj == NULL) {
+ kfree(ias_opt);
+ return -ENOMEM;
+ }
+ free_ias = 1;
}
/* Do we have the attribute already ? */
if(irias_find_attrib(ias_obj, ias_opt->irda_attrib_name)) {
kfree(ias_opt);
+ if (free_ias) {
+ kfree(ias_obj->name);
+ kfree(ias_obj);
+ }
return -EINVAL;
}
@@ -1904,6 +1919,11 @@
if(ias_opt->attribute.irda_attrib_octet_seq.len >
IAS_MAX_OCTET_STRING) {
kfree(ias_opt);
+ if (free_ias) {
+ kfree(ias_obj->name);
+ kfree(ias_obj);
+ }
+
return -EINVAL;
}
/* Add an octet sequence attribute */
@@ -1932,6 +1952,10 @@
break;
default :
kfree(ias_opt);
+ if (free_ias) {
+ kfree(ias_obj->name);
+ kfree(ias_obj);
+ }
return -EINVAL;
}
irias_insert_object(ias_obj);
^ permalink raw reply
* Re: [patch for 2.6.24? 1/1] bonding: locking fix
From: Andrew Morton @ 2008-01-17 23:42 UTC (permalink / raw)
To: Jay Vosburgh; +Cc: olel, davem, jeff, shemminger, netdev
In-Reply-To: <16796.1200351673@death>
On Mon, 14 Jan 2008 15:01:13 -0800
Jay Vosburgh <fubar@us.ibm.com> wrote:
> Andrew Morton <akpm@linux-foundation.org> wrote:
> [...]
> >That's bond_lock.
> >
> >This patch (below) addresses what appears to me to be an obvious
> >imbalance in rtnl_lock.
> >
> >I don't care how it's fixed, really. Someone please fix it?
>
> I posted a correct patch for this a few days ago:
>
> http://marc.info/?l=linux-netdev&m=119975746803886&w=2
>
> The correct fix requires more than simply removing the rtnl calls.
>
> I've got a few other patches in the pipeline, so I'm planning to
> repost the set the above patch was a part of plus a few others, most
> likely tomorrow.
Can we get this bug fixed please? Today? It has been known about for more
than two months.
I can only assume that people don't use this feature much because this bug
will kill your kernel, every time.
Applying this:
--- a/drivers/net/bonding/bond_sysfs.c~bonding-locking-fix
+++ a/drivers/net/bonding/bond_sysfs.c
@@ -1111,8 +1111,6 @@ static ssize_t bonding_store_primary(str
out:
write_unlock_bh(&bond->lock);
- rtnl_unlock();
-
return count;
}
static DEVICE_ATTR(primary, S_IRUGO | S_IWUSR, bonding_show_primary, bonding_store_primary);
is better than doing nothing.
^ permalink raw reply
* Re: [RFT] sky2: wake-on-lan configuration issues
From: Andrew Morton @ 2008-01-17 23:22 UTC (permalink / raw)
To: supersud501; +Cc: shemminger, rjw, netdev, linux-acpi, bugme-daemon
In-Reply-To: <478BCE98.5030709@yahoo.de>
On Mon, 14 Jan 2008 22:05:28 +0100
supersud501 <supersud501@yahoo.de> wrote:
>
>
> Stephen Hemminger wrote:
> > Please test this patch against Linus's current (approx 2.6.24-rc7-git5).
> > Ignore Andrew's premature reversion attempt...
> >
> > This patch disables config mode access after clearing PCI settings.
> >
>
> ...
>
> yes, that did it! just tested it (current linus git tree with patched
> sky with above patch), everything is clean now (dmesg output) and wol
> works even with the commit ac93a3946b676025fa55356180e8321639744b31
>
> so it the bug is fixed without the need to revert
> ac93a3946b676025fa55356180e8321639744b31.
Are we putting this into 2.6.24?
^ permalink raw reply
* Re: [PATCH 001/001] ipv4: enable use of 240/4 address space
From: Jan Engelhardt @ 2008-01-17 23:04 UTC (permalink / raw)
To: Vince Fuller; +Cc: netdev, linux-kernel
In-Reply-To: <20080108011057.GA21168@cisco.com>
On Jan 7 2008 17:10, Vince Fuller wrote:
>--- net/ipv4/devinet.c.orig 2007-04-12 10:16:23.000000000 -0700
>+++ net/ipv4/devinet.c 2008-01-07 16:55:59.000000000 -0800
>@@ -594,6 +594,8 @@ static __inline__ int inet_abc_len(__be3
> rc = 16;
> else if (IN_CLASSC(haddr))
> rc = 24;
>+ else if (IN_CLASSE(haddr))
>+ rc = 24;
> }
>
> return rc;
Any particular reason why 24?
^ permalink raw reply
* Pull request for 'ipg-fixes' branch (try #2)
From: Francois Romieu @ 2008-01-17 22:36 UTC (permalink / raw)
To: jeff; +Cc: David Miller, linux, Andrew Morton, netdev, Sorbica, Jesse,
craig_rich
Please pull from branch 'ipg-fixes' in repository
git://git.kernel.org/pub/scm/linux/kernel/git/romieu/netdev-2.6.git ipg-fixes
to get the changes below.
Distance from 'master' (d8c89eb3a12f0da96d049bd515c7fa3702e511c5)
-----------------------------------------------------------------
47cccd7d7cc1f2b6f34aadc9041fb991c6293cdd
dafdec746f8c468bebf6b99f32a392ee6c8d0212
0da1b995aee447656c0eb77e4e32468e37f868a3
227bc24d675d80de1cfb3ab72891cc932dadbc3b
Diffstat
--------
drivers/net/ipg.c | 36 ++++++++++++------------------------
1 files changed, 12 insertions(+), 24 deletions(-)
Shortlog
--------
Francois Romieu (4):
ipg: balance locking in irq handler
ipg: plug Tx completion leak
ipg: fix queue stop condition in the xmit handler
ipg: fix Tx completion irq request
Patch
-----
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index dbd23bb..50f0c17 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -857,21 +857,14 @@ static void init_tfdlist(struct net_device *dev)
static void ipg_nic_txfree(struct net_device *dev)
{
struct ipg_nic_private *sp = netdev_priv(dev);
- void __iomem *ioaddr = sp->ioaddr;
- unsigned int curr;
- u64 txd_map;
- unsigned int released, pending;
-
- txd_map = (u64)sp->txd_map;
- curr = ipg_r32(TFD_LIST_PTR_0) -
- do_div(txd_map, sizeof(struct ipg_tx)) - 1;
+ unsigned int released, pending, dirty;
IPG_DEBUG_MSG("_nic_txfree\n");
pending = sp->tx_current - sp->tx_dirty;
+ dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH;
for (released = 0; released < pending; released++) {
- unsigned int dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH;
struct sk_buff *skb = sp->TxBuff[dirty];
struct ipg_tx *txfd = sp->txd + dirty;
@@ -882,11 +875,8 @@ static void ipg_nic_txfree(struct net_device *dev)
* If the TFDDone bit is set, free the associated
* buffer.
*/
- if (dirty == curr)
- break;
-
- /* Setup TFDDONE for compatible issue. */
- txfd->tfc |= cpu_to_le64(IPG_TFC_TFDDONE);
+ if (!(txfd->tfc & cpu_to_le64(IPG_TFC_TFDDONE)))
+ break;
/* Free the transmit buffer. */
if (skb) {
@@ -898,6 +888,7 @@ static void ipg_nic_txfree(struct net_device *dev)
sp->TxBuff[dirty] = NULL;
}
+ dirty = (dirty + 1) % IPG_TFDLIST_LENGTH;
}
sp->tx_dirty += released;
@@ -1630,6 +1621,8 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
#ifdef JUMBO_FRAME
ipg_nic_rxrestore(dev);
#endif
+ spin_lock(&sp->lock);
+
/* Get interrupt source information, and acknowledge
* some (i.e. TxDMAComplete, RxDMAComplete, RxEarly,
* IntRequested, MacControlFrame, LinkEvent) interrupts
@@ -1647,9 +1640,7 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
handled = 1;
if (unlikely(!netif_running(dev)))
- goto out;
-
- spin_lock(&sp->lock);
+ goto out_unlock;
/* If RFDListEnd interrupt, restore all used RFDs. */
if (status & IPG_IS_RFD_LIST_END) {
@@ -1733,9 +1724,9 @@ out_enable:
ipg_w16(IPG_IE_TX_DMA_COMPLETE | IPG_IE_RX_DMA_COMPLETE |
IPG_IE_HOST_ERROR | IPG_IE_INT_REQUESTED | IPG_IE_TX_COMPLETE |
IPG_IE_LINK_EVENT | IPG_IE_UPDATE_STATS, INT_ENABLE);
-
+out_unlock:
spin_unlock(&sp->lock);
-out:
+
return IRQ_RETVAL(handled);
}
@@ -1943,10 +1934,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
*/
if (sp->tenmbpsmode)
txfd->tfc |= cpu_to_le64(IPG_TFC_TXINDICATE);
- else if (!((sp->tx_current - sp->tx_dirty + 1) >
- IPG_FRAMESBETWEENTXDMACOMPLETES)) {
- txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE);
- }
+ txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE);
/* Based on compilation option, determine if FCS is to be
* appended to transmit frame by IPG.
*/
@@ -2003,7 +1991,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
ipg_w32(IPG_DC_TX_DMA_POLL_NOW, DMA_CTRL);
if (sp->tx_current == (sp->tx_dirty + IPG_TFDLIST_LENGTH))
- netif_wake_queue(dev);
+ netif_stop_queue(dev);
spin_unlock_irqrestore(&sp->lock, flags);
--
Ueimor
^ permalink raw reply related
* Re: [RFC: 2.6 patch] remove IrPORT and the old dongle drivers
From: Samuel Ortiz @ 2008-01-18 6:46 UTC (permalink / raw)
To: Adrian Bunk; +Cc: netdev
In-Reply-To: <20080101134851.GO2360@does.not.exist>
Hi Adrian,
On Tue, Jan 01, 2008 at 03:48:51PM +0200, Adrian Bunk wrote:
> This patch removes IrPORT and the old dongle drivers (all off them
> have replacement drivers).
This patch looks good, yes. I'll schedule it for after 2.6.24, as I'd rather
not seeing this kind of patch to appear in a major release with users not
being warned in advance.
Thanks for the patch.
Cheers,
Samuel.
> Signed-off-by: Adrian Bunk <bunk@kernel.org>
>
> ---
>
> This patch has been sent on:
> - 24 Oct 2007
>
> drivers/net/irda/Kconfig | 141 ----
> drivers/net/irda/Makefile | 17
> drivers/net/irda/act200l.c | 297 --------
> drivers/net/irda/actisys.c | 288 --------
> drivers/net/irda/ep7211_ir.c | 125 ---
> drivers/net/irda/esi.c | 149 ----
> drivers/net/irda/girbil.c | 250 -------
> drivers/net/irda/irport.c | 1123 ---------------------------------
> drivers/net/irda/irport.h | 80 --
> drivers/net/irda/litelink.c | 179 -----
> drivers/net/irda/ma600.c | 354 ----------
> drivers/net/irda/mcp2120.c | 240 -------
> drivers/net/irda/old_belkin.c | 164 ----
> drivers/net/irda/tekram.c | 282 --------
> include/net/irda/irda_device.h | 13
> net/irda/irda_device.c | 169 ----
> 16 files changed, 3 insertions(+), 3868 deletions(-)
>
> dd727730309f6f76bafda7e69e3a3258a427e11c
> diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig
> index 6580695..ce816ba 100644
> --- a/drivers/net/irda/Kconfig
> +++ b/drivers/net/irda/Kconfig
> @@ -190,147 +190,6 @@ config KS959_DONGLE
> To compile it as a module, choose M here: the module will be called
> ks959-sir.
>
> -comment "Old SIR device drivers"
> -
> -config IRPORT_SIR
> - tristate "IrPORT (IrDA serial driver)"
> - depends on IRDA && BROKEN_ON_SMP
> - ---help---
> - Say Y here if you want to build support for the IrPORT IrDA device
> - driver. To compile it as a module, choose M here: the module will be
> - called irport. IrPORT can be used instead of IrTTY and sometimes
> - this can be better. One example is if your IrDA port does not
> - have echo-canceling, which will work OK with IrPORT since this
> - driver is working in half-duplex mode only. You don't need to use
> - irattach with IrPORT, but you just insert it the same way as FIR
> - drivers (insmod irport io=0x3e8 irq=11). Notice that IrPORT is a
> - SIR device driver which means that speed is limited to 115200 bps.
> -
> - If unsure, say Y.
> -
> -comment "Old Serial dongle support"
> -
> -config DONGLE_OLD
> - bool "Old Serial dongle support"
> - depends on IRPORT_SIR && BROKEN_ON_SMP
> - help
> - Say Y here if you have an infrared device that connects to your
> - computer's serial port. These devices are called dongles. Then say Y
> - or M to the driver for your particular dongle below.
> -
> - Note that the answer to this question won't directly affect the
> - kernel: saying N will just cause the configurator to skip all
> - the questions about serial dongles.
> -
> -config ESI_DONGLE_OLD
> - tristate "ESI JetEye PC dongle"
> - depends on DONGLE_OLD && IRDA
> - help
> - Say Y here if you want to build support for the Extended Systems
> - JetEye PC dongle. To compile it as a module, choose M here. The ESI
> - dongle attaches to the normal 9-pin serial port connector, and can
> - currently only be used by IrTTY. To activate support for ESI
> - dongles you will have to start irattach like this:
> - "irattach -d esi".
> -
> -config ACTISYS_DONGLE_OLD
> - tristate "ACTiSYS IR-220L and IR220L+ dongle"
> - depends on DONGLE_OLD && IRDA
> - help
> - Say Y here if you want to build support for the ACTiSYS IR-220L and
> - IR220L+ dongles. To compile it as a module, choose M here. The
> - ACTiSYS dongles attaches to the normal 9-pin serial port connector,
> - and can currently only be used by IrTTY. To activate support for
> - ACTiSYS dongles you will have to start irattach like this:
> - "irattach -d actisys" or "irattach -d actisys+".
> -
> -config TEKRAM_DONGLE_OLD
> - tristate "Tekram IrMate 210B dongle"
> - depends on DONGLE_OLD && IRDA
> - help
> - Say Y here if you want to build support for the Tekram IrMate 210B
> - dongle. To compile it as a module, choose M here. The Tekram dongle
> - attaches to the normal 9-pin serial port connector, and can
> - currently only be used by IrTTY. To activate support for Tekram
> - dongles you will have to start irattach like this:
> - "irattach -d tekram".
> -
> -config GIRBIL_DONGLE_OLD
> - tristate "Greenwich GIrBIL dongle"
> - depends on DONGLE_OLD && IRDA
> - help
> - Say Y here if you want to build support for the Greenwich GIrBIL
> - dongle. To compile it as a module, choose M here. The Greenwich
> - dongle attaches to the normal 9-pin serial port connector, and can
> - currently only be used by IrTTY. To activate support for Greenwich
> - dongles you will have to insert "irattach -d girbil" in the
> - /etc/irda/drivers script.
> -
> -config LITELINK_DONGLE_OLD
> - tristate "Parallax LiteLink dongle"
> - depends on DONGLE_OLD && IRDA
> - help
> - Say Y here if you want to build support for the Parallax Litelink
> - dongle. To compile it as a module, choose M here. The Parallax
> - dongle attaches to the normal 9-pin serial port connector, and can
> - currently only be used by IrTTY. To activate support for Parallax
> - dongles you will have to start irattach like this:
> - "irattach -d litelink".
> -
> -config MCP2120_DONGLE_OLD
> - tristate "Microchip MCP2120"
> - depends on DONGLE_OLD && IRDA
> - help
> - Say Y here if you want to build support for the Microchip MCP2120
> - dongle. To compile it as a module, choose M here. The MCP2120 dongle
> - attaches to the normal 9-pin serial port connector, and can
> - currently only be used by IrTTY. To activate support for MCP2120
> - dongles you will have to insert "irattach -d mcp2120" in the
> - /etc/irda/drivers script.
> -
> - You must build this dongle yourself. For more information see:
> - <http://www.eyetap.org/~tangf/irda_sir_linux.html>
> -
> -config OLD_BELKIN_DONGLE_OLD
> - tristate "Old Belkin dongle"
> - depends on DONGLE_OLD && IRDA
> - help
> - Say Y here if you want to build support for the Adaptec Airport 1000
> - and 2000 dongles. To compile it as a module, choose M here: the module
> - will be called old_belkin. Some information is contained in the
> - comments at the top of <file:drivers/net/irda/old_belkin.c>.
> -
> -config ACT200L_DONGLE_OLD
> - tristate "ACTiSYS IR-200L dongle (EXPERIMENTAL)"
> - depends on DONGLE_OLD && EXPERIMENTAL && IRDA
> - help
> - Say Y here if you want to build support for the ACTiSYS IR-200L
> - dongle. To compile it as a module, choose M here. The ACTiSYS
> - IR-200L dongle attaches to the normal 9-pin serial port connector,
> - and can currently only be used by IrTTY. To activate support for
> - ACTiSYS IR-200L dongles you will have to start irattach like this:
> - "irattach -d act200l".
> -
> -config MA600_DONGLE_OLD
> - tristate "Mobile Action MA600 dongle (EXPERIMENTAL)"
> - depends on DONGLE_OLD && EXPERIMENTAL && IRDA
> - ---help---
> - Say Y here if you want to build support for the Mobile Action MA600
> - dongle. To compile it as a module, choose M here. The MA600 dongle
> - attaches to the normal 9-pin serial port connector, and can
> - currently only be tested on IrCOMM. To activate support for MA600
> - dongles you will have to insert "irattach -d ma600" in the
> - /etc/irda/drivers script. Note: irutils 0.9.15 requires no
> - modification. irutils 0.9.9 needs modification. For more
> - information, download the following tar gzip file.
> -
> - There is a pre-compiled module on
> - <http://engsvr.ust.hk/~eetwl95/ma600.html>
> -
> -config EP7211_IR
> - tristate "EP7211 I/R support"
> - depends on DONGLE_OLD && ARCH_EP7211 && IRDA
> -
> comment "FIR device drivers"
>
> config USB_IRDA
> diff --git a/drivers/net/irda/Makefile b/drivers/net/irda/Makefile
> index fefbb59..5d20fde 100644
> --- a/drivers/net/irda/Makefile
> +++ b/drivers/net/irda/Makefile
> @@ -5,8 +5,6 @@
> # Rewritten to use lists instead of if-statements.
> #
>
> -# Old SIR drivers
> -obj-$(CONFIG_IRPORT_SIR) += irport.o
> # FIR drivers
> obj-$(CONFIG_USB_IRDA) += irda-usb.o
> obj-$(CONFIG_SIGMATEL_FIR) += stir4200.o
> @@ -20,21 +18,10 @@ obj-$(CONFIG_VLSI_FIR) += vlsi_ir.o
> obj-$(CONFIG_VIA_FIR) += via-ircc.o
> obj-$(CONFIG_PXA_FICP) += pxaficp_ir.o
> obj-$(CONFIG_MCS_FIR) += mcs7780.o
> -# Old dongle drivers for old SIR drivers
> -obj-$(CONFIG_ESI_DONGLE_OLD) += esi.o
> -obj-$(CONFIG_TEKRAM_DONGLE_OLD) += tekram.o
> -obj-$(CONFIG_ACTISYS_DONGLE_OLD) += actisys.o
> -obj-$(CONFIG_GIRBIL_DONGLE_OLD) += girbil.o
> -obj-$(CONFIG_LITELINK_DONGLE_OLD) += litelink.o
> -obj-$(CONFIG_OLD_BELKIN_DONGLE_OLD) += old_belkin.o
> -obj-$(CONFIG_MCP2120_DONGLE_OLD) += mcp2120.o
> -obj-$(CONFIG_ACT200L_DONGLE_OLD) += act200l.o
> -obj-$(CONFIG_MA600_DONGLE_OLD) += ma600.o
> -obj-$(CONFIG_EP7211_IR) += ep7211_ir.o
> obj-$(CONFIG_AU1000_FIR) += au1k_ir.o
> -# New SIR drivers
> +# SIR drivers
> obj-$(CONFIG_IRTTY_SIR) += irtty-sir.o sir-dev.o
> -# New dongles drivers for new SIR drivers
> +# dongle drivers for SIR drivers
> obj-$(CONFIG_ESI_DONGLE) += esi-sir.o
> obj-$(CONFIG_TEKRAM_DONGLE) += tekram-sir.o
> obj-$(CONFIG_ACTISYS_DONGLE) += actisys-sir.o
> diff --git a/drivers/net/irda/act200l.c b/drivers/net/irda/act200l.c
> deleted file mode 100644
> index 756cd44..0000000
> --- a/drivers/net/irda/act200l.c
> +++ /dev/null
> @@ -1,297 +0,0 @@
> -/*********************************************************************
> - *
> - * Filename: act200l.c
> - * Version: 0.8
> - * Description: Implementation for the ACTiSYS ACT-IR200L dongle
> - * Status: Experimental.
> - * Author: SHIMIZU Takuya <tshimizu@ga2.so-net.ne.jp>
> - * Created at: Fri Aug 3 17:35:42 2001
> - * Modified at: Fri Aug 17 10:22:40 2001
> - * Modified by: SHIMIZU Takuya <tshimizu@ga2.so-net.ne.jp>
> - *
> - * Copyright (c) 2001 SHIMIZU Takuya, All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - ********************************************************************/
> -
> -#include <linux/module.h>
> -#include <linux/delay.h>
> -#include <linux/tty.h>
> -#include <linux/init.h>
> -
> -#include <net/irda/irda.h>
> -#include <net/irda/irda_device.h>
> -
> -static int act200l_reset(struct irda_task *task);
> -static void act200l_open(dongle_t *self, struct qos_info *qos);
> -static void act200l_close(dongle_t *self);
> -static int act200l_change_speed(struct irda_task *task);
> -
> -/* Regsiter 0: Control register #1 */
> -#define ACT200L_REG0 0x00
> -#define ACT200L_TXEN 0x01 /* Enable transmitter */
> -#define ACT200L_RXEN 0x02 /* Enable receiver */
> -
> -/* Register 1: Control register #2 */
> -#define ACT200L_REG1 0x10
> -#define ACT200L_LODB 0x01 /* Load new baud rate count value */
> -#define ACT200L_WIDE 0x04 /* Expand the maximum allowable pulse */
> -
> -/* Register 4: Output Power register */
> -#define ACT200L_REG4 0x40
> -#define ACT200L_OP0 0x01 /* Enable LED1C output */
> -#define ACT200L_OP1 0x02 /* Enable LED2C output */
> -#define ACT200L_BLKR 0x04
> -
> -/* Register 5: Receive Mode register */
> -#define ACT200L_REG5 0x50
> -#define ACT200L_RWIDL 0x01 /* fixed 1.6us pulse mode */
> -
> -/* Register 6: Receive Sensitivity register #1 */
> -#define ACT200L_REG6 0x60
> -#define ACT200L_RS0 0x01 /* receive threshold bit 0 */
> -#define ACT200L_RS1 0x02 /* receive threshold bit 1 */
> -
> -/* Register 7: Receive Sensitivity register #2 */
> -#define ACT200L_REG7 0x70
> -#define ACT200L_ENPOS 0x04 /* Ignore the falling edge */
> -
> -/* Register 8,9: Baud Rate Dvider register #1,#2 */
> -#define ACT200L_REG8 0x80
> -#define ACT200L_REG9 0x90
> -
> -#define ACT200L_2400 0x5f
> -#define ACT200L_9600 0x17
> -#define ACT200L_19200 0x0b
> -#define ACT200L_38400 0x05
> -#define ACT200L_57600 0x03
> -#define ACT200L_115200 0x01
> -
> -/* Register 13: Control register #3 */
> -#define ACT200L_REG13 0xd0
> -#define ACT200L_SHDW 0x01 /* Enable access to shadow registers */
> -
> -/* Register 15: Status register */
> -#define ACT200L_REG15 0xf0
> -
> -/* Register 21: Control register #4 */
> -#define ACT200L_REG21 0x50
> -#define ACT200L_EXCK 0x02 /* Disable clock output driver */
> -#define ACT200L_OSCL 0x04 /* oscillator in low power, medium accuracy mode */
> -
> -static struct dongle_reg dongle = {
> - .type = IRDA_ACT200L_DONGLE,
> - .open = act200l_open,
> - .close = act200l_close,
> - .reset = act200l_reset,
> - .change_speed = act200l_change_speed,
> - .owner = THIS_MODULE,
> -};
> -
> -static int __init act200l_init(void)
> -{
> - return irda_device_register_dongle(&dongle);
> -}
> -
> -static void __exit act200l_cleanup(void)
> -{
> - irda_device_unregister_dongle(&dongle);
> -}
> -
> -static void act200l_open(dongle_t *self, struct qos_info *qos)
> -{
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
> -
> - /* Power on the dongle */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - /* Set the speeds we can accept */
> - qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
> - qos->min_turn_time.bits = 0x03;
> -}
> -
> -static void act200l_close(dongle_t *self)
> -{
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
> -
> - /* Power off the dongle */
> - self->set_dtr_rts(self->dev, FALSE, FALSE);
> -}
> -
> -/*
> - * Function act200l_change_speed (dev, speed)
> - *
> - * Set the speed for the ACTiSYS ACT-IR200L type dongle.
> - *
> - */
> -static int act200l_change_speed(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - __u32 speed = (__u32) task->param;
> - __u8 control[3];
> - int ret = 0;
> -
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
> -
> - self->speed_task = task;
> -
> - switch (task->state) {
> - case IRDA_TASK_INIT:
> - if (irda_task_execute(self, act200l_reset, NULL, task,
> - (void *) speed))
> - {
> - /* Dongle need more time to reset */
> - irda_task_next_state(task, IRDA_TASK_CHILD_WAIT);
> -
> - /* Give reset 1 sec to finish */
> - ret = msecs_to_jiffies(1000);
> - }
> - break;
> - case IRDA_TASK_CHILD_WAIT:
> - IRDA_WARNING("%s(), resetting dongle timed out!\n",
> - __FUNCTION__);
> - ret = -1;
> - break;
> - case IRDA_TASK_CHILD_DONE:
> - /* Clear DTR and set RTS to enter command mode */
> - self->set_dtr_rts(self->dev, FALSE, TRUE);
> -
> - switch (speed) {
> - case 9600:
> - default:
> - control[0] = ACT200L_REG8 | (ACT200L_9600 & 0x0f);
> - control[1] = ACT200L_REG9 | ((ACT200L_9600 >> 4) & 0x0f);
> - break;
> - case 19200:
> - control[0] = ACT200L_REG8 | (ACT200L_19200 & 0x0f);
> - control[1] = ACT200L_REG9 | ((ACT200L_19200 >> 4) & 0x0f);
> - break;
> - case 38400:
> - control[0] = ACT200L_REG8 | (ACT200L_38400 & 0x0f);
> - control[1] = ACT200L_REG9 | ((ACT200L_38400 >> 4) & 0x0f);
> - break;
> - case 57600:
> - control[0] = ACT200L_REG8 | (ACT200L_57600 & 0x0f);
> - control[1] = ACT200L_REG9 | ((ACT200L_57600 >> 4) & 0x0f);
> - break;
> - case 115200:
> - control[0] = ACT200L_REG8 | (ACT200L_115200 & 0x0f);
> - control[1] = ACT200L_REG9 | ((ACT200L_115200 >> 4) & 0x0f);
> - break;
> - }
> - control[2] = ACT200L_REG1 | ACT200L_LODB | ACT200L_WIDE;
> -
> - /* Write control bytes */
> - self->write(self->dev, control, 3);
> - irda_task_next_state(task, IRDA_TASK_WAIT);
> - ret = msecs_to_jiffies(5);
> - break;
> - case IRDA_TASK_WAIT:
> - /* Go back to normal mode */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->speed_task = NULL;
> - break;
> - default:
> - IRDA_ERROR("%s(), unknown state %d\n",
> - __FUNCTION__, task->state);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->speed_task = NULL;
> - ret = -1;
> - break;
> - }
> - return ret;
> -}
> -
> -/*
> - * Function act200l_reset (driver)
> - *
> - * Reset the ACTiSYS ACT-IR200L type dongle.
> - */
> -static int act200l_reset(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - __u8 control[9] = {
> - ACT200L_REG15,
> - ACT200L_REG13 | ACT200L_SHDW,
> - ACT200L_REG21 | ACT200L_EXCK | ACT200L_OSCL,
> - ACT200L_REG13,
> - ACT200L_REG7 | ACT200L_ENPOS,
> - ACT200L_REG6 | ACT200L_RS0 | ACT200L_RS1,
> - ACT200L_REG5 | ACT200L_RWIDL,
> - ACT200L_REG4 | ACT200L_OP0 | ACT200L_OP1 | ACT200L_BLKR,
> - ACT200L_REG0 | ACT200L_TXEN | ACT200L_RXEN
> - };
> - int ret = 0;
> -
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
> -
> - self->reset_task = task;
> -
> - switch (task->state) {
> - case IRDA_TASK_INIT:
> - /* Power on the dongle */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - irda_task_next_state(task, IRDA_TASK_WAIT1);
> - ret = msecs_to_jiffies(50);
> - break;
> - case IRDA_TASK_WAIT1:
> - /* Reset the dongle : set RTS low for 25 ms */
> - self->set_dtr_rts(self->dev, TRUE, FALSE);
> -
> - irda_task_next_state(task, IRDA_TASK_WAIT2);
> - ret = msecs_to_jiffies(50);
> - break;
> - case IRDA_TASK_WAIT2:
> - /* Clear DTR and set RTS to enter command mode */
> - self->set_dtr_rts(self->dev, FALSE, TRUE);
> -
> - /* Write control bytes */
> - self->write(self->dev, control, 9);
> - irda_task_next_state(task, IRDA_TASK_WAIT3);
> - ret = msecs_to_jiffies(15);
> - break;
> - case IRDA_TASK_WAIT3:
> - /* Go back to normal mode */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->reset_task = NULL;
> - break;
> - default:
> - IRDA_ERROR("%s(), unknown state %d\n",
> - __FUNCTION__, task->state);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->reset_task = NULL;
> - ret = -1;
> - break;
> - }
> - return ret;
> -}
> -
> -MODULE_AUTHOR("SHIMIZU Takuya <tshimizu@ga2.so-net.ne.jp>");
> -MODULE_DESCRIPTION("ACTiSYS ACT-IR200L dongle driver");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("irda-dongle-10"); /* IRDA_ACT200L_DONGLE */
> -
> -/*
> - * Function init_module (void)
> - *
> - * Initialize ACTiSYS ACT-IR200L module
> - *
> - */
> -module_init(act200l_init);
> -
> -/*
> - * Function cleanup_module (void)
> - *
> - * Cleanup ACTiSYS ACT-IR200L module
> - *
> - */
> -module_exit(act200l_cleanup);
> diff --git a/drivers/net/irda/actisys.c b/drivers/net/irda/actisys.c
> deleted file mode 100644
> index ae0b80a..0000000
> --- a/drivers/net/irda/actisys.c
> +++ /dev/null
> @@ -1,288 +0,0 @@
> -/*********************************************************************
> - *
> - * Filename: actisys.c
> - * Version: 1.0
> - * Description: Implementation for the ACTiSYS IR-220L and IR-220L+
> - * dongles
> - * Status: Beta.
> - * Authors: Dag Brattli <dagb@cs.uit.no> (initially)
> - * Jean Tourrilhes <jt@hpl.hp.com> (new version)
> - * Created at: Wed Oct 21 20:02:35 1998
> - * Modified at: Fri Dec 17 09:10:43 1999
> - * Modified by: Dag Brattli <dagb@cs.uit.no>
> - *
> - * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
> - * Copyright (c) 1999 Jean Tourrilhes
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - * Neither Dag Brattli nor University of Tromsø admit liability nor
> - * provide warranty for any of this software. This material is
> - * provided "AS-IS" and at no charge.
> - *
> - ********************************************************************/
> -
> -/*
> - * Changelog
> - *
> - * 0.8 -> 0.9999 - Jean
> - * o New initialisation procedure : much safer and correct
> - * o New procedure the change speed : much faster and simpler
> - * o Other cleanups & comments
> - * Thanks to Lichen Wang @ Actisys for his excellent help...
> - */
> -
> -#include <linux/module.h>
> -#include <linux/delay.h>
> -#include <linux/tty.h>
> -#include <linux/init.h>
> -
> -#include <net/irda/irda.h>
> -#include <net/irda/irda_device.h>
> -
> -/*
> - * Define the timing of the pulses we send to the dongle (to reset it, and
> - * to toggle speeds). Basically, the limit here is the propagation speed of
> - * the signals through the serial port, the dongle being much faster. Any
> - * serial port support 115 kb/s, so we are sure that pulses 8.5 us wide can
> - * go through cleanly . If you are on the wild side, you can try to lower
> - * this value (Actisys recommended me 2 us, and 0 us work for me on a P233!)
> - */
> -#define MIN_DELAY 10 /* 10 us to be on the conservative side */
> -
> -static int actisys_change_speed(struct irda_task *task);
> -static int actisys_reset(struct irda_task *task);
> -static void actisys_open(dongle_t *self, struct qos_info *qos);
> -static void actisys_close(dongle_t *self);
> -
> -/* These are the baudrates supported, in the order available */
> -/* Note : the 220L doesn't support 38400, but we will fix that below */
> -static __u32 baud_rates[] = { 9600, 19200, 57600, 115200, 38400 };
> -#define MAX_SPEEDS 5
> -
> -static struct dongle_reg dongle = {
> - .type = IRDA_ACTISYS_DONGLE,
> - .open = actisys_open,
> - .close = actisys_close,
> - .reset = actisys_reset,
> - .change_speed = actisys_change_speed,
> - .owner = THIS_MODULE,
> -};
> -
> -static struct dongle_reg dongle_plus = {
> - .type = IRDA_ACTISYS_PLUS_DONGLE,
> - .open = actisys_open,
> - .close = actisys_close,
> - .reset = actisys_reset,
> - .change_speed = actisys_change_speed,
> - .owner = THIS_MODULE,
> -};
> -
> -/*
> - * Function actisys_change_speed (task)
> - *
> - * There is two model of Actisys dongle we are dealing with,
> - * the 220L and 220L+. At this point, only irattach knows with
> - * kind the user has requested (it was an argument on irattach
> - * command line).
> - * So, we register a dongle of each sort and let irattach
> - * pick the right one...
> - */
> -static int __init actisys_init(void)
> -{
> - int ret;
> -
> - /* First, register an Actisys 220L dongle */
> - ret = irda_device_register_dongle(&dongle);
> - if (ret < 0)
> - return ret;
> - /* Now, register an Actisys 220L+ dongle */
> - ret = irda_device_register_dongle(&dongle_plus);
> - if (ret < 0) {
> - irda_device_unregister_dongle(&dongle);
> - return ret;
> - }
> - return 0;
> -}
> -
> -static void __exit actisys_cleanup(void)
> -{
> - /* We have to remove both dongles */
> - irda_device_unregister_dongle(&dongle);
> - irda_device_unregister_dongle(&dongle_plus);
> -}
> -
> -static void actisys_open(dongle_t *self, struct qos_info *qos)
> -{
> - /* Power on the dongle */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - /* Set the speeds we can accept */
> - qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
> -
> - /* Remove support for 38400 if this is not a 220L+ dongle */
> - if (self->issue->type == IRDA_ACTISYS_DONGLE)
> - qos->baud_rate.bits &= ~IR_38400;
> -
> - qos->min_turn_time.bits = 0x7f; /* Needs 0.01 ms */
> -}
> -
> -static void actisys_close(dongle_t *self)
> -{
> - /* Power off the dongle */
> - self->set_dtr_rts(self->dev, FALSE, FALSE);
> -}
> -
> -/*
> - * Function actisys_change_speed (task)
> - *
> - * Change speed of the ACTiSYS IR-220L and IR-220L+ type IrDA dongles.
> - * To cycle through the available baud rates, pulse RTS low for a few us.
> - *
> - * First, we reset the dongle to always start from a known state.
> - * Then, we cycle through the speeds by pulsing RTS low and then up.
> - * The dongle allow us to pulse quite fast, se we can set speed in one go,
> - * which is must faster ( < 100 us) and less complex than what is found
> - * in some other dongle drivers...
> - * Note that even if the new speed is the same as the current speed,
> - * we reassert the speed. This make sure that things are all right,
> - * and it's fast anyway...
> - * By the way, this function will work for both type of dongles,
> - * because the additional speed is at the end of the sequence...
> - */
> -static int actisys_change_speed(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - __u32 speed = (__u32) task->param; /* Target speed */
> - int ret = 0;
> - int i = 0;
> -
> - IRDA_DEBUG(4, "%s(), speed=%d (was %d)\n", __FUNCTION__, speed,
> - self->speed);
> -
> - /* Go to a known state by reseting the dongle */
> -
> - /* Reset the dongle : set DTR low for 10 us */
> - self->set_dtr_rts(self->dev, FALSE, TRUE);
> - udelay(MIN_DELAY);
> -
> - /* Go back to normal mode (we are now at 9600 b/s) */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - /*
> - * Now, we can set the speed requested. Send RTS pulses until we
> - * reach the target speed
> - */
> - for (i=0; i<MAX_SPEEDS; i++) {
> - if (speed == baud_rates[i]) {
> - self->speed = baud_rates[i];
> - break;
> - }
> - /* Make sure previous pulse is finished */
> - udelay(MIN_DELAY);
> -
> - /* Set RTS low for 10 us */
> - self->set_dtr_rts(self->dev, TRUE, FALSE);
> - udelay(MIN_DELAY);
> -
> - /* Set RTS high for 10 us */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> - }
> -
> - /* Check if life is sweet... */
> - if (i >= MAX_SPEEDS)
> - ret = -1; /* This should not happen */
> -
> - /* Basta lavoro, on se casse d'ici... */
> - irda_task_next_state(task, IRDA_TASK_DONE);
> -
> - return ret;
> -}
> -
> -/*
> - * Function actisys_reset (task)
> - *
> - * Reset the Actisys type dongle. Warning, this function must only be
> - * called with a process context!
> - *
> - * We need to do two things in this function :
> - * o first make sure that the dongle is in a state where it can operate
> - * o second put the dongle in a know state
> - *
> - * The dongle is powered of the RTS and DTR lines. In the dongle, there
> - * is a big capacitor to accommodate the current spikes. This capacitor
> - * takes a least 50 ms to be charged. In theory, the Bios set those lines
> - * up, so by the time we arrive here we should be set. It doesn't hurt
> - * to be on the conservative side, so we will wait...
> - * Then, we set the speed to 9600 b/s to get in a known state (see in
> - * change_speed for details). It is needed because the IrDA stack
> - * has tried to set the speed immediately after our first return,
> - * so before we can be sure the dongle is up and running.
> - */
> -static int actisys_reset(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - int ret = 0;
> -
> - IRDA_ASSERT(task != NULL, return -1;);
> -
> - self->reset_task = task;
> -
> - switch (task->state) {
> - case IRDA_TASK_INIT:
> - /* Set both DTR & RTS to power up the dongle */
> - /* In theory redundant with power up in actisys_open() */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - /* Sleep 50 ms to make sure capacitor is charged */
> - ret = msecs_to_jiffies(50);
> - irda_task_next_state(task, IRDA_TASK_WAIT);
> - break;
> - case IRDA_TASK_WAIT:
> - /* Reset the dongle : set DTR low for 10 us */
> - self->set_dtr_rts(self->dev, FALSE, TRUE);
> - udelay(MIN_DELAY);
> -
> - /* Go back to normal mode */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->reset_task = NULL;
> - self->speed = 9600; /* That's the default */
> - break;
> - default:
> - IRDA_ERROR("%s(), unknown state %d\n",
> - __FUNCTION__, task->state);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->reset_task = NULL;
> - ret = -1;
> - break;
> - }
> - return ret;
> -}
> -
> -MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no> - Jean Tourrilhes <jt@hpl.hp.com>");
> -MODULE_DESCRIPTION("ACTiSYS IR-220L and IR-220L+ dongle driver");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("irda-dongle-2"); /* IRDA_ACTISYS_DONGLE */
> -MODULE_ALIAS("irda-dongle-3"); /* IRDA_ACTISYS_PLUS_DONGLE */
> -
> -
> -/*
> - * Function init_module (void)
> - *
> - * Initialize Actisys module
> - *
> - */
> -module_init(actisys_init);
> -
> -/*
> - * Function cleanup_module (void)
> - *
> - * Cleanup Actisys module
> - *
> - */
> -module_exit(actisys_cleanup);
> diff --git a/drivers/net/irda/ep7211_ir.c b/drivers/net/irda/ep7211_ir.c
> deleted file mode 100644
> index 4cba38f..0000000
> --- a/drivers/net/irda/ep7211_ir.c
> +++ /dev/null
> @@ -1,125 +0,0 @@
> -/*
> - * IR port driver for the Cirrus Logic EP7211 processor.
> - *
> - * Copyright 2001, Blue Mug Inc. All rights reserved.
> - */
> -
> -#include <linux/module.h>
> -#include <linux/delay.h>
> -#include <linux/tty.h>
> -#include <linux/init.h>
> -#include <linux/spinlock.h>
> -
> -#include <net/irda/irda.h>
> -#include <net/irda/irda_device.h>
> -
> -#include <asm/io.h>
> -#include <asm/hardware.h>
> -
> -#define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */
> -#define MAX_DELAY 10000 /* 1 ms */
> -
> -static void ep7211_ir_open(dongle_t *self, struct qos_info *qos);
> -static void ep7211_ir_close(dongle_t *self);
> -static int ep7211_ir_change_speed(struct irda_task *task);
> -static int ep7211_ir_reset(struct irda_task *task);
> -
> -static DEFINE_SPINLOCK(ep7211_lock);
> -
> -static struct dongle_reg dongle = {
> - .type = IRDA_EP7211_IR,
> - .open = ep7211_ir_open,
> - .close = ep7211_ir_close,
> - .reset = ep7211_ir_reset,
> - .change_speed = ep7211_ir_change_speed,
> - .owner = THIS_MODULE,
> -};
> -
> -static void ep7211_ir_open(dongle_t *self, struct qos_info *qos)
> -{
> - unsigned int syscon1, flags;
> -
> - spin_lock_irqsave(&ep7211_lock, flags);
> -
> - /* Turn on the SIR encoder. */
> - syscon1 = clps_readl(SYSCON1);
> - syscon1 |= SYSCON1_SIREN;
> - clps_writel(syscon1, SYSCON1);
> -
> - /* XXX: We should disable modem status interrupts on the first
> - UART (interrupt #14). */
> -
> - spin_unlock_irqrestore(&ep7211_lock, flags);
> -}
> -
> -static void ep7211_ir_close(dongle_t *self)
> -{
> - unsigned int syscon1, flags;
> -
> - spin_lock_irqsave(&ep7211_lock, flags);
> -
> - /* Turn off the SIR encoder. */
> - syscon1 = clps_readl(SYSCON1);
> - syscon1 &= ~SYSCON1_SIREN;
> - clps_writel(syscon1, SYSCON1);
> -
> - /* XXX: If we've disabled the modem status interrupts, we should
> - reset them back to their original state. */
> -
> - spin_unlock_irqrestore(&ep7211_lock, flags);
> -}
> -
> -/*
> - * Function ep7211_ir_change_speed (task)
> - *
> - * Change speed of the EP7211 I/R port. We don't really have to do anything
> - * for the EP7211 as long as the rate is being changed at the serial port
> - * level.
> - */
> -static int ep7211_ir_change_speed(struct irda_task *task)
> -{
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - return 0;
> -}
> -
> -/*
> - * Function ep7211_ir_reset (task)
> - *
> - * Reset the EP7211 I/R. We don't really have to do anything.
> - *
> - */
> -static int ep7211_ir_reset(struct irda_task *task)
> -{
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - return 0;
> -}
> -
> -/*
> - * Function ep7211_ir_init(void)
> - *
> - * Initialize EP7211 I/R module
> - *
> - */
> -static int __init ep7211_ir_init(void)
> -{
> - return irda_device_register_dongle(&dongle);
> -}
> -
> -/*
> - * Function ep7211_ir_cleanup(void)
> - *
> - * Cleanup EP7211 I/R module
> - *
> - */
> -static void __exit ep7211_ir_cleanup(void)
> -{
> - irda_device_unregister_dongle(&dongle);
> -}
> -
> -MODULE_AUTHOR("Jon McClintock <jonm@bluemug.com>");
> -MODULE_DESCRIPTION("EP7211 I/R driver");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("irda-dongle-8"); /* IRDA_EP7211_IR */
> -
> -module_init(ep7211_ir_init);
> -module_exit(ep7211_ir_cleanup);
> diff --git a/drivers/net/irda/esi.c b/drivers/net/irda/esi.c
> deleted file mode 100644
> index d3a61af..0000000
> --- a/drivers/net/irda/esi.c
> +++ /dev/null
> @@ -1,149 +0,0 @@
> -/*********************************************************************
> - *
> - * Filename: esi.c
> - * Version: 1.5
> - * Description: Driver for the Extended Systems JetEye PC dongle
> - * Status: Experimental.
> - * Author: Dag Brattli <dagb@cs.uit.no>
> - * Created at: Sat Feb 21 18:54:38 1998
> - * Modified at: Fri Dec 17 09:14:04 1999
> - * Modified by: Dag Brattli <dagb@cs.uit.no>
> - *
> - * Copyright (c) 1999 Dag Brattli, <dagb@cs.uit.no>,
> - * Copyright (c) 1998 Thomas Davis, <ratbert@radiks.net>,
> - * All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> - * MA 02111-1307 USA
> - *
> - ********************************************************************/
> -
> -#include <linux/module.h>
> -#include <linux/delay.h>
> -#include <linux/tty.h>
> -#include <linux/init.h>
> -
> -#include <net/irda/irda.h>
> -#include <net/irda/irda_device.h>
> -
> -static void esi_open(dongle_t *self, struct qos_info *qos);
> -static void esi_close(dongle_t *self);
> -static int esi_change_speed(struct irda_task *task);
> -static int esi_reset(struct irda_task *task);
> -
> -static struct dongle_reg dongle = {
> - .type = IRDA_ESI_DONGLE,
> - .open = esi_open,
> - .close = esi_close,
> - .reset = esi_reset,
> - .change_speed = esi_change_speed,
> - .owner = THIS_MODULE,
> -};
> -
> -static int __init esi_init(void)
> -{
> - return irda_device_register_dongle(&dongle);
> -}
> -
> -static void __exit esi_cleanup(void)
> -{
> - irda_device_unregister_dongle(&dongle);
> -}
> -
> -static void esi_open(dongle_t *self, struct qos_info *qos)
> -{
> - qos->baud_rate.bits &= IR_9600|IR_19200|IR_115200;
> - qos->min_turn_time.bits = 0x01; /* Needs at least 10 ms */
> -}
> -
> -static void esi_close(dongle_t *dongle)
> -{
> - /* Power off dongle */
> - dongle->set_dtr_rts(dongle->dev, FALSE, FALSE);
> -}
> -
> -/*
> - * Function esi_change_speed (task)
> - *
> - * Set the speed for the Extended Systems JetEye PC ESI-9680 type dongle
> - *
> - */
> -static int esi_change_speed(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - __u32 speed = (__u32) task->param;
> - int dtr, rts;
> -
> - switch (speed) {
> - case 19200:
> - dtr = TRUE;
> - rts = FALSE;
> - break;
> - case 115200:
> - dtr = rts = TRUE;
> - break;
> - case 9600:
> - default:
> - dtr = FALSE;
> - rts = TRUE;
> - break;
> - }
> -
> - /* Change speed of dongle */
> - self->set_dtr_rts(self->dev, dtr, rts);
> - self->speed = speed;
> -
> - irda_task_next_state(task, IRDA_TASK_DONE);
> -
> - return 0;
> -}
> -
> -/*
> - * Function esi_reset (task)
> - *
> - * Reset dongle;
> - *
> - */
> -static int esi_reset(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> -
> - self->set_dtr_rts(self->dev, FALSE, FALSE);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> -
> - return 0;
> -}
> -
> -MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
> -MODULE_DESCRIPTION("Extended Systems JetEye PC dongle driver");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("irda-dongle-1"); /* IRDA_ESI_DONGLE */
> -
> -/*
> - * Function init_module (void)
> - *
> - * Initialize ESI module
> - *
> - */
> -module_init(esi_init);
> -
> -/*
> - * Function cleanup_module (void)
> - *
> - * Cleanup ESI module
> - *
> - */
> -module_exit(esi_cleanup);
> -
> diff --git a/drivers/net/irda/girbil.c b/drivers/net/irda/girbil.c
> deleted file mode 100644
> index 1f57391..0000000
> --- a/drivers/net/irda/girbil.c
> +++ /dev/null
> @@ -1,250 +0,0 @@
> -/*********************************************************************
> - *
> - * Filename: girbil.c
> - * Version: 1.2
> - * Description: Implementation for the Greenwich GIrBIL dongle
> - * Status: Experimental.
> - * Author: Dag Brattli <dagb@cs.uit.no>
> - * Created at: Sat Feb 6 21:02:33 1999
> - * Modified at: Fri Dec 17 09:13:20 1999
> - * Modified by: Dag Brattli <dagb@cs.uit.no>
> - *
> - * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - * Neither Dag Brattli nor University of Tromsø admit liability nor
> - * provide warranty for any of this software. This material is
> - * provided "AS-IS" and at no charge.
> - *
> - ********************************************************************/
> -
> -#include <linux/module.h>
> -#include <linux/delay.h>
> -#include <linux/tty.h>
> -#include <linux/init.h>
> -
> -#include <net/irda/irda.h>
> -#include <net/irda/irda_device.h>
> -
> -static int girbil_reset(struct irda_task *task);
> -static void girbil_open(dongle_t *self, struct qos_info *qos);
> -static void girbil_close(dongle_t *self);
> -static int girbil_change_speed(struct irda_task *task);
> -
> -/* Control register 1 */
> -#define GIRBIL_TXEN 0x01 /* Enable transmitter */
> -#define GIRBIL_RXEN 0x02 /* Enable receiver */
> -#define GIRBIL_ECAN 0x04 /* Cancel self emmited data */
> -#define GIRBIL_ECHO 0x08 /* Echo control characters */
> -
> -/* LED Current Register (0x2) */
> -#define GIRBIL_HIGH 0x20
> -#define GIRBIL_MEDIUM 0x21
> -#define GIRBIL_LOW 0x22
> -
> -/* Baud register (0x3) */
> -#define GIRBIL_2400 0x30
> -#define GIRBIL_4800 0x31
> -#define GIRBIL_9600 0x32
> -#define GIRBIL_19200 0x33
> -#define GIRBIL_38400 0x34
> -#define GIRBIL_57600 0x35
> -#define GIRBIL_115200 0x36
> -
> -/* Mode register (0x4) */
> -#define GIRBIL_IRDA 0x40
> -#define GIRBIL_ASK 0x41
> -
> -/* Control register 2 (0x5) */
> -#define GIRBIL_LOAD 0x51 /* Load the new baud rate value */
> -
> -static struct dongle_reg dongle = {
> - .type = IRDA_GIRBIL_DONGLE,
> - .open = girbil_open,
> - .close = girbil_close,
> - .reset = girbil_reset,
> - .change_speed = girbil_change_speed,
> - .owner = THIS_MODULE,
> -};
> -
> -static int __init girbil_init(void)
> -{
> - return irda_device_register_dongle(&dongle);
> -}
> -
> -static void __exit girbil_cleanup(void)
> -{
> - irda_device_unregister_dongle(&dongle);
> -}
> -
> -static void girbil_open(dongle_t *self, struct qos_info *qos)
> -{
> - qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
> - qos->min_turn_time.bits = 0x03;
> -}
> -
> -static void girbil_close(dongle_t *self)
> -{
> - /* Power off dongle */
> - self->set_dtr_rts(self->dev, FALSE, FALSE);
> -}
> -
> -/*
> - * Function girbil_change_speed (dev, speed)
> - *
> - * Set the speed for the Girbil type dongle.
> - *
> - */
> -static int girbil_change_speed(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - __u32 speed = (__u32) task->param;
> - __u8 control[2];
> - int ret = 0;
> -
> - self->speed_task = task;
> -
> - switch (task->state) {
> - case IRDA_TASK_INIT:
> - /* Need to reset the dongle and go to 9600 bps before
> - programming */
> - if (irda_task_execute(self, girbil_reset, NULL, task,
> - (void *) speed))
> - {
> - /* Dongle need more time to reset */
> - irda_task_next_state(task, IRDA_TASK_CHILD_WAIT);
> -
> - /* Give reset 1 sec to finish */
> - ret = msecs_to_jiffies(1000);
> - }
> - break;
> - case IRDA_TASK_CHILD_WAIT:
> - IRDA_WARNING("%s(), resetting dongle timed out!\n",
> - __FUNCTION__);
> - ret = -1;
> - break;
> - case IRDA_TASK_CHILD_DONE:
> - /* Set DTR and Clear RTS to enter command mode */
> - self->set_dtr_rts(self->dev, FALSE, TRUE);
> -
> - switch (speed) {
> - case 9600:
> - default:
> - control[0] = GIRBIL_9600;
> - break;
> - case 19200:
> - control[0] = GIRBIL_19200;
> - break;
> - case 34800:
> - control[0] = GIRBIL_38400;
> - break;
> - case 57600:
> - control[0] = GIRBIL_57600;
> - break;
> - case 115200:
> - control[0] = GIRBIL_115200;
> - break;
> - }
> - control[1] = GIRBIL_LOAD;
> -
> - /* Write control bytes */
> - self->write(self->dev, control, 2);
> - irda_task_next_state(task, IRDA_TASK_WAIT);
> - ret = msecs_to_jiffies(100);
> - break;
> - case IRDA_TASK_WAIT:
> - /* Go back to normal mode */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->speed_task = NULL;
> - break;
> - default:
> - IRDA_ERROR("%s(), unknown state %d\n",
> - __FUNCTION__, task->state);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->speed_task = NULL;
> - ret = -1;
> - break;
> - }
> - return ret;
> -}
> -
> -/*
> - * Function girbil_reset (driver)
> - *
> - * This function resets the girbil dongle.
> - *
> - * Algorithm:
> - * 0. set RTS, and wait at least 5 ms
> - * 1. clear RTS
> - */
> -static int girbil_reset(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - __u8 control = GIRBIL_TXEN | GIRBIL_RXEN;
> - int ret = 0;
> -
> - self->reset_task = task;
> -
> - switch (task->state) {
> - case IRDA_TASK_INIT:
> - /* Reset dongle */
> - self->set_dtr_rts(self->dev, TRUE, FALSE);
> - irda_task_next_state(task, IRDA_TASK_WAIT1);
> - /* Sleep at least 5 ms */
> - ret = msecs_to_jiffies(20);
> - break;
> - case IRDA_TASK_WAIT1:
> - /* Set DTR and clear RTS to enter command mode */
> - self->set_dtr_rts(self->dev, FALSE, TRUE);
> - irda_task_next_state(task, IRDA_TASK_WAIT2);
> - ret = msecs_to_jiffies(20);
> - break;
> - case IRDA_TASK_WAIT2:
> - /* Write control byte */
> - self->write(self->dev, &control, 1);
> - irda_task_next_state(task, IRDA_TASK_WAIT3);
> - ret = msecs_to_jiffies(20);
> - break;
> - case IRDA_TASK_WAIT3:
> - /* Go back to normal mode */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->reset_task = NULL;
> - break;
> - default:
> - IRDA_ERROR("%s(), unknown state %d\n",
> - __FUNCTION__, task->state);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->reset_task = NULL;
> - ret = -1;
> - break;
> - }
> - return ret;
> -}
> -
> -MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
> -MODULE_DESCRIPTION("Greenwich GIrBIL dongle driver");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("irda-dongle-4"); /* IRDA_GIRBIL_DONGLE */
> -
> -/*
> - * Function init_module (void)
> - *
> - * Initialize Girbil module
> - *
> - */
> -module_init(girbil_init);
> -
> -/*
> - * Function cleanup_module (void)
> - *
> - * Cleanup Girbil module
> - *
> - */
> -module_exit(girbil_cleanup);
> -
> diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c
> deleted file mode 100644
> index c79caa5..0000000
> --- a/drivers/net/irda/irport.c
> +++ /dev/null
> @@ -1,1123 +0,0 @@
> -/*********************************************************************
> - *
> - * Filename: irport.c
> - * Version: 1.0
> - * Description: Half duplex serial port SIR driver for IrDA.
> - * Status: Experimental.
> - * Author: Dag Brattli <dagb@cs.uit.no>
> - * Created at: Sun Aug 3 13:49:59 1997
> - * Modified at: Fri Jan 28 20:22:38 2000
> - * Modified by: Dag Brattli <dagb@cs.uit.no>
> - * Sources: serial.c by Linus Torvalds
> - *
> - * Copyright (c) 1997, 1998, 1999-2000 Dag Brattli, All Rights Reserved.
> - * Copyright (c) 2000-2003 Jean Tourrilhes, All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> - * MA 02111-1307 USA
> - *
> - * This driver is ment to be a small half duplex serial driver to be
> - * used for IR-chipsets that has a UART (16550) compatibility mode.
> - * Eventually it will replace irtty, because of irtty has some
> - * problems that is hard to get around when we don't have control
> - * over the serial driver. This driver may also be used by FIR
> - * drivers to handle SIR mode for them.
> - *
> - ********************************************************************/
> -
> -#include <linux/module.h>
> -
> -#include <linux/kernel.h>
> -#include <linux/types.h>
> -#include <linux/ioport.h>
> -#include <linux/slab.h>
> -#include <linux/string.h>
> -#include <linux/skbuff.h>
> -#include <linux/serial_reg.h>
> -#include <linux/errno.h>
> -#include <linux/init.h>
> -#include <linux/spinlock.h>
> -#include <linux/delay.h>
> -#include <linux/rtnetlink.h>
> -#include <linux/bitops.h>
> -
> -#include <asm/system.h>
> -#include <asm/io.h>
> -
> -#include <net/irda/irda.h>
> -#include <net/irda/wrapper.h>
> -#include "irport.h"
> -
> -#define IO_EXTENT 8
> -
> -/*
> - * Currently you'll need to set these values using insmod like this:
> - * insmod irport io=0x3e8 irq=11
> - */
> -static unsigned int io[] = { ~0, ~0, ~0, ~0 };
> -static unsigned int irq[] = { 0, 0, 0, 0 };
> -
> -static unsigned int qos_mtt_bits = 0x03;
> -
> -static struct irport_cb *dev_self[] = { NULL, NULL, NULL, NULL};
> -static char *driver_name = "irport";
> -
> -static inline void irport_write_wakeup(struct irport_cb *self);
> -static inline int irport_write(int iobase, int fifo_size, __u8 *buf, int len);
> -static inline void irport_receive(struct irport_cb *self);
> -
> -static int irport_net_ioctl(struct net_device *dev, struct ifreq *rq,
> - int cmd);
> -static inline int irport_is_receiving(struct irport_cb *self);
> -static int irport_set_dtr_rts(struct net_device *dev, int dtr, int rts);
> -static int irport_raw_write(struct net_device *dev, __u8 *buf, int len);
> -static struct net_device_stats *irport_net_get_stats(struct net_device *dev);
> -static int irport_change_speed_complete(struct irda_task *task);
> -static void irport_timeout(struct net_device *dev);
> -
> -static irqreturn_t irport_interrupt(int irq, void *dev_id);
> -static int irport_hard_xmit(struct sk_buff *skb, struct net_device *dev);
> -static void irport_change_speed(void *priv, __u32 speed);
> -static int irport_net_open(struct net_device *dev);
> -static int irport_net_close(struct net_device *dev);
> -
> -static struct irport_cb *
> -irport_open(int i, unsigned int iobase, unsigned int irq)
> -{
> - struct net_device *dev;
> - struct irport_cb *self;
> -
> - IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
> -
> - /* Lock the port that we need */
> - if (!request_region(iobase, IO_EXTENT, driver_name)) {
> - IRDA_DEBUG(0, "%s(), can't get iobase of 0x%03x\n",
> - __FUNCTION__, iobase);
> - goto err_out1;
> - }
> -
> - /*
> - * Allocate new instance of the driver
> - */
> - dev = alloc_irdadev(sizeof(struct irport_cb));
> - if (!dev) {
> - IRDA_ERROR("%s(), can't allocate memory for "
> - "irda device!\n", __FUNCTION__);
> - goto err_out2;
> - }
> -
> - self = dev->priv;
> - spin_lock_init(&self->lock);
> -
> - /* Need to store self somewhere */
> - dev_self[i] = self;
> - self->priv = self;
> - self->index = i;
> -
> - /* Initialize IO */
> - self->io.sir_base = iobase;
> - self->io.sir_ext = IO_EXTENT;
> - self->io.irq = irq;
> - self->io.fifo_size = 16; /* 16550A and compatible */
> -
> - /* Initialize QoS for this device */
> - irda_init_max_qos_capabilies(&self->qos);
> -
> - self->qos.baud_rate.bits = IR_9600|IR_19200|IR_38400|IR_57600|
> - IR_115200;
> -
> - self->qos.min_turn_time.bits = qos_mtt_bits;
> - irda_qos_bits_to_value(&self->qos);
> -
> - /* Bootstrap ZeroCopy Rx */
> - self->rx_buff.truesize = IRDA_SKB_MAX_MTU;
> - self->rx_buff.skb = __dev_alloc_skb(self->rx_buff.truesize,
> - GFP_KERNEL);
> - if (self->rx_buff.skb == NULL) {
> - IRDA_ERROR("%s(), can't allocate memory for "
> - "receive buffer!\n", __FUNCTION__);
> - goto err_out3;
> - }
> - skb_reserve(self->rx_buff.skb, 1);
> - self->rx_buff.head = self->rx_buff.skb->data;
> - /* No need to memset the buffer, unless you are really pedantic */
> -
> - /* Finish setup the Rx buffer descriptor */
> - self->rx_buff.in_frame = FALSE;
> - self->rx_buff.state = OUTSIDE_FRAME;
> - self->rx_buff.data = self->rx_buff.head;
> -
> - /* Specify how much memory we want */
> - self->tx_buff.truesize = 4000;
> -
> - /* Allocate memory if needed */
> - if (self->tx_buff.truesize > 0) {
> - self->tx_buff.head = kzalloc(self->tx_buff.truesize,
> - GFP_KERNEL);
> - if (self->tx_buff.head == NULL) {
> - IRDA_ERROR("%s(), can't allocate memory for "
> - "transmit buffer!\n", __FUNCTION__);
> - goto err_out4;
> - }
> - }
> - self->tx_buff.data = self->tx_buff.head;
> -
> - self->netdev = dev;
> -
> - /* May be overridden by piggyback drivers */
> - self->interrupt = irport_interrupt;
> - self->change_speed = irport_change_speed;
> -
> - /* Override the network functions we need to use */
> - dev->hard_start_xmit = irport_hard_xmit;
> - dev->tx_timeout = irport_timeout;
> - dev->watchdog_timeo = HZ; /* Allow time enough for speed change */
> - dev->open = irport_net_open;
> - dev->stop = irport_net_close;
> - dev->get_stats = irport_net_get_stats;
> - dev->do_ioctl = irport_net_ioctl;
> -
> - /* Make ifconfig display some details */
> - dev->base_addr = iobase;
> - dev->irq = irq;
> -
> - if (register_netdev(dev)) {
> - IRDA_ERROR("%s(), register_netdev() failed!\n", __FUNCTION__);
> - goto err_out5;
> - }
> - IRDA_MESSAGE("IrDA: Registered device %s (irport io=0x%X irq=%d)\n",
> - dev->name, iobase, irq);
> -
> - return self;
> - err_out5:
> - kfree(self->tx_buff.head);
> - err_out4:
> - kfree_skb(self->rx_buff.skb);
> - err_out3:
> - free_netdev(dev);
> - dev_self[i] = NULL;
> - err_out2:
> - release_region(iobase, IO_EXTENT);
> - err_out1:
> - return NULL;
> -}
> -
> -static int irport_close(struct irport_cb *self)
> -{
> - IRDA_ASSERT(self != NULL, return -1;);
> -
> - /* We are not using any dongle anymore! */
> - if (self->dongle)
> - irda_device_dongle_cleanup(self->dongle);
> - self->dongle = NULL;
> -
> - /* Remove netdevice */
> - unregister_netdev(self->netdev);
> -
> - /* Release the IO-port that this driver is using */
> - IRDA_DEBUG(0 , "%s(), Releasing Region %03x\n",
> - __FUNCTION__, self->io.sir_base);
> - release_region(self->io.sir_base, self->io.sir_ext);
> -
> - kfree(self->tx_buff.head);
> -
> - if (self->rx_buff.skb)
> - kfree_skb(self->rx_buff.skb);
> - self->rx_buff.skb = NULL;
> -
> - /* Remove ourselves */
> - dev_self[self->index] = NULL;
> - free_netdev(self->netdev);
> -
> - return 0;
> -}
> -
> -static void irport_stop(struct irport_cb *self)
> -{
> - int iobase;
> -
> - iobase = self->io.sir_base;
> -
> - /* We can't lock, we may be called from a FIR driver - Jean II */
> -
> - /* We are not transmitting any more */
> - self->transmitting = 0;
> -
> - /* Reset UART */
> - outb(0, iobase+UART_MCR);
> -
> - /* Turn off interrupts */
> - outb(0, iobase+UART_IER);
> -}
> -
> -static void irport_start(struct irport_cb *self)
> -{
> - int iobase;
> -
> - iobase = self->io.sir_base;
> -
> - irport_stop(self);
> -
> - /* We can't lock, we may be called from a FIR driver - Jean II */
> -
> - /* Initialize UART */
> - outb(UART_LCR_WLEN8, iobase+UART_LCR); /* Reset DLAB */
> - outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
> -
> - /* Turn on interrups */
> - outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, iobase+UART_IER);
> -}
> -
> -/*
> - * Function irport_get_fcr (speed)
> - *
> - * Compute value of fcr
> - *
> - */
> -static inline unsigned int irport_get_fcr(__u32 speed)
> -{
> - unsigned int fcr; /* FIFO control reg */
> -
> - /* Enable fifos */
> - fcr = UART_FCR_ENABLE_FIFO;
> -
> - /*
> - * Use trigger level 1 to avoid 3 ms. timeout delay at 9600 bps, and
> - * almost 1,7 ms at 19200 bps. At speeds above that we can just forget
> - * about this timeout since it will always be fast enough.
> - */
> - if (speed < 38400)
> - fcr |= UART_FCR_TRIGGER_1;
> - else
> - //fcr |= UART_FCR_TRIGGER_14;
> - fcr |= UART_FCR_TRIGGER_8;
> -
> - return(fcr);
> -}
> -
> -/*
> - * Function irport_change_speed (self, speed)
> - *
> - * Set speed of IrDA port to specified baudrate
> - *
> - * This function should be called with irq off and spin-lock.
> - */
> -static void irport_change_speed(void *priv, __u32 speed)
> -{
> - struct irport_cb *self = (struct irport_cb *) priv;
> - int iobase;
> - unsigned int fcr; /* FIFO control reg */
> - unsigned int lcr; /* Line control reg */
> - int divisor;
> -
> - IRDA_ASSERT(self != NULL, return;);
> - IRDA_ASSERT(speed != 0, return;);
> -
> - IRDA_DEBUG(1, "%s(), Setting speed to: %d - iobase=%#x\n",
> - __FUNCTION__, speed, self->io.sir_base);
> -
> - /* We can't lock, we may be called from a FIR driver - Jean II */
> -
> - iobase = self->io.sir_base;
> -
> - /* Update accounting for new speed */
> - self->io.speed = speed;
> -
> - /* Turn off interrupts */
> - outb(0, iobase+UART_IER);
> -
> - divisor = SPEED_MAX/speed;
> -
> - /* Get proper fifo configuration */
> - fcr = irport_get_fcr(speed);
> -
> - /* IrDA ports use 8N1 */
> - lcr = UART_LCR_WLEN8;
> -
> - outb(UART_LCR_DLAB | lcr, iobase+UART_LCR); /* Set DLAB */
> - outb(divisor & 0xff, iobase+UART_DLL); /* Set speed */
> - outb(divisor >> 8, iobase+UART_DLM);
> - outb(lcr, iobase+UART_LCR); /* Set 8N1 */
> - outb(fcr, iobase+UART_FCR); /* Enable FIFO's */
> -
> - /* Turn on interrups */
> - /* This will generate a fatal interrupt storm.
> - * People calling us will do that properly - Jean II */
> - //outb(/*UART_IER_RLSI|*/UART_IER_RDI/*|UART_IER_THRI*/, iobase+UART_IER);
> -}
> -
> -/*
> - * Function __irport_change_speed (instance, state, param)
> - *
> - * State machine for changing speed of the device. We do it this way since
> - * we cannot use schedule_timeout() when we are in interrupt context
> - *
> - */
> -static int __irport_change_speed(struct irda_task *task)
> -{
> - struct irport_cb *self;
> - __u32 speed = (__u32) task->param;
> - unsigned long flags = 0;
> - int wasunlocked = 0;
> - int ret = 0;
> -
> - IRDA_DEBUG(2, "%s(), <%ld>\n", __FUNCTION__, jiffies);
> -
> - self = (struct irport_cb *) task->instance;
> -
> - IRDA_ASSERT(self != NULL, return -1;);
> -
> - /* Locking notes : this function may be called from irq context with
> - * spinlock, via irport_write_wakeup(), or from non-interrupt without
> - * spinlock (from the task timer). Yuck !
> - * This is ugly, and unsafe is the spinlock is not already acquired.
> - * This will be fixed when irda-task get rewritten.
> - * Jean II */
> - if (!spin_is_locked(&self->lock)) {
> - spin_lock_irqsave(&self->lock, flags);
> - wasunlocked = 1;
> - }
> -
> - switch (task->state) {
> - case IRDA_TASK_INIT:
> - case IRDA_TASK_WAIT:
> - /* Are we ready to change speed yet? */
> - if (self->tx_buff.len > 0) {
> - task->state = IRDA_TASK_WAIT;
> -
> - /* Try again later */
> - ret = msecs_to_jiffies(20);
> - break;
> - }
> -
> - if (self->dongle)
> - irda_task_next_state(task, IRDA_TASK_CHILD_INIT);
> - else
> - irda_task_next_state(task, IRDA_TASK_CHILD_DONE);
> - break;
> - case IRDA_TASK_CHILD_INIT:
> - /* Go to default speed */
> - self->change_speed(self->priv, 9600);
> -
> - /* Change speed of dongle */
> - if (irda_task_execute(self->dongle,
> - self->dongle->issue->change_speed,
> - NULL, task, (void *) speed))
> - {
> - /* Dongle need more time to change its speed */
> - irda_task_next_state(task, IRDA_TASK_CHILD_WAIT);
> -
> - /* Give dongle 1 sec to finish */
> - ret = msecs_to_jiffies(1000);
> - } else
> - /* Child finished immediately */
> - irda_task_next_state(task, IRDA_TASK_CHILD_DONE);
> - break;
> - case IRDA_TASK_CHILD_WAIT:
> - IRDA_WARNING("%s(), changing speed of dongle timed out!\n", __FUNCTION__);
> - ret = -1;
> - break;
> - case IRDA_TASK_CHILD_DONE:
> - /* Finally we are ready to change the speed */
> - self->change_speed(self->priv, speed);
> -
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - break;
> - default:
> - IRDA_ERROR("%s(), unknown state %d\n",
> - __FUNCTION__, task->state);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - ret = -1;
> - break;
> - }
> - /* Put stuff in the state we found them - Jean II */
> - if(wasunlocked) {
> - spin_unlock_irqrestore(&self->lock, flags);
> - }
> -
> - return ret;
> -}
> -
> -/*
> - * Function irport_change_speed_complete (task)
> - *
> - * Called when the change speed operation completes
> - *
> - */
> -static int irport_change_speed_complete(struct irda_task *task)
> -{
> - struct irport_cb *self;
> -
> - IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
> -
> - self = (struct irport_cb *) task->instance;
> -
> - IRDA_ASSERT(self != NULL, return -1;);
> - IRDA_ASSERT(self->netdev != NULL, return -1;);
> -
> - /* Finished changing speed, so we are not busy any longer */
> - /* Signal network layer so it can try to send the frame */
> -
> - netif_wake_queue(self->netdev);
> -
> - return 0;
> -}
> -
> -/*
> - * Function irport_timeout (struct net_device *dev)
> - *
> - * The networking layer thinks we timed out.
> - *
> - */
> -
> -static void irport_timeout(struct net_device *dev)
> -{
> - struct irport_cb *self;
> - int iobase;
> - int iir, lsr;
> - unsigned long flags;
> -
> - self = (struct irport_cb *) dev->priv;
> - IRDA_ASSERT(self != NULL, return;);
> - iobase = self->io.sir_base;
> -
> - IRDA_WARNING("%s: transmit timed out, jiffies = %ld, trans_start = %ld\n",
> - dev->name, jiffies, dev->trans_start);
> - spin_lock_irqsave(&self->lock, flags);
> -
> - /* Debug what's happening... */
> -
> - /* Get interrupt status */
> - lsr = inb(iobase+UART_LSR);
> - /* Read interrupt register */
> - iir = inb(iobase+UART_IIR);
> - IRDA_DEBUG(0, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n",
> - __FUNCTION__, iir, lsr, iobase);
> -
> - IRDA_DEBUG(0, "%s(), transmitting=%d, remain=%d, done=%td\n",
> - __FUNCTION__, self->transmitting, self->tx_buff.len,
> - self->tx_buff.data - self->tx_buff.head);
> -
> - /* Now, restart the port */
> - irport_start(self);
> - self->change_speed(self->priv, self->io.speed);
> - /* This will re-enable irqs */
> - outb(/*UART_IER_RLSI|*/UART_IER_RDI/*|UART_IER_THRI*/, iobase+UART_IER);
> - dev->trans_start = jiffies;
> - spin_unlock_irqrestore(&self->lock, flags);
> -
> - netif_wake_queue(dev);
> -}
> -
> -/*
> - * Function irport_wait_hw_transmitter_finish ()
> - *
> - * Wait for the real end of HW transmission
> - *
> - * The UART is a strict FIFO, and we get called only when we have finished
> - * pushing data to the FIFO, so the maximum amount of time we must wait
> - * is only for the FIFO to drain out.
> - *
> - * We use a simple calibrated loop. We may need to adjust the loop
> - * delay (udelay) to balance I/O traffic and latency. And we also need to
> - * adjust the maximum timeout.
> - * It would probably be better to wait for the proper interrupt,
> - * but it doesn't seem to be available.
> - *
> - * We can't use jiffies or kernel timers because :
> - * 1) We are called from the interrupt handler, which disable softirqs,
> - * so jiffies won't be increased
> - * 2) Jiffies granularity is usually very coarse (10ms), and we don't
> - * want to wait that long to detect stuck hardware.
> - * Jean II
> - */
> -
> -static void irport_wait_hw_transmitter_finish(struct irport_cb *self)
> -{
> - int iobase;
> - int count = 1000; /* 1 ms */
> -
> - iobase = self->io.sir_base;
> -
> - /* Calibrated busy loop */
> - while((count-- > 0) && !(inb(iobase+UART_LSR) & UART_LSR_TEMT))
> - udelay(1);
> -
> - if(count == 0)
> - IRDA_DEBUG(0, "%s(): stuck transmitter\n", __FUNCTION__);
> -}
> -
> -/*
> - * Function irport_hard_start_xmit (struct sk_buff *skb, struct net_device *dev)
> - *
> - * Transmits the current frame until FIFO is full, then
> - * waits until the next transmitt interrupt, and continues until the
> - * frame is transmitted.
> - */
> -static int irport_hard_xmit(struct sk_buff *skb, struct net_device *dev)
> -{
> - struct irport_cb *self;
> - unsigned long flags;
> - int iobase;
> - s32 speed;
> -
> - IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
> -
> - IRDA_ASSERT(dev != NULL, return 0;);
> -
> - self = (struct irport_cb *) dev->priv;
> - IRDA_ASSERT(self != NULL, return 0;);
> -
> - iobase = self->io.sir_base;
> -
> - netif_stop_queue(dev);
> -
> - /* Make sure tests & speed change are atomic */
> - spin_lock_irqsave(&self->lock, flags);
> -
> - /* Check if we need to change the speed */
> - speed = irda_get_next_speed(skb);
> - if ((speed != self->io.speed) && (speed != -1)) {
> - /* Check for empty frame */
> - if (!skb->len) {
> - /*
> - * We send frames one by one in SIR mode (no
> - * pipelining), so at this point, if we were sending
> - * a previous frame, we just received the interrupt
> - * telling us it is finished (UART_IIR_THRI).
> - * Therefore, waiting for the transmitter to really
> - * finish draining the fifo won't take too long.
> - * And the interrupt handler is not expected to run.
> - * - Jean II */
> - irport_wait_hw_transmitter_finish(self);
> - /* Better go there already locked - Jean II */
> - irda_task_execute(self, __irport_change_speed,
> - irport_change_speed_complete,
> - NULL, (void *) speed);
> - dev->trans_start = jiffies;
> - spin_unlock_irqrestore(&self->lock, flags);
> - dev_kfree_skb(skb);
> - return 0;
> - } else
> - self->new_speed = speed;
> - }
> -
> - /* Init tx buffer */
> - self->tx_buff.data = self->tx_buff.head;
> -
> - /* Copy skb to tx_buff while wrapping, stuffing and making CRC */
> - self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data,
> - self->tx_buff.truesize);
> -
> - self->stats.tx_bytes += self->tx_buff.len;
> -
> - /* We are transmitting */
> - self->transmitting = 1;
> -
> - /* Turn on transmit finished interrupt. Will fire immediately! */
> - outb(UART_IER_THRI, iobase+UART_IER);
> -
> - dev->trans_start = jiffies;
> - spin_unlock_irqrestore(&self->lock, flags);
> -
> - dev_kfree_skb(skb);
> -
> - return 0;
> -}
> -
> -/*
> - * Function irport_write (driver)
> - *
> - * Fill Tx FIFO with transmit data
> - *
> - * Called only from irport_write_wakeup()
> - */
> -static inline int irport_write(int iobase, int fifo_size, __u8 *buf, int len)
> -{
> - int actual = 0;
> -
> - /* Fill FIFO with current frame */
> - while ((actual < fifo_size) && (actual < len)) {
> - /* Transmit next byte */
> - outb(buf[actual], iobase+UART_TX);
> -
> - actual++;
> - }
> -
> - return actual;
> -}
> -
> -/*
> - * Function irport_write_wakeup (tty)
> - *
> - * Called by the driver when there's room for more data. If we have
> - * more packets to send, we send them here.
> - *
> - * Called only from irport_interrupt()
> - * Make sure this function is *not* called while we are receiving,
> - * otherwise we will reset fifo and loose data :-(
> - */
> -static inline void irport_write_wakeup(struct irport_cb *self)
> -{
> - int actual = 0;
> - int iobase;
> - unsigned int fcr;
> -
> - IRDA_ASSERT(self != NULL, return;);
> -
> - IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
> -
> - iobase = self->io.sir_base;
> -
> - /* Finished with frame? */
> - if (self->tx_buff.len > 0) {
> - /* Write data left in transmit buffer */
> - actual = irport_write(iobase, self->io.fifo_size,
> - self->tx_buff.data, self->tx_buff.len);
> - self->tx_buff.data += actual;
> - self->tx_buff.len -= actual;
> - } else {
> - /*
> - * Now serial buffer is almost free & we can start
> - * transmission of another packet. But first we must check
> - * if we need to change the speed of the hardware
> - */
> - if (self->new_speed) {
> - irport_wait_hw_transmitter_finish(self);
> - irda_task_execute(self, __irport_change_speed,
> - irport_change_speed_complete,
> - NULL, (void *) self->new_speed);
> - self->new_speed = 0;
> - } else {
> - /* Tell network layer that we want more frames */
> - netif_wake_queue(self->netdev);
> - }
> - self->stats.tx_packets++;
> -
> - /*
> - * Reset Rx FIFO to make sure that all reflected transmit data
> - * is discarded. This is needed for half duplex operation
> - */
> - fcr = irport_get_fcr(self->io.speed);
> - fcr |= UART_FCR_CLEAR_RCVR;
> - outb(fcr, iobase+UART_FCR);
> -
> - /* Finished transmitting */
> - self->transmitting = 0;
> -
> - /* Turn on receive interrupts */
> - outb(UART_IER_RDI, iobase+UART_IER);
> -
> - IRDA_DEBUG(1, "%s() : finished Tx\n", __FUNCTION__);
> - }
> -}
> -
> -/*
> - * Function irport_receive (self)
> - *
> - * Receive one frame from the infrared port
> - *
> - * Called only from irport_interrupt()
> - */
> -static inline void irport_receive(struct irport_cb *self)
> -{
> - int boguscount = 0;
> - int iobase;
> -
> - IRDA_ASSERT(self != NULL, return;);
> -
> - iobase = self->io.sir_base;
> -
> - /*
> - * Receive all characters in Rx FIFO, unwrap and unstuff them.
> - * async_unwrap_char will deliver all found frames
> - */
> - do {
> - async_unwrap_char(self->netdev, &self->stats, &self->rx_buff,
> - inb(iobase+UART_RX));
> -
> - /* Make sure we don't stay here too long */
> - if (boguscount++ > 32) {
> - IRDA_DEBUG(2,"%s(), breaking!\n", __FUNCTION__);
> - break;
> - }
> - } while (inb(iobase+UART_LSR) & UART_LSR_DR);
> -}
> -
> -/*
> - * Function irport_interrupt (irq, dev_id)
> - *
> - * Interrupt handler
> - */
> -static irqreturn_t irport_interrupt(int irq, void *dev_id)
> -{
> - struct net_device *dev = dev_id;
> - struct irport_cb *self;
> - int boguscount = 0;
> - int iobase;
> - int iir, lsr;
> - int handled = 0;
> -
> - self = dev->priv;
> -
> - spin_lock(&self->lock);
> -
> - iobase = self->io.sir_base;
> -
> - /* Cut'n'paste interrupt routine from serial.c
> - * This version try to minimise latency and I/O operations.
> - * Simplified and modified to enforce half duplex operation.
> - * - Jean II */
> -
> - /* Check status even is iir reg is cleared, more robust and
> - * eliminate a read on the I/O bus - Jean II */
> - do {
> - /* Get interrupt status ; Clear interrupt */
> - lsr = inb(iobase+UART_LSR);
> -
> - /* Are we receiving or transmitting ? */
> - if(!self->transmitting) {
> - /* Received something ? */
> - if (lsr & UART_LSR_DR)
> - irport_receive(self);
> - } else {
> - /* Room in Tx fifo ? */
> - if (lsr & (UART_LSR_THRE | UART_LSR_TEMT))
> - irport_write_wakeup(self);
> - }
> -
> - /* A bit hackish, but working as expected... Jean II */
> - if(lsr & (UART_LSR_THRE | UART_LSR_TEMT | UART_LSR_DR))
> - handled = 1;
> -
> - /* Make sure we don't stay here to long */
> - if (boguscount++ > 10) {
> - IRDA_WARNING("%s() irq handler looping : lsr=%02x\n",
> - __FUNCTION__, lsr);
> - break;
> - }
> -
> - /* Read interrupt register */
> - iir = inb(iobase+UART_IIR);
> -
> - /* Enable this debug only when no other options and at low
> - * bit rates, otherwise it may cause Rx overruns (lsr=63).
> - * - Jean II */
> - IRDA_DEBUG(6, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n",
> - __FUNCTION__, iir, lsr, iobase);
> -
> - /* As long as interrupt pending... */
> - } while ((iir & UART_IIR_NO_INT) == 0);
> -
> - spin_unlock(&self->lock);
> - return IRQ_RETVAL(handled);
> -}
> -
> -/*
> - * Function irport_net_open (dev)
> - *
> - * Network device is taken up. Usually this is done by "ifconfig irda0 up"
> - *
> - */
> -static int irport_net_open(struct net_device *dev)
> -{
> - struct irport_cb *self;
> - int iobase;
> - char hwname[16];
> - unsigned long flags;
> -
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
> -
> - IRDA_ASSERT(dev != NULL, return -1;);
> - self = (struct irport_cb *) dev->priv;
> -
> - iobase = self->io.sir_base;
> -
> - if (request_irq(self->io.irq, self->interrupt, 0, dev->name,
> - (void *) dev)) {
> - IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n",
> - __FUNCTION__, self->io.irq);
> - return -EAGAIN;
> - }
> -
> - spin_lock_irqsave(&self->lock, flags);
> - /* Init uart */
> - irport_start(self);
> - /* Set 9600 bauds per default, including at the dongle */
> - irda_task_execute(self, __irport_change_speed,
> - irport_change_speed_complete,
> - NULL, (void *) 9600);
> - spin_unlock_irqrestore(&self->lock, flags);
> -
> -
> - /* Give self a hardware name */
> - sprintf(hwname, "SIR @ 0x%03x", self->io.sir_base);
> -
> - /*
> - * Open new IrLAP layer instance, now that everything should be
> - * initialized properly
> - */
> - self->irlap = irlap_open(dev, &self->qos, hwname);
> -
> - /* Ready to play! */
> -
> - netif_start_queue(dev);
> -
> - return 0;
> -}
> -
> -/*
> - * Function irport_net_close (self)
> - *
> - * Network device is taken down. Usually this is done by
> - * "ifconfig irda0 down"
> - */
> -static int irport_net_close(struct net_device *dev)
> -{
> - struct irport_cb *self;
> - int iobase;
> - unsigned long flags;
> -
> - IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
> -
> - IRDA_ASSERT(dev != NULL, return -1;);
> - self = (struct irport_cb *) dev->priv;
> -
> - IRDA_ASSERT(self != NULL, return -1;);
> -
> - iobase = self->io.sir_base;
> -
> - /* Stop device */
> - netif_stop_queue(dev);
> -
> - /* Stop and remove instance of IrLAP */
> - if (self->irlap)
> - irlap_close(self->irlap);
> - self->irlap = NULL;
> -
> - spin_lock_irqsave(&self->lock, flags);
> - irport_stop(self);
> - spin_unlock_irqrestore(&self->lock, flags);
> -
> - free_irq(self->io.irq, dev);
> -
> - return 0;
> -}
> -
> -/*
> - * Function irport_is_receiving (self)
> - *
> - * Returns true is we are currently receiving data
> - *
> - */
> -static inline int irport_is_receiving(struct irport_cb *self)
> -{
> - return (self->rx_buff.state != OUTSIDE_FRAME);
> -}
> -
> -/*
> - * Function irport_set_dtr_rts (tty, dtr, rts)
> - *
> - * This function can be used by dongles etc. to set or reset the status
> - * of the dtr and rts lines
> - */
> -static int irport_set_dtr_rts(struct net_device *dev, int dtr, int rts)
> -{
> - struct irport_cb *self = dev->priv;
> - int iobase;
> -
> - IRDA_ASSERT(self != NULL, return -1;);
> -
> - iobase = self->io.sir_base;
> -
> - if (dtr)
> - dtr = UART_MCR_DTR;
> - if (rts)
> - rts = UART_MCR_RTS;
> -
> - outb(dtr|rts|UART_MCR_OUT2, iobase+UART_MCR);
> -
> - return 0;
> -}
> -
> -static int irport_raw_write(struct net_device *dev, __u8 *buf, int len)
> -{
> - struct irport_cb *self = (struct irport_cb *) dev->priv;
> - int actual = 0;
> - int iobase;
> -
> - IRDA_ASSERT(self != NULL, return -1;);
> -
> - iobase = self->io.sir_base;
> -
> - /* Tx FIFO should be empty! */
> - if (!(inb(iobase+UART_LSR) & UART_LSR_THRE)) {
> - IRDA_DEBUG( 0, "%s(), failed, fifo not empty!\n", __FUNCTION__);
> - return -1;
> - }
> -
> - /* Fill FIFO with current frame */
> - while (actual < len) {
> - /* Transmit next byte */
> - outb(buf[actual], iobase+UART_TX);
> - actual++;
> - }
> -
> - return actual;
> -}
> -
> -/*
> - * Function irport_net_ioctl (dev, rq, cmd)
> - *
> - * Process IOCTL commands for this device
> - *
> - */
> -static int irport_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
> -{
> - struct if_irda_req *irq = (struct if_irda_req *) rq;
> - struct irport_cb *self;
> - dongle_t *dongle;
> - unsigned long flags;
> - int ret = 0;
> -
> - IRDA_ASSERT(dev != NULL, return -1;);
> -
> - self = dev->priv;
> -
> - IRDA_ASSERT(self != NULL, return -1;);
> -
> - IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd);
> -
> - switch (cmd) {
> - case SIOCSBANDWIDTH: /* Set bandwidth */
> - if (!capable(CAP_NET_ADMIN))
> - ret = -EPERM;
> - else
> - irda_task_execute(self, __irport_change_speed, NULL,
> - NULL, (void *) irq->ifr_baudrate);
> - break;
> - case SIOCSDONGLE: /* Set dongle */
> - if (!capable(CAP_NET_ADMIN)) {
> - ret = -EPERM;
> - break;
> - }
> -
> - /* Locking :
> - * irda_device_dongle_init() can't be locked.
> - * irda_task_execute() doesn't need to be locked.
> - * Jean II
> - */
> -
> - /* Initialize dongle */
> - dongle = irda_device_dongle_init(dev, irq->ifr_dongle);
> - if (!dongle)
> - break;
> -
> - dongle->set_mode = NULL;
> - dongle->read = NULL;
> - dongle->write = irport_raw_write;
> - dongle->set_dtr_rts = irport_set_dtr_rts;
> -
> - /* Now initialize the dongle! */
> - dongle->issue->open(dongle, &self->qos);
> -
> - /* Reset dongle */
> - irda_task_execute(dongle, dongle->issue->reset, NULL, NULL,
> - NULL);
> -
> - /* Make dongle available to driver only now to avoid
> - * race conditions - Jean II */
> - self->dongle = dongle;
> - break;
> - case SIOCSMEDIABUSY: /* Set media busy */
> - if (!capable(CAP_NET_ADMIN)) {
> - ret = -EPERM;
> - break;
> - }
> -
> - irda_device_set_media_busy(self->netdev, TRUE);
> - break;
> - case SIOCGRECEIVING: /* Check if we are receiving right now */
> - irq->ifr_receiving = irport_is_receiving(self);
> - break;
> - case SIOCSDTRRTS:
> - if (!capable(CAP_NET_ADMIN)) {
> - ret = -EPERM;
> - break;
> - }
> -
> - /* No real need to lock... */
> - spin_lock_irqsave(&self->lock, flags);
> - irport_set_dtr_rts(dev, irq->ifr_dtr, irq->ifr_rts);
> - spin_unlock_irqrestore(&self->lock, flags);
> - break;
> - default:
> - ret = -EOPNOTSUPP;
> - }
> -
> - return ret;
> -}
> -
> -static struct net_device_stats *irport_net_get_stats(struct net_device *dev)
> -{
> - struct irport_cb *self = (struct irport_cb *) dev->priv;
> -
> - return &self->stats;
> -}
> -
> -static int __init irport_init(void)
> -{
> - int i;
> -
> - for (i=0; (io[i] < 2000) && (i < ARRAY_SIZE(dev_self)); i++) {
> - if (irport_open(i, io[i], irq[i]) != NULL)
> - return 0;
> - }
> - /*
> - * Maybe something failed, but we can still be usable for FIR drivers
> - */
> - return 0;
> -}
> -
> -/*
> - * Function irport_cleanup ()
> - *
> - * Close all configured ports
> - *
> - */
> -static void __exit irport_cleanup(void)
> -{
> - int i;
> -
> - IRDA_DEBUG( 4, "%s()\n", __FUNCTION__);
> -
> - for (i=0; i < ARRAY_SIZE(dev_self); i++) {
> - if (dev_self[i])
> - irport_close(dev_self[i]);
> - }
> -}
> -
> -module_param_array(io, int, NULL, 0);
> -MODULE_PARM_DESC(io, "Base I/O addresses");
> -module_param_array(irq, int, NULL, 0);
> -MODULE_PARM_DESC(irq, "IRQ lines");
> -
> -MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
> -MODULE_DESCRIPTION("Half duplex serial driver for IrDA SIR mode");
> -MODULE_LICENSE("GPL");
> -
> -module_init(irport_init);
> -module_exit(irport_cleanup);
> -
> diff --git a/drivers/net/irda/irport.h b/drivers/net/irda/irport.h
> deleted file mode 100644
> index 66fc243..0000000
> --- a/drivers/net/irda/irport.h
> +++ /dev/null
> @@ -1,80 +0,0 @@
> -/*********************************************************************
> - *
> - * Filename: irport.h
> - * Version: 0.1
> - * Description: Serial driver for IrDA
> - * Status: Experimental.
> - * Author: Dag Brattli <dagb@cs.uit.no>
> - * Created at: Sun Aug 3 13:49:59 1997
> - * Modified at: Fri Jan 14 10:21:10 2000
> - * Modified by: Dag Brattli <dagb@cs.uit.no>
> - *
> - * Copyright (c) 1997, 1998-2000 Dag Brattli <dagb@cs.uit.no>
> - * All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - * Neither Dag Brattli nor University of Tromsø admit liability nor
> - * provide warranty for any of this software. This material is
> - * provided "AS-IS" and at no charge.
> - *
> - ********************************************************************/
> -
> -#ifndef IRPORT_H
> -#define IRPORT_H
> -
> -#include <linux/netdevice.h>
> -#include <linux/skbuff.h>
> -#include <linux/types.h>
> -#include <linux/spinlock.h>
> -
> -#include <net/irda/irda_device.h>
> -
> -#define SPEED_DEFAULT 9600
> -#define SPEED_MAX 115200
> -
> -/*
> - * These are the supported serial types.
> - */
> -#define PORT_UNKNOWN 0
> -#define PORT_8250 1
> -#define PORT_16450 2
> -#define PORT_16550 3
> -#define PORT_16550A 4
> -#define PORT_CIRRUS 5
> -#define PORT_16650 6
> -#define PORT_MAX 6
> -
> -#define FRAME_MAX_SIZE 2048
> -
> -struct irport_cb {
> - struct net_device *netdev; /* Yes! we are some kind of netdevice */
> - struct net_device_stats stats;
> -
> - struct irlap_cb *irlap; /* The link layer we are attached to */
> -
> - chipio_t io; /* IrDA controller information */
> - iobuff_t tx_buff; /* Transmit buffer */
> - iobuff_t rx_buff; /* Receive buffer */
> -
> - struct qos_info qos; /* QoS capabilities for this device */
> - dongle_t *dongle; /* Dongle driver */
> -
> - __u32 flags; /* Interface flags */
> - __u32 new_speed;
> - int mode;
> - int index; /* Instance index */
> - int transmitting; /* Are we transmitting ? */
> -
> - spinlock_t lock; /* For serializing operations */
> -
> - /* For piggyback drivers */
> - void *priv;
> - void (*change_speed)(void *priv, __u32 speed);
> - irqreturn_t (*interrupt)(int irq, void *dev_id);
> -};
> -
> -#endif /* IRPORT_H */
> diff --git a/drivers/net/irda/litelink.c b/drivers/net/irda/litelink.c
> deleted file mode 100644
> index 7db1143..0000000
> --- a/drivers/net/irda/litelink.c
> +++ /dev/null
> @@ -1,179 +0,0 @@
> -/*********************************************************************
> - *
> - * Filename: litelink.c
> - * Version: 1.1
> - * Description: Driver for the Parallax LiteLink dongle
> - * Status: Stable
> - * Author: Dag Brattli <dagb@cs.uit.no>
> - * Created at: Fri May 7 12:50:33 1999
> - * Modified at: Fri Dec 17 09:14:23 1999
> - * Modified by: Dag Brattli <dagb@cs.uit.no>
> - *
> - * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> - * MA 02111-1307 USA
> - *
> - ********************************************************************/
> -
> -#include <linux/module.h>
> -#include <linux/delay.h>
> -#include <linux/tty.h>
> -#include <linux/init.h>
> -
> -#include <net/irda/irda.h>
> -#include <net/irda/irda_device.h>
> -
> -#define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */
> -#define MAX_DELAY 10000 /* 1 ms */
> -
> -static void litelink_open(dongle_t *self, struct qos_info *qos);
> -static void litelink_close(dongle_t *self);
> -static int litelink_change_speed(struct irda_task *task);
> -static int litelink_reset(struct irda_task *task);
> -
> -/* These are the baudrates supported */
> -static __u32 baud_rates[] = { 115200, 57600, 38400, 19200, 9600 };
> -
> -static struct dongle_reg dongle = {
> - .type = IRDA_LITELINK_DONGLE,
> - .open = litelink_open,
> - .close = litelink_close,
> - .reset = litelink_reset,
> - .change_speed = litelink_change_speed,
> - .owner = THIS_MODULE,
> -};
> -
> -static int __init litelink_init(void)
> -{
> - return irda_device_register_dongle(&dongle);
> -}
> -
> -static void __exit litelink_cleanup(void)
> -{
> - irda_device_unregister_dongle(&dongle);
> -}
> -
> -static void litelink_open(dongle_t *self, struct qos_info *qos)
> -{
> - qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
> - qos->min_turn_time.bits = 0x7f; /* Needs 0.01 ms */
> -}
> -
> -static void litelink_close(dongle_t *self)
> -{
> - /* Power off dongle */
> - self->set_dtr_rts(self->dev, FALSE, FALSE);
> -}
> -
> -/*
> - * Function litelink_change_speed (task)
> - *
> - * Change speed of the Litelink dongle. To cycle through the available
> - * baud rates, pulse RTS low for a few ms.
> - */
> -static int litelink_change_speed(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - __u32 speed = (__u32) task->param;
> - int i;
> -
> - /* Clear RTS to reset dongle */
> - self->set_dtr_rts(self->dev, TRUE, FALSE);
> -
> - /* Sleep a minimum of 15 us */
> - udelay(MIN_DELAY);
> -
> - /* Go back to normal mode */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - /* Sleep a minimum of 15 us */
> - udelay(MIN_DELAY);
> -
> - /* Cycle through avaiable baudrates until we reach the correct one */
> - for (i=0; i<5 && baud_rates[i] != speed; i++) {
> - /* Set DTR, clear RTS */
> - self->set_dtr_rts(self->dev, FALSE, TRUE);
> -
> - /* Sleep a minimum of 15 us */
> - udelay(MIN_DELAY);
> -
> - /* Set DTR, Set RTS */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - /* Sleep a minimum of 15 us */
> - udelay(MIN_DELAY);
> - }
> - irda_task_next_state(task, IRDA_TASK_DONE);
> -
> - return 0;
> -}
> -
> -/*
> - * Function litelink_reset (task)
> - *
> - * Reset the Litelink type dongle.
> - *
> - */
> -static int litelink_reset(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> -
> - /* Power on dongle */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - /* Sleep a minimum of 15 us */
> - udelay(MIN_DELAY);
> -
> - /* Clear RTS to reset dongle */
> - self->set_dtr_rts(self->dev, TRUE, FALSE);
> -
> - /* Sleep a minimum of 15 us */
> - udelay(MIN_DELAY);
> -
> - /* Go back to normal mode */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - /* Sleep a minimum of 15 us */
> - udelay(MIN_DELAY);
> -
> - /* This dongles speed defaults to 115200 bps */
> - self->speed = 115200;
> -
> - irda_task_next_state(task, IRDA_TASK_DONE);
> -
> - return 0;
> -}
> -
> -MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
> -MODULE_DESCRIPTION("Parallax Litelink dongle driver");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("irda-dongle-5"); /* IRDA_LITELINK_DONGLE */
> -
> -/*
> - * Function init_module (void)
> - *
> - * Initialize Litelink module
> - *
> - */
> -module_init(litelink_init);
> -
> -/*
> - * Function cleanup_module (void)
> - *
> - * Cleanup Litelink module
> - *
> - */
> -module_exit(litelink_cleanup);
> diff --git a/drivers/net/irda/ma600.c b/drivers/net/irda/ma600.c
> deleted file mode 100644
> index f5e6836..0000000
> --- a/drivers/net/irda/ma600.c
> +++ /dev/null
> @@ -1,354 +0,0 @@
> -/*********************************************************************
> - *
> - * Filename: ma600.c
> - * Version: 0.1
> - * Description: Implementation of the MA600 dongle
> - * Status: Experimental.
> - * Author: Leung <95Etwl@alumni.ee.ust.hk> http://www.engsvr.ust/~eetwl95
> - * Created at: Sat Jun 10 20:02:35 2000
> - * Modified at:
> - * Modified by:
> - *
> - * Note: very thanks to Mr. Maru Wang <maru@mobileaction.com.tw> for providing
> - * information on the MA600 dongle
> - *
> - * Copyright (c) 2000 Leung, All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> - * MA 02111-1307 USA
> - *
> - ********************************************************************/
> -
> -/* define this macro for release version */
> -//#define NDEBUG
> -
> -#include <linux/module.h>
> -#include <linux/delay.h>
> -#include <linux/tty.h>
> -#include <linux/init.h>
> -
> -#include <net/irda/irda.h>
> -#include <net/irda/irda_device.h>
> -
> -#ifndef NDEBUG
> - #undef IRDA_DEBUG
> - #define IRDA_DEBUG(n, args...) (printk(KERN_DEBUG args))
> -
> - #undef ASSERT
> - #define ASSERT(expr, func) \
> - if(!(expr)) { \
> - printk( "Assertion failed! %s,%s,%s,line=%d\n",\
> - #expr,__FILE__,__FUNCTION__,__LINE__); \
> - func}
> -#endif
> -
> -/* convert hex value to ascii hex */
> -static const char hexTbl[] = "0123456789ABCDEF";
> -
> -
> -static void ma600_open(dongle_t *self, struct qos_info *qos);
> -static void ma600_close(dongle_t *self);
> -static int ma600_change_speed(struct irda_task *task);
> -static int ma600_reset(struct irda_task *task);
> -
> -/* control byte for MA600 */
> -#define MA600_9600 0x00
> -#define MA600_19200 0x01
> -#define MA600_38400 0x02
> -#define MA600_57600 0x03
> -#define MA600_115200 0x04
> -#define MA600_DEV_ID1 0x05
> -#define MA600_DEV_ID2 0x06
> -#define MA600_2400 0x08
> -
> -static struct dongle_reg dongle = {
> - .type = IRDA_MA600_DONGLE,
> - .open = ma600_open,
> - .close = ma600_close,
> - .reset = ma600_reset,
> - .change_speed = ma600_change_speed,
> - .owner = THIS_MODULE,
> -};
> -
> -static int __init ma600_init(void)
> -{
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
> - return irda_device_register_dongle(&dongle);
> -}
> -
> -static void __exit ma600_cleanup(void)
> -{
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
> - irda_device_unregister_dongle(&dongle);
> -}
> -
> -/*
> - Power on:
> - (0) Clear RTS and DTR for 1 second
> - (1) Set RTS and DTR for 1 second
> - (2) 9600 bps now
> - Note: assume RTS, DTR are clear before
> -*/
> -static void ma600_open(dongle_t *self, struct qos_info *qos)
> -{
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
> -
> - qos->baud_rate.bits &= IR_2400|IR_9600|IR_19200|IR_38400
> - |IR_57600|IR_115200;
> - qos->min_turn_time.bits = 0x01; /* Needs at least 1 ms */
> - irda_qos_bits_to_value(qos);
> -
> - //self->set_dtr_rts(self->dev, FALSE, FALSE);
> - // should wait 1 second
> -
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> - // should wait 1 second
> -}
> -
> -static void ma600_close(dongle_t *self)
> -{
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
> -
> - /* Power off dongle */
> - self->set_dtr_rts(self->dev, FALSE, FALSE);
> -}
> -
> -static __u8 get_control_byte(__u32 speed)
> -{
> - __u8 byte;
> -
> - switch (speed) {
> - default:
> - case 115200:
> - byte = MA600_115200;
> - break;
> - case 57600:
> - byte = MA600_57600;
> - break;
> - case 38400:
> - byte = MA600_38400;
> - break;
> - case 19200:
> - byte = MA600_19200;
> - break;
> - case 9600:
> - byte = MA600_9600;
> - break;
> - case 2400:
> - byte = MA600_2400;
> - break;
> - }
> -
> - return byte;
> -}
> -
> -/*
> - * Function ma600_change_speed (dev, state, speed)
> - *
> - * Set the speed for the MA600 type dongle. Warning, this
> - * function must be called with a process context!
> - *
> - * Algorithm
> - * 1. Reset
> - * 2. clear RTS, set DTR and wait for 1ms
> - * 3. send Control Byte to the MA600 through TXD to set new baud rate
> - * wait until the stop bit of Control Byte is sent (for 9600 baud rate,
> - * it takes about 10 msec)
> - * 4. set RTS, set DTR (return to NORMAL Operation)
> - * 5. wait at least 10 ms, new setting (baud rate, etc) takes effect here
> - * after
> - */
> -static int ma600_change_speed(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - __u32 speed = (__u32) task->param;
> - static __u8 byte;
> - __u8 byte_echo;
> - int ret = 0;
> -
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
> -
> - ASSERT(task != NULL, return -1;);
> -
> - if (self->speed_task && self->speed_task != task) {
> - IRDA_DEBUG(0, "%s(), busy!\n", __FUNCTION__);
> - return msecs_to_jiffies(10);
> - } else {
> - self->speed_task = task;
> - }
> -
> - switch (task->state) {
> - case IRDA_TASK_INIT:
> - case IRDA_TASK_CHILD_INIT:
> - /*
> - * Need to reset the dongle and go to 9600 bps before
> - * programming
> - */
> - if (irda_task_execute(self, ma600_reset, NULL, task,
> - (void *) speed)) {
> - /* Dongle need more time to reset */
> - irda_task_next_state(task, IRDA_TASK_CHILD_WAIT);
> -
> - /* give 1 second to finish */
> - ret = msecs_to_jiffies(1000);
> - } else {
> - irda_task_next_state(task, IRDA_TASK_CHILD_DONE);
> - }
> - break;
> -
> - case IRDA_TASK_CHILD_WAIT:
> - IRDA_WARNING("%s(), resetting dongle timed out!\n",
> - __FUNCTION__);
> - ret = -1;
> - break;
> -
> - case IRDA_TASK_CHILD_DONE:
> - /* Set DTR, Clear RTS */
> - self->set_dtr_rts(self->dev, TRUE, FALSE);
> -
> - ret = msecs_to_jiffies(1); /* Sleep 1 ms */
> - irda_task_next_state(task, IRDA_TASK_WAIT);
> - break;
> -
> - case IRDA_TASK_WAIT:
> - speed = (__u32) task->param;
> - byte = get_control_byte(speed);
> -
> - /* Write control byte */
> - self->write(self->dev, &byte, sizeof(byte));
> -
> - irda_task_next_state(task, IRDA_TASK_WAIT1);
> -
> - /* Wait at least 10 ms */
> - ret = msecs_to_jiffies(15);
> - break;
> -
> - case IRDA_TASK_WAIT1:
> - /* Read control byte echo */
> - self->read(self->dev, &byte_echo, sizeof(byte_echo));
> -
> - if(byte != byte_echo) {
> - /* if control byte != echo, I don't know what to do */
> - printk(KERN_WARNING "%s() control byte written != read!\n", __FUNCTION__);
> - printk(KERN_WARNING "control byte = 0x%c%c\n",
> - hexTbl[(byte>>4)&0x0f], hexTbl[byte&0x0f]);
> - printk(KERN_WARNING "byte echo = 0x%c%c\n",
> - hexTbl[(byte_echo>>4) & 0x0f],
> - hexTbl[byte_echo & 0x0f]);
> - #ifndef NDEBUG
> - } else {
> - IRDA_DEBUG(2, "%s() control byte write read OK\n", __FUNCTION__);
> - #endif
> - }
> -
> - /* Set DTR, Set RTS */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - irda_task_next_state(task, IRDA_TASK_WAIT2);
> -
> - /* Wait at least 10 ms */
> - ret = msecs_to_jiffies(10);
> - break;
> -
> - case IRDA_TASK_WAIT2:
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->speed_task = NULL;
> - break;
> -
> - default:
> - IRDA_ERROR("%s(), unknown state %d\n",
> - __FUNCTION__, task->state);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->speed_task = NULL;
> - ret = -1;
> - break;
> - }
> - return ret;
> -}
> -
> -/*
> - * Function ma600_reset (driver)
> - *
> - * This function resets the ma600 dongle. Warning, this function
> - * must be called with a process context!!
> - *
> - * Algorithm:
> - * 0. DTR=0, RTS=1 and wait 10 ms
> - * 1. DTR=1, RTS=1 and wait 10 ms
> - * 2. 9600 bps now
> - */
> -int ma600_reset(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - int ret = 0;
> -
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
> -
> - ASSERT(task != NULL, return -1;);
> -
> - if (self->reset_task && self->reset_task != task) {
> - IRDA_DEBUG(0, "%s(), busy!\n", __FUNCTION__);
> - return msecs_to_jiffies(10);
> - } else
> - self->reset_task = task;
> -
> - switch (task->state) {
> - case IRDA_TASK_INIT:
> - /* Clear DTR and Set RTS */
> - self->set_dtr_rts(self->dev, FALSE, TRUE);
> - irda_task_next_state(task, IRDA_TASK_WAIT1);
> - ret = msecs_to_jiffies(10); /* Sleep 10 ms */
> - break;
> - case IRDA_TASK_WAIT1:
> - /* Set DTR and RTS */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> - irda_task_next_state(task, IRDA_TASK_WAIT2);
> - ret = msecs_to_jiffies(10); /* Sleep 10 ms */
> - break;
> - case IRDA_TASK_WAIT2:
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->reset_task = NULL;
> - break;
> - default:
> - IRDA_ERROR("%s(), unknown state %d\n",
> - __FUNCTION__, task->state);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->reset_task = NULL;
> - ret = -1;
> - }
> - return ret;
> -}
> -
> -MODULE_AUTHOR("Leung <95Etwl@alumni.ee.ust.hk> http://www.engsvr.ust/~eetwl95");
> -MODULE_DESCRIPTION("MA600 dongle driver version 0.1");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("irda-dongle-11"); /* IRDA_MA600_DONGLE */
> -
> -/*
> - * Function init_module (void)
> - *
> - * Initialize MA600 module
> - *
> - */
> -module_init(ma600_init);
> -
> -/*
> - * Function cleanup_module (void)
> - *
> - * Cleanup MA600 module
> - *
> - */
> -module_exit(ma600_cleanup);
> -
> diff --git a/drivers/net/irda/mcp2120.c b/drivers/net/irda/mcp2120.c
> deleted file mode 100644
> index 5e6199e..0000000
> --- a/drivers/net/irda/mcp2120.c
> +++ /dev/null
> @@ -1,240 +0,0 @@
> -/*********************************************************************
> - *
> - *
> - * Filename: mcp2120.c
> - * Version: 1.0
> - * Description: Implementation for the MCP2120 (Microchip)
> - * Status: Experimental.
> - * Author: Felix Tang (tangf@eyetap.org)
> - * Created at: Sun Mar 31 19:32:12 EST 2002
> - * Based on code by: Dag Brattli <dagb@cs.uit.no>
> - *
> - * Copyright (c) 2002 Felix Tang, All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - ********************************************************************/
> -
> -#include <linux/module.h>
> -#include <linux/delay.h>
> -#include <linux/tty.h>
> -#include <linux/init.h>
> -
> -#include <net/irda/irda.h>
> -#include <net/irda/irda_device.h>
> -
> -static int mcp2120_reset(struct irda_task *task);
> -static void mcp2120_open(dongle_t *self, struct qos_info *qos);
> -static void mcp2120_close(dongle_t *self);
> -static int mcp2120_change_speed(struct irda_task *task);
> -
> -#define MCP2120_9600 0x87
> -#define MCP2120_19200 0x8B
> -#define MCP2120_38400 0x85
> -#define MCP2120_57600 0x83
> -#define MCP2120_115200 0x81
> -
> -#define MCP2120_COMMIT 0x11
> -
> -static struct dongle_reg dongle = {
> - .type = IRDA_MCP2120_DONGLE,
> - .open = mcp2120_open,
> - .close = mcp2120_close,
> - .reset = mcp2120_reset,
> - .change_speed = mcp2120_change_speed,
> - .owner = THIS_MODULE,
> -};
> -
> -static int __init mcp2120_init(void)
> -{
> - return irda_device_register_dongle(&dongle);
> -}
> -
> -static void __exit mcp2120_cleanup(void)
> -{
> - irda_device_unregister_dongle(&dongle);
> -}
> -
> -static void mcp2120_open(dongle_t *self, struct qos_info *qos)
> -{
> - qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
> - qos->min_turn_time.bits = 0x01;
> -}
> -
> -static void mcp2120_close(dongle_t *self)
> -{
> - /* Power off dongle */
> - /* reset and inhibit mcp2120 */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> - //self->set_dtr_rts(self->dev, FALSE, FALSE);
> -}
> -
> -/*
> - * Function mcp2120_change_speed (dev, speed)
> - *
> - * Set the speed for the MCP2120.
> - *
> - */
> -static int mcp2120_change_speed(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - __u32 speed = (__u32) task->param;
> - __u8 control[2];
> - int ret = 0;
> -
> - self->speed_task = task;
> -
> - switch (task->state) {
> - case IRDA_TASK_INIT:
> - /* Need to reset the dongle and go to 9600 bps before
> - programming */
> - //printk("Dmcp2120_change_speed irda_task_init\n");
> - if (irda_task_execute(self, mcp2120_reset, NULL, task,
> - (void *) speed))
> - {
> - /* Dongle need more time to reset */
> - irda_task_next_state(task, IRDA_TASK_CHILD_WAIT);
> -
> - /* Give reset 1 sec to finish */
> - ret = msecs_to_jiffies(1000);
> - }
> - break;
> - case IRDA_TASK_CHILD_WAIT:
> - IRDA_WARNING("%s(), resetting dongle timed out!\n",
> - __FUNCTION__);
> - ret = -1;
> - break;
> - case IRDA_TASK_CHILD_DONE:
> - /* Set DTR to enter command mode */
> - self->set_dtr_rts(self->dev, TRUE, FALSE);
> - udelay(500);
> -
> - switch (speed) {
> - case 9600:
> - default:
> - control[0] = MCP2120_9600;
> - //printk("mcp2120 9600\n");
> - break;
> - case 19200:
> - control[0] = MCP2120_19200;
> - //printk("mcp2120 19200\n");
> - break;
> - case 34800:
> - control[0] = MCP2120_38400;
> - //printk("mcp2120 38400\n");
> - break;
> - case 57600:
> - control[0] = MCP2120_57600;
> - //printk("mcp2120 57600\n");
> - break;
> - case 115200:
> - control[0] = MCP2120_115200;
> - //printk("mcp2120 115200\n");
> - break;
> - }
> - control[1] = MCP2120_COMMIT;
> -
> - /* Write control bytes */
> - self->write(self->dev, control, 2);
> -
> - irda_task_next_state(task, IRDA_TASK_WAIT);
> - ret = msecs_to_jiffies(100);
> - //printk("mcp2120_change_speed irda_child_done\n");
> - break;
> - case IRDA_TASK_WAIT:
> - /* Go back to normal mode */
> - self->set_dtr_rts(self->dev, FALSE, FALSE);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->speed_task = NULL;
> - //printk("mcp2120_change_speed irda_task_wait\n");
> - break;
> - default:
> - IRDA_ERROR("%s(), unknown state %d\n",
> - __FUNCTION__, task->state);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->speed_task = NULL;
> - ret = -1;
> - break;
> - }
> - return ret;
> -}
> -
> -/*
> - * Function mcp2120_reset (driver)
> - *
> - * This function resets the mcp2120 dongle.
> - *
> - * Info: -set RTS to reset mcp2120
> - * -set DTR to set mcp2120 software command mode
> - * -mcp2120 defaults to 9600 baud after reset
> - *
> - * Algorithm:
> - * 0. Set RTS to reset mcp2120.
> - * 1. Clear RTS and wait for device reset timer of 30 ms (max).
> - *
> - */
> -
> -
> -static int mcp2120_reset(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - int ret = 0;
> -
> - self->reset_task = task;
> -
> - switch (task->state) {
> - case IRDA_TASK_INIT:
> - //printk("mcp2120_reset irda_task_init\n");
> - /* Reset dongle by setting RTS*/
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> - irda_task_next_state(task, IRDA_TASK_WAIT1);
> - ret = msecs_to_jiffies(50);
> - break;
> - case IRDA_TASK_WAIT1:
> - //printk("mcp2120_reset irda_task_wait1\n");
> - /* clear RTS and wait for at least 30 ms. */
> - self->set_dtr_rts(self->dev, FALSE, FALSE);
> - irda_task_next_state(task, IRDA_TASK_WAIT2);
> - ret = msecs_to_jiffies(50);
> - break;
> - case IRDA_TASK_WAIT2:
> - //printk("mcp2120_reset irda_task_wait2\n");
> - /* Go back to normal mode */
> - self->set_dtr_rts(self->dev, FALSE, FALSE);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->reset_task = NULL;
> - break;
> - default:
> - IRDA_ERROR("%s(), unknown state %d\n",
> - __FUNCTION__, task->state);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->reset_task = NULL;
> - ret = -1;
> - break;
> - }
> - return ret;
> -}
> -
> -MODULE_AUTHOR("Felix Tang <tangf@eyetap.org>");
> -MODULE_DESCRIPTION("Microchip MCP2120");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("irda-dongle-9"); /* IRDA_MCP2120_DONGLE */
> -
> -/*
> - * Function init_module (void)
> - *
> - * Initialize MCP2120 module
> - *
> - */
> -module_init(mcp2120_init);
> -
> -/*
> - * Function cleanup_module (void)
> - *
> - * Cleanup MCP2120 module
> - *
> - */
> -module_exit(mcp2120_cleanup);
> diff --git a/drivers/net/irda/old_belkin.c b/drivers/net/irda/old_belkin.c
> deleted file mode 100644
> index 26f81fd..0000000
> --- a/drivers/net/irda/old_belkin.c
> +++ /dev/null
> @@ -1,164 +0,0 @@
> -/*********************************************************************
> - *
> - * Filename: old_belkin.c
> - * Version: 1.1
> - * Description: Driver for the Belkin (old) SmartBeam dongle
> - * Status: Experimental...
> - * Author: Jean Tourrilhes <jt@hpl.hp.com>
> - * Created at: 22/11/99
> - * Modified at: Fri Dec 17 09:13:32 1999
> - * Modified by: Dag Brattli <dagb@cs.uit.no>
> - *
> - * Copyright (c) 1999 Jean Tourrilhes, All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> - * MA 02111-1307 USA
> - *
> - ********************************************************************/
> -
> -#include <linux/module.h>
> -#include <linux/delay.h>
> -#include <linux/tty.h>
> -#include <linux/init.h>
> -
> -#include <net/irda/irda.h>
> -#include <net/irda/irda_device.h>
> -
> -/*
> - * Belkin is selling a dongle called the SmartBeam.
> - * In fact, there is two hardware version of this dongle, of course with
> - * the same name and looking the exactly same (grrr...).
> - * I guess that I've got the old one, because inside I don't have
> - * a jumper for IrDA/ASK...
> - *
> - * As far as I can make it from info on their web site, the old dongle
> - * support only 9600 b/s, which make our life much simpler as far as
> - * the driver is concerned, but you might not like it very much ;-)
> - * The new SmartBeam does 115 kb/s, and I've not tested it...
> - *
> - * Belkin claim that the correct driver for the old dongle (in Windows)
> - * is the generic Parallax 9500a driver, but the Linux LiteLink driver
> - * fails for me (probably because Linux-IrDA doesn't rate fallback),
> - * so I created this really dumb driver...
> - *
> - * In fact, this driver doesn't do much. The only thing it does is to
> - * prevent Linux-IrDA to use any other speed than 9600 b/s ;-) This
> - * driver is called "old_belkin" so that when the new SmartBeam is supported
> - * its driver can be called "belkin" instead of "new_belkin".
> - *
> - * Note : this driver was written without any info/help from Belkin,
> - * so a lot of info here might be totally wrong. Blame me ;-)
> - */
> -
> -/* Let's guess */
> -#define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */
> -
> -static void old_belkin_open(dongle_t *self, struct qos_info *qos);
> -static void old_belkin_close(dongle_t *self);
> -static int old_belkin_change_speed(struct irda_task *task);
> -static int old_belkin_reset(struct irda_task *task);
> -
> -/* These are the baudrates supported */
> -/* static __u32 baud_rates[] = { 9600 }; */
> -
> -static struct dongle_reg dongle = {
> - .type = IRDA_OLD_BELKIN_DONGLE,
> - .open = old_belkin_open,
> - .close = old_belkin_close,
> - .reset = old_belkin_reset,
> - .change_speed = old_belkin_change_speed,
> - .owner = THIS_MODULE,
> -};
> -
> -static int __init old_belkin_init(void)
> -{
> - return irda_device_register_dongle(&dongle);
> -}
> -
> -static void __exit old_belkin_cleanup(void)
> -{
> - irda_device_unregister_dongle(&dongle);
> -}
> -
> -static void old_belkin_open(dongle_t *self, struct qos_info *qos)
> -{
> - /* Not too fast, please... */
> - qos->baud_rate.bits &= IR_9600;
> - /* Needs at least 10 ms (totally wild guess, can do probably better) */
> - qos->min_turn_time.bits = 0x01;
> -}
> -
> -static void old_belkin_close(dongle_t *self)
> -{
> - /* Power off dongle */
> - self->set_dtr_rts(self->dev, FALSE, FALSE);
> -}
> -
> -/*
> - * Function old_belkin_change_speed (task)
> - *
> - * With only one speed available, not much to do...
> - */
> -static int old_belkin_change_speed(struct irda_task *task)
> -{
> - irda_task_next_state(task, IRDA_TASK_DONE);
> -
> - return 0;
> -}
> -
> -/*
> - * Function old_belkin_reset (task)
> - *
> - * Reset the Old-Belkin type dongle.
> - *
> - */
> -static int old_belkin_reset(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> -
> - /* Power on dongle */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - /* Sleep a minimum of 15 us */
> - udelay(MIN_DELAY);
> -
> - /* This dongles speed "defaults" to 9600 bps ;-) */
> - self->speed = 9600;
> -
> - irda_task_next_state(task, IRDA_TASK_DONE);
> -
> - return 0;
> -}
> -
> -MODULE_AUTHOR("Jean Tourrilhes <jt@hpl.hp.com>");
> -MODULE_DESCRIPTION("Belkin (old) SmartBeam dongle driver");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("irda-dongle-7"); /* IRDA_OLD_BELKIN_DONGLE */
> -
> -/*
> - * Function init_module (void)
> - *
> - * Initialize Old-Belkin module
> - *
> - */
> -module_init(old_belkin_init);
> -
> -/*
> - * Function cleanup_module (void)
> - *
> - * Cleanup Old-Belkin module
> - *
> - */
> -module_exit(old_belkin_cleanup);
> diff --git a/drivers/net/irda/tekram.c b/drivers/net/irda/tekram.c
> deleted file mode 100644
> index 9bfd244..0000000
> --- a/drivers/net/irda/tekram.c
> +++ /dev/null
> @@ -1,282 +0,0 @@
> -/*********************************************************************
> - *
> - * Filename: tekram.c
> - * Version: 1.2
> - * Description: Implementation of the Tekram IrMate IR-210B dongle
> - * Status: Experimental.
> - * Author: Dag Brattli <dagb@cs.uit.no>
> - * Created at: Wed Oct 21 20:02:35 1998
> - * Modified at: Fri Dec 17 09:13:09 1999
> - * Modified by: Dag Brattli <dagb@cs.uit.no>
> - *
> - * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - * Neither Dag Brattli nor University of Tromsø admit liability nor
> - * provide warranty for any of this software. This material is
> - * provided "AS-IS" and at no charge.
> - *
> - ********************************************************************/
> -
> -#include <linux/module.h>
> -#include <linux/delay.h>
> -#include <linux/tty.h>
> -#include <linux/init.h>
> -
> -#include <net/irda/irda.h>
> -#include <net/irda/irda_device.h>
> -
> -static void tekram_open(dongle_t *self, struct qos_info *qos);
> -static void tekram_close(dongle_t *self);
> -static int tekram_change_speed(struct irda_task *task);
> -static int tekram_reset(struct irda_task *task);
> -
> -#define TEKRAM_115200 0x00
> -#define TEKRAM_57600 0x01
> -#define TEKRAM_38400 0x02
> -#define TEKRAM_19200 0x03
> -#define TEKRAM_9600 0x04
> -
> -#define TEKRAM_PW 0x10 /* Pulse select bit */
> -
> -static struct dongle_reg dongle = {
> - .type = IRDA_TEKRAM_DONGLE,
> - .open = tekram_open,
> - .close = tekram_close,
> - .reset = tekram_reset,
> - .change_speed = tekram_change_speed,
> - .owner = THIS_MODULE,
> -};
> -
> -static int __init tekram_init(void)
> -{
> - return irda_device_register_dongle(&dongle);
> -}
> -
> -static void __exit tekram_cleanup(void)
> -{
> - irda_device_unregister_dongle(&dongle);
> -}
> -
> -static void tekram_open(dongle_t *self, struct qos_info *qos)
> -{
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
> -
> - qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
> - qos->min_turn_time.bits = 0x01; /* Needs at least 10 ms */
> - irda_qos_bits_to_value(qos);
> -}
> -
> -static void tekram_close(dongle_t *self)
> -{
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
> -
> - /* Power off dongle */
> - self->set_dtr_rts(self->dev, FALSE, FALSE);
> -
> - if (self->reset_task)
> - irda_task_delete(self->reset_task);
> - if (self->speed_task)
> - irda_task_delete(self->speed_task);
> -}
> -
> -/*
> - * Function tekram_change_speed (dev, state, speed)
> - *
> - * Set the speed for the Tekram IRMate 210 type dongle. Warning, this
> - * function must be called with a process context!
> - *
> - * Algorithm
> - * 1. clear DTR
> - * 2. set RTS, and wait at least 7 us
> - * 3. send Control Byte to the IR-210 through TXD to set new baud rate
> - * wait until the stop bit of Control Byte is sent (for 9600 baud rate,
> - * it takes about 100 msec)
> - * 5. clear RTS (return to NORMAL Operation)
> - * 6. wait at least 50 us, new setting (baud rate, etc) takes effect here
> - * after
> - */
> -static int tekram_change_speed(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - __u32 speed = (__u32) task->param;
> - __u8 byte;
> - int ret = 0;
> -
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
> -
> - IRDA_ASSERT(task != NULL, return -1;);
> -
> - if (self->speed_task && self->speed_task != task) {
> - IRDA_DEBUG(0, "%s(), busy!\n", __FUNCTION__ );
> - return msecs_to_jiffies(10);
> - } else
> - self->speed_task = task;
> -
> - switch (speed) {
> - default:
> - case 9600:
> - byte = TEKRAM_PW|TEKRAM_9600;
> - break;
> - case 19200:
> - byte = TEKRAM_PW|TEKRAM_19200;
> - break;
> - case 38400:
> - byte = TEKRAM_PW|TEKRAM_38400;
> - break;
> - case 57600:
> - byte = TEKRAM_PW|TEKRAM_57600;
> - break;
> - case 115200:
> - byte = TEKRAM_115200;
> - break;
> - }
> -
> - switch (task->state) {
> - case IRDA_TASK_INIT:
> - case IRDA_TASK_CHILD_INIT:
> - /*
> - * Need to reset the dongle and go to 9600 bps before
> - * programming
> - */
> - if (irda_task_execute(self, tekram_reset, NULL, task,
> - (void *) speed))
> - {
> - /* Dongle need more time to reset */
> - irda_task_next_state(task, IRDA_TASK_CHILD_WAIT);
> -
> - /* Give reset 1 sec to finish */
> - ret = msecs_to_jiffies(1000);
> - } else
> - irda_task_next_state(task, IRDA_TASK_CHILD_DONE);
> - break;
> - case IRDA_TASK_CHILD_WAIT:
> - IRDA_WARNING("%s(), resetting dongle timed out!\n",
> - __FUNCTION__);
> - ret = -1;
> - break;
> - case IRDA_TASK_CHILD_DONE:
> - /* Set DTR, Clear RTS */
> - self->set_dtr_rts(self->dev, TRUE, FALSE);
> -
> - /* Wait at least 7us */
> - udelay(14);
> -
> - /* Write control byte */
> - self->write(self->dev, &byte, 1);
> -
> - irda_task_next_state(task, IRDA_TASK_WAIT);
> -
> - /* Wait at least 100 ms */
> - ret = msecs_to_jiffies(150);
> - break;
> - case IRDA_TASK_WAIT:
> - /* Set DTR, Set RTS */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->speed_task = NULL;
> - break;
> - default:
> - IRDA_ERROR("%s(), unknown state %d\n",
> - __FUNCTION__, task->state);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->speed_task = NULL;
> - ret = -1;
> - break;
> - }
> - return ret;
> -}
> -
> -/*
> - * Function tekram_reset (driver)
> - *
> - * This function resets the tekram dongle. Warning, this function
> - * must be called with a process context!!
> - *
> - * Algorithm:
> - * 0. Clear RTS and DTR, and wait 50 ms (power off the IR-210 )
> - * 1. clear RTS
> - * 2. set DTR, and wait at least 1 ms
> - * 3. clear DTR to SPACE state, wait at least 50 us for further
> - * operation
> - */
> -int tekram_reset(struct irda_task *task)
> -{
> - dongle_t *self = (dongle_t *) task->instance;
> - int ret = 0;
> -
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
> -
> - IRDA_ASSERT(task != NULL, return -1;);
> -
> - if (self->reset_task && self->reset_task != task) {
> - IRDA_DEBUG(0, "%s(), busy!\n", __FUNCTION__ );
> - return msecs_to_jiffies(10);
> - } else
> - self->reset_task = task;
> -
> - /* Power off dongle */
> - //self->set_dtr_rts(self->dev, FALSE, FALSE);
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - switch (task->state) {
> - case IRDA_TASK_INIT:
> - irda_task_next_state(task, IRDA_TASK_WAIT1);
> -
> - /* Sleep 50 ms */
> - ret = msecs_to_jiffies(50);
> - break;
> - case IRDA_TASK_WAIT1:
> - /* Clear DTR, Set RTS */
> - self->set_dtr_rts(self->dev, FALSE, TRUE);
> -
> - irda_task_next_state(task, IRDA_TASK_WAIT2);
> -
> - /* Should sleep 1 ms */
> - ret = msecs_to_jiffies(1);
> - break;
> - case IRDA_TASK_WAIT2:
> - /* Set DTR, Set RTS */
> - self->set_dtr_rts(self->dev, TRUE, TRUE);
> -
> - /* Wait at least 50 us */
> - udelay(75);
> -
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->reset_task = NULL;
> - break;
> - default:
> - IRDA_ERROR("%s(), unknown state %d\n",
> - __FUNCTION__, task->state);
> - irda_task_next_state(task, IRDA_TASK_DONE);
> - self->reset_task = NULL;
> - ret = -1;
> - }
> - return ret;
> -}
> -
> -MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
> -MODULE_DESCRIPTION("Tekram IrMate IR-210B dongle driver");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("irda-dongle-0"); /* IRDA_TEKRAM_DONGLE */
> -
> -/*
> - * Function init_module (void)
> - *
> - * Initialize Tekram module
> - *
> - */
> -module_init(tekram_init);
> -
> -/*
> - * Function cleanup_module (void)
> - *
> - * Cleanup Tekram module
> - *
> - */
> -module_exit(tekram_cleanup);
> diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h
> index bca19ca..f70e9b3 100644
> --- a/include/net/irda/irda_device.h
> +++ b/include/net/irda/irda_device.h
> @@ -228,21 +228,8 @@ static inline int irda_device_txqueue_empty(const struct net_device *dev)
> int irda_device_set_raw_mode(struct net_device* self, int status);
> struct net_device *alloc_irdadev(int sizeof_priv);
>
> -/* Dongle interface */
> -void irda_device_unregister_dongle(struct dongle_reg *dongle);
> -int irda_device_register_dongle(struct dongle_reg *dongle);
> -dongle_t *irda_device_dongle_init(struct net_device *dev, int type);
> -int irda_device_dongle_cleanup(dongle_t *dongle);
> -
> void irda_setup_dma(int channel, dma_addr_t buffer, int count, int mode);
>
> -void irda_task_delete(struct irda_task *task);
> -struct irda_task *irda_task_execute(void *instance,
> - IRDA_TASK_CALLBACK function,
> - IRDA_TASK_CALLBACK finished,
> - struct irda_task *parent, void *param);
> -void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state);
> -
> /*
> * Function irda_get_mtt (skb)
> *
> diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c
> index 435b563..8718591 100644
> --- a/net/irda/irda_device.c
> +++ b/net/irda/irda_device.c
> @@ -57,20 +57,6 @@ static void __irda_task_delete(struct irda_task *task);
> static hashbin_t *dongles = NULL;
> static hashbin_t *tasks = NULL;
>
> -#ifdef CONFIG_IRDA_DEBUG
> -static const char *task_state[] = {
> - "IRDA_TASK_INIT",
> - "IRDA_TASK_DONE",
> - "IRDA_TASK_WAIT",
> - "IRDA_TASK_WAIT1",
> - "IRDA_TASK_WAIT2",
> - "IRDA_TASK_WAIT3",
> - "IRDA_TASK_CHILD_INIT",
> - "IRDA_TASK_CHILD_WAIT",
> - "IRDA_TASK_CHILD_DONE",
> -};
> -#endif /* CONFIG_IRDA_DEBUG */
> -
> static void irda_task_timer_expired(void *data);
>
> int __init irda_device_init( void)
> @@ -176,14 +162,6 @@ int irda_device_is_receiving(struct net_device *dev)
> return req.ifr_receiving;
> }
>
> -void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state)
> -{
> - IRDA_DEBUG(2, "%s(), state = %s\n", __FUNCTION__, task_state[state]);
> -
> - task->state = state;
> -}
> -EXPORT_SYMBOL(irda_task_next_state);
> -
> static void __irda_task_delete(struct irda_task *task)
> {
> del_timer(&task->timer);
> @@ -191,14 +169,13 @@ static void __irda_task_delete(struct irda_task *task)
> kfree(task);
> }
>
> -void irda_task_delete(struct irda_task *task)
> +static void irda_task_delete(struct irda_task *task)
> {
> /* Unregister task */
> hashbin_remove(tasks, (long) task, NULL);
>
> __irda_task_delete(task);
> }
> -EXPORT_SYMBOL(irda_task_delete);
>
> /*
> * Function irda_task_kick (task)
> @@ -272,51 +249,6 @@ static int irda_task_kick(struct irda_task *task)
> }
>
> /*
> - * Function irda_task_execute (instance, function, finished)
> - *
> - * This function registers and tries to execute tasks that may take some
> - * time to complete. We do it this hairy way since we may have been
> - * called from interrupt context, so it's not possible to use
> - * schedule_timeout()
> - * Two important notes :
> - * o Make sure you irda_task_delete(task); in case you delete the
> - * calling instance.
> - * o No real need to lock when calling this function, but you may
> - * want to lock within the task handler.
> - * Jean II
> - */
> -struct irda_task *irda_task_execute(void *instance,
> - IRDA_TASK_CALLBACK function,
> - IRDA_TASK_CALLBACK finished,
> - struct irda_task *parent, void *param)
> -{
> - struct irda_task *task;
> -
> - IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
> -
> - task = kmalloc(sizeof(struct irda_task), GFP_ATOMIC);
> - if (!task)
> - return NULL;
> -
> - task->state = IRDA_TASK_INIT;
> - task->instance = instance;
> - task->function = function;
> - task->finished = finished;
> - task->parent = parent;
> - task->param = param;
> - task->magic = IRDA_TASK_MAGIC;
> -
> - init_timer(&task->timer);
> -
> - /* Register task */
> - hashbin_insert(tasks, (irda_queue_t *) task, (long) task, NULL);
> -
> - /* No time to waste, so lets get going! */
> - return irda_task_kick(task) ? NULL : task;
> -}
> -EXPORT_SYMBOL(irda_task_execute);
> -
> -/*
> * Function irda_task_timer_expired (data)
> *
> * Task time has expired. We now try to execute task (again), and restart
> @@ -364,105 +296,6 @@ struct net_device *alloc_irdadev(int sizeof_priv)
> }
> EXPORT_SYMBOL(alloc_irdadev);
>
> -/*
> - * Function irda_device_init_dongle (self, type, qos)
> - *
> - * Initialize attached dongle.
> - *
> - * Important : request_module require us to call this function with
> - * a process context and irq enabled. - Jean II
> - */
> -dongle_t *irda_device_dongle_init(struct net_device *dev, int type)
> -{
> - struct dongle_reg *reg;
> - dongle_t *dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL);
> -
> - might_sleep();
> -
> - spin_lock(&dongles->hb_spinlock);
> - reg = hashbin_find(dongles, type, NULL);
> -
> -#ifdef CONFIG_KMOD
> - /* Try to load the module needed */
> - if (!reg && capable(CAP_SYS_MODULE)) {
> - spin_unlock(&dongles->hb_spinlock);
> -
> - request_module("irda-dongle-%d", type);
> -
> - spin_lock(&dongles->hb_spinlock);
> - reg = hashbin_find(dongles, type, NULL);
> - }
> -#endif
> -
> - if (!reg || !try_module_get(reg->owner) ) {
> - IRDA_ERROR("IrDA: Unable to find requested dongle type %x\n",
> - type);
> - kfree(dongle);
> - dongle = NULL;
> - }
> - if (dongle) {
> - /* Bind the registration info to this particular instance */
> - dongle->issue = reg;
> - dongle->dev = dev;
> - }
> - spin_unlock(&dongles->hb_spinlock);
> - return dongle;
> -}
> -EXPORT_SYMBOL(irda_device_dongle_init);
> -
> -/*
> - * Function irda_device_dongle_cleanup (dongle)
> - */
> -int irda_device_dongle_cleanup(dongle_t *dongle)
> -{
> - IRDA_ASSERT(dongle != NULL, return -1;);
> -
> - dongle->issue->close(dongle);
> - module_put(dongle->issue->owner);
> - kfree(dongle);
> -
> - return 0;
> -}
> -EXPORT_SYMBOL(irda_device_dongle_cleanup);
> -
> -/*
> - * Function irda_device_register_dongle (dongle)
> - */
> -int irda_device_register_dongle(struct dongle_reg *new)
> -{
> - spin_lock(&dongles->hb_spinlock);
> - /* Check if this dongle has been registered before */
> - if (hashbin_find(dongles, new->type, NULL)) {
> - IRDA_MESSAGE("%s: Dongle type %x already registered\n",
> - __FUNCTION__, new->type);
> - } else {
> - /* Insert IrDA dongle into hashbin */
> - hashbin_insert(dongles, (irda_queue_t *) new, new->type, NULL);
> - }
> - spin_unlock(&dongles->hb_spinlock);
> -
> - return 0;
> -}
> -EXPORT_SYMBOL(irda_device_register_dongle);
> -
> -/*
> - * Function irda_device_unregister_dongle (dongle)
> - *
> - * Unregister dongle, and remove dongle from list of registered dongles
> - *
> - */
> -void irda_device_unregister_dongle(struct dongle_reg *dongle)
> -{
> - struct dongle *node;
> -
> - spin_lock(&dongles->hb_spinlock);
> - node = hashbin_remove(dongles, dongle->type, NULL);
> - if (!node)
> - IRDA_ERROR("%s: dongle not found!\n", __FUNCTION__);
> - spin_unlock(&dongles->hb_spinlock);
> -}
> -EXPORT_SYMBOL(irda_device_unregister_dongle);
> -
> #ifdef CONFIG_ISA_DMA_API
> /*
> * Function setup_dma (idev, buffer, count, mode)
>
>
^ permalink raw reply
* Re: [RFT] sky2: wake-on-lan configuration issues
From: Tino Keitel @ 2008-01-17 21:08 UTC (permalink / raw)
To: netdev
In-Reply-To: <478BCE98.5030709@yahoo.de>
Hi,
I tried 2.6.24-rc8 on my Mac mini Core Duo and noticed that WOL didn't
work anymore, whereas I never had a WOL failure with 2.6.23. The above
patch fixes WOL with 2.6.24-rc8 for me.
Thanks for tracking it down even before I was hit by this regression.
:-)
Regards,
Tino
^ permalink raw reply
* Re: [RFC][PATCH] Fixing SA/SP dumps on netlink/af_key
From: Herbert Xu @ 2008-01-17 21:34 UTC (permalink / raw)
To: Timo Teräs; +Cc: jamal, netdev, David Miller
In-Reply-To: <478F58A2.6030209@iki.fi>
On Thu, Jan 17, 2008 at 03:31:14PM +0200, Timo Teräs wrote:
>
> I guess the idea was that application should know about the SAs it
> created. Though a SA dump needs to be done if you want to check
> for existing entries (created by other processes, or if you are
> recovering from a crash).
That's what SADB_GET is for. In any case KMs cannot coexist so this
is pointless. After a crash you should simply flush all states and
policies.
> SPD dumping is still a must if you want to work nicely with kernel.
No it isn't. Look at how Openswan does it. No dumping anywhere at all.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [PATCH] PHYLIB: Locking fixes for PHY I/O potentially sleeping
From: Benjamin Herrenschmidt @ 2008-01-17 21:04 UTC (permalink / raw)
To: Nate Case; +Cc: Andy Fleming, netdev
In-Reply-To: <1199403419.25262.62.camel@localhost.localdomain>
On Thu, 2008-01-03 at 17:36 -0600, Nate Case wrote:
> PHY read/write functions can potentially sleep (e.g., a PHY accessed
> via I2C). The following changes were made to account for this:
>
> * Change spin locks to mutex locks
> * Add a BUG_ON() to phy_read() phy_write() to warn against
> calling them from an interrupt context.
> * Use work queue for PHY state machine handling since
> it can potentially sleep
> * Change phydev lock from spinlock to mutex
>
> Signed-off-by: Nate Case <ncase@xes-inc.com>
Excellent ! I've been wanting to do that for some time. I'll be able to
convert EMAC to phylib now :-) I'll review the patch in detail as I do
this convesion, maybe next week. Thanks !
Ben.
> ---
> drivers/net/phy/mdio_bus.c | 2 +-
> drivers/net/phy/phy.c | 68 ++++++++++++++++++++++++++++-------------
> drivers/net/phy/phy_device.c | 11 +++----
> include/linux/phy.h | 5 ++-
> 4 files changed, 55 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index c30196d..6e9f619 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -49,7 +49,7 @@ int mdiobus_register(struct mii_bus *bus)
> int i;
> int err = 0;
>
> - spin_lock_init(&bus->mdio_lock);
> + mutex_init(&bus->mdio_lock);
>
> if (NULL == bus || NULL == bus->name ||
> NULL == bus->read ||
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 7c9e6e3..12fccb1 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -26,7 +26,6 @@
> #include <linux/netdevice.h>
> #include <linux/etherdevice.h>
> #include <linux/skbuff.h>
> -#include <linux/spinlock.h>
> #include <linux/mm.h>
> #include <linux/module.h>
> #include <linux/mii.h>
> @@ -72,9 +71,11 @@ int phy_read(struct phy_device *phydev, u16 regnum)
> int retval;
> struct mii_bus *bus = phydev->bus;
>
> - spin_lock_bh(&bus->mdio_lock);
> + BUG_ON(in_interrupt());
> +
> + mutex_lock(&bus->mdio_lock);
> retval = bus->read(bus, phydev->addr, regnum);
> - spin_unlock_bh(&bus->mdio_lock);
> + mutex_unlock(&bus->mdio_lock);
>
> return retval;
> }
> @@ -95,9 +96,11 @@ int phy_write(struct phy_device *phydev, u16 regnum, u16 val)
> int err;
> struct mii_bus *bus = phydev->bus;
>
> - spin_lock_bh(&bus->mdio_lock);
> + BUG_ON(in_interrupt());
> +
> + mutex_lock(&bus->mdio_lock);
> err = bus->write(bus, phydev->addr, regnum, val);
> - spin_unlock_bh(&bus->mdio_lock);
> + mutex_unlock(&bus->mdio_lock);
>
> return err;
> }
> @@ -428,7 +431,7 @@ int phy_start_aneg(struct phy_device *phydev)
> {
> int err;
>
> - spin_lock_bh(&phydev->lock);
> + mutex_lock(&phydev->lock);
>
> if (AUTONEG_DISABLE == phydev->autoneg)
> phy_sanitize_settings(phydev);
> @@ -449,13 +452,14 @@ int phy_start_aneg(struct phy_device *phydev)
> }
>
> out_unlock:
> - spin_unlock_bh(&phydev->lock);
> + mutex_unlock(&phydev->lock);
> return err;
> }
> EXPORT_SYMBOL(phy_start_aneg);
>
>
> static void phy_change(struct work_struct *work);
> +static void phy_state_machine(struct work_struct *work);
> static void phy_timer(unsigned long data);
>
> /**
> @@ -476,6 +480,7 @@ void phy_start_machine(struct phy_device *phydev,
> {
> phydev->adjust_state = handler;
>
> + INIT_WORK(&phydev->state_queue, phy_state_machine);
> init_timer(&phydev->phy_timer);
> phydev->phy_timer.function = &phy_timer;
> phydev->phy_timer.data = (unsigned long) phydev;
> @@ -493,11 +498,12 @@ void phy_start_machine(struct phy_device *phydev,
> void phy_stop_machine(struct phy_device *phydev)
> {
> del_timer_sync(&phydev->phy_timer);
> + cancel_work_sync(&phydev->state_queue);
>
> - spin_lock_bh(&phydev->lock);
> + mutex_lock(&phydev->lock);
> if (phydev->state > PHY_UP)
> phydev->state = PHY_UP;
> - spin_unlock_bh(&phydev->lock);
> + mutex_unlock(&phydev->lock);
>
> phydev->adjust_state = NULL;
> }
> @@ -541,9 +547,9 @@ static void phy_force_reduction(struct phy_device *phydev)
> */
> void phy_error(struct phy_device *phydev)
> {
> - spin_lock_bh(&phydev->lock);
> + mutex_lock(&phydev->lock);
> phydev->state = PHY_HALTED;
> - spin_unlock_bh(&phydev->lock);
> + mutex_unlock(&phydev->lock);
> }
>
> /**
> @@ -705,10 +711,10 @@ static void phy_change(struct work_struct *work)
> if (err)
> goto phy_err;
>
> - spin_lock_bh(&phydev->lock);
> + mutex_lock(&phydev->lock);
> if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state))
> phydev->state = PHY_CHANGELINK;
> - spin_unlock_bh(&phydev->lock);
> + mutex_unlock(&phydev->lock);
>
> atomic_dec(&phydev->irq_disable);
> enable_irq(phydev->irq);
> @@ -735,7 +741,7 @@ phy_err:
> */
> void phy_stop(struct phy_device *phydev)
> {
> - spin_lock_bh(&phydev->lock);
> + mutex_lock(&phydev->lock);
>
> if (PHY_HALTED == phydev->state)
> goto out_unlock;
> @@ -751,7 +757,7 @@ void phy_stop(struct phy_device *phydev)
> phydev->state = PHY_HALTED;
>
> out_unlock:
> - spin_unlock_bh(&phydev->lock);
> + mutex_unlock(&phydev->lock);
>
> /*
> * Cannot call flush_scheduled_work() here as desired because
> @@ -773,7 +779,7 @@ out_unlock:
> */
> void phy_start(struct phy_device *phydev)
> {
> - spin_lock_bh(&phydev->lock);
> + mutex_lock(&phydev->lock);
>
> switch (phydev->state) {
> case PHY_STARTING:
> @@ -787,19 +793,26 @@ void phy_start(struct phy_device *phydev)
> default:
> break;
> }
> - spin_unlock_bh(&phydev->lock);
> + mutex_unlock(&phydev->lock);
> }
> EXPORT_SYMBOL(phy_stop);
> EXPORT_SYMBOL(phy_start);
>
> -/* PHY timer which handles the state machine */
> -static void phy_timer(unsigned long data)
> +/**
> + * phy_state_machine - Handle the state machine
> + * @work: work_struct that describes the work to be done
> + *
> + * Description: Scheduled by the state_queue workqueue each time
> + * phy_timer is triggered.
> + */
> +static void phy_state_machine(struct work_struct *work)
> {
> - struct phy_device *phydev = (struct phy_device *)data;
> + struct phy_device *phydev =
> + container_of(work, struct phy_device, state_queue);
> int needs_aneg = 0;
> int err = 0;
>
> - spin_lock_bh(&phydev->lock);
> + mutex_lock(&phydev->lock);
>
> if (phydev->adjust_state)
> phydev->adjust_state(phydev->attached_dev);
> @@ -965,7 +978,7 @@ static void phy_timer(unsigned long data)
> break;
> }
>
> - spin_unlock_bh(&phydev->lock);
> + mutex_unlock(&phydev->lock);
>
> if (needs_aneg)
> err = phy_start_aneg(phydev);
> @@ -976,3 +989,14 @@ static void phy_timer(unsigned long data)
> mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ);
> }
>
> +/* PHY timer which schedules the state machine work */
> +static void phy_timer(unsigned long data)
> +{
> + struct phy_device *phydev = (struct phy_device *)data;
> +
> + /*
> + * PHY I/O operations can potentially sleep so we ensure that
> + * it's done from a process context
> + */
> + schedule_work(&phydev->state_queue);
> +}
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 5b9e175..f4c4fd8 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -25,7 +25,6 @@
> #include <linux/netdevice.h>
> #include <linux/etherdevice.h>
> #include <linux/skbuff.h>
> -#include <linux/spinlock.h>
> #include <linux/mm.h>
> #include <linux/module.h>
> #include <linux/mii.h>
> @@ -80,7 +79,7 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
>
> dev->state = PHY_DOWN;
>
> - spin_lock_init(&dev->lock);
> + mutex_init(&dev->lock);
>
> return dev;
> }
> @@ -656,7 +655,7 @@ static int phy_probe(struct device *dev)
> if (!(phydrv->flags & PHY_HAS_INTERRUPT))
> phydev->irq = PHY_POLL;
>
> - spin_lock_bh(&phydev->lock);
> + mutex_lock(&phydev->lock);
>
> /* Start out supporting everything. Eventually,
> * a controller will attach, and may modify one
> @@ -670,7 +669,7 @@ static int phy_probe(struct device *dev)
> if (phydev->drv->probe)
> err = phydev->drv->probe(phydev);
>
> - spin_unlock_bh(&phydev->lock);
> + mutex_unlock(&phydev->lock);
>
> return err;
>
> @@ -682,9 +681,9 @@ static int phy_remove(struct device *dev)
>
> phydev = to_phy_device(dev);
>
> - spin_lock_bh(&phydev->lock);
> + mutex_lock(&phydev->lock);
> phydev->state = PHY_DOWN;
> - spin_unlock_bh(&phydev->lock);
> + mutex_unlock(&phydev->lock);
>
> if (phydev->drv->remove)
> phydev->drv->remove(phydev);
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 554836e..5e43ae7 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -88,7 +88,7 @@ struct mii_bus {
>
> /* A lock to ensure that only one thing can read/write
> * the MDIO bus at a time */
> - spinlock_t mdio_lock;
> + struct mutex mdio_lock;
>
> struct device *dev;
>
> @@ -284,10 +284,11 @@ struct phy_device {
>
> /* Interrupt and Polling infrastructure */
> struct work_struct phy_queue;
> + struct work_struct state_queue;
> struct timer_list phy_timer;
> atomic_t irq_disable;
>
> - spinlock_t lock;
> + struct mutex lock;
>
> struct net_device *attached_dev;
>
^ permalink raw reply
* Re: [PATCH] net: NEWEMAC: Remove "rgmii-interface" from rgmii matching table
From: Benjamin Herrenschmidt @ 2008-01-17 20:53 UTC (permalink / raw)
To: Stefan Roese; +Cc: linuxppc-dev, netdev
In-Reply-To: <1200476230-14026-1-git-send-email-sr@denx.de>
On Wed, 2008-01-16 at 10:37 +0100, Stefan Roese wrote:
> With the removal the the "rgmii-interface" device_type property from the
> dts files, the newemac driver needs an update to only rely on compatible
> property.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
> ---
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Jeff, please stick that into your queue for 2.6.25, thanks !
Ben.
> drivers/net/ibm_newemac/rgmii.c | 1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c
> index 9bc1132..5757788 100644
> --- a/drivers/net/ibm_newemac/rgmii.c
> +++ b/drivers/net/ibm_newemac/rgmii.c
> @@ -302,7 +302,6 @@ static int __devexit rgmii_remove(struct of_device *ofdev)
> static struct of_device_id rgmii_match[] =
> {
> {
> - .type = "rgmii-interface",
> .compatible = "ibm,rgmii",
> },
> {
^ permalink raw reply
* Re: [PATCH 6/8] [PATCH] Split up rndis_host.c
From: Jussi Kivilinna @ 2008-01-17 20:40 UTC (permalink / raw)
To: David Brownell
Cc: bjd-a1rhEgazXTw, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <200801080319.23299.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
On Tue, 2008-01-08 at 03:19 -0800, David Brownell wrote:
> > Our
> > module version checks OID_GEN_PHYSICAL_MEDIUM in generic_rndis_bind,
> > with rndis_host bind fails if OID is supported and wireless media
type
> > is returned, with rndis_wext if OID isn't supported or type isn't
> > wireless. Should this be ok?
>
> Sounds like if you can go the different-modules route, then
rndis_bind()
> should maybe accept a parameter giving it that option. Then
>
> rndis_wlan_bind(...) == rndis_bind(..., check_wlan_media)
> rndis_generic_bind(...) == rndis_bind(..., non_wlan_media)
>
> That would be getting pretty complicated, since as you say the same
> USB-level binding (hence hotplugging) would need to kick in ... but
> having different modules for different RNDIS flavors would need a
> new hotplug mechanism keying on media type. Ugh.
Different modules works with rndis_generic_bind(..., media type option).
dmesg shows following:
[11214.496773] usb 3-3: new high speed USB device using ehci_hcd and
address 7
[11214.622861] usb 3-3: configuration #1 chosen from 1 choice
[11214.784874] usbcore: registered new interface driver cdc_ether
[11214.805700] rndis_host 3-3:1.0: driver requires wired physical
medium, but device is wireless.
[11214.806823] usbcore: registered new interface driver rndis_host
[11215.190824] wlan0: register 'rndis_wext' at usb-0000:00:10.3-3,
Wireless RNDIS device, 00:xx:xx:xx:xx:xx
[11215.190853] usbcore: registered new interface driver rndis_wext
[11215.398850] rndis_wext 3-3:1.0: rndis media disconnect
I assume that rndis_host gets always bind first as it's first in
alphabetic, so rndis_wext is only loaded if RNDIS device has wireless
media type.
I have new patchset that prepares rndis_host/usbnet for separate
rndis_wext but not sure should I submit (I haven't managed to get into
contact with Bjorge Dijkstra for 3,5 weeks now to have him decide how to
proceed).
- Jussi Kivilinna
^ permalink raw reply
* Re: [PATCH] IPv6 support for NFS server
From: J. Bruce Fields @ 2008-01-17 20:38 UTC (permalink / raw)
To: Aurélien Charbon; +Cc: netdev ML, Brian Haley, Mailing list NFSv4
In-Reply-To: <478F8AA3.9060707@ext.bull.net>
On Thu, Jan 17, 2008 at 06:04:35PM +0100, Aurélien Charbon wrote:
> Hi Bruce.
>
> Thanks for your comments.
> Here is the patch with some cleanups.
Thanks for the revisions. We need to submit this with a patch comment
that:
- Explains more precisely what this does (fixes export
interfaces to allow ipv6) and what remains to be done (?)
- Credits the folks (like Brian Haley) who have provided
feedback.
I'll help clean up that comment if needed but please make sure it's
always included with the patch when you resend it.
--b.
>
> Regards,
> Aurélien
>
>
> --
>
> ********************************
> Aurelien Charbon
> Linux NFSv4 team
> Bull SAS
> Echirolles - France
> http://nfsv4.bullopensource.org/
> ********************************
>
> >From 51755892e19186cd18230bac3f783b0382bf9ae0 Mon Sep 17 00:00:00 2001
> From: Aurelien Charbon <aurelien.charbon@ext.bull.net>
> Date: Thu, 17 Jan 2008 14:55:03 +0100
> Subject: [PATCH 1/1] IPv6 support for NFS server
>
> ---
> fs/nfsd/export.c | 9 ++-
> fs/nfsd/nfsctl.c | 15 +++++-
> include/linux/sunrpc/svcauth.h | 4 +-
> include/net/ipv6.h | 9 +++
> net/sunrpc/svcauth_unix.c | 118 +++++++++++++++++++++++++++-------------
> 5 files changed, 110 insertions(+), 45 deletions(-)
>
> diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
> index 66d0aeb..208db3a 100644
> --- a/fs/nfsd/export.c
> +++ b/fs/nfsd/export.c
> @@ -35,6 +35,7 @@
> #include <linux/lockd/bind.h>
> #include <linux/sunrpc/msg_prot.h>
> #include <linux/sunrpc/gss_api.h>
> +#include <net/ipv6.h>
>
> #define NFSDDBG_FACILITY NFSDDBG_EXPORT
>
> @@ -1556,6 +1557,7 @@ exp_addclient(struct nfsctl_client *ncp)
> {
> struct auth_domain *dom;
> int i, err;
> + struct in6_addr addr6;
>
> /* First, consistency check. */
> err = -EINVAL;
> @@ -1574,9 +1576,10 @@ exp_addclient(struct nfsctl_client *ncp)
> goto out_unlock;
>
> /* Insert client into hashtable. */
> - for (i = 0; i < ncp->cl_naddr; i++)
> - auth_unix_add_addr(ncp->cl_addrlist[i], dom);
> -
> + for (i = 0; i < ncp->cl_naddr; i++) {
> + ipv6_addr_set_v4mapped(ncp->cl_addrlist[i].s_addr, &addr6);
> + auth_unix_add_addr(&addr6, dom);
> + }
> auth_unix_forget_old(dom);
> auth_domain_put(dom);
>
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index 77dc989..13d6b6b 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -37,6 +37,7 @@
> #include <linux/nfsd/syscall.h>
>
> #include <asm/uaccess.h>
> +#include <net/ipv6.h>
>
> /*
> * We have a single directory with 9 nodes in it.
> @@ -222,6 +223,7 @@ static ssize_t write_getfs(struct file *file, char *buf, size_t size)
> struct auth_domain *clp;
> int err = 0;
> struct knfsd_fh *res;
> + struct in6_addr in6;
>
> if (size < sizeof(*data))
> return -EINVAL;
> @@ -236,7 +238,11 @@ static ssize_t write_getfs(struct file *file, char *buf, size_t size)
> res = (struct knfsd_fh*)buf;
>
> exp_readlock();
> - if (!(clp = auth_unix_lookup(sin->sin_addr)))
> +
> + ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6);
> +
> + clp = auth_unix_lookup(&in6);
> + if (!clp)
> err = -EPERM;
> else {
> err = exp_rootfh(clp, data->gd_path, res, data->gd_maxlen);
> @@ -257,6 +263,7 @@ static ssize_t write_getfd(struct file *file, char *buf, size_t size)
> int err = 0;
> struct knfsd_fh fh;
> char *res;
> + struct in6_addr in6;
>
> if (size < sizeof(*data))
> return -EINVAL;
> @@ -271,7 +278,11 @@ static ssize_t write_getfd(struct file *file, char *buf, size_t size)
> res = buf;
> sin = (struct sockaddr_in *)&data->gd_addr;
> exp_readlock();
> - if (!(clp = auth_unix_lookup(sin->sin_addr)))
> +
> + ipv6_addr_set_v4mapped(sin->sin_addr.s_addr,&in6);
> +
> + clp = auth_unix_lookup(&in6);
> + if (!clp)
> err = -EPERM;
> else {
> err = exp_rootfh(clp, data->gd_path, &fh, NFS_FHSIZE);
> diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
> index 22e1ef8..9e6fb86 100644
> --- a/include/linux/sunrpc/svcauth.h
> +++ b/include/linux/sunrpc/svcauth.h
> @@ -120,10 +120,10 @@ extern void svc_auth_unregister(rpc_authflavor_t flavor);
>
> extern struct auth_domain *unix_domain_find(char *name);
> extern void auth_domain_put(struct auth_domain *item);
> -extern int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom);
> +extern int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom);
> extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new);
> extern struct auth_domain *auth_domain_find(char *name);
> -extern struct auth_domain *auth_unix_lookup(struct in_addr addr);
> +extern struct auth_domain *auth_unix_lookup(struct in6_addr *addr);
> extern int auth_unix_forget_old(struct auth_domain *dom);
> extern void svcauth_unix_purge(void);
> extern void svcauth_unix_info_release(void *);
> diff --git a/include/net/ipv6.h b/include/net/ipv6.h
> index ae328b6..9394710 100644
> --- a/include/net/ipv6.h
> +++ b/include/net/ipv6.h
> @@ -400,6 +400,15 @@ static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
> a->s6_addr32[2] == htonl(0x0000ffff));
> }
>
> +static inline void ipv6_addr_set_v4mapped(const __be32 addr,
> + struct in6_addr *v4mapped)
> +{
> + ipv6_addr_set(v4mapped,
> + 0, 0,
> + htonl(0x0000FFFF),
> + addr);
> +}
> +
> /*
> * find the first different bit between two addresses
> * length of address must be a multiple of 32bits
> diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
> index 4114794..10ba208 100644
> --- a/net/sunrpc/svcauth_unix.c
> +++ b/net/sunrpc/svcauth_unix.c
> @@ -11,7 +11,8 @@
> #include <linux/hash.h>
> #include <linux/string.h>
> #include <net/sock.h>
> -
> +#include <net/ipv6.h>
> +#include <linux/kernel.h>
> #define RPCDBG_FACILITY RPCDBG_AUTH
>
>
> @@ -84,7 +85,7 @@ static void svcauth_unix_domain_release(struct auth_domain *dom)
> struct ip_map {
> struct cache_head h;
> char m_class[8]; /* e.g. "nfsd" */
> - struct in_addr m_addr;
> + struct in6_addr m_addr;
> struct unix_domain *m_client;
> int m_add_change;
> };
> @@ -112,12 +113,19 @@ static inline int hash_ip(__be32 ip)
> return (hash ^ (hash>>8)) & 0xff;
> }
> #endif
> +static inline int hash_ip6(struct in6_addr ip)
> +{
> + return (hash_ip(ip.s6_addr32[0]) ^
> + hash_ip(ip.s6_addr32[1]) ^
> + hash_ip(ip.s6_addr32[2]) ^
> + hash_ip(ip.s6_addr32[3]));
> +}
> static int ip_map_match(struct cache_head *corig, struct cache_head *cnew)
> {
> struct ip_map *orig = container_of(corig, struct ip_map, h);
> struct ip_map *new = container_of(cnew, struct ip_map, h);
> return strcmp(orig->m_class, new->m_class) == 0
> - && orig->m_addr.s_addr == new->m_addr.s_addr;
> + && ipv6_addr_equal(&orig->m_addr, &new->m_addr);
> }
> static void ip_map_init(struct cache_head *cnew, struct cache_head *citem)
> {
> @@ -125,7 +133,7 @@ static void ip_map_init(struct cache_head *cnew, struct cache_head *citem)
> struct ip_map *item = container_of(citem, struct ip_map, h);
>
> strcpy(new->m_class, item->m_class);
> - new->m_addr.s_addr = item->m_addr.s_addr;
> + ipv6_addr_copy(&new->m_addr, &item->m_addr);
> }
> static void update(struct cache_head *cnew, struct cache_head *citem)
> {
> @@ -149,22 +157,24 @@ static void ip_map_request(struct cache_detail *cd,
> struct cache_head *h,
> char **bpp, int *blen)
> {
> - char text_addr[20];
> + char text_addr[40];
> struct ip_map *im = container_of(h, struct ip_map, h);
> - __be32 addr = im->m_addr.s_addr;
> -
> - snprintf(text_addr, 20, "%u.%u.%u.%u",
> - ntohl(addr) >> 24 & 0xff,
> - ntohl(addr) >> 16 & 0xff,
> - ntohl(addr) >> 8 & 0xff,
> - ntohl(addr) >> 0 & 0xff);
>
> + if (ipv6_addr_v4mapped(&(im->m_addr))) {
> + snprintf(text_addr, 20, NIPQUAD_FMT,
> + ntohl(im->m_addr.s6_addr32[3]) >> 24 & 0xff,
> + ntohl(im->m_addr.s6_addr32[3]) >> 16 & 0xff,
> + ntohl(im->m_addr.s6_addr32[3]) >> 8 & 0xff,
> + ntohl(im->m_addr.s6_addr32[3]) >> 0 & 0xff);
> + } else {
> + snprintf(text_addr, 40, NIP6_FMT, NIP6(im->m_addr));
> + }
> qword_add(bpp, blen, im->m_class);
> qword_add(bpp, blen, text_addr);
> (*bpp)[-1] = '\n';
> }
>
> -static struct ip_map *ip_map_lookup(char *class, struct in_addr addr);
> +static struct ip_map *ip_map_lookup(char *class, struct in6_addr *addr);
> static int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t expiry);
>
> static int ip_map_parse(struct cache_detail *cd,
> @@ -175,10 +185,10 @@ static int ip_map_parse(struct cache_detail *cd,
> * for scratch: */
> char *buf = mesg;
> int len;
> - int b1,b2,b3,b4;
> + int b1, b2, b3, b4, b5, b6, b7, b8;
> char c;
> char class[8];
> - struct in_addr addr;
> + struct in6_addr addr;
> int err;
>
> struct ip_map *ipmp;
> @@ -197,7 +207,23 @@ static int ip_map_parse(struct cache_detail *cd,
> len = qword_get(&mesg, buf, mlen);
> if (len <= 0) return -EINVAL;
>
> - if (sscanf(buf, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c) != 4)
> + if (sscanf(buf, NIPQUAD_FMT "%c", &b1, &b2, &b3, &b4, &c) == 4) {
> + addr.s6_addr32[0] = 0;
> + addr.s6_addr32[1] = 0;
> + addr.s6_addr32[2] = htonl(0xffff);
> + addr.s6_addr32[3] =
> + htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4);
> + } else if (sscanf(buf, NIP6_FMT "%c",
> + &b1, &b2, &b3, &b4, &b5, &b6, &b7, &b8, &c) == 8) {
> + addr.s6_addr16[0] = htons(b1);
> + addr.s6_addr16[1] = htons(b2);
> + addr.s6_addr16[2] = htons(b3);
> + addr.s6_addr16[3] = htons(b4);
> + addr.s6_addr16[4] = htons(b5);
> + addr.s6_addr16[5] = htons(b6);
> + addr.s6_addr16[6] = htons(b7);
> + addr.s6_addr16[7] = htons(b8);
> + } else
> return -EINVAL;
>
> expiry = get_expiry(&mesg);
> @@ -215,10 +241,7 @@ static int ip_map_parse(struct cache_detail *cd,
> } else
> dom = NULL;
>
> - addr.s_addr =
> - htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4);
> -
> - ipmp = ip_map_lookup(class,addr);
> + ipmp = ip_map_lookup(class, &addr);
> if (ipmp) {
> err = ip_map_update(ipmp,
> container_of(dom, struct unix_domain, h),
> @@ -238,7 +261,7 @@ static int ip_map_show(struct seq_file *m,
> struct cache_head *h)
> {
> struct ip_map *im;
> - struct in_addr addr;
> + struct in6_addr addr;
> char *dom = "-no-domain-";
>
> if (h == NULL) {
> @@ -247,20 +270,24 @@ static int ip_map_show(struct seq_file *m,
> }
> im = container_of(h, struct ip_map, h);
> /* class addr domain */
> - addr = im->m_addr;
> + ipv6_addr_copy(&addr, &im->m_addr);
>
> if (test_bit(CACHE_VALID, &h->flags) &&
> !test_bit(CACHE_NEGATIVE, &h->flags))
> dom = im->m_client->h.name;
>
> - seq_printf(m, "%s %d.%d.%d.%d %s\n",
> - im->m_class,
> - ntohl(addr.s_addr) >> 24 & 0xff,
> - ntohl(addr.s_addr) >> 16 & 0xff,
> - ntohl(addr.s_addr) >> 8 & 0xff,
> - ntohl(addr.s_addr) >> 0 & 0xff,
> - dom
> - );
> + if (ipv6_addr_v4mapped(&addr)) {
> + seq_printf(m, "%s" NIPQUAD_FMT "%s\n",
> + im->m_class,
> + ntohl(addr.s6_addr32[3]) >> 24 & 0xff,
> + ntohl(addr.s6_addr32[3]) >> 16 & 0xff,
> + ntohl(addr.s6_addr32[3]) >> 8 & 0xff,
> + ntohl(addr.s6_addr32[3]) >> 0 & 0xff,
> + dom);
> + } else {
> + seq_printf(m, "%s" NIP6_FMT "%s\n",
> + im->m_class, NIP6(addr), dom);
> + }
> return 0;
> }
>
> @@ -280,16 +307,16 @@ struct cache_detail ip_map_cache = {
> .alloc = ip_map_alloc,
> };
>
> -static struct ip_map *ip_map_lookup(char *class, struct in_addr addr)
> +static struct ip_map *ip_map_lookup(char *class, struct in6_addr *addr)
> {
> struct ip_map ip;
> struct cache_head *ch;
>
> strcpy(ip.m_class, class);
> - ip.m_addr = addr;
> + ipv6_addr_copy(&ip.m_addr, addr);
> ch = sunrpc_cache_lookup(&ip_map_cache, &ip.h,
> hash_str(class, IP_HASHBITS) ^
> - hash_ip(addr.s_addr));
> + hash_ip6(*addr));
>
> if (ch)
> return container_of(ch, struct ip_map, h);
> @@ -318,14 +345,14 @@ static int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t ex
> ch = sunrpc_cache_update(&ip_map_cache,
> &ip.h, &ipm->h,
> hash_str(ipm->m_class, IP_HASHBITS) ^
> - hash_ip(ipm->m_addr.s_addr));
> + hash_ip6(ipm->m_addr));
> if (!ch)
> return -ENOMEM;
> cache_put(ch, &ip_map_cache);
> return 0;
> }
>
> -int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom)
> +int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom)
> {
> struct unix_domain *udom;
> struct ip_map *ipmp;
> @@ -352,7 +379,7 @@ int auth_unix_forget_old(struct auth_domain *dom)
> return 0;
> }
>
> -struct auth_domain *auth_unix_lookup(struct in_addr addr)
> +struct auth_domain *auth_unix_lookup(struct in6_addr *addr)
> {
> struct ip_map *ipm;
> struct auth_domain *rv;
> @@ -641,9 +668,24 @@ static int unix_gid_find(uid_t uid, struct group_info **gip,
> int
> svcauth_unix_set_client(struct svc_rqst *rqstp)
> {
> - struct sockaddr_in *sin = svc_addr_in(rqstp);
> + struct sockaddr_in *sin;
> + struct sockaddr_in6 *sin6, sin6_storage;
> struct ip_map *ipm;
>
> + switch (rqstp->rq_addr.ss_family) {
> + case AF_INET:
> + sin = svc_addr_in(rqstp);
> + sin6 = &sin6_storage;
> + ipv6_addr_set(&sin6->sin6_addr, 0, 0,
> + htonl(0x0000FFFF), sin->sin_addr.s_addr);
> + break;
> + case AF_INET6:
> + sin6 = svc_addr_in6(rqstp);
> + break;
> + default:
> + BUG();
> + }
> +
> rqstp->rq_client = NULL;
> if (rqstp->rq_proc == 0)
> return SVC_OK;
> @@ -651,7 +693,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
> ipm = ip_map_cached_get(rqstp);
> if (ipm == NULL)
> ipm = ip_map_lookup(rqstp->rq_server->sv_program->pg_class,
> - sin->sin_addr);
> + &sin6->sin6_addr);
>
> if (ipm == NULL)
> return SVC_DENIED;
> --
> 1.5.3.8
>
_______________________________________________
NFSv4 mailing list
NFSv4@linux-nfs.org
http://linux-nfs.org/cgi-bin/mailman/listinfo/nfsv4
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox