main.c (ed0a5dce0c29f30ee53a87793206156cf38ae70d) main.c (c5c47e67bcd24638a059b1b5e9ec18c95f8634ca)
1/*
2 * Copyright (C) 2007-2012 Siemens AG
3 *
4 * Written by:
5 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
6 *
7 * Based on the code from 'linux-zigbee.sourceforge.net' project.
8 *

--- 208 unchanged lines hidden (view full) ---

217
218static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries)
219{
220 struct ieee802154_local *local = wpan_phy_priv(phy);
221
222 return local->ops->set_frame_retries(&local->hw, retries);
223}
224
1/*
2 * Copyright (C) 2007-2012 Siemens AG
3 *
4 * Written by:
5 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
6 *
7 * Based on the code from 'linux-zigbee.sourceforge.net' project.
8 *

--- 208 unchanged lines hidden (view full) ---

217
218static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries)
219{
220 struct ieee802154_local *local = wpan_phy_priv(phy);
221
222 return local->ops->set_frame_retries(&local->hw, retries);
223}
224
225static void ieee802154_tasklet_handler(unsigned long data)
226{
227 struct ieee802154_local *local = (struct ieee802154_local *)data;
228 struct sk_buff *skb;
229
230 while ((skb = skb_dequeue(&local->skb_queue))) {
231 switch (skb->pkt_type) {
232 case IEEE802154_RX_MSG:
233 /* Clear skb->pkt_type in order to not confuse kernel
234 * netstack.
235 */
236 skb->pkt_type = 0;
237 ieee802154_rx(&local->hw, skb);
238 break;
239 default:
240 WARN(1, "mac802154: Packet is of unknown type %d\n",
241 skb->pkt_type);
242 kfree_skb(skb);
243 break;
244 }
245 }
246}
247
225struct ieee802154_hw *
226ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops)
227{
228 struct wpan_phy *phy;
229 struct ieee802154_local *local;
230 size_t priv_size;
231
232 if (!ops || !(ops->xmit_async || ops->xmit_sync) || !ops->ed ||

--- 32 unchanged lines hidden (view full) ---

265 local->phy = phy;
266 local->hw.phy = local->phy;
267 local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);
268 local->ops = ops;
269
270 INIT_LIST_HEAD(&local->interfaces);
271 mutex_init(&local->iflist_mtx);
272
248struct ieee802154_hw *
249ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops)
250{
251 struct wpan_phy *phy;
252 struct ieee802154_local *local;
253 size_t priv_size;
254
255 if (!ops || !(ops->xmit_async || ops->xmit_sync) || !ops->ed ||

--- 32 unchanged lines hidden (view full) ---

288 local->phy = phy;
289 local->hw.phy = local->phy;
290 local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);
291 local->ops = ops;
292
293 INIT_LIST_HEAD(&local->interfaces);
294 mutex_init(&local->iflist_mtx);
295
296 tasklet_init(&local->tasklet,
297 ieee802154_tasklet_handler,
298 (unsigned long)local);
299
300 skb_queue_head_init(&local->skb_queue);
301
273 return &local->hw;
274}
275EXPORT_SYMBOL(ieee802154_alloc_hw);
276
277void ieee802154_free_hw(struct ieee802154_hw *hw)
278{
279 struct ieee802154_local *local = hw_to_local(hw);
280

--- 85 unchanged lines hidden (view full) ---

366}
367EXPORT_SYMBOL(ieee802154_register_hw);
368
369void ieee802154_unregister_hw(struct ieee802154_hw *hw)
370{
371 struct ieee802154_local *local = hw_to_local(hw);
372 struct ieee802154_sub_if_data *sdata, *next;
373
302 return &local->hw;
303}
304EXPORT_SYMBOL(ieee802154_alloc_hw);
305
306void ieee802154_free_hw(struct ieee802154_hw *hw)
307{
308 struct ieee802154_local *local = hw_to_local(hw);
309

--- 85 unchanged lines hidden (view full) ---

395}
396EXPORT_SYMBOL(ieee802154_register_hw);
397
398void ieee802154_unregister_hw(struct ieee802154_hw *hw)
399{
400 struct ieee802154_local *local = hw_to_local(hw);
401 struct ieee802154_sub_if_data *sdata, *next;
402
403 tasklet_kill(&local->tasklet);
374 flush_workqueue(local->workqueue);
375 destroy_workqueue(local->workqueue);
376
377 rtnl_lock();
378
379 mutex_lock(&local->iflist_mtx);
380 local->running = MAC802154_DEVICE_STOPPED;
381 mutex_unlock(&local->iflist_mtx);

--- 17 unchanged lines hidden ---
404 flush_workqueue(local->workqueue);
405 destroy_workqueue(local->workqueue);
406
407 rtnl_lock();
408
409 mutex_lock(&local->iflist_mtx);
410 local->running = MAC802154_DEVICE_STOPPED;
411 mutex_unlock(&local->iflist_mtx);

--- 17 unchanged lines hidden ---