diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-10-26 04:37:01 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-10-26 12:23:50 -0400 |
commit | 50c6fb9965907732b4f5c45bd3bacf4b4f3463b9 (patch) | |
tree | ccb8ce86981b34f7adb884d77115f8bf0c4863f6 /net/mac802154/tx.c | |
parent | c6f635faf3bca66cf73f6b3319a054959e367b19 (diff) |
mac802154: tx: move xmit callback to tx file
This patch moves the netdev xmit callback functions into the tx.c file.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154/tx.c')
-rw-r--r-- | net/mac802154/tx.c | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c index 2c40d9bb8387..2eb06c2cf96d 100644 --- a/net/mac802154/tx.c +++ b/net/mac802154/tx.c | |||
@@ -77,8 +77,8 @@ out: | |||
77 | kfree(xw); | 77 | kfree(xw); |
78 | } | 78 | } |
79 | 79 | ||
80 | netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb, | 80 | static netdev_tx_t mac802154_tx(struct ieee802154_local *local, |
81 | u8 page, u8 chan) | 81 | struct sk_buff *skb, u8 page, u8 chan) |
82 | { | 82 | { |
83 | struct xmit_work *work; | 83 | struct xmit_work *work; |
84 | struct ieee802154_sub_if_data *sdata; | 84 | struct ieee802154_sub_if_data *sdata; |
@@ -127,3 +127,58 @@ err_tx: | |||
127 | kfree_skb(skb); | 127 | kfree_skb(skb); |
128 | return NETDEV_TX_OK; | 128 | return NETDEV_TX_OK; |
129 | } | 129 | } |
130 | |||
131 | netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb, struct net_device *dev) | ||
132 | { | ||
133 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); | ||
134 | u8 chan, page; | ||
135 | |||
136 | /* FIXME: locking */ | ||
137 | chan = sdata->local->phy->current_channel; | ||
138 | page = sdata->local->phy->current_page; | ||
139 | |||
140 | if (chan == MAC802154_CHAN_NONE) /* not initialized */ | ||
141 | return NETDEV_TX_OK; | ||
142 | |||
143 | if (WARN_ON(page >= WPAN_NUM_PAGES) || | ||
144 | WARN_ON(chan >= WPAN_NUM_CHANNELS)) | ||
145 | return NETDEV_TX_OK; | ||
146 | |||
147 | skb->skb_iif = dev->ifindex; | ||
148 | dev->stats.tx_packets++; | ||
149 | dev->stats.tx_bytes += skb->len; | ||
150 | |||
151 | return mac802154_tx(sdata->local, skb, page, chan); | ||
152 | } | ||
153 | |||
154 | netdev_tx_t mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev) | ||
155 | { | ||
156 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); | ||
157 | u8 chan, page; | ||
158 | int rc; | ||
159 | |||
160 | spin_lock_bh(&sdata->mib_lock); | ||
161 | chan = sdata->chan; | ||
162 | page = sdata->page; | ||
163 | spin_unlock_bh(&sdata->mib_lock); | ||
164 | |||
165 | if (chan == MAC802154_CHAN_NONE || | ||
166 | page >= WPAN_NUM_PAGES || | ||
167 | chan >= WPAN_NUM_CHANNELS) { | ||
168 | kfree_skb(skb); | ||
169 | return NETDEV_TX_OK; | ||
170 | } | ||
171 | |||
172 | rc = mac802154_llsec_encrypt(&sdata->sec, skb); | ||
173 | if (rc) { | ||
174 | pr_warn("encryption failed: %i\n", rc); | ||
175 | kfree_skb(skb); | ||
176 | return NETDEV_TX_OK; | ||
177 | } | ||
178 | |||
179 | skb->skb_iif = dev->ifindex; | ||
180 | dev->stats.tx_packets++; | ||
181 | dev->stats.tx_bytes += skb->len; | ||
182 | |||
183 | return mac802154_tx(sdata->local, skb, page, chan); | ||
184 | } | ||