6b13f685e
김민수
BSP 최초 추가
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/workqueue.h>
#include <linux/netdevice.h>
#include <linux/crc-ccitt.h>
#include <net/mac802154.h>
#include <net/ieee802154_netdev.h>
#include "mac802154.h"
struct rx_work {
struct sk_buff *skb;
struct work_struct work;
struct ieee802154_dev *dev;
u8 lqi;
};
static void
mac802154_subif_rx(struct ieee802154_dev *hw, struct sk_buff *skb, u8 lqi)
{
struct mac802154_priv *priv = mac802154_to_priv(hw);
mac_cb(skb)->lqi = lqi;
skb->protocol = htons(ETH_P_IEEE802154);
skb_reset_mac_header(skb);
BUILD_BUG_ON(sizeof(struct ieee802154_mac_cb) > sizeof(skb->cb));
if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
u16 crc;
if (skb->len < 2) {
pr_debug("got invalid frame
");
goto out;
}
crc = crc_ccitt(0, skb->data, skb->len);
if (crc) {
pr_debug("CRC mismatch
");
goto out;
}
skb_trim(skb, skb->len - 2);
}
mac802154_monitors_rx(priv, skb);
mac802154_wpans_rx(priv, skb);
out:
dev_kfree_skb(skb);
return;
}
static void mac802154_rx_worker(struct work_struct *work)
{
struct rx_work *rw = container_of(work, struct rx_work, work);
struct sk_buff *skb = rw->skb;
mac802154_subif_rx(rw->dev, skb, rw->lqi);
kfree(rw);
}
void
ieee802154_rx_irqsafe(struct ieee802154_dev *dev, struct sk_buff *skb, u8 lqi)
{
struct mac802154_priv *priv = mac802154_to_priv(dev);
struct rx_work *work;
if (!skb)
return;
work = kzalloc(sizeof(struct rx_work), GFP_ATOMIC);
if (!work)
return;
INIT_WORK(&work->work, mac802154_rx_worker);
work->skb = skb;
work->dev = dev;
work->lqi = lqi;
queue_work(priv->dev_workqueue, &work->work);
}
EXPORT_SYMBOL(ieee802154_rx_irqsafe);
|