rx.c (0f1556bc2b152fc5d2a6b929c579748ec90c55d0) | rx.c (5a50439775853a8d565115edb63a5ab4bb780479) |
---|---|
1/* 2 * Copyright (C) 2007-2012 Siemens AG 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 6 * as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 28 unchanged lines hidden (view full) --- 37 * and only the data frame should be pushed to the upper layers, other types 38 * are just internal MAC layer management information. So only data packets 39 * are going to be sent to the networking queue, all other will be processed 40 * right here by using the device workqueue. 41 */ 42struct rx_work { 43 struct sk_buff *skb; 44 struct work_struct work; | 1/* 2 * Copyright (C) 2007-2012 Siemens AG 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 6 * as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 28 unchanged lines hidden (view full) --- 37 * and only the data frame should be pushed to the upper layers, other types 38 * are just internal MAC layer management information. So only data packets 39 * are going to be sent to the networking queue, all other will be processed 40 * right here by using the device workqueue. 41 */ 42struct rx_work { 43 struct sk_buff *skb; 44 struct work_struct work; |
45 struct ieee802154_dev *dev; | 45 struct ieee802154_hw *hw; |
46 u8 lqi; 47}; 48 49static void | 46 u8 lqi; 47}; 48 49static void |
50mac802154_subif_rx(struct ieee802154_dev *hw, struct sk_buff *skb, u8 lqi) | 50mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi) |
51{ 52 struct mac802154_priv *priv = mac802154_to_priv(hw); 53 54 mac_cb(skb)->lqi = lqi; 55 skb->protocol = htons(ETH_P_IEEE802154); 56 skb_reset_mac_header(skb); 57 58 if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) { --- 19 unchanged lines hidden (view full) --- 78fail: 79 kfree_skb(skb); 80} 81 82static void mac802154_rx_worker(struct work_struct *work) 83{ 84 struct rx_work *rw = container_of(work, struct rx_work, work); 85 | 51{ 52 struct mac802154_priv *priv = mac802154_to_priv(hw); 53 54 mac_cb(skb)->lqi = lqi; 55 skb->protocol = htons(ETH_P_IEEE802154); 56 skb_reset_mac_header(skb); 57 58 if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) { --- 19 unchanged lines hidden (view full) --- 78fail: 79 kfree_skb(skb); 80} 81 82static void mac802154_rx_worker(struct work_struct *work) 83{ 84 struct rx_work *rw = container_of(work, struct rx_work, work); 85 |
86 mac802154_subif_rx(rw->dev, rw->skb, rw->lqi); | 86 mac802154_subif_rx(rw->hw, rw->skb, rw->lqi); |
87 kfree(rw); 88} 89 90void | 87 kfree(rw); 88} 89 90void |
91ieee802154_rx_irqsafe(struct ieee802154_dev *dev, struct sk_buff *skb, u8 lqi) | 91ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi) |
92{ | 92{ |
93 struct mac802154_priv *priv = mac802154_to_priv(dev); | 93 struct mac802154_priv *priv = mac802154_to_priv(hw); |
94 struct rx_work *work; 95 96 if (!skb) 97 return; 98 99 work = kzalloc(sizeof(*work), GFP_ATOMIC); 100 if (!work) 101 return; 102 103 INIT_WORK(&work->work, mac802154_rx_worker); 104 work->skb = skb; | 94 struct rx_work *work; 95 96 if (!skb) 97 return; 98 99 work = kzalloc(sizeof(*work), GFP_ATOMIC); 100 if (!work) 101 return; 102 103 INIT_WORK(&work->work, mac802154_rx_worker); 104 work->skb = skb; |
105 work->dev = dev; | 105 work->hw = hw; |
106 work->lqi = lqi; 107 108 queue_work(priv->dev_workqueue, &work->work); 109} 110EXPORT_SYMBOL(ieee802154_rx_irqsafe); | 106 work->lqi = lqi; 107 108 queue_work(priv->dev_workqueue, &work->work); 109} 110EXPORT_SYMBOL(ieee802154_rx_irqsafe); |