Lines Matching full:mask
96 struct fl_flow_key mask; member
111 struct fl_flow_mask *mask; member
139 static unsigned short int fl_mask_range(const struct fl_flow_mask *mask) in fl_mask_range() argument
141 return mask->range.end - mask->range.start; in fl_mask_range()
144 static void fl_mask_update_range(struct fl_flow_mask *mask) in fl_mask_update_range() argument
146 const u8 *bytes = (const u8 *) &mask->key; in fl_mask_update_range()
147 size_t size = sizeof(mask->key); in fl_mask_update_range()
163 mask->range.start = rounddown(first, sizeof(long)); in fl_mask_update_range()
164 mask->range.end = roundup(last + 1, sizeof(long)); in fl_mask_update_range()
168 const struct fl_flow_mask *mask) in fl_key_get_start() argument
170 return (u8 *) key + mask->range.start; in fl_key_get_start()
174 struct fl_flow_mask *mask) in fl_set_masked_key() argument
176 const long *lkey = fl_key_get_start(key, mask); in fl_set_masked_key()
177 const long *lmask = fl_key_get_start(&mask->key, mask); in fl_set_masked_key()
178 long *lmkey = fl_key_get_start(mkey, mask); in fl_set_masked_key()
181 for (i = 0; i < fl_mask_range(mask); i += sizeof(long)) in fl_set_masked_key()
186 struct fl_flow_mask *mask) in fl_mask_fits_tmplt() argument
188 const long *lmask = fl_key_get_start(&mask->key, mask); in fl_mask_fits_tmplt()
194 ltmplt = fl_key_get_start(&tmplt->mask, mask); in fl_mask_fits_tmplt()
195 for (i = 0; i < fl_mask_range(mask); i += sizeof(long)) { in fl_mask_fits_tmplt()
203 struct fl_flow_mask *mask) in fl_clear_masked_range() argument
205 memset(fl_key_get_start(key, mask), 0, fl_mask_range(mask)); in fl_clear_masked_range()
214 min_mask = ntohs(filter->mask->key.tp_range.tp_min.dst); in fl_range_port_dst_cmp()
215 max_mask = ntohs(filter->mask->key.tp_range.tp_max.dst); in fl_range_port_dst_cmp()
237 min_mask = ntohs(filter->mask->key.tp_range.tp_min.src); in fl_range_port_src_cmp()
238 max_mask = ntohs(filter->mask->key.tp_range.tp_max.src); in fl_range_port_src_cmp()
254 static struct cls_fl_filter *__fl_lookup(struct fl_flow_mask *mask, in __fl_lookup() argument
257 return rhashtable_lookup_fast(&mask->ht, fl_key_get_start(mkey, mask), in __fl_lookup()
258 mask->filter_ht_params); in __fl_lookup()
261 static struct cls_fl_filter *fl_lookup_range(struct fl_flow_mask *mask, in fl_lookup_range() argument
267 list_for_each_entry_rcu(filter, &mask->filters, list) { in fl_lookup_range()
274 f = __fl_lookup(mask, mkey); in fl_lookup_range()
282 struct cls_fl_filter *fl_mask_lookup(struct fl_flow_mask *mask, struct fl_flow_key *key) in fl_mask_lookup() argument
286 fl_set_masked_key(&mkey, key, mask); in fl_mask_lookup()
287 if ((mask->flags & TCA_FLOWER_MASK_FLAGS_RANGE)) in fl_mask_lookup()
288 return fl_lookup_range(mask, &mkey, key); in fl_mask_lookup()
290 return __fl_lookup(mask, &mkey); in fl_mask_lookup()
315 struct fl_flow_mask *mask; in fl_classify() local
318 list_for_each_entry_rcu(mask, &head->masks, list) { in fl_classify()
320 fl_clear_masked_range(&skb_key, mask); in fl_classify()
322 skb_flow_dissect_meta(skb, &mask->dissector, &skb_key); in fl_classify()
327 skb_flow_dissect_tunnel_info(skb, &mask->dissector, &skb_key); in fl_classify()
328 skb_flow_dissect_ct(skb, &mask->dissector, &skb_key, in fl_classify()
332 skb_flow_dissect_hash(skb, &mask->dissector, &skb_key); in fl_classify()
333 skb_flow_dissect(skb, &mask->dissector, &skb_key, in fl_classify()
336 f = fl_mask_lookup(mask, &skb_key); in fl_classify()
362 static void fl_mask_free(struct fl_flow_mask *mask, bool mask_init_done) in fl_mask_free() argument
366 WARN_ON(!list_empty(&mask->filters)); in fl_mask_free()
367 rhashtable_destroy(&mask->ht); in fl_mask_free()
369 kfree(mask); in fl_mask_free()
374 struct fl_flow_mask *mask = container_of(to_rcu_work(work), in fl_mask_free_work() local
377 fl_mask_free(mask, true); in fl_mask_free_work()
382 struct fl_flow_mask *mask = container_of(to_rcu_work(work), in fl_uninit_mask_free_work() local
385 fl_mask_free(mask, false); in fl_uninit_mask_free_work()
388 static bool fl_mask_put(struct cls_fl_head *head, struct fl_flow_mask *mask) in fl_mask_put() argument
390 if (!refcount_dec_and_test(&mask->refcnt)) in fl_mask_put()
393 rhashtable_remove_fast(&head->ht, &mask->ht_node, mask_ht_params); in fl_mask_put()
396 list_del_rcu(&mask->list); in fl_mask_put()
399 tcf_queue_work(&mask->rwork, fl_mask_free_work); in fl_mask_put()
460 cls_flower.rule->match.dissector = &f->mask->dissector; in fl_hw_replace_filter()
461 cls_flower.rule->match.mask = &f->mask->key; in fl_hw_replace_filter()
550 rhashtable_remove_fast(&f->mask->ht, &f->ht_node, in __fl_delete()
551 f->mask->filter_ht_params); in __fl_delete()
556 *last = fl_mask_put(head, f->mask); in __fl_delete()
580 struct fl_flow_mask *mask, *next_mask; in fl_destroy() local
584 list_for_each_entry_safe(mask, next_mask, &head->masks, list) { in fl_destroy()
585 list_for_each_entry_safe(f, next, &mask->filters, list) { in fl_destroy()
768 void *mask, int mask_type, int len) in fl_set_key_val() argument
774 memset(mask, 0xff, len); in fl_set_key_val()
776 nla_memcpy(mask, tb[mask_type], len); in fl_set_key_val()
780 struct fl_flow_key *mask, in fl_set_key_port_range() argument
784 TCA_FLOWER_KEY_PORT_DST_MIN, &mask->tp_range.tp_min.dst, in fl_set_key_port_range()
787 TCA_FLOWER_KEY_PORT_DST_MAX, &mask->tp_range.tp_max.dst, in fl_set_key_port_range()
790 TCA_FLOWER_KEY_PORT_SRC_MIN, &mask->tp_range.tp_min.src, in fl_set_key_port_range()
793 TCA_FLOWER_KEY_PORT_SRC_MAX, &mask->tp_range.tp_max.src, in fl_set_key_port_range()
796 if (mask->tp_range.tp_min.dst && mask->tp_range.tp_max.dst && in fl_set_key_port_range()
804 if (mask->tp_range.tp_min.src && mask->tp_range.tp_max.src && in fl_set_key_port_range()
1048 struct fl_flow_key *mask) in fl_set_key_pppoe() argument
1071 mask->basic.n_proto = cpu_to_be16(~0); in fl_set_key_pppoe()
1074 mask->basic.n_proto = cpu_to_be16(~0); in fl_set_key_pppoe()
1077 mask->basic.n_proto = cpu_to_be16(~0); in fl_set_key_pppoe()
1080 mask->basic.n_proto = cpu_to_be16(~0); in fl_set_key_pppoe()
1084 mask->basic.n_proto = cpu_to_be16(0); in fl_set_key_pppoe()
1102 u32 key, mask; in fl_set_key_flags() local
1104 /* mask is mandatory for flags */ in fl_set_key_flags()
1106 NL_SET_ERR_MSG(extack, "Missing flags mask"); in fl_set_key_flags()
1111 mask = be32_to_cpu(nla_get_be32(tb[TCA_FLOWER_KEY_FLAGS_MASK])); in fl_set_key_flags()
1116 fl_set_key_flag(key, mask, flags_key, flags_mask, in fl_set_key_flags()
1118 fl_set_key_flag(key, mask, flags_key, flags_mask, in fl_set_key_flags()
1127 struct flow_dissector_key_ip *mask) in fl_set_key_ip() argument
1134 fl_set_key_val(tb, &key->tos, tos_key, &mask->tos, tos_mask, sizeof(key->tos)); in fl_set_key_ip()
1135 fl_set_key_val(tb, &key->ttl, ttl_key, &mask->ttl, ttl_mask, sizeof(key->ttl)); in fl_set_key_ip()
1157 /* If no mask has been prodived we assume an exact match. */ in fl_set_geneve_opt()
1162 NL_SET_ERR_MSG(extack, "Non-geneve option type for mask"); in fl_set_geneve_opt()
1184 * for the mask. in fl_set_geneve_opt()
1238 NL_SET_ERR_MSG(extack, "Non-vxlan option type for mask"); in fl_set_vxlan_opt()
1276 NL_SET_ERR_MSG(extack, "Non-erspan option type for mask"); in fl_set_erspan_opt()
1341 NL_SET_ERR_MSG_MOD(extack, "Non-gtp option type for mask"); in fl_set_gtp_opt()
1369 struct fl_flow_key *mask, in fl_set_enc_opt() argument
1416 /* At the same time we need to parse through the mask in fl_set_enc_opt()
1417 * in order to verify exact and mask attribute lengths. in fl_set_enc_opt()
1419 mask->enc_opts.dst_opt_type = TUNNEL_GENEVE_OPT; in fl_set_enc_opt()
1420 option_len = fl_set_geneve_opt(nla_opt_msk, mask, in fl_set_enc_opt()
1426 mask->enc_opts.len += option_len; in fl_set_enc_opt()
1427 if (key->enc_opts.len != mask->enc_opts.len) { in fl_set_enc_opt()
1428 NL_SET_ERR_MSG(extack, "Key and mask miss aligned"); in fl_set_enc_opt()
1446 /* At the same time we need to parse through the mask in fl_set_enc_opt()
1447 * in order to verify exact and mask attribute lengths. in fl_set_enc_opt()
1449 mask->enc_opts.dst_opt_type = TUNNEL_VXLAN_OPT; in fl_set_enc_opt()
1450 option_len = fl_set_vxlan_opt(nla_opt_msk, mask, in fl_set_enc_opt()
1456 mask->enc_opts.len += option_len; in fl_set_enc_opt()
1457 if (key->enc_opts.len != mask->enc_opts.len) { in fl_set_enc_opt()
1458 NL_SET_ERR_MSG(extack, "Key and mask miss aligned"); in fl_set_enc_opt()
1476 /* At the same time we need to parse through the mask in fl_set_enc_opt()
1477 * in order to verify exact and mask attribute lengths. in fl_set_enc_opt()
1479 mask->enc_opts.dst_opt_type = TUNNEL_ERSPAN_OPT; in fl_set_enc_opt()
1480 option_len = fl_set_erspan_opt(nla_opt_msk, mask, in fl_set_enc_opt()
1486 mask->enc_opts.len += option_len; in fl_set_enc_opt()
1487 if (key->enc_opts.len != mask->enc_opts.len) { in fl_set_enc_opt()
1488 NL_SET_ERR_MSG(extack, "Key and mask miss aligned"); in fl_set_enc_opt()
1507 /* At the same time we need to parse through the mask in fl_set_enc_opt()
1508 * in order to verify exact and mask attribute lengths. in fl_set_enc_opt()
1510 mask->enc_opts.dst_opt_type = TUNNEL_GTP_OPT; in fl_set_enc_opt()
1511 option_len = fl_set_gtp_opt(nla_opt_msk, mask, in fl_set_enc_opt()
1517 mask->enc_opts.len += option_len; in fl_set_enc_opt()
1518 if (key->enc_opts.len != mask->enc_opts.len) { in fl_set_enc_opt()
1520 "Key and mask miss aligned"); in fl_set_enc_opt()
1533 NL_SET_ERR_MSG(extack, "A mask attribute is invalid"); in fl_set_enc_opt()
1578 struct flow_dissector_key_ct *mask, in fl_set_key_ct() argument
1589 &mask->ct_state, TCA_FLOWER_KEY_CT_STATE_MASK, in fl_set_key_ct()
1592 err = fl_validate_ct_state(key->ct_state & mask->ct_state, in fl_set_key_ct()
1605 &mask->ct_zone, TCA_FLOWER_KEY_CT_ZONE_MASK, in fl_set_key_ct()
1614 &mask->ct_mark, TCA_FLOWER_KEY_CT_MARK_MASK, in fl_set_key_ct()
1623 mask->ct_labels, TCA_FLOWER_KEY_CT_LABELS_MASK, in fl_set_key_ct()
1631 struct fl_flow_key *key, struct fl_flow_key *mask, in is_vlan_key() argument
1646 mask->basic.n_proto = cpu_to_be16(~0); in is_vlan_key()
1651 struct fl_flow_key *key, struct fl_flow_key *mask, in fl_set_key() argument
1662 mask->meta.ingress_ifindex = 0xffffffff; in fl_set_key()
1666 mask->eth.dst, TCA_FLOWER_KEY_ETH_DST_MASK, in fl_set_key()
1669 mask->eth.src, TCA_FLOWER_KEY_ETH_SRC_MASK, in fl_set_key()
1673 &mask->num_of_vlans, in fl_set_key()
1677 if (is_vlan_key(tb[TCA_FLOWER_KEY_ETH_TYPE], ðertype, key, mask, 0)) { in fl_set_key()
1681 &key->vlan, &mask->vlan); in fl_set_key()
1684 ðertype, key, mask, 1)) { in fl_set_key()
1689 &key->cvlan, &mask->cvlan); in fl_set_key()
1692 &mask->basic.n_proto, in fl_set_key()
1699 fl_set_key_pppoe(tb, &key->pppoe, &mask->pppoe, key, mask); in fl_set_key()
1704 &mask->basic.ip_proto, TCA_FLOWER_UNSPEC, in fl_set_key()
1706 fl_set_key_ip(tb, false, &key->ip, &mask->ip); in fl_set_key()
1711 mask->control.addr_type = ~0; in fl_set_key()
1713 &mask->ipv4.src, TCA_FLOWER_KEY_IPV4_SRC_MASK, in fl_set_key()
1716 &mask->ipv4.dst, TCA_FLOWER_KEY_IPV4_DST_MASK, in fl_set_key()
1720 mask->control.addr_type = ~0; in fl_set_key()
1722 &mask->ipv6.src, TCA_FLOWER_KEY_IPV6_SRC_MASK, in fl_set_key()
1725 &mask->ipv6.dst, TCA_FLOWER_KEY_IPV6_DST_MASK, in fl_set_key()
1731 &mask->tp.src, TCA_FLOWER_KEY_TCP_SRC_MASK, in fl_set_key()
1734 &mask->tp.dst, TCA_FLOWER_KEY_TCP_DST_MASK, in fl_set_key()
1737 &mask->tcp.flags, TCA_FLOWER_KEY_TCP_FLAGS_MASK, in fl_set_key()
1741 &mask->tp.src, TCA_FLOWER_KEY_UDP_SRC_MASK, in fl_set_key()
1744 &mask->tp.dst, TCA_FLOWER_KEY_UDP_DST_MASK, in fl_set_key()
1748 &mask->tp.src, TCA_FLOWER_KEY_SCTP_SRC_MASK, in fl_set_key()
1751 &mask->tp.dst, TCA_FLOWER_KEY_SCTP_DST_MASK, in fl_set_key()
1756 &mask->icmp.type, in fl_set_key()
1760 &mask->icmp.code, in fl_set_key()
1766 &mask->icmp.type, in fl_set_key()
1770 &mask->icmp.code, in fl_set_key()
1775 ret = fl_set_key_mpls(tb, &key->mpls, &mask->mpls, extack); in fl_set_key()
1781 &mask->arp.sip, TCA_FLOWER_KEY_ARP_SIP_MASK, in fl_set_key()
1784 &mask->arp.tip, TCA_FLOWER_KEY_ARP_TIP_MASK, in fl_set_key()
1787 &mask->arp.op, TCA_FLOWER_KEY_ARP_OP_MASK, in fl_set_key()
1790 mask->arp.sha, TCA_FLOWER_KEY_ARP_SHA_MASK, in fl_set_key()
1793 mask->arp.tha, TCA_FLOWER_KEY_ARP_THA_MASK, in fl_set_key()
1798 &mask->l2tpv3.session_id, TCA_FLOWER_UNSPEC, in fl_set_key()
1805 ret = fl_set_key_port_range(tb, key, mask, extack); in fl_set_key()
1813 mask->enc_control.addr_type = ~0; in fl_set_key()
1816 &mask->enc_ipv4.src, in fl_set_key()
1821 &mask->enc_ipv4.dst, in fl_set_key()
1829 mask->enc_control.addr_type = ~0; in fl_set_key()
1832 &mask->enc_ipv6.src, in fl_set_key()
1837 &mask->enc_ipv6.dst, in fl_set_key()
1843 &mask->enc_key_id.keyid, TCA_FLOWER_UNSPEC, in fl_set_key()
1847 &mask->enc_tp.src, TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK, in fl_set_key()
1851 &mask->enc_tp.dst, TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK, in fl_set_key()
1854 fl_set_key_ip(tb, true, &key->enc_ip, &mask->enc_ip); in fl_set_key()
1857 &mask->hash.hash, TCA_FLOWER_KEY_HASH_MASK, in fl_set_key()
1861 ret = fl_set_enc_opt(tb, key, mask, extack); in fl_set_key()
1866 ret = fl_set_key_ct(tb, &key->ct, &mask->ct, extack); in fl_set_key()
1872 &mask->control.flags, extack); in fl_set_key()
1893 static int fl_init_mask_hashtable(struct fl_flow_mask *mask) in fl_init_mask_hashtable() argument
1895 mask->filter_ht_params = fl_ht_params; in fl_init_mask_hashtable()
1896 mask->filter_ht_params.key_len = fl_mask_range(mask); in fl_init_mask_hashtable()
1897 mask->filter_ht_params.key_offset += mask->range.start; in fl_init_mask_hashtable()
1899 return rhashtable_init(&mask->ht, &mask->filter_ht_params); in fl_init_mask_hashtable()
1905 #define FL_KEY_IS_MASKED(mask, member) \ argument
1906 memchr_inv(((char *)mask) + FL_KEY_MEMBER_OFFSET(member), \
1916 #define FL_KEY_SET_IF_MASKED(mask, keys, cnt, id, member) \ argument
1918 if (FL_KEY_IS_MASKED(mask, member)) \
1923 struct fl_flow_key *mask) in fl_init_dissector() argument
1928 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1932 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1934 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1936 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1938 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1940 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1942 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1944 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1946 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1948 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1950 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1952 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1954 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1956 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1958 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1960 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1962 if (FL_KEY_IS_MASKED(mask, enc_ipv4) || in fl_init_dissector()
1963 FL_KEY_IS_MASKED(mask, enc_ipv6)) in fl_init_dissector()
1966 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1968 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1970 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1972 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1974 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1976 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1978 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1980 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
1987 struct fl_flow_mask *mask) in fl_create_new_mask() argument
1996 fl_mask_copy(newmask, mask); in fl_create_new_mask()
2013 err = rhashtable_replace_fast(&head->ht, &mask->ht_node, in fl_create_new_mask()
2035 struct fl_flow_mask *mask) in fl_check_assign_mask() argument
2042 /* Insert mask as temporary node to prevent concurrent creation of mask in fl_check_assign_mask()
2044 * -EAGAIN because mask's refcnt is zero. in fl_check_assign_mask()
2046 fnew->mask = rhashtable_lookup_get_insert_fast(&head->ht, in fl_check_assign_mask()
2047 &mask->ht_node, in fl_check_assign_mask()
2049 if (!fnew->mask) { in fl_check_assign_mask()
2057 newmask = fl_create_new_mask(head, mask); in fl_check_assign_mask()
2063 fnew->mask = newmask; in fl_check_assign_mask()
2065 } else if (IS_ERR(fnew->mask)) { in fl_check_assign_mask()
2066 ret = PTR_ERR(fnew->mask); in fl_check_assign_mask()
2067 } else if (fold && fold->mask != fnew->mask) { in fl_check_assign_mask()
2069 } else if (!refcount_inc_not_zero(&fnew->mask->refcnt)) { in fl_check_assign_mask()
2070 /* Mask was deleted concurrently, try again */ in fl_check_assign_mask()
2077 rhashtable_remove_fast(&head->ht, &mask->ht_node, in fl_check_assign_mask()
2083 struct cls_fl_filter *f, struct fl_flow_mask *mask, in fl_set_parms() argument
2106 err = fl_set_key(net, tb, &f->key, &mask->key, extack); in fl_set_parms()
2110 fl_mask_update_range(mask); in fl_set_parms()
2111 fl_set_masked_key(&f->mkey, &f->key, mask); in fl_set_parms()
2113 if (!fl_mask_fits_tmplt(tmplt, mask)) { in fl_set_parms()
2114 NL_SET_ERR_MSG_MOD(extack, "Mask does not fit the template"); in fl_set_parms()
2125 struct fl_flow_mask *mask = fnew->mask; in fl_ht_insert_unique() local
2128 err = rhashtable_lookup_insert_fast(&mask->ht, in fl_ht_insert_unique()
2130 mask->filter_ht_params); in fl_ht_insert_unique()
2153 struct fl_flow_mask *mask; in fl_change() local
2163 mask = kzalloc(sizeof(struct fl_flow_mask), GFP_KERNEL); in fl_change()
2164 if (!mask) { in fl_change()
2206 err = fl_set_parms(net, tp, fnew, mask, base, tb, tca[TCA_RATE], in fl_change()
2212 err = fl_check_assign_mask(head, fnew, fold, mask); in fl_change()
2250 fnew->mask->filter_ht_params; in fl_change()
2252 err = rhashtable_insert_fast(&fnew->mask->ht, in fl_change()
2261 rhashtable_remove_fast(&fold->mask->ht, in fl_change()
2263 fold->mask->filter_ht_params); in fl_change()
2270 fl_mask_put(head, fold->mask); in fl_change()
2303 list_add_tail_rcu(&fnew->list, &fnew->mask->filters); in fl_change()
2310 tcf_queue_work(&mask->rwork, fl_uninit_mask_free_work); in fl_change()
2321 rhashtable_remove_fast(&fnew->mask->ht, &fnew->ht_node, in fl_change()
2322 fnew->mask->filter_ht_params); in fl_change()
2324 fl_mask_put(head, fnew->mask); in fl_change()
2330 tcf_queue_work(&mask->rwork, fl_uninit_mask_free_work); in fl_change()
2434 cls_flower.rule->match.dissector = &f->mask->dissector; in fl_reoffload()
2435 cls_flower.rule->match.mask = &f->mask->key; in fl_reoffload()
2507 cls_flower.rule->match.mask = &tmplt->mask; in fl_hw_create_tmplt()
2557 err = fl_set_key(net, tb, &tmplt->dummy_key, &tmplt->mask, extack); in fl_tmplt_create()
2561 fl_init_dissector(&tmplt->dissector, &tmplt->mask); in fl_tmplt_create()
2587 void *mask, int mask_type, int len) in fl_dump_key_val() argument
2591 if (!memchr_inv(mask, 0, len)) in fl_dump_key_val()
2597 err = nla_put(skb, mask_type, len, mask); in fl_dump_key_val()
2605 struct fl_flow_key *mask) in fl_dump_key_port_range() argument
2609 &mask->tp_range.tp_min.dst, TCA_FLOWER_UNSPEC, in fl_dump_key_port_range()
2613 &mask->tp_range.tp_max.dst, TCA_FLOWER_UNSPEC, in fl_dump_key_port_range()
2617 &mask->tp_range.tp_min.src, TCA_FLOWER_UNSPEC, in fl_dump_key_port_range()
2621 &mask->tp_range.tp_max.src, TCA_FLOWER_UNSPEC, in fl_dump_key_port_range()
2762 struct flow_dissector_key_ip *mask) in fl_dump_key_ip() argument
2769 if (fl_dump_key_val(skb, &key->tos, tos_key, &mask->tos, tos_mask, sizeof(key->tos)) || in fl_dump_key_ip()
2770 fl_dump_key_val(skb, &key->ttl, ttl_key, &mask->ttl, ttl_mask, sizeof(key->ttl))) in fl_dump_key_ip()
2813 u32 key, mask; in fl_dump_key_flags() local
2821 mask = 0; in fl_dump_key_flags()
2823 fl_get_key_flag(flags_key, flags_mask, &key, &mask, in fl_dump_key_flags()
2825 fl_get_key_flag(flags_key, flags_mask, &key, &mask, in fl_dump_key_flags()
2830 _mask = cpu_to_be32(mask); in fl_dump_key_flags()
2958 struct flow_dissector_key_ct *mask) in fl_dump_key_ct() argument
2962 &mask->ct_state, TCA_FLOWER_KEY_CT_STATE_MASK, in fl_dump_key_ct()
2968 &mask->ct_zone, TCA_FLOWER_KEY_CT_ZONE_MASK, in fl_dump_key_ct()
2974 &mask->ct_mark, TCA_FLOWER_KEY_CT_MARK_MASK, in fl_dump_key_ct()
2980 &mask->ct_labels, TCA_FLOWER_KEY_CT_LABELS_MASK, in fl_dump_key_ct()
3049 struct fl_flow_key *key, struct fl_flow_key *mask) in fl_dump_key() argument
3051 if (mask->meta.ingress_ifindex) { in fl_dump_key()
3060 mask->eth.dst, TCA_FLOWER_KEY_ETH_DST_MASK, in fl_dump_key()
3063 mask->eth.src, TCA_FLOWER_KEY_ETH_SRC_MASK, in fl_dump_key()
3066 &mask->basic.n_proto, TCA_FLOWER_UNSPEC, in fl_dump_key()
3070 if (mask->num_of_vlans.num_of_vlans) { in fl_dump_key()
3075 if (fl_dump_key_mpls(skb, &key->mpls, &mask->mpls)) in fl_dump_key()
3079 TCA_FLOWER_KEY_VLAN_PRIO, &key->vlan, &mask->vlan)) in fl_dump_key()
3084 &key->cvlan, &mask->cvlan) || in fl_dump_key()
3085 (mask->cvlan.vlan_tpid && in fl_dump_key()
3090 if (mask->basic.n_proto) { in fl_dump_key()
3091 if (mask->cvlan.vlan_eth_type) { in fl_dump_key()
3095 } else if (mask->vlan.vlan_eth_type) { in fl_dump_key()
3105 &mask->basic.ip_proto, TCA_FLOWER_UNSPEC, in fl_dump_key()
3107 fl_dump_key_ip(skb, false, &key->ip, &mask->ip))) in fl_dump_key()
3110 if (mask->pppoe.session_id) { in fl_dump_key()
3115 if (mask->basic.n_proto && mask->pppoe.ppp_proto) { in fl_dump_key()
3123 &mask->ipv4.src, TCA_FLOWER_KEY_IPV4_SRC_MASK, in fl_dump_key()
3126 &mask->ipv4.dst, TCA_FLOWER_KEY_IPV4_DST_MASK, in fl_dump_key()
3131 &mask->ipv6.src, TCA_FLOWER_KEY_IPV6_SRC_MASK, in fl_dump_key()
3134 &mask->ipv6.dst, TCA_FLOWER_KEY_IPV6_DST_MASK, in fl_dump_key()
3140 &mask->tp.src, TCA_FLOWER_KEY_TCP_SRC_MASK, in fl_dump_key()
3143 &mask->tp.dst, TCA_FLOWER_KEY_TCP_DST_MASK, in fl_dump_key()
3146 &mask->tcp.flags, TCA_FLOWER_KEY_TCP_FLAGS_MASK, in fl_dump_key()
3151 &mask->tp.src, TCA_FLOWER_KEY_UDP_SRC_MASK, in fl_dump_key()
3154 &mask->tp.dst, TCA_FLOWER_KEY_UDP_DST_MASK, in fl_dump_key()
3159 &mask->tp.src, TCA_FLOWER_KEY_SCTP_SRC_MASK, in fl_dump_key()
3162 &mask->tp.dst, TCA_FLOWER_KEY_SCTP_DST_MASK, in fl_dump_key()
3168 TCA_FLOWER_KEY_ICMPV4_TYPE, &mask->icmp.type, in fl_dump_key()
3172 TCA_FLOWER_KEY_ICMPV4_CODE, &mask->icmp.code, in fl_dump_key()
3179 TCA_FLOWER_KEY_ICMPV6_TYPE, &mask->icmp.type, in fl_dump_key()
3183 TCA_FLOWER_KEY_ICMPV6_CODE, &mask->icmp.code, in fl_dump_key()
3190 TCA_FLOWER_KEY_ARP_SIP, &mask->arp.sip, in fl_dump_key()
3194 TCA_FLOWER_KEY_ARP_TIP, &mask->arp.tip, in fl_dump_key()
3198 TCA_FLOWER_KEY_ARP_OP, &mask->arp.op, in fl_dump_key()
3202 mask->arp.sha, TCA_FLOWER_KEY_ARP_SHA_MASK, in fl_dump_key()
3205 mask->arp.tha, TCA_FLOWER_KEY_ARP_THA_MASK, in fl_dump_key()
3211 &mask->l2tpv3.session_id, in fl_dump_key()
3219 fl_dump_key_port_range(skb, key, mask)) in fl_dump_key()
3224 TCA_FLOWER_KEY_ENC_IPV4_SRC, &mask->enc_ipv4.src, in fl_dump_key()
3228 TCA_FLOWER_KEY_ENC_IPV4_DST, &mask->enc_ipv4.dst, in fl_dump_key()
3234 TCA_FLOWER_KEY_ENC_IPV6_SRC, &mask->enc_ipv6.src, in fl_dump_key()
3239 &mask->enc_ipv6.dst, in fl_dump_key()
3245 &mask->enc_key_id, TCA_FLOWER_UNSPEC, in fl_dump_key()
3249 &mask->enc_tp.src, in fl_dump_key()
3254 &mask->enc_tp.dst, in fl_dump_key()
3257 fl_dump_key_ip(skb, true, &key->enc_ip, &mask->enc_ip) || in fl_dump_key()
3258 fl_dump_key_enc_opt(skb, &key->enc_opts, &mask->enc_opts)) in fl_dump_key()
3261 if (fl_dump_key_ct(skb, &key->ct, &mask->ct)) in fl_dump_key()
3264 if (fl_dump_key_flags(skb, key->control.flags, mask->control.flags)) in fl_dump_key()
3268 &mask->hash.hash, TCA_FLOWER_KEY_HASH_MASK, in fl_dump_key()
3283 struct fl_flow_key *key, *mask; in fl_dump() local
3302 mask = &f->mask->key; in fl_dump()
3305 if (fl_dump_key(skb, net, key, mask)) in fl_dump()
3381 struct fl_flow_key *key, *mask; in fl_tmplt_dump() local
3389 mask = &tmplt->mask; in fl_tmplt_dump()
3391 if (fl_dump_key(skb, net, key, mask)) in fl_tmplt_dump()