Lines Matching full:mask

100 	struct fl_flow_key mask;  member
115 struct fl_flow_mask *mask; member
144 static unsigned short int fl_mask_range(const struct fl_flow_mask *mask) in fl_mask_range() argument
146 return mask->range.end - mask->range.start; in fl_mask_range()
149 static void fl_mask_update_range(struct fl_flow_mask *mask) in fl_mask_update_range() argument
151 const u8 *bytes = (const u8 *) &mask->key; in fl_mask_update_range()
152 size_t size = sizeof(mask->key); in fl_mask_update_range()
168 mask->range.start = rounddown(first, sizeof(long)); in fl_mask_update_range()
169 mask->range.end = roundup(last + 1, sizeof(long)); in fl_mask_update_range()
173 const struct fl_flow_mask *mask) in fl_key_get_start() argument
175 return (u8 *) key + mask->range.start; in fl_key_get_start()
179 struct fl_flow_mask *mask) in fl_set_masked_key() argument
181 const long *lkey = fl_key_get_start(key, mask); in fl_set_masked_key()
182 const long *lmask = fl_key_get_start(&mask->key, mask); in fl_set_masked_key()
183 long *lmkey = fl_key_get_start(mkey, mask); in fl_set_masked_key()
186 for (i = 0; i < fl_mask_range(mask); i += sizeof(long)) in fl_set_masked_key()
191 struct fl_flow_mask *mask) in fl_mask_fits_tmplt() argument
193 const long *lmask = fl_key_get_start(&mask->key, mask); in fl_mask_fits_tmplt()
199 ltmplt = fl_key_get_start(&tmplt->mask, mask); in fl_mask_fits_tmplt()
200 for (i = 0; i < fl_mask_range(mask); i += sizeof(long)) { in fl_mask_fits_tmplt()
208 struct fl_flow_mask *mask) in fl_clear_masked_range() argument
210 memset(fl_key_get_start(key, mask), 0, fl_mask_range(mask)); in fl_clear_masked_range()
219 min_mask = ntohs(filter->mask->key.tp_range.tp_min.dst); in fl_range_port_dst_cmp()
220 max_mask = ntohs(filter->mask->key.tp_range.tp_max.dst); in fl_range_port_dst_cmp()
242 min_mask = ntohs(filter->mask->key.tp_range.tp_min.src); in fl_range_port_src_cmp()
243 max_mask = ntohs(filter->mask->key.tp_range.tp_max.src); in fl_range_port_src_cmp()
259 static struct cls_fl_filter *__fl_lookup(struct fl_flow_mask *mask, in __fl_lookup() argument
262 return rhashtable_lookup_fast(&mask->ht, fl_key_get_start(mkey, mask), in __fl_lookup()
263 mask->filter_ht_params); in __fl_lookup()
266 static struct cls_fl_filter *fl_lookup_range(struct fl_flow_mask *mask, in fl_lookup_range() argument
272 list_for_each_entry_rcu(filter, &mask->filters, list) { in fl_lookup_range()
279 f = __fl_lookup(mask, mkey); in fl_lookup_range()
287 struct cls_fl_filter *fl_mask_lookup(struct fl_flow_mask *mask, struct fl_flow_key *key) in fl_mask_lookup() argument
291 fl_set_masked_key(&mkey, key, mask); in fl_mask_lookup()
292 if ((mask->flags & TCA_FLOWER_MASK_FLAGS_RANGE)) in fl_mask_lookup()
293 return fl_lookup_range(mask, &mkey, key); in fl_mask_lookup()
295 return __fl_lookup(mask, &mkey); in fl_mask_lookup()
321 struct fl_flow_mask *mask; in fl_classify() local
324 list_for_each_entry_rcu(mask, &head->masks, list) { in fl_classify()
326 fl_clear_masked_range(&skb_key, mask); in fl_classify()
328 skb_flow_dissect_meta(skb, &mask->dissector, &skb_key); in fl_classify()
333 skb_flow_dissect_tunnel_info(skb, &mask->dissector, &skb_key); in fl_classify()
334 skb_flow_dissect_ct(skb, &mask->dissector, &skb_key, in fl_classify()
338 skb_flow_dissect_hash(skb, &mask->dissector, &skb_key); in fl_classify()
339 skb_flow_dissect(skb, &mask->dissector, &skb_key, in fl_classify()
342 f = fl_mask_lookup(mask, &skb_key); in fl_classify()
368 static void fl_mask_free(struct fl_flow_mask *mask, bool mask_init_done) in fl_mask_free() argument
372 WARN_ON(!list_empty(&mask->filters)); in fl_mask_free()
373 rhashtable_destroy(&mask->ht); in fl_mask_free()
375 kfree(mask); in fl_mask_free()
380 struct fl_flow_mask *mask = container_of(to_rcu_work(work), in fl_mask_free_work() local
383 fl_mask_free(mask, true); in fl_mask_free_work()
388 struct fl_flow_mask *mask = container_of(to_rcu_work(work), in fl_uninit_mask_free_work() local
391 fl_mask_free(mask, false); in fl_uninit_mask_free_work()
394 static bool fl_mask_put(struct cls_fl_head *head, struct fl_flow_mask *mask) in fl_mask_put() argument
396 if (!refcount_dec_and_test(&mask->refcnt)) in fl_mask_put()
399 rhashtable_remove_fast(&head->ht, &mask->ht_node, mask_ht_params); in fl_mask_put()
402 list_del_rcu(&mask->list); in fl_mask_put()
405 tcf_queue_work(&mask->rwork, fl_mask_free_work); in fl_mask_put()
468 cls_flower.rule->match.dissector = &f->mask->dissector; in fl_hw_replace_filter()
469 cls_flower.rule->match.mask = &f->mask->key; in fl_hw_replace_filter()
562 rhashtable_remove_fast(&f->mask->ht, &f->ht_node, in __fl_delete()
563 f->mask->filter_ht_params); in __fl_delete()
568 *last = fl_mask_put(head, f->mask); in __fl_delete()
592 struct fl_flow_mask *mask, *next_mask; in fl_destroy() local
596 list_for_each_entry_safe(mask, next_mask, &head->masks, list) { in fl_destroy()
597 list_for_each_entry_safe(f, next, &mask->filters, list) { in fl_destroy()
791 void *mask, int mask_type, int len) in fl_set_key_val() argument
797 memset(mask, 0xff, len); in fl_set_key_val()
799 nla_memcpy(mask, tb[mask_type], len); in fl_set_key_val()
803 struct fl_flow_key *mask, in fl_set_key_spi() argument
815 &mask->ipsec.spi, TCA_FLOWER_KEY_SPI_MASK, in fl_set_key_spi()
821 struct fl_flow_key *mask, in fl_set_key_port_range() argument
825 TCA_FLOWER_KEY_PORT_DST_MIN, &mask->tp_range.tp_min.dst, in fl_set_key_port_range()
828 TCA_FLOWER_KEY_PORT_DST_MAX, &mask->tp_range.tp_max.dst, in fl_set_key_port_range()
831 TCA_FLOWER_KEY_PORT_SRC_MIN, &mask->tp_range.tp_min.src, in fl_set_key_port_range()
834 TCA_FLOWER_KEY_PORT_SRC_MAX, &mask->tp_range.tp_max.src, in fl_set_key_port_range()
837 if (mask->tp_range.tp_min.dst != mask->tp_range.tp_max.dst) { in fl_set_key_port_range()
842 if (mask->tp_range.tp_min.src != mask->tp_range.tp_max.src) { in fl_set_key_port_range()
847 if (mask->tp_range.tp_min.dst && mask->tp_range.tp_max.dst && in fl_set_key_port_range()
855 if (mask->tp_range.tp_min.src && mask->tp_range.tp_max.src && in fl_set_key_port_range()
1099 struct fl_flow_key *mask) in fl_set_key_pppoe() argument
1122 mask->basic.n_proto = cpu_to_be16(~0); in fl_set_key_pppoe()
1125 mask->basic.n_proto = cpu_to_be16(~0); in fl_set_key_pppoe()
1128 mask->basic.n_proto = cpu_to_be16(~0); in fl_set_key_pppoe()
1131 mask->basic.n_proto = cpu_to_be16(~0); in fl_set_key_pppoe()
1135 mask->basic.n_proto = cpu_to_be16(0); in fl_set_key_pppoe()
1153 u32 key, mask; in fl_set_key_flags() local
1155 /* mask is mandatory for flags */ in fl_set_key_flags()
1157 NL_SET_ERR_MSG(extack, "Missing flags mask"); in fl_set_key_flags()
1162 mask = be32_to_cpu(nla_get_be32(tb[TCA_FLOWER_KEY_FLAGS_MASK])); in fl_set_key_flags()
1167 fl_set_key_flag(key, mask, flags_key, flags_mask, in fl_set_key_flags()
1169 fl_set_key_flag(key, mask, flags_key, flags_mask, in fl_set_key_flags()
1178 struct flow_dissector_key_ip *mask) in fl_set_key_ip() argument
1185 fl_set_key_val(tb, &key->tos, tos_key, &mask->tos, tos_mask, sizeof(key->tos)); in fl_set_key_ip()
1186 fl_set_key_val(tb, &key->ttl, ttl_key, &mask->ttl, ttl_mask, sizeof(key->ttl)); in fl_set_key_ip()
1211 /* If no mask has been prodived we assume an exact match. */ in fl_set_geneve_opt()
1216 NL_SET_ERR_MSG(extack, "Non-geneve option type for mask"); in fl_set_geneve_opt()
1238 * for the mask. in fl_set_geneve_opt()
1292 NL_SET_ERR_MSG(extack, "Non-vxlan option type for mask"); in fl_set_vxlan_opt()
1329 NL_SET_ERR_MSG(extack, "Non-erspan option type for mask"); in fl_set_erspan_opt()
1396 NL_SET_ERR_MSG_MOD(extack, "Non-gtp option type for mask"); in fl_set_gtp_opt()
1424 struct fl_flow_key *mask, in fl_set_enc_opt() argument
1471 /* At the same time we need to parse through the mask in fl_set_enc_opt()
1472 * in order to verify exact and mask attribute lengths. in fl_set_enc_opt()
1474 mask->enc_opts.dst_opt_type = TUNNEL_GENEVE_OPT; in fl_set_enc_opt()
1475 option_len = fl_set_geneve_opt(nla_opt_msk, mask, in fl_set_enc_opt()
1481 mask->enc_opts.len += option_len; in fl_set_enc_opt()
1482 if (key->enc_opts.len != mask->enc_opts.len) { in fl_set_enc_opt()
1483 NL_SET_ERR_MSG(extack, "Key and mask miss aligned"); in fl_set_enc_opt()
1501 /* At the same time we need to parse through the mask in fl_set_enc_opt()
1502 * in order to verify exact and mask attribute lengths. in fl_set_enc_opt()
1504 mask->enc_opts.dst_opt_type = TUNNEL_VXLAN_OPT; in fl_set_enc_opt()
1505 option_len = fl_set_vxlan_opt(nla_opt_msk, mask, in fl_set_enc_opt()
1511 mask->enc_opts.len += option_len; in fl_set_enc_opt()
1512 if (key->enc_opts.len != mask->enc_opts.len) { in fl_set_enc_opt()
1513 NL_SET_ERR_MSG(extack, "Key and mask miss aligned"); in fl_set_enc_opt()
1531 /* At the same time we need to parse through the mask in fl_set_enc_opt()
1532 * in order to verify exact and mask attribute lengths. in fl_set_enc_opt()
1534 mask->enc_opts.dst_opt_type = TUNNEL_ERSPAN_OPT; in fl_set_enc_opt()
1535 option_len = fl_set_erspan_opt(nla_opt_msk, mask, in fl_set_enc_opt()
1541 mask->enc_opts.len += option_len; in fl_set_enc_opt()
1542 if (key->enc_opts.len != mask->enc_opts.len) { in fl_set_enc_opt()
1543 NL_SET_ERR_MSG(extack, "Key and mask miss aligned"); in fl_set_enc_opt()
1562 /* At the same time we need to parse through the mask in fl_set_enc_opt()
1563 * in order to verify exact and mask attribute lengths. in fl_set_enc_opt()
1565 mask->enc_opts.dst_opt_type = TUNNEL_GTP_OPT; in fl_set_enc_opt()
1566 option_len = fl_set_gtp_opt(nla_opt_msk, mask, in fl_set_enc_opt()
1572 mask->enc_opts.len += option_len; in fl_set_enc_opt()
1573 if (key->enc_opts.len != mask->enc_opts.len) { in fl_set_enc_opt()
1575 "Key and mask miss aligned"); in fl_set_enc_opt()
1588 NL_SET_ERR_MSG(extack, "A mask attribute is invalid"); in fl_set_enc_opt()
1633 struct flow_dissector_key_ct *mask, in fl_set_key_ct() argument
1644 &mask->ct_state, TCA_FLOWER_KEY_CT_STATE_MASK, in fl_set_key_ct()
1647 err = fl_validate_ct_state(key->ct_state & mask->ct_state, in fl_set_key_ct()
1660 &mask->ct_zone, TCA_FLOWER_KEY_CT_ZONE_MASK, in fl_set_key_ct()
1669 &mask->ct_mark, TCA_FLOWER_KEY_CT_MARK_MASK, in fl_set_key_ct()
1678 mask->ct_labels, TCA_FLOWER_KEY_CT_LABELS_MASK, in fl_set_key_ct()
1686 struct fl_flow_key *key, struct fl_flow_key *mask, in is_vlan_key() argument
1701 mask->basic.n_proto = cpu_to_be16(~0); in is_vlan_key()
1707 struct fl_flow_key *mask, in fl_set_key_cfm_md_level() argument
1717 mask->cfm.mdl_ver = FLOW_DIS_CFM_MDL_MASK; in fl_set_key_cfm_md_level()
1722 struct fl_flow_key *mask, in fl_set_key_cfm_opcode() argument
1726 &mask->cfm.opcode, TCA_FLOWER_UNSPEC, in fl_set_key_cfm_opcode()
1732 struct fl_flow_key *mask, in fl_set_key_cfm() argument
1746 fl_set_key_cfm_opcode(nla_cfm_opt, key, mask, extack); in fl_set_key_cfm()
1747 fl_set_key_cfm_md_level(nla_cfm_opt, key, mask, extack); in fl_set_key_cfm()
1753 struct fl_flow_key *key, struct fl_flow_key *mask, in fl_set_key() argument
1764 mask->meta.ingress_ifindex = 0xffffffff; in fl_set_key()
1768 &mask->meta.l2_miss, TCA_FLOWER_UNSPEC, in fl_set_key()
1772 mask->eth.dst, TCA_FLOWER_KEY_ETH_DST_MASK, in fl_set_key()
1775 mask->eth.src, TCA_FLOWER_KEY_ETH_SRC_MASK, in fl_set_key()
1779 &mask->num_of_vlans, in fl_set_key()
1783 if (is_vlan_key(tb[TCA_FLOWER_KEY_ETH_TYPE], &ethertype, key, mask, 0)) { in fl_set_key()
1787 &key->vlan, &mask->vlan); in fl_set_key()
1790 &ethertype, key, mask, 1)) { in fl_set_key()
1795 &key->cvlan, &mask->cvlan); in fl_set_key()
1798 &mask->basic.n_proto, in fl_set_key()
1805 fl_set_key_pppoe(tb, &key->pppoe, &mask->pppoe, key, mask); in fl_set_key()
1810 &mask->basic.ip_proto, TCA_FLOWER_UNSPEC, in fl_set_key()
1812 fl_set_key_ip(tb, false, &key->ip, &mask->ip); in fl_set_key()
1817 mask->control.addr_type = ~0; in fl_set_key()
1819 &mask->ipv4.src, TCA_FLOWER_KEY_IPV4_SRC_MASK, in fl_set_key()
1822 &mask->ipv4.dst, TCA_FLOWER_KEY_IPV4_DST_MASK, in fl_set_key()
1826 mask->control.addr_type = ~0; in fl_set_key()
1828 &mask->ipv6.src, TCA_FLOWER_KEY_IPV6_SRC_MASK, in fl_set_key()
1831 &mask->ipv6.dst, TCA_FLOWER_KEY_IPV6_DST_MASK, in fl_set_key()
1837 &mask->tp.src, TCA_FLOWER_KEY_TCP_SRC_MASK, in fl_set_key()
1840 &mask->tp.dst, TCA_FLOWER_KEY_TCP_DST_MASK, in fl_set_key()
1843 &mask->tcp.flags, TCA_FLOWER_KEY_TCP_FLAGS_MASK, in fl_set_key()
1847 &mask->tp.src, TCA_FLOWER_KEY_UDP_SRC_MASK, in fl_set_key()
1850 &mask->tp.dst, TCA_FLOWER_KEY_UDP_DST_MASK, in fl_set_key()
1854 &mask->tp.src, TCA_FLOWER_KEY_SCTP_SRC_MASK, in fl_set_key()
1857 &mask->tp.dst, TCA_FLOWER_KEY_SCTP_DST_MASK, in fl_set_key()
1862 &mask->icmp.type, in fl_set_key()
1866 &mask->icmp.code, in fl_set_key()
1872 &mask->icmp.type, in fl_set_key()
1876 &mask->icmp.code, in fl_set_key()
1881 ret = fl_set_key_mpls(tb, &key->mpls, &mask->mpls, extack); in fl_set_key()
1887 &mask->arp.sip, TCA_FLOWER_KEY_ARP_SIP_MASK, in fl_set_key()
1890 &mask->arp.tip, TCA_FLOWER_KEY_ARP_TIP_MASK, in fl_set_key()
1893 &mask->arp.op, TCA_FLOWER_KEY_ARP_OP_MASK, in fl_set_key()
1896 mask->arp.sha, TCA_FLOWER_KEY_ARP_SHA_MASK, in fl_set_key()
1899 mask->arp.tha, TCA_FLOWER_KEY_ARP_THA_MASK, in fl_set_key()
1904 &mask->l2tpv3.session_id, TCA_FLOWER_UNSPEC, in fl_set_key()
1907 ret = fl_set_key_cfm(tb, key, mask, extack); in fl_set_key()
1915 ret = fl_set_key_port_range(tb, key, mask, extack); in fl_set_key()
1921 ret = fl_set_key_spi(tb, key, mask, extack); in fl_set_key()
1929 mask->enc_control.addr_type = ~0; in fl_set_key()
1932 &mask->enc_ipv4.src, in fl_set_key()
1937 &mask->enc_ipv4.dst, in fl_set_key()
1945 mask->enc_control.addr_type = ~0; in fl_set_key()
1948 &mask->enc_ipv6.src, in fl_set_key()
1953 &mask->enc_ipv6.dst, in fl_set_key()
1959 &mask->enc_key_id.keyid, TCA_FLOWER_UNSPEC, in fl_set_key()
1963 &mask->enc_tp.src, TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK, in fl_set_key()
1967 &mask->enc_tp.dst, TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK, in fl_set_key()
1970 fl_set_key_ip(tb, true, &key->enc_ip, &mask->enc_ip); in fl_set_key()
1973 &mask->hash.hash, TCA_FLOWER_KEY_HASH_MASK, in fl_set_key()
1977 ret = fl_set_enc_opt(tb, key, mask, extack); in fl_set_key()
1982 ret = fl_set_key_ct(tb, &key->ct, &mask->ct, extack); in fl_set_key()
1988 &mask->control.flags, extack); in fl_set_key()
2009 static int fl_init_mask_hashtable(struct fl_flow_mask *mask) in fl_init_mask_hashtable() argument
2011 mask->filter_ht_params = fl_ht_params; in fl_init_mask_hashtable()
2012 mask->filter_ht_params.key_len = fl_mask_range(mask); in fl_init_mask_hashtable()
2013 mask->filter_ht_params.key_offset += mask->range.start; in fl_init_mask_hashtable()
2015 return rhashtable_init(&mask->ht, &mask->filter_ht_params); in fl_init_mask_hashtable()
2021 #define FL_KEY_IS_MASKED(mask, member) \ argument
2022 memchr_inv(((char *)mask) + FL_KEY_MEMBER_OFFSET(member), \
2032 #define FL_KEY_SET_IF_MASKED(mask, keys, cnt, id, member) \ argument
2034 if (FL_KEY_IS_MASKED(mask, member)) \
2039 struct fl_flow_key *mask) in fl_init_dissector() argument
2044 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2048 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2050 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2052 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2054 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2056 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2058 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2060 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2062 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2064 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2066 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2068 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2070 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2072 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2074 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2076 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2078 if (FL_KEY_IS_MASKED(mask, enc_ipv4) || in fl_init_dissector()
2079 FL_KEY_IS_MASKED(mask, enc_ipv6)) in fl_init_dissector()
2082 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2084 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2086 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2088 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2090 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2092 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2094 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2096 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2098 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2100 FL_KEY_SET_IF_MASKED(mask, keys, cnt, in fl_init_dissector()
2107 struct fl_flow_mask *mask) in fl_create_new_mask() argument
2116 fl_mask_copy(newmask, mask); in fl_create_new_mask()
2133 err = rhashtable_replace_fast(&head->ht, &mask->ht_node, in fl_create_new_mask()
2155 struct fl_flow_mask *mask) in fl_check_assign_mask() argument
2162 /* Insert mask as temporary node to prevent concurrent creation of mask in fl_check_assign_mask()
2164 * -EAGAIN because mask's refcnt is zero. in fl_check_assign_mask()
2166 fnew->mask = rhashtable_lookup_get_insert_fast(&head->ht, in fl_check_assign_mask()
2167 &mask->ht_node, in fl_check_assign_mask()
2169 if (!fnew->mask) { in fl_check_assign_mask()
2177 newmask = fl_create_new_mask(head, mask); in fl_check_assign_mask()
2183 fnew->mask = newmask; in fl_check_assign_mask()
2185 } else if (IS_ERR(fnew->mask)) { in fl_check_assign_mask()
2186 ret = PTR_ERR(fnew->mask); in fl_check_assign_mask()
2187 } else if (fold && fold->mask != fnew->mask) { in fl_check_assign_mask()
2189 } else if (!refcount_inc_not_zero(&fnew->mask->refcnt)) { in fl_check_assign_mask()
2190 /* Mask was deleted concurrently, try again */ in fl_check_assign_mask()
2197 rhashtable_remove_fast(&head->ht, &mask->ht_node, in fl_check_assign_mask()
2202 static bool fl_needs_tc_skb_ext(const struct fl_flow_key *mask) in fl_needs_tc_skb_ext() argument
2204 return mask->meta.l2_miss; in fl_needs_tc_skb_ext()
2211 struct fl_flow_mask *mask = fnew->mask; in fl_ht_insert_unique() local
2214 err = rhashtable_lookup_insert_fast(&mask->ht, in fl_ht_insert_unique()
2216 mask->filter_ht_params); in fl_ht_insert_unique()
2240 struct fl_flow_mask *mask; in fl_change() local
2250 mask = kzalloc(sizeof(struct fl_flow_mask), GFP_KERNEL); in fl_change()
2251 if (!mask) { in fl_change()
2339 err = fl_set_key(net, tb, &fnew->key, &mask->key, extack); in fl_change()
2343 fl_mask_update_range(mask); in fl_change()
2344 fl_set_masked_key(&fnew->mkey, &fnew->key, mask); in fl_change()
2346 if (!fl_mask_fits_tmplt(tp->chain->tmplt_priv, mask)) { in fl_change()
2347 NL_SET_ERR_MSG_MOD(extack, "Mask does not fit the template"); in fl_change()
2355 if (fl_needs_tc_skb_ext(&mask->key)) { in fl_change()
2360 err = fl_check_assign_mask(head, fnew, fold, mask); in fl_change()
2398 fnew->mask->filter_ht_params; in fl_change()
2400 err = rhashtable_insert_fast(&fnew->mask->ht, in fl_change()
2409 rhashtable_remove_fast(&fold->mask->ht, in fl_change()
2411 fold->mask->filter_ht_params); in fl_change()
2418 fl_mask_put(head, fold->mask); in fl_change()
2431 list_add_tail_rcu(&fnew->list, &fnew->mask->filters); in fl_change()
2438 tcf_queue_work(&mask->rwork, fl_uninit_mask_free_work); in fl_change()
2449 rhashtable_remove_fast(&fnew->mask->ht, &fnew->ht_node, in fl_change()
2450 fnew->mask->filter_ht_params); in fl_change()
2452 fl_mask_put(head, fnew->mask); in fl_change()
2473 tcf_queue_work(&mask->rwork, fl_uninit_mask_free_work); in fl_change()
2577 cls_flower.rule->match.dissector = &f->mask->dissector; in fl_reoffload()
2578 cls_flower.rule->match.mask = &f->mask->key; in fl_reoffload()
2650 cls_flower.rule->match.mask = &tmplt->mask; in fl_hw_create_tmplt()
2700 err = fl_set_key(net, tb, &tmplt->dummy_key, &tmplt->mask, extack); in fl_tmplt_create()
2704 fl_init_dissector(&tmplt->dissector, &tmplt->mask); in fl_tmplt_create()
2743 cls_flower.rule->match.mask = &tmplt->mask; in fl_tmplt_reoffload()
2752 void *mask, int mask_type, int len) in fl_dump_key_val() argument
2756 if (!memchr_inv(mask, 0, len)) in fl_dump_key_val()
2762 err = nla_put(skb, mask_type, len, mask); in fl_dump_key_val()
2770 struct fl_flow_key *mask) in fl_dump_key_port_range() argument
2774 &mask->tp_range.tp_min.dst, TCA_FLOWER_UNSPEC, in fl_dump_key_port_range()
2778 &mask->tp_range.tp_max.dst, TCA_FLOWER_UNSPEC, in fl_dump_key_port_range()
2782 &mask->tp_range.tp_min.src, TCA_FLOWER_UNSPEC, in fl_dump_key_port_range()
2786 &mask->tp_range.tp_max.src, TCA_FLOWER_UNSPEC, in fl_dump_key_port_range()
2927 struct flow_dissector_key_ip *mask) in fl_dump_key_ip() argument
2934 if (fl_dump_key_val(skb, &key->tos, tos_key, &mask->tos, tos_mask, sizeof(key->tos)) || in fl_dump_key_ip()
2935 fl_dump_key_val(skb, &key->ttl, ttl_key, &mask->ttl, ttl_mask, sizeof(key->ttl))) in fl_dump_key_ip()
2978 u32 key, mask; in fl_dump_key_flags() local
2986 mask = 0; in fl_dump_key_flags()
2988 fl_get_key_flag(flags_key, flags_mask, &key, &mask, in fl_dump_key_flags()
2990 fl_get_key_flag(flags_key, flags_mask, &key, &mask, in fl_dump_key_flags()
2995 _mask = cpu_to_be32(mask); in fl_dump_key_flags()
3123 struct flow_dissector_key_ct *mask) in fl_dump_key_ct() argument
3127 &mask->ct_state, TCA_FLOWER_KEY_CT_STATE_MASK, in fl_dump_key_ct()
3133 &mask->ct_zone, TCA_FLOWER_KEY_CT_ZONE_MASK, in fl_dump_key_ct()
3139 &mask->ct_mark, TCA_FLOWER_KEY_CT_MARK_MASK, in fl_dump_key_ct()
3145 &mask->ct_labels, TCA_FLOWER_KEY_CT_LABELS_MASK, in fl_dump_key_ct()
3157 struct flow_dissector_key_cfm *mask) in fl_dump_key_cfm() argument
3163 if (!memchr_inv(mask, 0, sizeof(*mask))) in fl_dump_key_cfm()
3170 if (FIELD_GET(FLOW_DIS_CFM_MDL_MASK, mask->mdl_ver)) { in fl_dump_key_cfm()
3177 if (mask->opcode) { in fl_dump_key_cfm()
3251 struct fl_flow_key *key, struct fl_flow_key *mask) in fl_dump_key() argument
3253 if (mask->meta.ingress_ifindex) { in fl_dump_key()
3262 TCA_FLOWER_L2_MISS, &mask->meta.l2_miss, in fl_dump_key()
3267 mask->eth.dst, TCA_FLOWER_KEY_ETH_DST_MASK, in fl_dump_key()
3270 mask->eth.src, TCA_FLOWER_KEY_ETH_SRC_MASK, in fl_dump_key()
3273 &mask->basic.n_proto, TCA_FLOWER_UNSPEC, in fl_dump_key()
3277 if (mask->num_of_vlans.num_of_vlans) { in fl_dump_key()
3282 if (fl_dump_key_mpls(skb, &key->mpls, &mask->mpls)) in fl_dump_key()
3286 TCA_FLOWER_KEY_VLAN_PRIO, &key->vlan, &mask->vlan)) in fl_dump_key()
3291 &key->cvlan, &mask->cvlan) || in fl_dump_key()
3292 (mask->cvlan.vlan_tpid && in fl_dump_key()
3297 if (mask->basic.n_proto) { in fl_dump_key()
3298 if (mask->cvlan.vlan_eth_type) { in fl_dump_key()
3302 } else if (mask->vlan.vlan_eth_type) { in fl_dump_key()
3312 &mask->basic.ip_proto, TCA_FLOWER_UNSPEC, in fl_dump_key()
3314 fl_dump_key_ip(skb, false, &key->ip, &mask->ip))) in fl_dump_key()
3317 if (mask->pppoe.session_id) { in fl_dump_key()
3322 if (mask->basic.n_proto && mask->pppoe.ppp_proto) { in fl_dump_key()
3330 &mask->ipv4.src, TCA_FLOWER_KEY_IPV4_SRC_MASK, in fl_dump_key()
3333 &mask->ipv4.dst, TCA_FLOWER_KEY_IPV4_DST_MASK, in fl_dump_key()
3338 &mask->ipv6.src, TCA_FLOWER_KEY_IPV6_SRC_MASK, in fl_dump_key()
3341 &mask->ipv6.dst, TCA_FLOWER_KEY_IPV6_DST_MASK, in fl_dump_key()
3347 &mask->tp.src, TCA_FLOWER_KEY_TCP_SRC_MASK, in fl_dump_key()
3350 &mask->tp.dst, TCA_FLOWER_KEY_TCP_DST_MASK, in fl_dump_key()
3353 &mask->tcp.flags, TCA_FLOWER_KEY_TCP_FLAGS_MASK, in fl_dump_key()
3358 &mask->tp.src, TCA_FLOWER_KEY_UDP_SRC_MASK, in fl_dump_key()
3361 &mask->tp.dst, TCA_FLOWER_KEY_UDP_DST_MASK, in fl_dump_key()
3366 &mask->tp.src, TCA_FLOWER_KEY_SCTP_SRC_MASK, in fl_dump_key()
3369 &mask->tp.dst, TCA_FLOWER_KEY_SCTP_DST_MASK, in fl_dump_key()
3375 TCA_FLOWER_KEY_ICMPV4_TYPE, &mask->icmp.type, in fl_dump_key()
3379 TCA_FLOWER_KEY_ICMPV4_CODE, &mask->icmp.code, in fl_dump_key()
3386 TCA_FLOWER_KEY_ICMPV6_TYPE, &mask->icmp.type, in fl_dump_key()
3390 TCA_FLOWER_KEY_ICMPV6_CODE, &mask->icmp.code, in fl_dump_key()
3397 TCA_FLOWER_KEY_ARP_SIP, &mask->arp.sip, in fl_dump_key()
3401 TCA_FLOWER_KEY_ARP_TIP, &mask->arp.tip, in fl_dump_key()
3405 TCA_FLOWER_KEY_ARP_OP, &mask->arp.op, in fl_dump_key()
3409 mask->arp.sha, TCA_FLOWER_KEY_ARP_SHA_MASK, in fl_dump_key()
3412 mask->arp.tha, TCA_FLOWER_KEY_ARP_THA_MASK, in fl_dump_key()
3418 &mask->l2tpv3.session_id, in fl_dump_key()
3425 &mask->ipsec.spi, TCA_FLOWER_KEY_SPI_MASK, in fl_dump_key()
3432 fl_dump_key_port_range(skb, key, mask)) in fl_dump_key()
3437 TCA_FLOWER_KEY_ENC_IPV4_SRC, &mask->enc_ipv4.src, in fl_dump_key()
3441 TCA_FLOWER_KEY_ENC_IPV4_DST, &mask->enc_ipv4.dst, in fl_dump_key()
3447 TCA_FLOWER_KEY_ENC_IPV6_SRC, &mask->enc_ipv6.src, in fl_dump_key()
3452 &mask->enc_ipv6.dst, in fl_dump_key()
3458 &mask->enc_key_id, TCA_FLOWER_UNSPEC, in fl_dump_key()
3462 &mask->enc_tp.src, in fl_dump_key()
3467 &mask->enc_tp.dst, in fl_dump_key()
3470 fl_dump_key_ip(skb, true, &key->enc_ip, &mask->enc_ip) || in fl_dump_key()
3471 fl_dump_key_enc_opt(skb, &key->enc_opts, &mask->enc_opts)) in fl_dump_key()
3474 if (fl_dump_key_ct(skb, &key->ct, &mask->ct)) in fl_dump_key()
3477 if (fl_dump_key_flags(skb, key->control.flags, mask->control.flags)) in fl_dump_key()
3481 &mask->hash.hash, TCA_FLOWER_KEY_HASH_MASK, in fl_dump_key()
3485 if (fl_dump_key_cfm(skb, &key->cfm, &mask->cfm)) in fl_dump_key()
3499 struct fl_flow_key *key, *mask; in fl_dump() local
3518 mask = &f->mask->key; in fl_dump()
3521 if (fl_dump_key(skb, net, key, mask)) in fl_dump()
3597 struct fl_flow_key *key, *mask; in fl_tmplt_dump() local
3605 mask = &tmplt->mask; in fl_tmplt_dump()
3607 if (fl_dump_key(skb, net, key, mask)) in fl_tmplt_dump()