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

TOMOYO Linux Cross Reference
Linux/net/ieee802154/pan.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /net/ieee802154/pan.c (Version linux-6.11.5) and /net/ieee802154/pan.c (Version linux-4.4.302)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 /*                                                
  3  * IEEE 802.15.4 PAN management                   
  4  *                                                
  5  * Copyright (C) 2023 Qorvo US, Inc               
  6  * Authors:                                       
  7  *   - David Girault <david.girault@qorvo.com>    
  8  *   - Miquel Raynal <miquel.raynal@bootlin.co    
  9  */                                               
 10                                                   
 11 #include <linux/kernel.h>                         
 12 #include <net/cfg802154.h>                        
 13 #include <net/af_ieee802154.h>                    
 14                                                   
 15 /* Checks whether a device address matches one    
 16  * This helper is meant to be used only during    
 17  * extended addresses to be used.                 
 18  */                                               
 19 static bool cfg802154_pan_device_is_matching(s    
 20                                              s    
 21 {                                                 
 22         if (!pan_dev || !ext_dev)                 
 23                 return false;                     
 24                                                   
 25         if (ext_dev->mode == IEEE802154_ADDR_S    
 26                 return false;                     
 27                                                   
 28         return pan_dev->extended_addr == ext_d    
 29 }                                                 
 30                                                   
 31 bool cfg802154_device_is_associated(struct wpa    
 32 {                                                 
 33         bool is_assoc;                            
 34                                                   
 35         mutex_lock(&wpan_dev->association_lock    
 36         is_assoc = !list_empty(&wpan_dev->chil    
 37         mutex_unlock(&wpan_dev->association_lo    
 38                                                   
 39         return is_assoc;                          
 40 }                                                 
 41                                                   
 42 bool cfg802154_device_is_parent(struct wpan_de    
 43                                 struct ieee802    
 44 {                                                 
 45         lockdep_assert_held(&wpan_dev->associa    
 46                                                   
 47         return cfg802154_pan_device_is_matchin    
 48 }                                                 
 49 EXPORT_SYMBOL_GPL(cfg802154_device_is_parent);    
 50                                                   
 51 struct ieee802154_pan_device *                    
 52 cfg802154_device_is_child(struct wpan_dev *wpa    
 53                           struct ieee802154_ad    
 54 {                                                 
 55         struct ieee802154_pan_device *child;      
 56                                                   
 57         lockdep_assert_held(&wpan_dev->associa    
 58                                                   
 59         list_for_each_entry(child, &wpan_dev->    
 60                 if (cfg802154_pan_device_is_ma    
 61                         return child;             
 62                                                   
 63         return NULL;                              
 64 }                                                 
 65 EXPORT_SYMBOL_GPL(cfg802154_device_is_child);     
 66                                                   
 67 __le16 cfg802154_get_free_short_addr(struct wp    
 68 {                                                 
 69         struct ieee802154_pan_device *child;      
 70         __le16 addr;                              
 71                                                   
 72         lockdep_assert_held(&wpan_dev->associa    
 73                                                   
 74         do {                                      
 75                 get_random_bytes(&addr, 2);       
 76                 if (addr == cpu_to_le16(IEEE80    
 77                     addr == cpu_to_le16(IEEE80    
 78                         continue;                 
 79                                                   
 80                 if (wpan_dev->short_addr == ad    
 81                         continue;                 
 82                                                   
 83                 if (wpan_dev->parent && wpan_d    
 84                         continue;                 
 85                                                   
 86                 list_for_each_entry(child, &wp    
 87                         if (child->short_addr     
 88                                 continue;         
 89                                                   
 90                 break;                            
 91         } while (1);                              
 92                                                   
 93         return addr;                              
 94 }                                                 
 95 EXPORT_SYMBOL_GPL(cfg802154_get_free_short_add    
 96                                                   
 97 unsigned int cfg802154_set_max_associations(st    
 98                                             un    
 99 {                                                 
100         unsigned int old_max;                     
101                                                   
102         lockdep_assert_held(&wpan_dev->associa    
103                                                   
104         old_max = wpan_dev->max_associations;     
105         wpan_dev->max_associations = max;         
106                                                   
107         return old_max;                           
108 }                                                 
109 EXPORT_SYMBOL_GPL(cfg802154_set_max_associatio    
110                                                   

~ [ 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