@@ -213,3 +213,190 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
213213 } else
214214 mutex_unlock (& priv -> hw -> phy -> pib_lock );
215215}
216+
217+
218+ int mac802154_get_params (struct net_device * dev ,
219+ struct ieee802154_llsec_params * params )
220+ {
221+ struct mac802154_sub_if_data * priv = netdev_priv (dev );
222+ int res ;
223+
224+ BUG_ON (dev -> type != ARPHRD_IEEE802154 );
225+
226+ mutex_lock (& priv -> sec_mtx );
227+ res = mac802154_llsec_get_params (& priv -> sec , params );
228+ mutex_unlock (& priv -> sec_mtx );
229+
230+ return res ;
231+ }
232+
233+ int mac802154_set_params (struct net_device * dev ,
234+ const struct ieee802154_llsec_params * params ,
235+ int changed )
236+ {
237+ struct mac802154_sub_if_data * priv = netdev_priv (dev );
238+ int res ;
239+
240+ BUG_ON (dev -> type != ARPHRD_IEEE802154 );
241+
242+ mutex_lock (& priv -> sec_mtx );
243+ res = mac802154_llsec_set_params (& priv -> sec , params , changed );
244+ mutex_unlock (& priv -> sec_mtx );
245+
246+ return res ;
247+ }
248+
249+
250+ int mac802154_add_key (struct net_device * dev ,
251+ const struct ieee802154_llsec_key_id * id ,
252+ const struct ieee802154_llsec_key * key )
253+ {
254+ struct mac802154_sub_if_data * priv = netdev_priv (dev );
255+ int res ;
256+
257+ BUG_ON (dev -> type != ARPHRD_IEEE802154 );
258+
259+ mutex_lock (& priv -> sec_mtx );
260+ res = mac802154_llsec_key_add (& priv -> sec , id , key );
261+ mutex_unlock (& priv -> sec_mtx );
262+
263+ return res ;
264+ }
265+
266+ int mac802154_del_key (struct net_device * dev ,
267+ const struct ieee802154_llsec_key_id * id )
268+ {
269+ struct mac802154_sub_if_data * priv = netdev_priv (dev );
270+ int res ;
271+
272+ BUG_ON (dev -> type != ARPHRD_IEEE802154 );
273+
274+ mutex_lock (& priv -> sec_mtx );
275+ res = mac802154_llsec_key_del (& priv -> sec , id );
276+ mutex_unlock (& priv -> sec_mtx );
277+
278+ return res ;
279+ }
280+
281+
282+ int mac802154_add_dev (struct net_device * dev ,
283+ const struct ieee802154_llsec_device * llsec_dev )
284+ {
285+ struct mac802154_sub_if_data * priv = netdev_priv (dev );
286+ int res ;
287+
288+ BUG_ON (dev -> type != ARPHRD_IEEE802154 );
289+
290+ mutex_lock (& priv -> sec_mtx );
291+ res = mac802154_llsec_dev_add (& priv -> sec , llsec_dev );
292+ mutex_unlock (& priv -> sec_mtx );
293+
294+ return res ;
295+ }
296+
297+ int mac802154_del_dev (struct net_device * dev , __le64 dev_addr )
298+ {
299+ struct mac802154_sub_if_data * priv = netdev_priv (dev );
300+ int res ;
301+
302+ BUG_ON (dev -> type != ARPHRD_IEEE802154 );
303+
304+ mutex_lock (& priv -> sec_mtx );
305+ res = mac802154_llsec_dev_del (& priv -> sec , dev_addr );
306+ mutex_unlock (& priv -> sec_mtx );
307+
308+ return res ;
309+ }
310+
311+
312+ int mac802154_add_devkey (struct net_device * dev ,
313+ __le64 device_addr ,
314+ const struct ieee802154_llsec_device_key * key )
315+ {
316+ struct mac802154_sub_if_data * priv = netdev_priv (dev );
317+ int res ;
318+
319+ BUG_ON (dev -> type != ARPHRD_IEEE802154 );
320+
321+ mutex_lock (& priv -> sec_mtx );
322+ res = mac802154_llsec_devkey_add (& priv -> sec , device_addr , key );
323+ mutex_unlock (& priv -> sec_mtx );
324+
325+ return res ;
326+ }
327+
328+ int mac802154_del_devkey (struct net_device * dev ,
329+ __le64 device_addr ,
330+ const struct ieee802154_llsec_device_key * key )
331+ {
332+ struct mac802154_sub_if_data * priv = netdev_priv (dev );
333+ int res ;
334+
335+ BUG_ON (dev -> type != ARPHRD_IEEE802154 );
336+
337+ mutex_lock (& priv -> sec_mtx );
338+ res = mac802154_llsec_devkey_del (& priv -> sec , device_addr , key );
339+ mutex_unlock (& priv -> sec_mtx );
340+
341+ return res ;
342+ }
343+
344+
345+ int mac802154_add_seclevel (struct net_device * dev ,
346+ const struct ieee802154_llsec_seclevel * sl )
347+ {
348+ struct mac802154_sub_if_data * priv = netdev_priv (dev );
349+ int res ;
350+
351+ BUG_ON (dev -> type != ARPHRD_IEEE802154 );
352+
353+ mutex_lock (& priv -> sec_mtx );
354+ res = mac802154_llsec_seclevel_add (& priv -> sec , sl );
355+ mutex_unlock (& priv -> sec_mtx );
356+
357+ return res ;
358+ }
359+
360+ int mac802154_del_seclevel (struct net_device * dev ,
361+ const struct ieee802154_llsec_seclevel * sl )
362+ {
363+ struct mac802154_sub_if_data * priv = netdev_priv (dev );
364+ int res ;
365+
366+ BUG_ON (dev -> type != ARPHRD_IEEE802154 );
367+
368+ mutex_lock (& priv -> sec_mtx );
369+ res = mac802154_llsec_seclevel_del (& priv -> sec , sl );
370+ mutex_unlock (& priv -> sec_mtx );
371+
372+ return res ;
373+ }
374+
375+
376+ void mac802154_lock_table (struct net_device * dev )
377+ {
378+ struct mac802154_sub_if_data * priv = netdev_priv (dev );
379+
380+ BUG_ON (dev -> type != ARPHRD_IEEE802154 );
381+
382+ mutex_lock (& priv -> sec_mtx );
383+ }
384+
385+ void mac802154_get_table (struct net_device * dev ,
386+ struct ieee802154_llsec_table * * t )
387+ {
388+ struct mac802154_sub_if_data * priv = netdev_priv (dev );
389+
390+ BUG_ON (dev -> type != ARPHRD_IEEE802154 );
391+
392+ * t = & priv -> sec .table ;
393+ }
394+
395+ void mac802154_unlock_table (struct net_device * dev )
396+ {
397+ struct mac802154_sub_if_data * priv = netdev_priv (dev );
398+
399+ BUG_ON (dev -> type != ARPHRD_IEEE802154 );
400+
401+ mutex_unlock (& priv -> sec_mtx );
402+ }
0 commit comments