Lines Matching refs:entry

44 static void arp_entry_cleanup(struct arp_entry *entry, bool pending)  in arp_entry_cleanup()  argument
46 NET_DBG("entry %p", entry); in arp_entry_cleanup()
51 while (!k_fifo_is_empty(&entry->pending_queue)) { in arp_entry_cleanup()
52 pkt = k_fifo_get(&entry->pending_queue, K_FOREVER); in arp_entry_cleanup()
60 entry->iface = NULL; in arp_entry_cleanup()
62 (void)memset(&entry->ip, 0, sizeof(struct in_addr)); in arp_entry_cleanup()
63 (void)memset(&entry->eth, 0, sizeof(struct net_eth_addr)); in arp_entry_cleanup()
71 struct arp_entry *entry; in arp_entry_find() local
73 SYS_SLIST_FOR_EACH_CONTAINER(list, entry, node) { in arp_entry_find()
76 net_sprint_ipv4_addr(&entry->ip)); in arp_entry_find()
78 if (entry->iface == iface && in arp_entry_find()
79 net_ipv4_addr_cmp(&entry->ip, dst)) { in arp_entry_find()
80 return entry; in arp_entry_find()
84 *previous = &entry->node; in arp_entry_find()
95 struct arp_entry *entry; in arp_entry_find_move_first() local
99 entry = arp_entry_find(&arp_table, iface, dst, &prev); in arp_entry_find_move_first()
100 if (entry) { in arp_entry_find_move_first()
106 if (&entry->node != sys_slist_peek_head(&arp_table)) { in arp_entry_find_move_first()
107 sys_slist_remove(&arp_table, prev, &entry->node); in arp_entry_find_move_first()
108 sys_slist_prepend(&arp_table, &entry->node); in arp_entry_find_move_first()
112 return entry; in arp_entry_find_move_first()
128 struct arp_entry *entry; in arp_entry_get_pending() local
132 entry = arp_entry_find(&arp_pending_entries, iface, dst, &prev); in arp_entry_get_pending()
133 if (entry) { in arp_entry_get_pending()
135 sys_slist_remove(&arp_pending_entries, prev, &entry->node); in arp_entry_get_pending()
142 return entry; in arp_entry_get_pending()
179 static void arp_entry_register_pending(struct arp_entry *entry) in arp_entry_register_pending() argument
181 NET_DBG("dst %s", net_sprint_ipv4_addr(&entry->ip)); in arp_entry_register_pending()
183 sys_slist_append(&arp_pending_entries, &entry->node); in arp_entry_register_pending()
185 entry->req_start = k_uptime_get_32(); in arp_entry_register_pending()
197 struct arp_entry *entry, *next; in arp_request_timeout() local
204 entry, next, node) { in arp_request_timeout()
205 if ((int32_t)(entry->req_start + in arp_request_timeout()
210 arp_entry_cleanup(entry, true); in arp_request_timeout()
212 sys_slist_remove(&arp_pending_entries, NULL, &entry->node); in arp_request_timeout()
213 sys_slist_append(&arp_free_entries, &entry->node); in arp_request_timeout()
215 entry = NULL; in arp_request_timeout()
218 if (entry) { in arp_request_timeout()
220 K_MSEC(entry->req_start + in arp_request_timeout()
252 struct arp_entry *entry, in arp_prepare() argument
292 if (entry) { in arp_prepare()
295 k_fifo_put(&entry->pending_queue, pending); in arp_prepare()
298 entry->iface = net_pkt_iface(pkt); in arp_prepare()
300 net_ipaddr_copy(&entry->ip, next_addr); in arp_prepare()
303 (uint8_t *)net_if_get_link_addr(entry->iface)->addr; in arp_prepare()
305 arp_entry_register_pending(entry); in arp_prepare()
331 } else if (!entry) { in arp_prepare()
334 my_addr = if_get_addr(entry->iface, current_ip); in arp_prepare()
352 struct arp_entry *entry; in net_arp_prepare() local
400 entry = arp_entry_find_move_first(net_pkt_iface(pkt), addr); in net_arp_prepare()
401 if (!entry) { in net_arp_prepare()
404 entry = arp_entry_find_pending(net_pkt_iface(pkt), addr); in net_arp_prepare()
405 if (!entry) { in net_arp_prepare()
407 entry = arp_entry_get_free(); in net_arp_prepare()
408 if (!entry) { in net_arp_prepare()
410 entry = arp_entry_get_last_from_table(); in net_arp_prepare()
417 if (k_queue_unique_append(&entry->pending_queue._queue, in net_arp_prepare()
425 entry = NULL; in net_arp_prepare()
428 req = arp_prepare(net_pkt_iface(pkt), addr, entry, pkt, in net_arp_prepare()
431 if (!entry) { in net_arp_prepare()
439 if (!req && entry) { in net_arp_prepare()
443 sys_slist_prepend(&arp_free_entries, &entry->node); in net_arp_prepare()
453 (uint8_t *)net_if_get_link_addr(entry->iface)->addr; in net_arp_prepare()
456 net_pkt_lladdr_dst(pkt)->addr = (uint8_t *)&entry->eth; in net_arp_prepare()
472 struct arp_entry *entry; in arp_gratuitous() local
474 entry = arp_entry_find(&arp_table, iface, src, &prev); in arp_gratuitous()
475 if (entry) { in arp_gratuitous()
477 net_sprint_ll_addr((const uint8_t *)&entry->eth, in arp_gratuitous()
482 memcpy(&entry->eth, hwaddr, sizeof(struct net_eth_addr)); in arp_gratuitous()
627 struct arp_entry *entry; in net_arp_update() local
635 entry = arp_entry_get_pending(iface, src); in net_arp_update()
636 if (!entry) { in net_arp_update()
674 memcpy(&entry->eth, hwaddr, sizeof(struct net_eth_addr)); in net_arp_update()
677 sys_slist_prepend(&arp_table, &entry->node); in net_arp_update()
679 while (!k_fifo_is_empty(&entry->pending_queue)) { in net_arp_update()
682 pkt = k_fifo_get(&entry->pending_queue, K_FOREVER); in net_arp_update()
691 net_sprint_ipv4_addr(&entry->ip), in net_arp_update()
898 struct arp_entry *entry, *next; in net_arp_clear_cache() local
904 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&arp_table, entry, next, node) { in net_arp_clear_cache()
905 if (iface && iface != entry->iface) { in net_arp_clear_cache()
906 prev = &entry->node; in net_arp_clear_cache()
910 arp_entry_cleanup(entry, false); in net_arp_clear_cache()
912 sys_slist_remove(&arp_table, prev, &entry->node); in net_arp_clear_cache()
913 sys_slist_prepend(&arp_free_entries, &entry->node); in net_arp_clear_cache()
921 entry, next, node) { in net_arp_clear_cache()
922 if (iface && iface != entry->iface) { in net_arp_clear_cache()
923 prev = &entry->node; in net_arp_clear_cache()
927 arp_entry_cleanup(entry, true); in net_arp_clear_cache()
929 sys_slist_remove(&arp_pending_entries, prev, &entry->node); in net_arp_clear_cache()
930 sys_slist_prepend(&arp_free_entries, &entry->node); in net_arp_clear_cache()
942 struct arp_entry *entry = arp_entry_find_pending(iface, dst); in net_arp_clear_pending() local
944 if (!entry) { in net_arp_clear_pending()
948 arp_entry_cleanup(entry, true); in net_arp_clear_pending()
956 struct arp_entry *entry; in net_arp_foreach() local
960 SYS_SLIST_FOR_EACH_CONTAINER(&arp_table, entry, node) { in net_arp_foreach()
962 cb(entry, user_data); in net_arp_foreach()