~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/mac802154/mib.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /net/mac802154/mib.c (Version linux-6.12-rc7) and /net/mac802154/mib.c (Version linux-4.4.302)


  1 // SPDX-License-Identifier: GPL-2.0-only       << 
  2 /*                                                  1 /*
  3  * Copyright 2007-2012 Siemens AG                   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.
  4  *                                                 12  *
  5  * Written by:                                     13  * Written by:
  6  * Dmitry Eremin-Solenikov <dbaryshkov@gmail.c     14  * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
  7  * Sergey Lapin <slapin@ossfans.org>               15  * Sergey Lapin <slapin@ossfans.org>
  8  * Maxim Gorbachyov <maxim.gorbachev@siemens.c     16  * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
  9  * Alexander Smirnov <alex.bluesman.smirnov@gm     17  * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
 10  */                                                18  */
 11                                                    19 
 12 #include <linux/if_arp.h>                          20 #include <linux/if_arp.h>
 13                                                    21 
 14 #include <net/mac802154.h>                         22 #include <net/mac802154.h>
 15 #include <net/ieee802154_netdev.h>                 23 #include <net/ieee802154_netdev.h>
 16 #include <net/cfg802154.h>                         24 #include <net/cfg802154.h>
 17                                                    25 
 18 #include "ieee802154_i.h"                          26 #include "ieee802154_i.h"
 19 #include "driver-ops.h"                            27 #include "driver-ops.h"
 20                                                    28 
 21 void mac802154_dev_set_page_channel(struct net     29 void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
 22 {                                                  30 {
 23         struct ieee802154_sub_if_data *sdata =     31         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 24         struct ieee802154_local *local = sdata     32         struct ieee802154_local *local = sdata->local;
 25         int res;                                   33         int res;
 26                                                    34 
 27         ASSERT_RTNL();                             35         ASSERT_RTNL();
 28                                                    36 
 29         BUG_ON(dev->type != ARPHRD_IEEE802154)     37         BUG_ON(dev->type != ARPHRD_IEEE802154);
 30                                                    38 
 31         res = drv_set_channel(local, page, cha     39         res = drv_set_channel(local, page, chan);
 32         if (res) {                                 40         if (res) {
 33                 pr_debug("set_channel failed\n     41                 pr_debug("set_channel failed\n");
 34         } else {                                   42         } else {
 35                 local->phy->current_channel =      43                 local->phy->current_channel = chan;
 36                 local->phy->current_page = pag     44                 local->phy->current_page = page;
 37         }                                          45         }
 38 }                                                  46 }
 39                                                    47 
 40 int mac802154_get_params(struct net_device *de     48 int mac802154_get_params(struct net_device *dev,
 41                          struct ieee802154_lls     49                          struct ieee802154_llsec_params *params)
 42 {                                                  50 {
 43         struct ieee802154_sub_if_data *sdata =     51         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 44         int res;                                   52         int res;
 45                                                    53 
 46         BUG_ON(dev->type != ARPHRD_IEEE802154)     54         BUG_ON(dev->type != ARPHRD_IEEE802154);
 47                                                    55 
 48         mutex_lock(&sdata->sec_mtx);               56         mutex_lock(&sdata->sec_mtx);
 49         res = mac802154_llsec_get_params(&sdat     57         res = mac802154_llsec_get_params(&sdata->sec, params);
 50         mutex_unlock(&sdata->sec_mtx);             58         mutex_unlock(&sdata->sec_mtx);
 51                                                    59 
 52         return res;                                60         return res;
 53 }                                                  61 }
 54                                                    62 
 55 int mac802154_set_params(struct net_device *de     63 int mac802154_set_params(struct net_device *dev,
 56                          const struct ieee8021     64                          const struct ieee802154_llsec_params *params,
 57                          int changed)              65                          int changed)
 58 {                                                  66 {
 59         struct ieee802154_sub_if_data *sdata =     67         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 60         int res;                                   68         int res;
 61                                                    69 
 62         BUG_ON(dev->type != ARPHRD_IEEE802154)     70         BUG_ON(dev->type != ARPHRD_IEEE802154);
 63                                                    71 
 64         mutex_lock(&sdata->sec_mtx);               72         mutex_lock(&sdata->sec_mtx);
 65         res = mac802154_llsec_set_params(&sdat     73         res = mac802154_llsec_set_params(&sdata->sec, params, changed);
 66         mutex_unlock(&sdata->sec_mtx);             74         mutex_unlock(&sdata->sec_mtx);
 67                                                    75 
 68         return res;                                76         return res;
 69 }                                                  77 }
 70                                                    78 
 71 int mac802154_add_key(struct net_device *dev,      79 int mac802154_add_key(struct net_device *dev,
 72                       const struct ieee802154_     80                       const struct ieee802154_llsec_key_id *id,
 73                       const struct ieee802154_     81                       const struct ieee802154_llsec_key *key)
 74 {                                                  82 {
 75         struct ieee802154_sub_if_data *sdata =     83         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 76         int res;                                   84         int res;
 77                                                    85 
 78         BUG_ON(dev->type != ARPHRD_IEEE802154)     86         BUG_ON(dev->type != ARPHRD_IEEE802154);
 79                                                    87 
 80         mutex_lock(&sdata->sec_mtx);               88         mutex_lock(&sdata->sec_mtx);
 81         res = mac802154_llsec_key_add(&sdata->     89         res = mac802154_llsec_key_add(&sdata->sec, id, key);
 82         mutex_unlock(&sdata->sec_mtx);             90         mutex_unlock(&sdata->sec_mtx);
 83                                                    91 
 84         return res;                                92         return res;
 85 }                                                  93 }
 86                                                    94 
 87 int mac802154_del_key(struct net_device *dev,      95 int mac802154_del_key(struct net_device *dev,
 88                       const struct ieee802154_     96                       const struct ieee802154_llsec_key_id *id)
 89 {                                                  97 {
 90         struct ieee802154_sub_if_data *sdata =     98         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 91         int res;                                   99         int res;
 92                                                   100 
 93         BUG_ON(dev->type != ARPHRD_IEEE802154)    101         BUG_ON(dev->type != ARPHRD_IEEE802154);
 94                                                   102 
 95         mutex_lock(&sdata->sec_mtx);              103         mutex_lock(&sdata->sec_mtx);
 96         res = mac802154_llsec_key_del(&sdata->    104         res = mac802154_llsec_key_del(&sdata->sec, id);
 97         mutex_unlock(&sdata->sec_mtx);            105         mutex_unlock(&sdata->sec_mtx);
 98                                                   106 
 99         return res;                               107         return res;
100 }                                                 108 }
101                                                   109 
102 int mac802154_add_dev(struct net_device *dev,     110 int mac802154_add_dev(struct net_device *dev,
103                       const struct ieee802154_    111                       const struct ieee802154_llsec_device *llsec_dev)
104 {                                                 112 {
105         struct ieee802154_sub_if_data *sdata =    113         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
106         int res;                                  114         int res;
107                                                   115 
108         BUG_ON(dev->type != ARPHRD_IEEE802154)    116         BUG_ON(dev->type != ARPHRD_IEEE802154);
109                                                   117 
110         mutex_lock(&sdata->sec_mtx);              118         mutex_lock(&sdata->sec_mtx);
111         res = mac802154_llsec_dev_add(&sdata->    119         res = mac802154_llsec_dev_add(&sdata->sec, llsec_dev);
112         mutex_unlock(&sdata->sec_mtx);            120         mutex_unlock(&sdata->sec_mtx);
113                                                   121 
114         return res;                               122         return res;
115 }                                                 123 }
116                                                   124 
117 int mac802154_del_dev(struct net_device *dev,     125 int mac802154_del_dev(struct net_device *dev, __le64 dev_addr)
118 {                                                 126 {
119         struct ieee802154_sub_if_data *sdata =    127         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
120         int res;                                  128         int res;
121                                                   129 
122         BUG_ON(dev->type != ARPHRD_IEEE802154)    130         BUG_ON(dev->type != ARPHRD_IEEE802154);
123                                                   131 
124         mutex_lock(&sdata->sec_mtx);              132         mutex_lock(&sdata->sec_mtx);
125         res = mac802154_llsec_dev_del(&sdata->    133         res = mac802154_llsec_dev_del(&sdata->sec, dev_addr);
126         mutex_unlock(&sdata->sec_mtx);            134         mutex_unlock(&sdata->sec_mtx);
127                                                   135 
128         return res;                               136         return res;
129 }                                                 137 }
130                                                   138 
131 int mac802154_add_devkey(struct net_device *de    139 int mac802154_add_devkey(struct net_device *dev,
132                          __le64 device_addr,      140                          __le64 device_addr,
133                          const struct ieee8021    141                          const struct ieee802154_llsec_device_key *key)
134 {                                                 142 {
135         struct ieee802154_sub_if_data *sdata =    143         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
136         int res;                                  144         int res;
137                                                   145 
138         BUG_ON(dev->type != ARPHRD_IEEE802154)    146         BUG_ON(dev->type != ARPHRD_IEEE802154);
139                                                   147 
140         mutex_lock(&sdata->sec_mtx);              148         mutex_lock(&sdata->sec_mtx);
141         res = mac802154_llsec_devkey_add(&sdat    149         res = mac802154_llsec_devkey_add(&sdata->sec, device_addr, key);
142         mutex_unlock(&sdata->sec_mtx);            150         mutex_unlock(&sdata->sec_mtx);
143                                                   151 
144         return res;                               152         return res;
145 }                                                 153 }
146                                                   154 
147 int mac802154_del_devkey(struct net_device *de    155 int mac802154_del_devkey(struct net_device *dev,
148                          __le64 device_addr,      156                          __le64 device_addr,
149                          const struct ieee8021    157                          const struct ieee802154_llsec_device_key *key)
150 {                                                 158 {
151         struct ieee802154_sub_if_data *sdata =    159         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
152         int res;                                  160         int res;
153                                                   161 
154         BUG_ON(dev->type != ARPHRD_IEEE802154)    162         BUG_ON(dev->type != ARPHRD_IEEE802154);
155                                                   163 
156         mutex_lock(&sdata->sec_mtx);              164         mutex_lock(&sdata->sec_mtx);
157         res = mac802154_llsec_devkey_del(&sdat    165         res = mac802154_llsec_devkey_del(&sdata->sec, device_addr, key);
158         mutex_unlock(&sdata->sec_mtx);            166         mutex_unlock(&sdata->sec_mtx);
159                                                   167 
160         return res;                               168         return res;
161 }                                                 169 }
162                                                   170 
163 int mac802154_add_seclevel(struct net_device *    171 int mac802154_add_seclevel(struct net_device *dev,
164                            const struct ieee80    172                            const struct ieee802154_llsec_seclevel *sl)
165 {                                                 173 {
166         struct ieee802154_sub_if_data *sdata =    174         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
167         int res;                                  175         int res;
168                                                   176 
169         BUG_ON(dev->type != ARPHRD_IEEE802154)    177         BUG_ON(dev->type != ARPHRD_IEEE802154);
170                                                   178 
171         mutex_lock(&sdata->sec_mtx);              179         mutex_lock(&sdata->sec_mtx);
172         res = mac802154_llsec_seclevel_add(&sd    180         res = mac802154_llsec_seclevel_add(&sdata->sec, sl);
173         mutex_unlock(&sdata->sec_mtx);            181         mutex_unlock(&sdata->sec_mtx);
174                                                   182 
175         return res;                               183         return res;
176 }                                                 184 }
177                                                   185 
178 int mac802154_del_seclevel(struct net_device *    186 int mac802154_del_seclevel(struct net_device *dev,
179                            const struct ieee80    187                            const struct ieee802154_llsec_seclevel *sl)
180 {                                                 188 {
181         struct ieee802154_sub_if_data *sdata =    189         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
182         int res;                                  190         int res;
183                                                   191 
184         BUG_ON(dev->type != ARPHRD_IEEE802154)    192         BUG_ON(dev->type != ARPHRD_IEEE802154);
185                                                   193 
186         mutex_lock(&sdata->sec_mtx);              194         mutex_lock(&sdata->sec_mtx);
187         res = mac802154_llsec_seclevel_del(&sd    195         res = mac802154_llsec_seclevel_del(&sdata->sec, sl);
188         mutex_unlock(&sdata->sec_mtx);            196         mutex_unlock(&sdata->sec_mtx);
189                                                   197 
190         return res;                               198         return res;
191 }                                                 199 }
192                                                   200 
193 void mac802154_lock_table(struct net_device *d    201 void mac802154_lock_table(struct net_device *dev)
194 {                                                 202 {
195         struct ieee802154_sub_if_data *sdata =    203         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
196                                                   204 
197         BUG_ON(dev->type != ARPHRD_IEEE802154)    205         BUG_ON(dev->type != ARPHRD_IEEE802154);
198                                                   206 
199         mutex_lock(&sdata->sec_mtx);              207         mutex_lock(&sdata->sec_mtx);
200 }                                                 208 }
201                                                   209 
202 void mac802154_get_table(struct net_device *de    210 void mac802154_get_table(struct net_device *dev,
203                          struct ieee802154_lls    211                          struct ieee802154_llsec_table **t)
204 {                                                 212 {
205         struct ieee802154_sub_if_data *sdata =    213         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
206                                                   214 
207         BUG_ON(dev->type != ARPHRD_IEEE802154)    215         BUG_ON(dev->type != ARPHRD_IEEE802154);
208                                                   216 
209         *t = &sdata->sec.table;                   217         *t = &sdata->sec.table;
210 }                                                 218 }
211                                                   219 
212 void mac802154_unlock_table(struct net_device     220 void mac802154_unlock_table(struct net_device *dev)
213 {                                                 221 {
214         struct ieee802154_sub_if_data *sdata =    222         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
215                                                   223 
216         BUG_ON(dev->type != ARPHRD_IEEE802154)    224         BUG_ON(dev->type != ARPHRD_IEEE802154);
217                                                   225 
218         mutex_unlock(&sdata->sec_mtx);            226         mutex_unlock(&sdata->sec_mtx);
219 }                                                 227 }
220                                                   228 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php