alex.bluesman.smirnov@gmail.com | ef2486f | 2012-05-15 20:50:26 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 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, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
alex.bluesman.smirnov@gmail.com | ef2486f | 2012-05-15 20:50:26 +0000 | [diff] [blame] | 13 | * Written by: |
| 14 | * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
| 15 | * Sergey Lapin <slapin@ossfans.org> |
| 16 | * Maxim Gorbachyov <maxim.gorbachev@siemens.com> |
| 17 | * Alexander Smirnov <alex.bluesman.smirnov@gmail.com> |
| 18 | */ |
| 19 | |
| 20 | #include <linux/if_arp.h> |
| 21 | |
| 22 | #include <net/mac802154.h> |
Phoebe Buckheister | b70ab2e | 2014-03-14 21:23:59 +0100 | [diff] [blame] | 23 | #include <net/ieee802154_netdev.h> |
Alexander Aring | 5ad60d3 | 2014-10-25 09:41:02 +0200 | [diff] [blame] | 24 | #include <net/cfg802154.h> |
alex.bluesman.smirnov@gmail.com | ef2486f | 2012-05-15 20:50:26 +0000 | [diff] [blame] | 25 | |
Alexander Aring | 0f1556b | 2014-10-25 09:41:00 +0200 | [diff] [blame] | 26 | #include "ieee802154_i.h" |
Alexander Aring | 59cb300 | 2014-10-28 18:21:21 +0100 | [diff] [blame] | 27 | #include "driver-ops.h" |
alex.bluesman.smirnov@gmail.com | ef2486f | 2012-05-15 20:50:26 +0000 | [diff] [blame] | 28 | |
Phoebe Buckheister | b70ab2e | 2014-03-14 21:23:59 +0100 | [diff] [blame] | 29 | void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val) |
alex.bluesman.smirnov@gmail.com | 48e44d5 | 2012-06-25 23:24:50 +0000 | [diff] [blame] | 30 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 31 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
alex.bluesman.smirnov@gmail.com | 48e44d5 | 2012-06-25 23:24:50 +0000 | [diff] [blame] | 32 | |
| 33 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 34 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 35 | spin_lock_bh(&sdata->mib_lock); |
Alexander Aring | 863e88f | 2014-11-09 08:36:45 +0100 | [diff] [blame] | 36 | sdata->wpan_dev.short_addr = val; |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 37 | spin_unlock_bh(&sdata->mib_lock); |
alex.bluesman.smirnov@gmail.com | 48e44d5 | 2012-06-25 23:24:50 +0000 | [diff] [blame] | 38 | } |
| 39 | |
Phoebe Buckheister | b70ab2e | 2014-03-14 21:23:59 +0100 | [diff] [blame] | 40 | __le16 mac802154_dev_get_short_addr(const struct net_device *dev) |
alex.bluesman.smirnov@gmail.com | e885a47 | 2012-07-10 21:22:44 +0000 | [diff] [blame] | 41 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 42 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | b70ab2e | 2014-03-14 21:23:59 +0100 | [diff] [blame] | 43 | __le16 ret; |
alex.bluesman.smirnov@gmail.com | e885a47 | 2012-07-10 21:22:44 +0000 | [diff] [blame] | 44 | |
| 45 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 46 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 47 | spin_lock_bh(&sdata->mib_lock); |
Alexander Aring | 863e88f | 2014-11-09 08:36:45 +0100 | [diff] [blame] | 48 | ret = sdata->wpan_dev.short_addr; |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 49 | spin_unlock_bh(&sdata->mib_lock); |
alex.bluesman.smirnov@gmail.com | e885a47 | 2012-07-10 21:22:44 +0000 | [diff] [blame] | 50 | |
| 51 | return ret; |
| 52 | } |
| 53 | |
Phoebe Buckheister | b70ab2e | 2014-03-14 21:23:59 +0100 | [diff] [blame] | 54 | __le16 mac802154_dev_get_pan_id(const struct net_device *dev) |
alex.bluesman.smirnov@gmail.com | dcbe4f9 | 2012-06-25 23:24:49 +0000 | [diff] [blame] | 55 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 56 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | b70ab2e | 2014-03-14 21:23:59 +0100 | [diff] [blame] | 57 | __le16 ret; |
alex.bluesman.smirnov@gmail.com | dcbe4f9 | 2012-06-25 23:24:49 +0000 | [diff] [blame] | 58 | |
| 59 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 60 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 61 | spin_lock_bh(&sdata->mib_lock); |
Alexander Aring | 863e88f | 2014-11-09 08:36:45 +0100 | [diff] [blame] | 62 | ret = sdata->wpan_dev.pan_id; |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 63 | spin_unlock_bh(&sdata->mib_lock); |
alex.bluesman.smirnov@gmail.com | dcbe4f9 | 2012-06-25 23:24:49 +0000 | [diff] [blame] | 64 | |
| 65 | return ret; |
| 66 | } |
| 67 | |
Phoebe Buckheister | b70ab2e | 2014-03-14 21:23:59 +0100 | [diff] [blame] | 68 | void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val) |
alex.bluesman.smirnov@gmail.com | dcbe4f9 | 2012-06-25 23:24:49 +0000 | [diff] [blame] | 69 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 70 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
alex.bluesman.smirnov@gmail.com | dcbe4f9 | 2012-06-25 23:24:49 +0000 | [diff] [blame] | 71 | |
| 72 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 73 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 74 | spin_lock_bh(&sdata->mib_lock); |
Alexander Aring | 863e88f | 2014-11-09 08:36:45 +0100 | [diff] [blame] | 75 | sdata->wpan_dev.pan_id = val; |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 76 | spin_unlock_bh(&sdata->mib_lock); |
alex.bluesman.smirnov@gmail.com | dcbe4f9 | 2012-06-25 23:24:49 +0000 | [diff] [blame] | 77 | } |
alex.bluesman.smirnov@gmail.com | 66b69d4 | 2012-06-25 23:24:51 +0000 | [diff] [blame] | 78 | |
Tony Cheneau | 0483546 | 2013-03-25 17:59:29 +0000 | [diff] [blame] | 79 | u8 mac802154_dev_get_dsn(const struct net_device *dev) |
| 80 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 81 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Tony Cheneau | 0483546 | 2013-03-25 17:59:29 +0000 | [diff] [blame] | 82 | |
| 83 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 84 | |
Alexander Aring | 863e88f | 2014-11-09 08:36:45 +0100 | [diff] [blame] | 85 | return sdata->wpan_dev.dsn++; |
Tony Cheneau | 0483546 | 2013-03-25 17:59:29 +0000 | [diff] [blame] | 86 | } |
| 87 | |
alex.bluesman.smirnov@gmail.com | 66b69d4 | 2012-06-25 23:24:51 +0000 | [diff] [blame] | 88 | void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan) |
| 89 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 90 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Alexander Aring | 12439a5 | 2014-10-28 18:21:29 +0100 | [diff] [blame] | 91 | struct ieee802154_local *local = sdata->local; |
| 92 | int res; |
alex.bluesman.smirnov@gmail.com | 66b69d4 | 2012-06-25 23:24:51 +0000 | [diff] [blame] | 93 | |
| 94 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 95 | |
Alexander Aring | 12439a5 | 2014-10-28 18:21:29 +0100 | [diff] [blame] | 96 | res = drv_set_channel(local, page, chan); |
| 97 | if (res) { |
| 98 | pr_debug("set_channel failed\n"); |
Varka Bhadram | 4710d80 | 2014-07-02 09:01:09 +0530 | [diff] [blame] | 99 | } else { |
Alexander Aring | 12439a5 | 2014-10-28 18:21:29 +0100 | [diff] [blame] | 100 | mutex_lock(&local->phy->pib_lock); |
| 101 | local->phy->current_channel = chan; |
| 102 | local->phy->current_page = page; |
| 103 | mutex_unlock(&local->phy->pib_lock); |
Varka Bhadram | 4710d80 | 2014-07-02 09:01:09 +0530 | [diff] [blame] | 104 | } |
alex.bluesman.smirnov@gmail.com | 66b69d4 | 2012-06-25 23:24:51 +0000 | [diff] [blame] | 105 | } |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 106 | |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 107 | int mac802154_get_params(struct net_device *dev, |
| 108 | struct ieee802154_llsec_params *params) |
| 109 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 110 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 111 | int res; |
| 112 | |
| 113 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 114 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 115 | mutex_lock(&sdata->sec_mtx); |
| 116 | res = mac802154_llsec_get_params(&sdata->sec, params); |
| 117 | mutex_unlock(&sdata->sec_mtx); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 118 | |
| 119 | return res; |
| 120 | } |
| 121 | |
| 122 | int mac802154_set_params(struct net_device *dev, |
| 123 | const struct ieee802154_llsec_params *params, |
| 124 | int changed) |
| 125 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 126 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 127 | int res; |
| 128 | |
| 129 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 130 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 131 | mutex_lock(&sdata->sec_mtx); |
| 132 | res = mac802154_llsec_set_params(&sdata->sec, params, changed); |
| 133 | mutex_unlock(&sdata->sec_mtx); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 134 | |
| 135 | return res; |
| 136 | } |
| 137 | |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 138 | int mac802154_add_key(struct net_device *dev, |
| 139 | const struct ieee802154_llsec_key_id *id, |
| 140 | const struct ieee802154_llsec_key *key) |
| 141 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 142 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 143 | int res; |
| 144 | |
| 145 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 146 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 147 | mutex_lock(&sdata->sec_mtx); |
| 148 | res = mac802154_llsec_key_add(&sdata->sec, id, key); |
| 149 | mutex_unlock(&sdata->sec_mtx); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 150 | |
| 151 | return res; |
| 152 | } |
| 153 | |
| 154 | int mac802154_del_key(struct net_device *dev, |
| 155 | const struct ieee802154_llsec_key_id *id) |
| 156 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 157 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 158 | int res; |
| 159 | |
| 160 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 161 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 162 | mutex_lock(&sdata->sec_mtx); |
| 163 | res = mac802154_llsec_key_del(&sdata->sec, id); |
| 164 | mutex_unlock(&sdata->sec_mtx); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 165 | |
| 166 | return res; |
| 167 | } |
| 168 | |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 169 | int mac802154_add_dev(struct net_device *dev, |
| 170 | const struct ieee802154_llsec_device *llsec_dev) |
| 171 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 172 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 173 | int res; |
| 174 | |
| 175 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 176 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 177 | mutex_lock(&sdata->sec_mtx); |
| 178 | res = mac802154_llsec_dev_add(&sdata->sec, llsec_dev); |
| 179 | mutex_unlock(&sdata->sec_mtx); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 180 | |
| 181 | return res; |
| 182 | } |
| 183 | |
| 184 | int mac802154_del_dev(struct net_device *dev, __le64 dev_addr) |
| 185 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 186 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 187 | int res; |
| 188 | |
| 189 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 190 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 191 | mutex_lock(&sdata->sec_mtx); |
| 192 | res = mac802154_llsec_dev_del(&sdata->sec, dev_addr); |
| 193 | mutex_unlock(&sdata->sec_mtx); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 194 | |
| 195 | return res; |
| 196 | } |
| 197 | |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 198 | int mac802154_add_devkey(struct net_device *dev, |
| 199 | __le64 device_addr, |
| 200 | const struct ieee802154_llsec_device_key *key) |
| 201 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 202 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 203 | int res; |
| 204 | |
| 205 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 206 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 207 | mutex_lock(&sdata->sec_mtx); |
| 208 | res = mac802154_llsec_devkey_add(&sdata->sec, device_addr, key); |
| 209 | mutex_unlock(&sdata->sec_mtx); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 210 | |
| 211 | return res; |
| 212 | } |
| 213 | |
| 214 | int mac802154_del_devkey(struct net_device *dev, |
| 215 | __le64 device_addr, |
| 216 | const struct ieee802154_llsec_device_key *key) |
| 217 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 218 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 219 | int res; |
| 220 | |
| 221 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 222 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 223 | mutex_lock(&sdata->sec_mtx); |
| 224 | res = mac802154_llsec_devkey_del(&sdata->sec, device_addr, key); |
| 225 | mutex_unlock(&sdata->sec_mtx); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 226 | |
| 227 | return res; |
| 228 | } |
| 229 | |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 230 | int mac802154_add_seclevel(struct net_device *dev, |
| 231 | const struct ieee802154_llsec_seclevel *sl) |
| 232 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 233 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 234 | int res; |
| 235 | |
| 236 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 237 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 238 | mutex_lock(&sdata->sec_mtx); |
| 239 | res = mac802154_llsec_seclevel_add(&sdata->sec, sl); |
| 240 | mutex_unlock(&sdata->sec_mtx); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 241 | |
| 242 | return res; |
| 243 | } |
| 244 | |
| 245 | int mac802154_del_seclevel(struct net_device *dev, |
| 246 | const struct ieee802154_llsec_seclevel *sl) |
| 247 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 248 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 249 | int res; |
| 250 | |
| 251 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 252 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 253 | mutex_lock(&sdata->sec_mtx); |
| 254 | res = mac802154_llsec_seclevel_del(&sdata->sec, sl); |
| 255 | mutex_unlock(&sdata->sec_mtx); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 256 | |
| 257 | return res; |
| 258 | } |
| 259 | |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 260 | void mac802154_lock_table(struct net_device *dev) |
| 261 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 262 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 263 | |
| 264 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 265 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 266 | mutex_lock(&sdata->sec_mtx); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | void mac802154_get_table(struct net_device *dev, |
| 270 | struct ieee802154_llsec_table **t) |
| 271 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 272 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 273 | |
| 274 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 275 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 276 | *t = &sdata->sec.table; |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 277 | } |
| 278 | |
| 279 | void mac802154_unlock_table(struct net_device *dev) |
| 280 | { |
Alexander Aring | 59d19cd | 2014-10-25 17:16:40 +0200 | [diff] [blame] | 281 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 282 | |
| 283 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
| 284 | |
Alexander Aring | 036562f | 2014-10-25 17:16:36 +0200 | [diff] [blame] | 285 | mutex_unlock(&sdata->sec_mtx); |
Phoebe Buckheister | 29e0237 | 2014-05-16 17:46:42 +0200 | [diff] [blame] | 286 | } |