Lines Matching +full:supported +full:- +full:hw
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2007-2012 Siemens AG
28 while ((skb = skb_dequeue(&local->skb_queue))) { in ieee802154_tasklet_handler()
29 switch (skb->pkt_type) { in ieee802154_tasklet_handler()
31 /* Clear skb->pkt_type in order to not confuse kernel in ieee802154_tasklet_handler()
34 skb->pkt_type = 0; in ieee802154_tasklet_handler()
39 skb->pkt_type); in ieee802154_tasklet_handler()
53 if (WARN_ON(!ops || !(ops->xmit_async || ops->xmit_sync) || !ops->ed || in ieee802154_alloc_hw()
54 !ops->start || !ops->stop || !ops->set_channel)) in ieee802154_alloc_hw()
57 /* Ensure 32-byte alignment of our private data and hw private data. in ieee802154_alloc_hw()
63 * +-------------------------+ in ieee802154_alloc_hw()
65 * +-------------------------+ in ieee802154_alloc_hw()
67 * +-------------------------+ in ieee802154_alloc_hw()
69 * +-------------------------+ in ieee802154_alloc_hw()
83 phy->privid = mac802154_wpan_phy_privid; in ieee802154_alloc_hw()
86 local->phy = phy; in ieee802154_alloc_hw()
87 local->hw.phy = local->phy; in ieee802154_alloc_hw()
88 local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN); in ieee802154_alloc_hw()
89 local->ops = ops; in ieee802154_alloc_hw()
91 INIT_LIST_HEAD(&local->interfaces); in ieee802154_alloc_hw()
92 INIT_LIST_HEAD(&local->rx_beacon_list); in ieee802154_alloc_hw()
93 INIT_LIST_HEAD(&local->rx_mac_cmd_list); in ieee802154_alloc_hw()
94 mutex_init(&local->iflist_mtx); in ieee802154_alloc_hw()
96 tasklet_setup(&local->tasklet, ieee802154_tasklet_handler); in ieee802154_alloc_hw()
98 skb_queue_head_init(&local->skb_queue); in ieee802154_alloc_hw()
100 INIT_WORK(&local->sync_tx_work, ieee802154_xmit_sync_worker); in ieee802154_alloc_hw()
101 INIT_DELAYED_WORK(&local->scan_work, mac802154_scan_worker); in ieee802154_alloc_hw()
102 INIT_WORK(&local->rx_beacon_work, mac802154_rx_beacon_worker); in ieee802154_alloc_hw()
103 INIT_DELAYED_WORK(&local->beacon_work, mac802154_beacon_worker); in ieee802154_alloc_hw()
104 INIT_WORK(&local->rx_mac_cmd_work, mac802154_rx_mac_cmd_worker); in ieee802154_alloc_hw()
106 init_completion(&local->assoc_done); in ieee802154_alloc_hw()
108 /* init supported flags with 802.15.4 default ranges */ in ieee802154_alloc_hw()
109 phy->supported.max_minbe = 8; in ieee802154_alloc_hw()
110 phy->supported.min_maxbe = 3; in ieee802154_alloc_hw()
111 phy->supported.max_maxbe = 8; in ieee802154_alloc_hw()
112 phy->supported.min_frame_retries = 0; in ieee802154_alloc_hw()
113 phy->supported.max_frame_retries = 7; in ieee802154_alloc_hw()
114 phy->supported.max_csma_backoffs = 5; in ieee802154_alloc_hw()
115 phy->supported.lbt = NL802154_SUPPORTED_BOOL_FALSE; in ieee802154_alloc_hw()
117 /* always supported */ in ieee802154_alloc_hw()
118 phy->supported.iftypes = BIT(NL802154_IFTYPE_NODE) | BIT(NL802154_IFTYPE_COORD); in ieee802154_alloc_hw()
120 return &local->hw; in ieee802154_alloc_hw()
132 /* 868 MHz BPSK 802.15.4-2003: 20 ksym/s */ in ieee802154_configure_durations()
135 /* 915 MHz BPSK 802.15.4-2003: 40 ksym/s */ in ieee802154_configure_durations()
138 /* 2400 MHz O-QPSK 802.15.4-2006: 62.5 ksym/s */ in ieee802154_configure_durations()
143 /* 868 MHz O-QPSK 802.15.4-2006: 25 ksym/s */ in ieee802154_configure_durations()
146 /* 915 MHz O-QPSK 802.15.4-2006: 62.5 ksym/s */ in ieee802154_configure_durations()
151 /* 2.4 GHz CSS 802.15.4a-2007: 1/6 Msym/s */ in ieee802154_configure_durations()
163 phy->symbol_duration = duration; in ieee802154_configure_durations()
164 phy->lifs_period = in ieee802154_configure_durations()
165 (IEEE802154_LIFS_PERIOD * phy->symbol_duration) / NSEC_PER_USEC; in ieee802154_configure_durations()
166 phy->sifs_period = in ieee802154_configure_durations()
167 (IEEE802154_SIFS_PERIOD * phy->symbol_duration) / NSEC_PER_USEC; in ieee802154_configure_durations()
171 void ieee802154_free_hw(struct ieee802154_hw *hw) in ieee802154_free_hw() argument
173 struct ieee802154_local *local = hw_to_local(hw); in ieee802154_free_hw()
175 BUG_ON(!list_empty(&local->interfaces)); in ieee802154_free_hw()
177 mutex_destroy(&local->iflist_mtx); in ieee802154_free_hw()
179 wpan_phy_free(local->phy); in ieee802154_free_hw()
189 wpan_phy->lifs_period = (IEEE802154_LIFS_PERIOD * in ieee802154_setup_wpan_phy_pib()
190 wpan_phy->symbol_duration) / NSEC_PER_USEC; in ieee802154_setup_wpan_phy_pib()
191 wpan_phy->sifs_period = (IEEE802154_SIFS_PERIOD * in ieee802154_setup_wpan_phy_pib()
192 wpan_phy->symbol_duration) / NSEC_PER_USEC; in ieee802154_setup_wpan_phy_pib()
195 int ieee802154_register_hw(struct ieee802154_hw *hw) in ieee802154_register_hw() argument
197 struct ieee802154_local *local = hw_to_local(hw); in ieee802154_register_hw()
200 int rc = -ENOSYS; in ieee802154_register_hw()
202 local->workqueue = in ieee802154_register_hw()
203 create_singlethread_workqueue(wpan_phy_name(local->phy)); in ieee802154_register_hw()
204 if (!local->workqueue) { in ieee802154_register_hw()
205 rc = -ENOMEM; in ieee802154_register_hw()
209 snprintf(mac_wq_name, IFNAMSIZ + 10, "%s-mac-cmds", wpan_phy_name(local->phy)); in ieee802154_register_hw()
210 local->mac_wq = create_singlethread_workqueue(mac_wq_name); in ieee802154_register_hw()
211 if (!local->mac_wq) { in ieee802154_register_hw()
212 rc = -ENOMEM; in ieee802154_register_hw()
216 hrtimer_init(&local->ifs_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in ieee802154_register_hw()
217 local->ifs_timer.function = ieee802154_xmit_ifs_timer; in ieee802154_register_hw()
219 wpan_phy_set_dev(local->phy, local->hw.parent); in ieee802154_register_hw()
221 ieee802154_setup_wpan_phy_pib(local->phy); in ieee802154_register_hw()
223 ieee802154_configure_durations(local->phy, local->phy->current_page, in ieee802154_register_hw()
224 local->phy->current_channel); in ieee802154_register_hw()
226 if (!(hw->flags & IEEE802154_HW_CSMA_PARAMS)) { in ieee802154_register_hw()
227 local->phy->supported.min_csma_backoffs = 4; in ieee802154_register_hw()
228 local->phy->supported.max_csma_backoffs = 4; in ieee802154_register_hw()
229 local->phy->supported.min_maxbe = 5; in ieee802154_register_hw()
230 local->phy->supported.max_maxbe = 5; in ieee802154_register_hw()
231 local->phy->supported.min_minbe = 3; in ieee802154_register_hw()
232 local->phy->supported.max_minbe = 3; in ieee802154_register_hw()
235 if (!(hw->flags & IEEE802154_HW_FRAME_RETRIES)) { in ieee802154_register_hw()
236 local->phy->supported.min_frame_retries = 3; in ieee802154_register_hw()
237 local->phy->supported.max_frame_retries = 3; in ieee802154_register_hw()
240 if (hw->flags & IEEE802154_HW_PROMISCUOUS) in ieee802154_register_hw()
241 local->phy->supported.iftypes |= BIT(NL802154_IFTYPE_MONITOR); in ieee802154_register_hw()
243 rc = wpan_phy_register(local->phy); in ieee802154_register_hw()
263 wpan_phy_unregister(local->phy); in ieee802154_register_hw()
265 destroy_workqueue(local->mac_wq); in ieee802154_register_hw()
267 destroy_workqueue(local->workqueue); in ieee802154_register_hw()
273 void ieee802154_unregister_hw(struct ieee802154_hw *hw) in ieee802154_unregister_hw() argument
275 struct ieee802154_local *local = hw_to_local(hw); in ieee802154_unregister_hw()
277 tasklet_kill(&local->tasklet); in ieee802154_unregister_hw()
278 flush_workqueue(local->workqueue); in ieee802154_unregister_hw()
286 destroy_workqueue(local->mac_wq); in ieee802154_unregister_hw()
287 destroy_workqueue(local->workqueue); in ieee802154_unregister_hw()
288 wpan_phy_unregister(local->phy); in ieee802154_unregister_hw()