diff options
author | Michal Marek <mmarek@suse.cz> | 2010-10-12 09:09:06 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-10-12 09:09:06 -0400 |
commit | 239060b93bb30a4ad55f1ecaa512464a035cc5ba (patch) | |
tree | 77f79810e57d4fc24356eca0cd6db463e8994128 /net/atm | |
parent | 1408b15b98635a13bad2e2a50b3c2ae2ccdf625b (diff) | |
parent | e9203c988234aa512bd45ca32b52e21c7bbfc414 (diff) |
Merge branch 'kbuild/rc-fixes' into kbuild/kconfig
We need to revert the temporary hack in 71ebc01, hence the merge.
Diffstat (limited to 'net/atm')
-rw-r--r-- | net/atm/br2684.c | 66 | ||||
-rw-r--r-- | net/atm/clip.c | 2 | ||||
-rw-r--r-- | net/atm/common.c | 30 | ||||
-rw-r--r-- | net/atm/pppoatm.c | 2 |
4 files changed, 96 insertions, 4 deletions
diff --git a/net/atm/br2684.c b/net/atm/br2684.c index 6719af6a59fa..651babdfab38 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c | |||
@@ -139,6 +139,43 @@ static struct net_device *br2684_find_dev(const struct br2684_if_spec *s) | |||
139 | return NULL; | 139 | return NULL; |
140 | } | 140 | } |
141 | 141 | ||
142 | static int atm_dev_event(struct notifier_block *this, unsigned long event, | ||
143 | void *arg) | ||
144 | { | ||
145 | struct atm_dev *atm_dev = arg; | ||
146 | struct list_head *lh; | ||
147 | struct net_device *net_dev; | ||
148 | struct br2684_vcc *brvcc; | ||
149 | struct atm_vcc *atm_vcc; | ||
150 | unsigned long flags; | ||
151 | |||
152 | pr_debug("event=%ld dev=%p\n", event, atm_dev); | ||
153 | |||
154 | read_lock_irqsave(&devs_lock, flags); | ||
155 | list_for_each(lh, &br2684_devs) { | ||
156 | net_dev = list_entry_brdev(lh); | ||
157 | |||
158 | list_for_each_entry(brvcc, &BRPRIV(net_dev)->brvccs, brvccs) { | ||
159 | atm_vcc = brvcc->atmvcc; | ||
160 | if (atm_vcc && brvcc->atmvcc->dev == atm_dev) { | ||
161 | |||
162 | if (atm_vcc->dev->signal == ATM_PHY_SIG_LOST) | ||
163 | netif_carrier_off(net_dev); | ||
164 | else | ||
165 | netif_carrier_on(net_dev); | ||
166 | |||
167 | } | ||
168 | } | ||
169 | } | ||
170 | read_unlock_irqrestore(&devs_lock, flags); | ||
171 | |||
172 | return NOTIFY_DONE; | ||
173 | } | ||
174 | |||
175 | static struct notifier_block atm_dev_notifier = { | ||
176 | .notifier_call = atm_dev_event, | ||
177 | }; | ||
178 | |||
142 | /* chained vcc->pop function. Check if we should wake the netif_queue */ | 179 | /* chained vcc->pop function. Check if we should wake the netif_queue */ |
143 | static void br2684_pop(struct atm_vcc *vcc, struct sk_buff *skb) | 180 | static void br2684_pop(struct atm_vcc *vcc, struct sk_buff *skb) |
144 | { | 181 | { |
@@ -362,6 +399,12 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb) | |||
362 | unregister_netdev(net_dev); | 399 | unregister_netdev(net_dev); |
363 | free_netdev(net_dev); | 400 | free_netdev(net_dev); |
364 | } | 401 | } |
402 | read_lock_irq(&devs_lock); | ||
403 | if (list_empty(&br2684_devs)) { | ||
404 | /* last br2684 device */ | ||
405 | unregister_atmdevice_notifier(&atm_dev_notifier); | ||
406 | } | ||
407 | read_unlock_irq(&devs_lock); | ||
365 | return; | 408 | return; |
366 | } | 409 | } |
367 | 410 | ||
@@ -530,6 +573,13 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg) | |||
530 | 573 | ||
531 | br2684_push(atmvcc, skb); | 574 | br2684_push(atmvcc, skb); |
532 | } | 575 | } |
576 | |||
577 | /* initialize netdev carrier state */ | ||
578 | if (atmvcc->dev->signal == ATM_PHY_SIG_LOST) | ||
579 | netif_carrier_off(net_dev); | ||
580 | else | ||
581 | netif_carrier_on(net_dev); | ||
582 | |||
533 | __module_get(THIS_MODULE); | 583 | __module_get(THIS_MODULE); |
534 | return 0; | 584 | return 0; |
535 | 585 | ||
@@ -620,9 +670,16 @@ static int br2684_create(void __user *arg) | |||
620 | } | 670 | } |
621 | 671 | ||
622 | write_lock_irq(&devs_lock); | 672 | write_lock_irq(&devs_lock); |
673 | |||
623 | brdev->payload = payload; | 674 | brdev->payload = payload; |
624 | brdev->number = list_empty(&br2684_devs) ? 1 : | 675 | |
625 | BRPRIV(list_entry_brdev(br2684_devs.prev))->number + 1; | 676 | if (list_empty(&br2684_devs)) { |
677 | /* 1st br2684 device */ | ||
678 | register_atmdevice_notifier(&atm_dev_notifier); | ||
679 | brdev->number = 1; | ||
680 | } else | ||
681 | brdev->number = BRPRIV(list_entry_brdev(br2684_devs.prev))->number + 1; | ||
682 | |||
626 | list_add_tail(&brdev->br2684_devs, &br2684_devs); | 683 | list_add_tail(&brdev->br2684_devs, &br2684_devs); |
627 | write_unlock_irq(&devs_lock); | 684 | write_unlock_irq(&devs_lock); |
628 | return 0; | 685 | return 0; |
@@ -772,6 +829,11 @@ static void __exit br2684_exit(void) | |||
772 | remove_proc_entry("br2684", atm_proc_root); | 829 | remove_proc_entry("br2684", atm_proc_root); |
773 | #endif | 830 | #endif |
774 | 831 | ||
832 | |||
833 | /* if not already empty */ | ||
834 | if (!list_empty(&br2684_devs)) | ||
835 | unregister_atmdevice_notifier(&atm_dev_notifier); | ||
836 | |||
775 | while (!list_empty(&br2684_devs)) { | 837 | while (!list_empty(&br2684_devs)) { |
776 | net_dev = list_entry_brdev(br2684_devs.next); | 838 | net_dev = list_entry_brdev(br2684_devs.next); |
777 | brdev = BRPRIV(net_dev); | 839 | brdev = BRPRIV(net_dev); |
diff --git a/net/atm/clip.c b/net/atm/clip.c index 313aba11316b..95fdd1185067 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c | |||
@@ -522,7 +522,7 @@ static int clip_setentry(struct atm_vcc *vcc, __be32 ip) | |||
522 | error = ip_route_output_key(&init_net, &rt, &fl); | 522 | error = ip_route_output_key(&init_net, &rt, &fl); |
523 | if (error) | 523 | if (error) |
524 | return error; | 524 | return error; |
525 | neigh = __neigh_lookup(&clip_tbl, &ip, rt->u.dst.dev, 1); | 525 | neigh = __neigh_lookup(&clip_tbl, &ip, rt->dst.dev, 1); |
526 | ip_rt_put(rt); | 526 | ip_rt_put(rt); |
527 | if (!neigh) | 527 | if (!neigh) |
528 | return -ENOMEM; | 528 | return -ENOMEM; |
diff --git a/net/atm/common.c b/net/atm/common.c index b43feb1a3995..940404a73b3d 100644 --- a/net/atm/common.c +++ b/net/atm/common.c | |||
@@ -37,6 +37,8 @@ EXPORT_SYMBOL(vcc_hash); | |||
37 | DEFINE_RWLOCK(vcc_sklist_lock); | 37 | DEFINE_RWLOCK(vcc_sklist_lock); |
38 | EXPORT_SYMBOL(vcc_sklist_lock); | 38 | EXPORT_SYMBOL(vcc_sklist_lock); |
39 | 39 | ||
40 | static ATOMIC_NOTIFIER_HEAD(atm_dev_notify_chain); | ||
41 | |||
40 | static void __vcc_insert_socket(struct sock *sk) | 42 | static void __vcc_insert_socket(struct sock *sk) |
41 | { | 43 | { |
42 | struct atm_vcc *vcc = atm_sk(sk); | 44 | struct atm_vcc *vcc = atm_sk(sk); |
@@ -212,6 +214,22 @@ void vcc_release_async(struct atm_vcc *vcc, int reply) | |||
212 | } | 214 | } |
213 | EXPORT_SYMBOL(vcc_release_async); | 215 | EXPORT_SYMBOL(vcc_release_async); |
214 | 216 | ||
217 | void atm_dev_signal_change(struct atm_dev *dev, char signal) | ||
218 | { | ||
219 | pr_debug("%s signal=%d dev=%p number=%d dev->signal=%d\n", | ||
220 | __func__, signal, dev, dev->number, dev->signal); | ||
221 | |||
222 | /* atm driver sending invalid signal */ | ||
223 | WARN_ON(signal < ATM_PHY_SIG_LOST || signal > ATM_PHY_SIG_FOUND); | ||
224 | |||
225 | if (dev->signal == signal) | ||
226 | return; /* no change */ | ||
227 | |||
228 | dev->signal = signal; | ||
229 | |||
230 | atomic_notifier_call_chain(&atm_dev_notify_chain, signal, dev); | ||
231 | } | ||
232 | EXPORT_SYMBOL(atm_dev_signal_change); | ||
215 | 233 | ||
216 | void atm_dev_release_vccs(struct atm_dev *dev) | 234 | void atm_dev_release_vccs(struct atm_dev *dev) |
217 | { | 235 | { |
@@ -781,6 +799,18 @@ int vcc_getsockopt(struct socket *sock, int level, int optname, | |||
781 | return vcc->dev->ops->getsockopt(vcc, level, optname, optval, len); | 799 | return vcc->dev->ops->getsockopt(vcc, level, optname, optval, len); |
782 | } | 800 | } |
783 | 801 | ||
802 | int register_atmdevice_notifier(struct notifier_block *nb) | ||
803 | { | ||
804 | return atomic_notifier_chain_register(&atm_dev_notify_chain, nb); | ||
805 | } | ||
806 | EXPORT_SYMBOL_GPL(register_atmdevice_notifier); | ||
807 | |||
808 | void unregister_atmdevice_notifier(struct notifier_block *nb) | ||
809 | { | ||
810 | atomic_notifier_chain_unregister(&atm_dev_notify_chain, nb); | ||
811 | } | ||
812 | EXPORT_SYMBOL_GPL(unregister_atmdevice_notifier); | ||
813 | |||
784 | static int __init atm_init(void) | 814 | static int __init atm_init(void) |
785 | { | 815 | { |
786 | int error; | 816 | int error; |
diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c index e49bb6d948a1..e9aced0ec56b 100644 --- a/net/atm/pppoatm.c +++ b/net/atm/pppoatm.c | |||
@@ -260,7 +260,7 @@ static int pppoatm_devppp_ioctl(struct ppp_channel *chan, unsigned int cmd, | |||
260 | return -ENOTTY; | 260 | return -ENOTTY; |
261 | } | 261 | } |
262 | 262 | ||
263 | static /*const*/ struct ppp_channel_ops pppoatm_ops = { | 263 | static const struct ppp_channel_ops pppoatm_ops = { |
264 | .start_xmit = pppoatm_send, | 264 | .start_xmit = pppoatm_send, |
265 | .ioctl = pppoatm_devppp_ioctl, | 265 | .ioctl = pppoatm_devppp_ioctl, |
266 | }; | 266 | }; |