Lines Matching refs:hash_entry
395 struct soflow_hash_entry *hash_entry = NULL; in soflow_db_init() local
405 db->soflow_db_debug = SOFLOW_ENABLE_DEBUG(so, hash_entry); in soflow_db_init()
413 soflow_entry_free(struct soflow_hash_entry *hash_entry) in soflow_entry_free() argument
415 …struct socket *so = (hash_entry && hash_entry->soflow_db) ? hash_entry->soflow_db->soflow_db_so : … in soflow_entry_free()
417 if (hash_entry == NULL) { in soflow_entry_free()
421 SOFLOW_ENTRY_LOG(LOG_INFO, so, hash_entry, hash_entry->soflow_debug, "Free entry"); in soflow_entry_free()
422 kfree_type(struct soflow_hash_entry, hash_entry); in soflow_entry_free()
426 soflow_db_remove_entry(struct soflow_db *db, struct soflow_hash_entry *hash_entry) in soflow_db_remove_entry() argument
428 if (hash_entry == NULL) { in soflow_db_remove_entry()
436 if (hash_entry->soflow_nstat_context != NULL) { in soflow_db_remove_entry()
437 …OW_LOG(LOG_INFO, db->soflow_db_so, hash_entry->soflow_debug, "<Close nstat> - context %lX", (unsig… in soflow_db_remove_entry()
438 nstat_provider_stats_close(hash_entry->soflow_nstat_context); in soflow_db_remove_entry()
439 hash_entry->soflow_nstat_context = NULL; in soflow_db_remove_entry()
440 SOFLOW_ENTRY_FREE(hash_entry); in soflow_db_remove_entry()
445 if (db->soflow_db_only_entry == hash_entry) { in soflow_db_remove_entry()
448 LIST_REMOVE(hash_entry, soflow_entry_link); in soflow_db_remove_entry()
451 if (hash_entry->soflow_feat_ctxt != NULL && soflow_feat_detach_entry_func_ptr != NULL) { in soflow_db_remove_entry()
452 soflow_feat_detach_entry_func_ptr(db->soflow_db_so, hash_entry); in soflow_db_remove_entry()
453 hash_entry->soflow_feat_ctxt = NULL; in soflow_db_remove_entry()
454 hash_entry->soflow_feat_ctxt_id = 0; in soflow_db_remove_entry()
457 hash_entry->soflow_db = NULL; in soflow_db_remove_entry()
461 TAILQ_REMOVE(&soflow_entry_head, hash_entry, soflow_entry_list_link); in soflow_db_remove_entry()
466 SOFLOW_ENTRY_FREE(hash_entry); in soflow_db_remove_entry()
646 struct soflow_hash_entry *hash_entry = NULL; in soflow_db_get_feature_context() local
675 hash_entry = soflow_db_lookup_by_feature_context_id(db, feature_context_id); in soflow_db_get_feature_context()
676 context = hash_entry != NULL ? hash_entry->soflow_feat_ctxt : NULL; in soflow_db_get_feature_context()
686 struct soflow_hash_entry *hash_entry = NULL; in soflow_db_get_feature_context_id() local
701 hash_entry = soflow_db_lookup_entry(db, local, remote, false); in soflow_db_get_feature_context_id()
702 if (hash_entry == NULL) { in soflow_db_get_feature_context_id()
704 hash_entry = soflow_db_lookup_entry(db, local, remote, true); in soflow_db_get_feature_context_id()
706 if (hash_entry != NULL && hash_entry->soflow_feat_ctxt != NULL) { in soflow_db_get_feature_context_id()
707 context_id = hash_entry->soflow_feat_ctxt_id; in soflow_db_get_feature_context_id()
939 struct soflow_hash_entry *hash_entry = (struct soflow_hash_entry *) ctx; in soflow_nstat_provider_request_vals() local
940 …struct socket *so = (hash_entry && hash_entry->soflow_db) ? hash_entry->soflow_db->soflow_db_so : … in soflow_nstat_provider_request_vals()
946 if (hash_entry == NULL || so == NULL || inp == NULL) { in soflow_nstat_provider_request_vals()
951 if (hash_entry->soflow_outifindex) { in soflow_nstat_provider_request_vals()
952 struct ifnet *ifp = ifindex2ifnet[hash_entry->soflow_outifindex]; in soflow_nstat_provider_request_vals()
956 SOFLOW_LOG(LOG_DEBUG, so, hash_entry->soflow_debug, "ifflagsp set to 0x%X", *ifflagsp); in soflow_nstat_provider_request_vals()
963 countsp->nstat_rxpackets = hash_entry->soflow_rxpackets; in soflow_nstat_provider_request_vals()
964 countsp->nstat_rxbytes = hash_entry->soflow_rxbytes; in soflow_nstat_provider_request_vals()
965 countsp->nstat_txpackets = hash_entry->soflow_txpackets; in soflow_nstat_provider_request_vals()
966 countsp->nstat_txbytes = hash_entry->soflow_txbytes; in soflow_nstat_provider_request_vals()
968 SOFLOW_LOG(LOG_DEBUG, so, hash_entry->soflow_debug, in soflow_nstat_provider_request_vals()
988 uuid_copy(desc->fuuid, hash_entry->soflow_uuid); in soflow_nstat_provider_request_vals()
990 if (hash_entry->soflow_family == AF_INET6) { in soflow_nstat_provider_request_vals()
991 …in6_ip6_to_sockaddr(&hash_entry->soflow_laddr.addr6, hash_entry->soflow_lport, hash_entry->soflow_… in soflow_nstat_provider_request_vals()
993 …in6_ip6_to_sockaddr(&hash_entry->soflow_faddr.addr6, hash_entry->soflow_fport, hash_entry->soflow_… in soflow_nstat_provider_request_vals()
995 } else if (hash_entry->soflow_family == AF_INET) { in soflow_nstat_provider_request_vals()
998 desc->local.v4.sin_port = hash_entry->soflow_lport; in soflow_nstat_provider_request_vals()
999 desc->local.v4.sin_addr = hash_entry->soflow_laddr.addr46.ia46_addr4; in soflow_nstat_provider_request_vals()
1003 desc->remote.v4.sin_port = hash_entry->soflow_fport; in soflow_nstat_provider_request_vals()
1004 desc->remote.v4.sin_addr = hash_entry->soflow_faddr.addr46.ia46_addr4; in soflow_nstat_provider_request_vals()
1007 desc->ifindex = hash_entry->soflow_outifindex; in soflow_nstat_provider_request_vals()
1008 if (hash_entry->soflow_outifindex) { in soflow_nstat_provider_request_vals()
1009 struct ifnet *ifp = ifindex2ifnet[hash_entry->soflow_outifindex]; in soflow_nstat_provider_request_vals()
1018 if (hash_entry->soflow_debug) { in soflow_nstat_provider_request_vals()
1019 switch (hash_entry->soflow_family) { in soflow_nstat_provider_request_vals()
1038 SOFLOW_LOG(LOG_DEBUG, so, hash_entry->soflow_debug, in soflow_nstat_provider_request_vals()
1060 struct soflow_hash_entry *hash_entry = (struct soflow_hash_entry *) ctx; in soflow_nstat_provider_request_extensions() local
1061 …struct socket *so = (hash_entry && hash_entry->soflow_db) ? hash_entry->soflow_db->soflow_db_so : … in soflow_nstat_provider_request_extensions()
1066 if (hash_entry == NULL || so == NULL || inp == NULL) { in soflow_nstat_provider_request_extensions()
1109 if (hash_entry->soflow_debug) { in soflow_nstat_provider_request_extensions()
1110 …SOFLOW_LOG(LOG_DEBUG, so, hash_entry->soflow_debug, "Collected NSTAT domain_info:pid %d domain <%s… in soflow_nstat_provider_request_extensions()
1132 soflow_update_flow_stats(struct soflow_hash_entry *hash_entry, size_t data_size, bool outgoing) in soflow_update_flow_stats() argument
1134 …struct socket *so = (hash_entry && hash_entry->soflow_db) ? hash_entry->soflow_db->soflow_db_so : … in soflow_update_flow_stats()
1136 if (hash_entry != NULL) { in soflow_update_flow_stats()
1138 hash_entry->soflow_txbytes += data_size; in soflow_update_flow_stats()
1139 hash_entry->soflow_txpackets++; in soflow_update_flow_stats()
1140 SOFLOW_ENTRY_LOG(LOG_DEBUG, so, hash_entry, hash_entry->soflow_debug, "Stats update - Outgoing"); in soflow_update_flow_stats()
1142 hash_entry->soflow_rxbytes += data_size; in soflow_update_flow_stats()
1143 hash_entry->soflow_rxpackets++; in soflow_update_flow_stats()
1144 SOFLOW_ENTRY_LOG(LOG_DEBUG, so, hash_entry, hash_entry->soflow_debug, "Stats update - Incoming"); in soflow_update_flow_stats()
1153 struct soflow_hash_entry *hash_entry = NULL; in soflow_get_flow() local
1171 hash_entry = soflow_db_lookup_entry(so->so_flow_db, local, remote, false); in soflow_get_flow()
1172 if (hash_entry == NULL) { in soflow_get_flow()
1174 hash_entry = soflow_db_lookup_entry(so->so_flow_db, local, remote, true); in soflow_get_flow()
1176 if (hash_entry != NULL) { in soflow_get_flow()
1179 if (os_ref_retain_try(&hash_entry->soflow_ref_count) == false) { in soflow_get_flow()
1185 if (hash_entry->soflow_outifindex == 0 || in soflow_get_flow()
1186 …soflow_entry_local_address_needs_update(hash_entry) || soflow_entry_local_port_needs_update(so, ha… in soflow_get_flow()
1187 soflow_entry_update_local(so->so_flow_db, hash_entry, local, control, rcv_ifindex); in soflow_get_flow()
1189 hash_entry->soflow_lastused = net_uptime(); in soflow_get_flow()
1190 soflow_update_flow_stats(hash_entry, data_size, outgoing); in soflow_get_flow()
1193 return hash_entry; in soflow_get_flow()
1204 hash_entry = soflow_db_add_entry(so->so_flow_db, local, remote); in soflow_get_flow()
1205 if (hash_entry == NULL) { in soflow_get_flow()
1212 if (os_ref_retain_try(&hash_entry->soflow_ref_count) == false) { in soflow_get_flow()
1217 …hash_entry->soflow_outifindex = inp->inp_last_outifp ? inp->inp_last_outifp->if_index : rcv_ifinde… in soflow_get_flow()
1222 soflow_entry_update_local(so->so_flow_db, hash_entry, local, control, rcv_ifindex); in soflow_get_flow()
1224 hash_entry->soflow_outgoing = outgoing; in soflow_get_flow()
1225 soflow_update_flow_stats(hash_entry, data_size, outgoing); in soflow_get_flow()
1231 if (os_ref_retain_try(&hash_entry->soflow_ref_count) == false) { in soflow_get_flow()
1232 soflow_db_remove_entry(so->so_flow_db, hash_entry); in soflow_get_flow()
1235 uuid_generate_random(hash_entry->soflow_uuid); in soflow_get_flow()
1236 hash_entry->soflow_nstat_context = nstat_provider_stats_open((nstat_provider_context) hash_entry, in soflow_get_flow()
1240 …SOFLOW_LOG(LOG_INFO, so, hash_entry->soflow_debug, "<Open nstat> - context %lX", (unsigned long)ha… in soflow_get_flow()
1248 TAILQ_INSERT_TAIL(&soflow_entry_head, hash_entry, soflow_entry_list_link); in soflow_get_flow()
1255 SOFLOW_ENTRY_LOG(LOG_INFO, so, hash_entry, hash_entry->soflow_debug, "Added entry"); in soflow_get_flow()
1256 return hash_entry; in soflow_get_flow()
1363 soflow_gc_idle_timed_out(struct soflow_hash_entry *hash_entry, int timeout, u_int64_t current_time) in soflow_gc_idle_timed_out() argument
1365 …struct socket *so = (hash_entry && hash_entry->soflow_db) ? hash_entry->soflow_db->soflow_db_so : … in soflow_gc_idle_timed_out()
1367 if (hash_entry && (current_time - hash_entry->soflow_lastused >= (u_int64_t)timeout)) { in soflow_gc_idle_timed_out()
1368 SOFLOW_ENTRY_LOG(LOG_INFO, so, hash_entry, hash_entry->soflow_debug, "GC Idle Timeout detected"); in soflow_gc_idle_timed_out()
1427 struct soflow_hash_entry *hash_entry = NULL; in soflow_gc_expire() local
1444 TAILQ_FOREACH(hash_entry, &soflow_entry_head, soflow_entry_list_link) { in soflow_gc_expire()
1448 so = hash_entry->soflow_db ? hash_entry->soflow_db->soflow_db_so : NULL; in soflow_gc_expire()
1451 hash_entry->soflow_gc = soflow_gc_idle_timed_out(hash_entry, SOFLOW_GC_IDLE_TO, current_time); in soflow_gc_expire()
1452 …hash_entry->soflow_feat_gc = (soflow_feat_gc_needed_func_ptr != NULL && soflow_feat_gc_needed_func… in soflow_gc_expire()
1454 if (hash_entry->soflow_gc || hash_entry->soflow_feat_gc) { in soflow_gc_expire()