Lines Matching defs:ft

133 #define	FLOWSTAT_ADD(ft, name, v)	\
134 counter_u64_add((ft)->ft_stat[offsetof(struct flowtable_stat, name) / sizeof(uint64_t)], (v))
135 #define FLOWSTAT_INC(ft, name) FLOWSTAT_ADD(ft, name, 1)
412 flowtable_mask(struct flowtable *ft)
418 * ft lifetime, it is safe, otherwise...
423 return (*(bitstr_t **)zpcpu_get(ft->ft_masks));
427 flowtable_list(struct flowtable *ft, uint32_t hash)
431 return (zpcpu_get(ft->ft_table[hash % ft->ft_size]));
435 flow_stale(struct flowtable *ft, struct flentry *fle, int maxidle)
495 flowtable_insert(struct flowtable *ft, uint32_t hash, uint32_t *key,
533 if (ft == &V_ip4_ft) {
546 if (ft == &V_ip6_ft) {
577 if (ft == &V_ip4_ft)
581 if (ft == &V_ip6_ft)
600 FLOWSTAT_INC(ft, ft_fail_lle_invalid);
623 mask = flowtable_mask(ft);
624 flist = flowtable_list(ft, hash);
627 bit_set(mask, (hash % ft->ft_size));
637 KASSERT(iter->f_hash % ft->ft_size == hash % ft->ft_size,
651 FLOWSTAT_INC(ft, ft_collisions);
660 FLOWSTAT_INC(ft, ft_inserts);
704 flowtable_lookup_common(struct flowtable *ft, uint32_t *key, int keylen,
711 FLOWSTAT_INC(ft, ft_lookups);
716 flist = flowtable_list(ft, hash);
718 KASSERT(fle->f_hash % ft->ft_size == hash % ft->ft_size,
726 FLOWSTAT_INC(ft, ft_hits);
732 FLOWSTAT_INC(ft, ft_misses);
734 return (flowtable_insert(ft, hash, key, keylen, fibnum));
742 flowtable_alloc(struct flowtable *ft)
745 ft->ft_table = malloc(ft->ft_size * sizeof(struct flist),
747 for (int i = 0; i < ft->ft_size; i++)
748 ft->ft_table[i] = uma_zalloc(pcpu_zone_ptr, M_WAITOK | M_ZERO);
750 ft->ft_masks = uma_zalloc(pcpu_zone_ptr, M_WAITOK);
754 b = zpcpu_get_cpu(ft->ft_masks, i);
755 *b = bit_alloc(ft->ft_size);
757 ft->ft_tmpmask = bit_alloc(ft->ft_size);
762 flowtable_free_stale(struct flowtable *ft, struct rtentry *rt, int maxidle)
770 mask = flowtable_mask(ft);
771 tmpmask = ft->ft_tmpmask;
772 tmpsize = ft->ft_size;
773 memcpy(tmpmask, mask, ft->ft_size/8);
780 bit_ffs(tmpmask, ft->ft_size, &curbit);
782 if (curbit >= ft->ft_size || curbit < -1) {
789 FLOWSTAT_INC(ft, ft_free_checks);
792 flist = flowtable_list(ft, curbit);
805 if (!flow_stale(ft, fle, maxidle)) {
827 FLOWSTAT_INC(ft, ft_frees);
837 flowtable_clean_vnet(struct flowtable *ft, struct rtentry *rt, int maxidle)
848 flowtable_free_stale(ft, rt, maxidle);
861 struct flowtable *ft;
866 ft = &V_ip4_ft;
871 ft = &V_ip6_ft;
878 flowtable_clean_vnet(ft, rt, 0);
1039 flowtable_mask_pcpu(struct flowtable *ft, int cpuid)
1042 return (zpcpu_get_cpu(*ft->ft_masks, cpuid));
1046 flowtable_list_pcpu(struct flowtable *ft, uint32_t hash, int cpuid)
1049 return (zpcpu_get_cpu(&ft->ft_table[hash % ft->ft_size], cpuid));
1053 flow_show(struct flowtable *ft, struct flentry *fle)
1069 if (ft == &V_ip4_ft) {
1088 if (ft == &V_ip6_ft) {
1125 flowtable_show(struct flowtable *ft, int cpuid)
1132 mask = flowtable_mask_pcpu(ft, cpuid);
1133 tmpmask = ft->ft_tmpmask;
1134 memcpy(tmpmask, mask, ft->ft_size/8);
1139 bit_ffs(tmpmask, ft->ft_size, &curbit);
1144 if (curbit >= ft->ft_size || curbit < -1) {
1150 flist = flowtable_list_pcpu(ft, curbit, cpuid);
1153 flow_show(ft, fle);
1155 bit_ffs(tmpmask, ft->ft_size, &curbit);
1160 flowtable_show_vnet(struct flowtable *ft)
1166 flowtable_show(ft, i);