Lines Matching refs:entry
73 udp_tunnel_nic_entry_is_free(struct udp_tunnel_nic_table_entry *entry) in udp_tunnel_nic_entry_is_free() argument
75 return entry->use_cnt == 0 && !entry->flags; in udp_tunnel_nic_entry_is_free()
79 udp_tunnel_nic_entry_is_present(struct udp_tunnel_nic_table_entry *entry) in udp_tunnel_nic_entry_is_present() argument
81 return entry->use_cnt && !(entry->flags & ~UDP_TUNNEL_NIC_ENTRY_FROZEN); in udp_tunnel_nic_entry_is_present()
85 udp_tunnel_nic_entry_is_frozen(struct udp_tunnel_nic_table_entry *entry) in udp_tunnel_nic_entry_is_frozen() argument
87 return entry->flags & UDP_TUNNEL_NIC_ENTRY_FROZEN; in udp_tunnel_nic_entry_is_frozen()
91 udp_tunnel_nic_entry_freeze_used(struct udp_tunnel_nic_table_entry *entry) in udp_tunnel_nic_entry_freeze_used() argument
93 if (!udp_tunnel_nic_entry_is_free(entry)) in udp_tunnel_nic_entry_freeze_used()
94 entry->flags |= UDP_TUNNEL_NIC_ENTRY_FROZEN; in udp_tunnel_nic_entry_freeze_used()
98 udp_tunnel_nic_entry_unfreeze(struct udp_tunnel_nic_table_entry *entry) in udp_tunnel_nic_entry_unfreeze() argument
100 entry->flags &= ~UDP_TUNNEL_NIC_ENTRY_FROZEN; in udp_tunnel_nic_entry_unfreeze()
104 udp_tunnel_nic_entry_is_queued(struct udp_tunnel_nic_table_entry *entry) in udp_tunnel_nic_entry_is_queued() argument
106 return entry->flags & (UDP_TUNNEL_NIC_ENTRY_ADD | in udp_tunnel_nic_entry_is_queued()
112 struct udp_tunnel_nic_table_entry *entry, in udp_tunnel_nic_entry_queue() argument
115 entry->flags |= flag; in udp_tunnel_nic_entry_queue()
120 udp_tunnel_nic_ti_from_entry(struct udp_tunnel_nic_table_entry *entry, in udp_tunnel_nic_ti_from_entry() argument
124 ti->port = entry->port; in udp_tunnel_nic_ti_from_entry()
125 ti->type = entry->type; in udp_tunnel_nic_ti_from_entry()
126 ti->hw_priv = entry->hw_priv; in udp_tunnel_nic_ti_from_entry()
168 struct udp_tunnel_nic_table_entry *entry; in __udp_tunnel_nic_get_port() local
172 entry = &utn->entries[table][idx]; in __udp_tunnel_nic_get_port()
174 if (entry->use_cnt) in __udp_tunnel_nic_get_port()
175 udp_tunnel_nic_ti_from_entry(entry, ti); in __udp_tunnel_nic_get_port()
186 udp_tunnel_nic_entry_update_done(struct udp_tunnel_nic_table_entry *entry, in udp_tunnel_nic_entry_update_done() argument
189 bool dodgy = entry->flags & UDP_TUNNEL_NIC_ENTRY_OP_FAIL; in udp_tunnel_nic_entry_update_done()
191 WARN_ON_ONCE(entry->flags & UDP_TUNNEL_NIC_ENTRY_ADD && in udp_tunnel_nic_entry_update_done()
192 entry->flags & UDP_TUNNEL_NIC_ENTRY_DEL); in udp_tunnel_nic_entry_update_done()
194 if (entry->flags & UDP_TUNNEL_NIC_ENTRY_ADD && in udp_tunnel_nic_entry_update_done()
196 entry->flags &= ~UDP_TUNNEL_NIC_ENTRY_ADD; in udp_tunnel_nic_entry_update_done()
198 if (entry->flags & UDP_TUNNEL_NIC_ENTRY_DEL && in udp_tunnel_nic_entry_update_done()
200 entry->flags &= ~UDP_TUNNEL_NIC_ENTRY_DEL; in udp_tunnel_nic_entry_update_done()
203 entry->flags &= ~UDP_TUNNEL_NIC_ENTRY_OP_FAIL; in udp_tunnel_nic_entry_update_done()
205 entry->flags |= UDP_TUNNEL_NIC_ENTRY_OP_FAIL; in udp_tunnel_nic_entry_update_done()
213 struct udp_tunnel_nic_table_entry *entry; in udp_tunnel_nic_device_sync_one() local
217 entry = &utn->entries[table][idx]; in udp_tunnel_nic_device_sync_one()
218 if (!udp_tunnel_nic_entry_is_queued(entry)) in udp_tunnel_nic_device_sync_one()
221 udp_tunnel_nic_ti_from_entry(entry, &ti); in udp_tunnel_nic_device_sync_one()
222 if (entry->flags & UDP_TUNNEL_NIC_ENTRY_ADD) in udp_tunnel_nic_device_sync_one()
227 udp_tunnel_nic_entry_update_done(entry, err); in udp_tunnel_nic_device_sync_one()
232 be16_to_cpu(entry->port), in udp_tunnel_nic_device_sync_one()
233 udp_tunnel_nic_tunnel_type_name(entry->type), in udp_tunnel_nic_device_sync_one()
271 struct udp_tunnel_nic_table_entry *entry; in udp_tunnel_nic_device_sync_by_table() local
273 entry = &utn->entries[i][j]; in udp_tunnel_nic_device_sync_by_table()
274 if (udp_tunnel_nic_entry_is_queued(entry)) in udp_tunnel_nic_device_sync_by_table()
275 udp_tunnel_nic_entry_update_done(entry, err); in udp_tunnel_nic_device_sync_by_table()
349 struct udp_tunnel_nic_table_entry *entry; in udp_tunnel_nic_has_collision() local
354 entry = &utn->entries[i][j]; in udp_tunnel_nic_has_collision()
356 if (!udp_tunnel_nic_entry_is_free(entry) && in udp_tunnel_nic_has_collision()
357 entry->port == ti->port && in udp_tunnel_nic_has_collision()
358 entry->type != ti->type) { in udp_tunnel_nic_has_collision()
370 struct udp_tunnel_nic_table_entry *entry = &utn->entries[table][idx]; in udp_tunnel_nic_entry_adj() local
371 bool dodgy = entry->flags & UDP_TUNNEL_NIC_ENTRY_OP_FAIL; in udp_tunnel_nic_entry_adj()
374 WARN_ON(entry->use_cnt + (u32)use_cnt_adj > U16_MAX); in udp_tunnel_nic_entry_adj()
379 entry->use_cnt += use_cnt_adj; in udp_tunnel_nic_entry_adj()
380 if (!dodgy && !entry->use_cnt == !(entry->use_cnt - use_cnt_adj)) in udp_tunnel_nic_entry_adj()
395 if (entry->flags & from) { in udp_tunnel_nic_entry_adj()
396 entry->flags &= ~from; in udp_tunnel_nic_entry_adj()
401 udp_tunnel_nic_entry_queue(utn, entry, to); in udp_tunnel_nic_entry_adj()
409 struct udp_tunnel_nic_table_entry *entry = &utn->entries[table][idx]; in udp_tunnel_nic_entry_try_adj() local
411 if (udp_tunnel_nic_entry_is_free(entry) || in udp_tunnel_nic_entry_try_adj()
412 entry->port != ti->port || in udp_tunnel_nic_entry_try_adj()
413 entry->type != ti->type) in udp_tunnel_nic_entry_try_adj()
416 if (udp_tunnel_nic_entry_is_frozen(entry)) in udp_tunnel_nic_entry_try_adj()
476 struct udp_tunnel_nic_table_entry *entry; in udp_tunnel_nic_add_new() local
478 entry = &utn->entries[i][j]; in udp_tunnel_nic_add_new()
479 if (!udp_tunnel_nic_entry_is_free(entry)) in udp_tunnel_nic_add_new()
482 entry->port = ti->port; in udp_tunnel_nic_add_new()
483 entry->type = ti->type; in udp_tunnel_nic_add_new()
484 entry->use_cnt = 1; in udp_tunnel_nic_add_new()
485 udp_tunnel_nic_entry_queue(utn, entry, in udp_tunnel_nic_add_new()
566 struct udp_tunnel_nic_table_entry *entry; in __udp_tunnel_nic_reset_ntf() local
568 entry = &utn->entries[i][j]; in __udp_tunnel_nic_reset_ntf()
570 entry->flags &= ~(UDP_TUNNEL_NIC_ENTRY_DEL | in __udp_tunnel_nic_reset_ntf()
573 WARN_ON(entry->flags & UDP_TUNNEL_NIC_ENTRY_FROZEN); in __udp_tunnel_nic_reset_ntf()
574 if (!entry->use_cnt) in __udp_tunnel_nic_reset_ntf()
577 udp_tunnel_nic_entry_queue(utn, entry, in __udp_tunnel_nic_reset_ntf()