Lines Matching +full:scan +full:- +full:interval

1 // SPDX-License-Identifier: GPL-2.0-only
7 * - David Girault <david.girault@qorvo.com>
8 * - Miquel Raynal <miquel.raynal@bootlin.com>
16 #include "driver-ops.h"
28 /* mac802154_scan_cleanup_locked() must be called upon scan completion or abort.
29 * - Completions are asynchronous, not locked by the rtnl and decided by the
30 * scan worker.
31 * - Aborts are decided by userspace, and locked by the rtnl.
37 * However, the scan worker get's triggered without anybody noticing and thus we
39 * - The sub-interface and device driver module get both their reference
40 * counters incremented whenever we start a scan, so they cannot disappear
42 * - Data consistency is achieved by the use of rcu protected pointers.
48 struct wpan_dev *wpan_dev = &sdata->wpan_dev; in mac802154_scan_cleanup_locked()
49 struct wpan_phy *wpan_phy = local->phy; in mac802154_scan_cleanup_locked()
53 /* Prevent any further use of the scan request */ in mac802154_scan_cleanup_locked()
54 clear_bit(IEEE802154_IS_SCANNING, &local->ongoing); in mac802154_scan_cleanup_locked()
55 cancel_delayed_work(&local->scan_work); in mac802154_scan_cleanup_locked()
56 request = rcu_replace_pointer(local->scan_req, NULL, 1); in mac802154_scan_cleanup_locked()
72 drv_set_channel(local, wpan_phy->current_page, in mac802154_scan_cleanup_locked()
73 wpan_phy->current_channel); in mac802154_scan_cleanup_locked()
74 ieee802154_configure_durations(wpan_phy, wpan_phy->current_page, in mac802154_scan_cleanup_locked()
75 wpan_phy->current_channel); in mac802154_scan_cleanup_locked()
78 sdata->required_filtering = sdata->iface_default_filtering; in mac802154_scan_cleanup_locked()
79 drv_start(local, sdata->required_filtering, &local->addr_filt); in mac802154_scan_cleanup_locked()
90 return -ESRCH; in mac802154_abort_scan_locked()
109 list_for_each_entry_safe(mac_pkt, tmp, &local->rx_beacon_list, node) { in mac802154_flush_queued_beacons()
110 list_del(&mac_pkt->node); in mac802154_flush_queued_beacons()
111 kfree_skb(mac_pkt->skb); in mac802154_flush_queued_beacons()
122 *channel = find_next_bit((const unsigned long *)&scan_req->channels, in mac802154_scan_get_next_channel()
133 return -EINVAL; in mac802154_scan_find_next_chan()
140 memset(&local->scan_beacon_req, 0, sizeof(local->scan_beacon_req)); in mac802154_scan_prepare_beacon_req()
141 local->scan_beacon_req.mhr.fc.type = IEEE802154_FC_TYPE_MAC_CMD; in mac802154_scan_prepare_beacon_req()
142 local->scan_beacon_req.mhr.fc.dest_addr_mode = IEEE802154_SHORT_ADDRESSING; in mac802154_scan_prepare_beacon_req()
143 local->scan_beacon_req.mhr.fc.version = IEEE802154_2003_STD; in mac802154_scan_prepare_beacon_req()
144 local->scan_beacon_req.mhr.fc.source_addr_mode = IEEE802154_NO_ADDRESSING; in mac802154_scan_prepare_beacon_req()
145 local->scan_beacon_req.mhr.dest.mode = IEEE802154_ADDR_SHORT; in mac802154_scan_prepare_beacon_req()
146 local->scan_beacon_req.mhr.dest.pan_id = cpu_to_le16(IEEE802154_PANID_BROADCAST); in mac802154_scan_prepare_beacon_req()
147 local->scan_beacon_req.mhr.dest.short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST); in mac802154_scan_prepare_beacon_req()
148 local->scan_beacon_req.mac_pl.cmd_id = IEEE802154_CMD_BEACON_REQ; in mac802154_scan_prepare_beacon_req()
161 return -ENOBUFS; in mac802154_transmit_beacon_req()
163 skb->dev = sdata->dev; in mac802154_transmit_beacon_req()
165 ret = ieee802154_mac_cmd_push(skb, &local->scan_beacon_req, NULL, 0); in mac802154_transmit_beacon_req()
196 scan_req = rcu_dereference(local->scan_req); in mac802154_scan_worker()
202 sdata = IEEE802154_WPAN_DEV_TO_SUB_IF(scan_req->wpan_dev); in mac802154_scan_worker()
205 if (local->suspended || !ieee802154_sdata_running(sdata)) { in mac802154_scan_worker()
207 queue_delayed_work(local->mac_wq, &local->scan_work, in mac802154_scan_worker()
212 wpan_phy = scan_req->wpan_phy; in mac802154_scan_worker()
213 scan_req_type = scan_req->type; in mac802154_scan_worker()
214 scan_req_duration = scan_req->duration; in mac802154_scan_worker()
217 page = local->scan_page; in mac802154_scan_worker()
218 channel = local->scan_channel; in mac802154_scan_worker()
225 } while (!ieee802154_chan_is_valid(scan_req->wpan_phy, page, channel)); in mac802154_scan_worker()
234 dev_err(&sdata->dev->dev, in mac802154_scan_worker()
235 "Channel change failure during scan, aborting (%d)\n", ret); in mac802154_scan_worker()
239 local->scan_page = page; in mac802154_scan_worker()
240 local->scan_channel = channel; in mac802154_scan_worker()
243 ret = drv_start(local, IEEE802154_FILTERING_3_SCAN, &local->addr_filt); in mac802154_scan_worker()
246 dev_err(&sdata->dev->dev, in mac802154_scan_worker()
254 dev_err(&sdata->dev->dev, in mac802154_scan_worker()
260 wpan_phy->symbol_duration); in mac802154_scan_worker()
261 dev_dbg(&sdata->dev->dev, in mac802154_scan_worker()
262 "Scan page %u channel %u for %ums\n", in mac802154_scan_worker()
264 queue_delayed_work(local->mac_wq, &local->scan_work, scan_duration); in mac802154_scan_worker()
276 struct ieee802154_local *local = sdata->local; in mac802154_trigger_scan_locked()
281 return -EBUSY; in mac802154_trigger_scan_locked()
283 if (request->type != NL802154_SCAN_PASSIVE && in mac802154_trigger_scan_locked()
284 request->type != NL802154_SCAN_ACTIVE) in mac802154_trigger_scan_locked()
285 return -EOPNOTSUPP; in mac802154_trigger_scan_locked()
288 rcu_assign_pointer(local->scan_req, request); in mac802154_trigger_scan_locked()
295 sdata->required_filtering = IEEE802154_FILTERING_3_SCAN; in mac802154_trigger_scan_locked()
296 local->scan_page = request->page; in mac802154_trigger_scan_locked()
297 local->scan_channel = -1; in mac802154_trigger_scan_locked()
298 set_bit(IEEE802154_IS_SCANNING, &local->ongoing); in mac802154_trigger_scan_locked()
299 if (request->type == NL802154_SCAN_ACTIVE) in mac802154_trigger_scan_locked()
302 nl802154_scan_started(request->wpan_phy, request->wpan_dev); in mac802154_trigger_scan_locked()
304 queue_delayed_work(local->mac_wq, &local->scan_work, 0); in mac802154_trigger_scan_locked()
313 struct ieee802154_beacon_hdr *bh = (void *)skb->data; in mac802154_process_beacon()
314 struct ieee802154_addr *src = &mac_cb(skb)->source; in mac802154_process_beacon()
318 if (skb->len != sizeof(*bh)) in mac802154_process_beacon()
319 return -EINVAL; in mac802154_process_beacon()
321 if (unlikely(src->mode == IEEE802154_ADDR_NONE)) in mac802154_process_beacon()
322 return -EINVAL; in mac802154_process_beacon()
324 dev_dbg(&skb->dev->dev, in mac802154_process_beacon()
331 desc.link_quality = mac_cb(skb)->lqi; in mac802154_process_beacon()
332 desc.superframe_spec = get_unaligned_le16(skb->data); in mac802154_process_beacon()
333 desc.gts_permit = bh->gts_permit; in mac802154_process_beacon()
338 scan_req = rcu_dereference(local->scan_req); in mac802154_process_beacon()
340 nl802154_scan_event(scan_req->wpan_phy, scan_req->wpan_dev, &desc); in mac802154_process_beacon()
355 local->beacon.mhr.seq = atomic_inc_return(&wpan_dev->bsn) & 0xFF; in mac802154_transmit_beacon()
359 return -ENOBUFS; in mac802154_transmit_beacon()
362 beacon_req = rcu_dereference(local->beacon_req); in mac802154_transmit_beacon()
366 return -EINVAL; in mac802154_transmit_beacon()
369 sdata = IEEE802154_WPAN_DEV_TO_SUB_IF(beacon_req->wpan_dev); in mac802154_transmit_beacon()
370 skb->dev = sdata->dev; in mac802154_transmit_beacon()
374 ret = ieee802154_beacon_push(skb, &local->beacon); in mac802154_transmit_beacon()
408 u8 interval; in mac802154_beacon_worker() local
412 beacon_req = rcu_dereference(local->beacon_req); in mac802154_beacon_worker()
418 sdata = IEEE802154_WPAN_DEV_TO_SUB_IF(beacon_req->wpan_dev); in mac802154_beacon_worker()
421 if (local->suspended || !ieee802154_sdata_running(sdata)) { in mac802154_beacon_worker()
423 queue_delayed_work(local->mac_wq, &local->beacon_work, in mac802154_beacon_worker()
428 wpan_dev = beacon_req->wpan_dev; in mac802154_beacon_worker()
429 interval = beacon_req->interval; in mac802154_beacon_worker()
433 dev_dbg(&sdata->dev->dev, "Sending beacon\n"); in mac802154_beacon_worker()
436 dev_err(&sdata->dev->dev, in mac802154_beacon_worker()
439 if (interval < IEEE802154_ACTIVE_SCAN_DURATION) in mac802154_beacon_worker()
440 queue_delayed_work(local->mac_wq, &local->beacon_work, in mac802154_beacon_worker()
441 local->beacon_interval); in mac802154_beacon_worker()
447 struct wpan_dev *wpan_dev = &sdata->wpan_dev; in mac802154_stop_beacons_locked()
453 return -ESRCH; in mac802154_stop_beacons_locked()
455 clear_bit(IEEE802154_IS_BEACONING, &local->ongoing); in mac802154_stop_beacons_locked()
456 cancel_delayed_work(&local->beacon_work); in mac802154_stop_beacons_locked()
457 request = rcu_replace_pointer(local->beacon_req, NULL, 1); in mac802154_stop_beacons_locked()
470 struct ieee802154_local *local = sdata->local; in mac802154_send_beacons_locked()
471 struct wpan_dev *wpan_dev = &sdata->wpan_dev; in mac802154_send_beacons_locked()
479 rcu_assign_pointer(local->beacon_req, request); in mac802154_send_beacons_locked()
481 set_bit(IEEE802154_IS_BEACONING, &local->ongoing); in mac802154_send_beacons_locked()
483 memset(&local->beacon, 0, sizeof(local->beacon)); in mac802154_send_beacons_locked()
484 local->beacon.mhr.fc.type = IEEE802154_FC_TYPE_BEACON; in mac802154_send_beacons_locked()
485 local->beacon.mhr.fc.security_enabled = 0; in mac802154_send_beacons_locked()
486 local->beacon.mhr.fc.frame_pending = 0; in mac802154_send_beacons_locked()
487 local->beacon.mhr.fc.ack_request = 0; in mac802154_send_beacons_locked()
488 local->beacon.mhr.fc.intra_pan = 0; in mac802154_send_beacons_locked()
489 local->beacon.mhr.fc.dest_addr_mode = IEEE802154_NO_ADDRESSING; in mac802154_send_beacons_locked()
490 local->beacon.mhr.fc.version = IEEE802154_2003_STD; in mac802154_send_beacons_locked()
491 local->beacon.mhr.fc.source_addr_mode = IEEE802154_EXTENDED_ADDRESSING; in mac802154_send_beacons_locked()
492 atomic_set(&request->wpan_dev->bsn, -1); in mac802154_send_beacons_locked()
493 local->beacon.mhr.source.mode = IEEE802154_ADDR_LONG; in mac802154_send_beacons_locked()
494 local->beacon.mhr.source.pan_id = request->wpan_dev->pan_id; in mac802154_send_beacons_locked()
495 local->beacon.mhr.source.extended_addr = request->wpan_dev->extended_addr; in mac802154_send_beacons_locked()
496 local->beacon.mac_pl.beacon_order = request->interval; in mac802154_send_beacons_locked()
497 if (request->interval <= IEEE802154_MAX_SCAN_DURATION) in mac802154_send_beacons_locked()
498 local->beacon.mac_pl.superframe_order = request->interval; in mac802154_send_beacons_locked()
499 local->beacon.mac_pl.final_cap_slot = 0xf; in mac802154_send_beacons_locked()
500 local->beacon.mac_pl.battery_life_ext = 0; in mac802154_send_beacons_locked()
501 local->beacon.mac_pl.pan_coordinator = !wpan_dev->parent; in mac802154_send_beacons_locked()
502 local->beacon.mac_pl.assoc_permit = 1; in mac802154_send_beacons_locked()
504 if (request->interval == IEEE802154_ACTIVE_SCAN_DURATION) in mac802154_send_beacons_locked()
508 local->beacon_interval = in mac802154_send_beacons_locked()
509 mac802154_scan_get_channel_time(request->interval, in mac802154_send_beacons_locked()
510 request->wpan_phy->symbol_duration); in mac802154_send_beacons_locked()
511 queue_delayed_work(local->mac_wq, &local->beacon_work, 0); in mac802154_send_beacons_locked()
520 u64 ceaddr = swab64((__force u64)coord->extended_addr); in mac802154_perform_association()
522 struct ieee802154_local *local = sdata->local; in mac802154_perform_association()
523 struct wpan_dev *wpan_dev = &sdata->wpan_dev; in mac802154_perform_association()
532 frame.mhr.fc.dest_addr_mode = (coord->mode == IEEE802154_ADDR_LONG) ? in mac802154_perform_association()
538 frame.mhr.source.extended_addr = wpan_dev->extended_addr; in mac802154_perform_association()
539 frame.mhr.dest.mode = coord->mode; in mac802154_perform_association()
540 frame.mhr.dest.pan_id = coord->pan_id; in mac802154_perform_association()
541 if (coord->mode == IEEE802154_ADDR_LONG) in mac802154_perform_association()
542 frame.mhr.dest.extended_addr = coord->extended_addr; in mac802154_perform_association()
544 frame.mhr.dest.short_addr = coord->short_addr; in mac802154_perform_association()
545 frame.mhr.seq = atomic_inc_return(&wpan_dev->dsn) & 0xFF; in mac802154_perform_association()
555 return -ENOBUFS; in mac802154_perform_association()
557 skb->dev = sdata->dev; in mac802154_perform_association()
566 local->assoc_dev = coord; in mac802154_perform_association()
567 reinit_completion(&local->assoc_done); in mac802154_perform_association()
568 set_bit(IEEE802154_IS_ASSOCIATING, &local->ongoing); in mac802154_perform_association()
573 ret = (ret == IEEE802154_NO_ACK) ? -EREMOTEIO : -EIO; in mac802154_perform_association()
574 dev_warn(&sdata->dev->dev, in mac802154_perform_association()
579 ret = wait_for_completion_killable_timeout(&local->assoc_done, 10 * HZ); in mac802154_perform_association()
581 dev_warn(&sdata->dev->dev, in mac802154_perform_association()
583 ret = -ETIMEDOUT; in mac802154_perform_association()
587 if (local->assoc_status != IEEE802154_ASSOCIATION_SUCCESSFUL) { in mac802154_perform_association()
588 if (local->assoc_status == IEEE802154_PAN_AT_CAPACITY) in mac802154_perform_association()
589 ret = -ERANGE; in mac802154_perform_association()
591 ret = -EPERM; in mac802154_perform_association()
593 dev_warn(&sdata->dev->dev, in mac802154_perform_association()
595 local->assoc_status == IEEE802154_PAN_AT_CAPACITY ? in mac802154_perform_association()
600 *short_addr = local->assoc_addr; in mac802154_perform_association()
603 clear_bit(IEEE802154_IS_ASSOCIATING, &local->ongoing); in mac802154_perform_association()
604 local->assoc_dev = NULL; in mac802154_perform_association()
612 struct ieee802154_addr *src = &mac_cb(skb)->source; in mac802154_process_association_resp()
613 struct ieee802154_addr *dest = &mac_cb(skb)->dest; in mac802154_process_association_resp()
614 u64 deaddr = swab64((__force u64)dest->extended_addr); in mac802154_process_association_resp()
615 struct ieee802154_local *local = sdata->local; in mac802154_process_association_resp()
616 struct wpan_dev *wpan_dev = &sdata->wpan_dev; in mac802154_process_association_resp()
619 if (skb->len != sizeof(resp_pl)) in mac802154_process_association_resp()
620 return -EINVAL; in mac802154_process_association_resp()
622 if (unlikely(src->mode != IEEE802154_EXTENDED_ADDRESSING || in mac802154_process_association_resp()
623 dest->mode != IEEE802154_EXTENDED_ADDRESSING)) in mac802154_process_association_resp()
624 return -EINVAL; in mac802154_process_association_resp()
626 if (unlikely(dest->extended_addr != wpan_dev->extended_addr || in mac802154_process_association_resp()
627 src->extended_addr != local->assoc_dev->extended_addr)) in mac802154_process_association_resp()
628 return -ENODEV; in mac802154_process_association_resp()
630 memcpy(&resp_pl, skb->data, sizeof(resp_pl)); in mac802154_process_association_resp()
631 local->assoc_addr = resp_pl.short_addr; in mac802154_process_association_resp()
632 local->assoc_status = resp_pl.status; in mac802154_process_association_resp()
634 dev_dbg(&skb->dev->dev, in mac802154_process_association_resp()
636 local->assoc_status, &deaddr, local->assoc_addr); in mac802154_process_association_resp()
638 complete(&local->assoc_done); in mac802154_process_association_resp()
648 u64 teaddr = swab64((__force u64)target->extended_addr); in mac802154_send_disassociation_notif()
649 struct ieee802154_local *local = sdata->local; in mac802154_send_disassociation_notif()
650 struct wpan_dev *wpan_dev = &sdata->wpan_dev; in mac802154_send_disassociation_notif()
659 frame.mhr.fc.dest_addr_mode = (target->mode == IEEE802154_ADDR_LONG) ? in mac802154_send_disassociation_notif()
664 frame.mhr.source.pan_id = wpan_dev->pan_id; in mac802154_send_disassociation_notif()
665 frame.mhr.source.extended_addr = wpan_dev->extended_addr; in mac802154_send_disassociation_notif()
666 frame.mhr.dest.mode = target->mode; in mac802154_send_disassociation_notif()
667 frame.mhr.dest.pan_id = wpan_dev->pan_id; in mac802154_send_disassociation_notif()
668 if (target->mode == IEEE802154_ADDR_LONG) in mac802154_send_disassociation_notif()
669 frame.mhr.dest.extended_addr = target->extended_addr; in mac802154_send_disassociation_notif()
671 frame.mhr.dest.short_addr = target->short_addr; in mac802154_send_disassociation_notif()
672 frame.mhr.seq = atomic_inc_return(&wpan_dev->dsn) & 0xFF; in mac802154_send_disassociation_notif()
679 return -ENOBUFS; in mac802154_send_disassociation_notif()
681 skb->dev = sdata->dev; in mac802154_send_disassociation_notif()
692 dev_warn(&sdata->dev->dev, in mac802154_send_disassociation_notif()
695 ret = (ret == IEEE802154_NO_ACK) ? -EREMOTEIO : -EIO; in mac802154_send_disassociation_notif()
699 dev_dbg(&sdata->dev->dev, "DISASSOC ACK received from %8phC\n", &teaddr); in mac802154_send_disassociation_notif()
708 u64 teaddr = swab64((__force u64)target->extended_addr); in mac802154_send_association_resp_locked()
710 struct ieee802154_local *local = sdata->local; in mac802154_send_association_resp_locked()
711 struct wpan_dev *wpan_dev = &sdata->wpan_dev; in mac802154_send_association_resp_locked()
724 frame.mhr.source.extended_addr = wpan_dev->extended_addr; in mac802154_send_association_resp_locked()
726 frame.mhr.dest.pan_id = wpan_dev->pan_id; in mac802154_send_association_resp_locked()
727 frame.mhr.dest.extended_addr = target->extended_addr; in mac802154_send_association_resp_locked()
728 frame.mhr.seq = atomic_inc_return(&wpan_dev->dsn) & 0xFF; in mac802154_send_association_resp_locked()
734 return -ENOBUFS; in mac802154_send_association_resp_locked()
736 skb->dev = sdata->dev; in mac802154_send_association_resp_locked()
747 dev_warn(&sdata->dev->dev, in mac802154_send_association_resp_locked()
750 ret = (ret == IEEE802154_NO_ACK) ? -EREMOTEIO : -EIO; in mac802154_send_association_resp_locked()
760 struct wpan_dev *wpan_dev = &sdata->wpan_dev; in mac802154_process_association_req()
761 struct ieee802154_addr *src = &mac_cb(skb)->source; in mac802154_process_association_req()
762 struct ieee802154_addr *dest = &mac_cb(skb)->dest; in mac802154_process_association_req()
770 if (skb->len != sizeof(assoc_req_pl)) in mac802154_process_association_req()
771 return -EINVAL; in mac802154_process_association_req()
773 if (unlikely(src->mode != IEEE802154_EXTENDED_ADDRESSING)) in mac802154_process_association_req()
774 return -EINVAL; in mac802154_process_association_req()
776 if (unlikely(dest->pan_id != wpan_dev->pan_id)) in mac802154_process_association_req()
777 return -ENODEV; in mac802154_process_association_req()
779 if (dest->mode == IEEE802154_EXTENDED_ADDRESSING && in mac802154_process_association_req()
780 unlikely(dest->extended_addr != wpan_dev->extended_addr)) in mac802154_process_association_req()
781 return -ENODEV; in mac802154_process_association_req()
782 else if (dest->mode == IEEE802154_SHORT_ADDRESSING && in mac802154_process_association_req()
783 unlikely(dest->short_addr != wpan_dev->short_addr)) in mac802154_process_association_req()
784 return -ENODEV; in mac802154_process_association_req()
786 if (wpan_dev->parent) { in mac802154_process_association_req()
787 dev_dbg(&sdata->dev->dev, in mac802154_process_association_req()
789 return -ENODEV; in mac802154_process_association_req()
792 mutex_lock(&wpan_dev->association_lock); in mac802154_process_association_req()
794 memcpy(&assoc_req_pl, skb->data, sizeof(assoc_req_pl)); in mac802154_process_association_req()
796 dev_err(&skb->dev->dev, "Fast associations not supported yet\n"); in mac802154_process_association_req()
797 ret = -EOPNOTSUPP; in mac802154_process_association_req()
803 ret = -ENOMEM; in mac802154_process_association_req()
807 child->extended_addr = src->extended_addr; in mac802154_process_association_req()
808 child->mode = IEEE802154_EXTENDED_ADDRESSING; in mac802154_process_association_req()
809 ceaddr = swab64((__force u64)child->extended_addr); in mac802154_process_association_req()
811 if (wpan_dev->nchildren >= wpan_dev->max_associations) { in mac802154_process_association_req()
812 if (!wpan_dev->max_associations) in mac802154_process_association_req()
817 dev_dbg(&sdata->dev->dev, in mac802154_process_association_req()
825 child->mode = IEEE802154_SHORT_ADDRESSING; in mac802154_process_association_req()
829 child->short_addr = assoc_resp_pl.short_addr; in mac802154_process_association_req()
830 dev_dbg(&sdata->dev->dev, in mac802154_process_association_req()
832 &ceaddr, le16_to_cpu(child->short_addr)); in mac802154_process_association_req()
841 dev_dbg(&sdata->dev->dev, in mac802154_process_association_req()
847 tmp.mode = child->mode; in mac802154_process_association_req()
848 tmp.extended_addr = child->extended_addr; in mac802154_process_association_req()
851 dev_dbg(&sdata->dev->dev, in mac802154_process_association_req()
853 list_del(&exchild->node); in mac802154_process_association_req()
856 list_add(&child->node, &wpan_dev->children); in mac802154_process_association_req()
857 wpan_dev->nchildren++; in mac802154_process_association_req()
860 mutex_unlock(&wpan_dev->association_lock); in mac802154_process_association_req()
867 struct ieee802154_addr *src = &mac_cb(skb)->source; in mac802154_process_disassociation_notif()
868 struct ieee802154_addr *dest = &mac_cb(skb)->dest; in mac802154_process_disassociation_notif()
869 struct wpan_dev *wpan_dev = &sdata->wpan_dev; in mac802154_process_disassociation_notif()
875 if (skb->len != sizeof(u8)) in mac802154_process_disassociation_notif()
876 return -EINVAL; in mac802154_process_disassociation_notif()
878 if (unlikely(src->mode != IEEE802154_EXTENDED_ADDRESSING)) in mac802154_process_disassociation_notif()
879 return -EINVAL; in mac802154_process_disassociation_notif()
881 if (dest->mode == IEEE802154_EXTENDED_ADDRESSING && in mac802154_process_disassociation_notif()
882 unlikely(dest->extended_addr != wpan_dev->extended_addr)) in mac802154_process_disassociation_notif()
883 return -ENODEV; in mac802154_process_disassociation_notif()
884 else if (dest->mode == IEEE802154_SHORT_ADDRESSING && in mac802154_process_disassociation_notif()
885 unlikely(dest->short_addr != wpan_dev->short_addr)) in mac802154_process_disassociation_notif()
886 return -ENODEV; in mac802154_process_disassociation_notif()
888 if (dest->pan_id != wpan_dev->pan_id) in mac802154_process_disassociation_notif()
889 return -ENODEV; in mac802154_process_disassociation_notif()
892 target.extended_addr = src->extended_addr; in mac802154_process_disassociation_notif()
894 dev_dbg(&skb->dev->dev, "Processing DISASSOC NOTIF from %8phC\n", &teaddr); in mac802154_process_disassociation_notif()
896 mutex_lock(&wpan_dev->association_lock); in mac802154_process_disassociation_notif()
901 mutex_unlock(&wpan_dev->association_lock); in mac802154_process_disassociation_notif()
902 return -EINVAL; in mac802154_process_disassociation_notif()
906 kfree(wpan_dev->parent); in mac802154_process_disassociation_notif()
907 wpan_dev->parent = NULL; in mac802154_process_disassociation_notif()
909 list_del(&child->node); in mac802154_process_disassociation_notif()
911 wpan_dev->nchildren--; in mac802154_process_disassociation_notif()
914 mutex_unlock(&wpan_dev->association_lock); in mac802154_process_disassociation_notif()