Lines Matching refs:pnd
51 struct phonet_device *pnd = kmalloc(sizeof(*pnd), GFP_ATOMIC); in __phonet_device_alloc() local
52 if (pnd == NULL) in __phonet_device_alloc()
54 pnd->netdev = dev; in __phonet_device_alloc()
55 bitmap_zero(pnd->addrs, 64); in __phonet_device_alloc()
58 list_add_rcu(&pnd->list, &pndevs->list); in __phonet_device_alloc()
59 return pnd; in __phonet_device_alloc()
65 struct phonet_device *pnd; in __phonet_get() local
68 list_for_each_entry(pnd, &pndevs->list, list) { in __phonet_get()
69 if (pnd->netdev == dev) in __phonet_get()
70 return pnd; in __phonet_get()
78 struct phonet_device *pnd; in __phonet_get_rcu() local
80 list_for_each_entry_rcu(pnd, &pndevs->list, list) { in __phonet_get_rcu()
81 if (pnd->netdev == dev) in __phonet_get_rcu()
82 return pnd; in __phonet_get_rcu()
90 struct phonet_device *pnd; in phonet_device_destroy() local
95 pnd = __phonet_get(dev); in phonet_device_destroy()
96 if (pnd) in phonet_device_destroy()
97 list_del_rcu(&pnd->list); in phonet_device_destroy()
100 if (pnd) { in phonet_device_destroy()
103 for_each_set_bit(addr, pnd->addrs, 64) in phonet_device_destroy()
105 kfree(pnd); in phonet_device_destroy()
112 struct phonet_device *pnd; in phonet_device_get() local
116 list_for_each_entry_rcu(pnd, &pndevs->list, list) { in phonet_device_get()
117 dev = pnd->netdev; in phonet_device_get()
121 ((pnd->netdev->flags & IFF_UP)) == IFF_UP) in phonet_device_get()
133 struct phonet_device *pnd; in phonet_address_add() local
138 pnd = __phonet_get(dev); in phonet_address_add()
139 if (pnd == NULL) in phonet_address_add()
140 pnd = __phonet_device_alloc(dev); in phonet_address_add()
141 if (unlikely(pnd == NULL)) in phonet_address_add()
143 else if (test_and_set_bit(addr >> 2, pnd->addrs)) in phonet_address_add()
152 struct phonet_device *pnd; in phonet_address_del() local
156 pnd = __phonet_get(dev); in phonet_address_del()
157 if (!pnd || !test_and_clear_bit(addr >> 2, pnd->addrs)) { in phonet_address_del()
159 pnd = NULL; in phonet_address_del()
160 } else if (bitmap_empty(pnd->addrs, 64)) in phonet_address_del()
161 list_del_rcu(&pnd->list); in phonet_address_del()
163 pnd = NULL; in phonet_address_del()
166 if (pnd) in phonet_address_del()
167 kfree_rcu(pnd, rcu); in phonet_address_del()
175 struct phonet_device *pnd; in phonet_address_get() local
179 pnd = __phonet_get_rcu(dev); in phonet_address_get()
180 if (pnd) { in phonet_address_get()
181 BUG_ON(bitmap_empty(pnd->addrs, 64)); in phonet_address_get()
184 if (test_bit(daddr >> 2, pnd->addrs)) in phonet_address_get()
187 saddr = find_first_bit(pnd->addrs, 64) << 2; in phonet_address_get()
209 struct phonet_device *pnd; in phonet_address_lookup() local
213 list_for_each_entry_rcu(pnd, &pndevs->list, list) { in phonet_address_lookup()
215 if ((pnd->netdev->reg_state != NETREG_REGISTERED) || in phonet_address_lookup()
216 ((pnd->netdev->flags & IFF_UP)) != IFF_UP) in phonet_address_lookup()
219 if (test_bit(addr >> 2, pnd->addrs)) { in phonet_address_lookup()