Lines Matching refs:a
462 const struct nlattr *a[], in __parse_flow_nlattrs() argument
494 a[type] = nla; in __parse_flow_nlattrs()
507 const struct nlattr *a[], u64 *attrsp, in parse_flow_mask_nlattrs() argument
510 return __parse_flow_nlattrs(attr, a, attrsp, log, true); in parse_flow_mask_nlattrs()
513 int parse_flow_nlattrs(const struct nlattr *attr, const struct nlattr *a[], in parse_flow_nlattrs() argument
516 return __parse_flow_nlattrs(attr, a, attrsp, log, false); in parse_flow_nlattrs()
519 static int genev_tun_opt_from_nlattr(const struct nlattr *a, in genev_tun_opt_from_nlattr() argument
525 if (nla_len(a) > sizeof(match->key->tun_opts)) { in genev_tun_opt_from_nlattr()
527 nla_len(a), sizeof(match->key->tun_opts)); in genev_tun_opt_from_nlattr()
531 if (nla_len(a) % 4 != 0) { in genev_tun_opt_from_nlattr()
533 nla_len(a)); in genev_tun_opt_from_nlattr()
542 SW_FLOW_KEY_PUT(match, tun_opts_len, nla_len(a), in genev_tun_opt_from_nlattr()
555 if (match->key->tun_opts_len != nla_len(a)) { in genev_tun_opt_from_nlattr()
557 match->key->tun_opts_len, nla_len(a)); in genev_tun_opt_from_nlattr()
564 opt_key_offset = TUN_METADATA_OFFSET(nla_len(a)); in genev_tun_opt_from_nlattr()
565 SW_FLOW_KEY_MEMCPY_OFFSET(match, opt_key_offset, nla_data(a), in genev_tun_opt_from_nlattr()
566 nla_len(a), is_mask); in genev_tun_opt_from_nlattr()
574 struct nlattr *a; in vxlan_tun_opt_from_nlattr() local
582 nla_for_each_nested(a, attr, rem) { in vxlan_tun_opt_from_nlattr()
583 int type = nla_type(a); in vxlan_tun_opt_from_nlattr()
591 if (!check_attr_len(nla_len(a), in vxlan_tun_opt_from_nlattr()
594 type, nla_len(a), in vxlan_tun_opt_from_nlattr()
601 opts.gbp = nla_get_u32(a); in vxlan_tun_opt_from_nlattr()
626 static int erspan_tun_opt_from_nlattr(const struct nlattr *a, in erspan_tun_opt_from_nlattr() argument
635 if (nla_len(a) > sizeof(match->key->tun_opts)) { in erspan_tun_opt_from_nlattr()
637 nla_len(a), sizeof(match->key->tun_opts)); in erspan_tun_opt_from_nlattr()
647 opt_key_offset = TUN_METADATA_OFFSET(nla_len(a)); in erspan_tun_opt_from_nlattr()
648 SW_FLOW_KEY_MEMCPY_OFFSET(match, opt_key_offset, nla_data(a), in erspan_tun_opt_from_nlattr()
649 nla_len(a), is_mask); in erspan_tun_opt_from_nlattr()
661 struct nlattr *a; in ip_tun_from_nlattr() local
664 nla_for_each_nested(a, attr, rem) { in ip_tun_from_nlattr()
665 int type = nla_type(a); in ip_tun_from_nlattr()
674 if (!check_attr_len(nla_len(a), in ip_tun_from_nlattr()
677 type, nla_len(a), ovs_tunnel_key_lens[type].len); in ip_tun_from_nlattr()
684 nla_get_be64(a), is_mask); in ip_tun_from_nlattr()
689 nla_get_in_addr(a), is_mask); in ip_tun_from_nlattr()
694 nla_get_in_addr(a), is_mask); in ip_tun_from_nlattr()
699 nla_get_in6_addr(a), is_mask); in ip_tun_from_nlattr()
704 nla_get_in6_addr(a), is_mask); in ip_tun_from_nlattr()
709 nla_get_u8(a), is_mask); in ip_tun_from_nlattr()
713 nla_get_u8(a), is_mask); in ip_tun_from_nlattr()
724 nla_get_be16(a), is_mask); in ip_tun_from_nlattr()
728 nla_get_be16(a), is_mask); in ip_tun_from_nlattr()
739 err = genev_tun_opt_from_nlattr(a, match, is_mask, log); in ip_tun_from_nlattr()
752 err = vxlan_tun_opt_from_nlattr(a, match, is_mask, log); in ip_tun_from_nlattr()
767 err = erspan_tun_opt_from_nlattr(a, match, is_mask, in ip_tun_from_nlattr()
961 const struct nlattr *a[], in encode_vlan_from_nlattrs() argument
967 if (a[OVS_KEY_ATTR_VLAN]) in encode_vlan_from_nlattrs()
968 tci = nla_get_be16(a[OVS_KEY_ATTR_VLAN]); in encode_vlan_from_nlattrs()
970 if (a[OVS_KEY_ATTR_ETHERTYPE]) in encode_vlan_from_nlattrs()
971 tpid = nla_get_be16(a[OVS_KEY_ATTR_ETHERTYPE]); in encode_vlan_from_nlattrs()
985 const struct nlattr **a, bool log) in validate_vlan_from_nlattrs() argument
991 eth_type_vlan(nla_get_be16(a[OVS_KEY_ATTR_ETHERTYPE])))) { in validate_vlan_from_nlattrs()
1002 if (a[OVS_KEY_ATTR_VLAN]) in validate_vlan_from_nlattrs()
1003 tci = nla_get_be16(a[OVS_KEY_ATTR_VLAN]); in validate_vlan_from_nlattrs()
1010 } else if (nla_len(a[OVS_KEY_ATTR_ENCAP])) { in validate_vlan_from_nlattrs()
1023 const struct nlattr **a, bool log) in validate_vlan_mask_from_nlattrs() argument
1043 if (a[OVS_KEY_ATTR_VLAN]) in validate_vlan_mask_from_nlattrs()
1044 tci = nla_get_be16(a[OVS_KEY_ATTR_VLAN]); in validate_vlan_mask_from_nlattrs()
1046 if (a[OVS_KEY_ATTR_ETHERTYPE]) in validate_vlan_mask_from_nlattrs()
1047 tpid = nla_get_be16(a[OVS_KEY_ATTR_ETHERTYPE]); in validate_vlan_mask_from_nlattrs()
1065 const struct nlattr **a, bool is_mask, in __parse_vlan_from_nlattrs() argument
1073 a, log); in __parse_vlan_from_nlattrs()
1076 a, log); in __parse_vlan_from_nlattrs()
1080 err = encode_vlan_from_nlattrs(match, a, is_mask, inner); in __parse_vlan_from_nlattrs()
1088 encap = a[OVS_KEY_ATTR_ENCAP]; in __parse_vlan_from_nlattrs()
1091 err = parse_flow_nlattrs(encap, a, key_attrs, log); in __parse_vlan_from_nlattrs()
1093 err = parse_flow_mask_nlattrs(encap, a, key_attrs, log); in __parse_vlan_from_nlattrs()
1099 u64 *key_attrs, const struct nlattr **a, in parse_vlan_from_nlattrs() argument
1105 err = __parse_vlan_from_nlattrs(match, key_attrs, false, a, in parse_vlan_from_nlattrs()
1112 err = __parse_vlan_from_nlattrs(match, key_attrs, true, a, in parse_vlan_from_nlattrs()
1122 u64 *attrs, const struct nlattr **a, in parse_eth_type_from_nlattrs() argument
1127 eth_type = nla_get_be16(a[OVS_KEY_ATTR_ETHERTYPE]); in parse_eth_type_from_nlattrs()
1143 u64 *attrs, const struct nlattr **a, in metadata_from_nlattrs() argument
1149 u32 hash_val = nla_get_u32(a[OVS_KEY_ATTR_DP_HASH]); in metadata_from_nlattrs()
1156 u32 recirc_id = nla_get_u32(a[OVS_KEY_ATTR_RECIRC_ID]); in metadata_from_nlattrs()
1164 nla_get_u32(a[OVS_KEY_ATTR_PRIORITY]), is_mask); in metadata_from_nlattrs()
1169 u32 in_port = nla_get_u32(a[OVS_KEY_ATTR_IN_PORT]); in metadata_from_nlattrs()
1186 uint32_t mark = nla_get_u32(a[OVS_KEY_ATTR_SKB_MARK]); in metadata_from_nlattrs()
1192 if (ip_tun_from_nlattr(a[OVS_KEY_ATTR_TUNNEL], match, in metadata_from_nlattrs()
1200 u32 ct_state = nla_get_u32(a[OVS_KEY_ATTR_CT_STATE]); in metadata_from_nlattrs()
1213 u16 ct_zone = nla_get_u16(a[OVS_KEY_ATTR_CT_ZONE]); in metadata_from_nlattrs()
1220 u32 mark = nla_get_u32(a[OVS_KEY_ATTR_CT_MARK]); in metadata_from_nlattrs()
1229 cl = nla_data(a[OVS_KEY_ATTR_CT_LABELS]); in metadata_from_nlattrs()
1237 ct = nla_data(a[OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV4]); in metadata_from_nlattrs()
1249 ct = nla_data(a[OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV6]); in metadata_from_nlattrs()
1274 return parse_eth_type_from_nlattrs(match, attrs, a, is_mask, in metadata_from_nlattrs()
1283 struct nlattr *a; in nsh_hdr_from_nlattr() local
1294 nla_for_each_nested(a, attr, rem) { in nsh_hdr_from_nlattr()
1295 int type = nla_type(a); in nsh_hdr_from_nlattr()
1299 const struct ovs_nsh_key_base *base = nla_data(a); in nsh_hdr_from_nlattr()
1309 mdlen = nla_len(a); in nsh_hdr_from_nlattr()
1312 memcpy(&nh->md1, nla_data(a), mdlen); in nsh_hdr_from_nlattr()
1316 mdlen = nla_len(a); in nsh_hdr_from_nlattr()
1319 memcpy(&nh->md2, nla_data(a), mdlen); in nsh_hdr_from_nlattr()
1337 struct nlattr *a; in nsh_key_from_nlattr() local
1342 nla_for_each_nested(a, attr, rem) { in nsh_key_from_nlattr()
1343 int type = nla_type(a); in nsh_key_from_nlattr()
1347 const struct ovs_nsh_key_base *base = nla_data(a); in nsh_key_from_nlattr()
1355 const struct ovs_nsh_key_md1 *md1 = nla_data(a); in nsh_key_from_nlattr()
1378 struct nlattr *a; in nsh_key_put_from_nlattr() local
1389 nla_for_each_nested(a, attr, rem) { in nsh_key_put_from_nlattr()
1390 int type = nla_type(a); in nsh_key_put_from_nlattr()
1399 if (!check_attr_len(nla_len(a), in nsh_key_put_from_nlattr()
1405 nla_len(a), in nsh_key_put_from_nlattr()
1413 const struct ovs_nsh_key_base *base = nla_data(a); in nsh_key_put_from_nlattr()
1430 const struct ovs_nsh_key_md1 *md1 = nla_data(a); in nsh_key_put_from_nlattr()
1443 mdlen = nla_len(a); in nsh_key_put_from_nlattr()
1496 u64 attrs, const struct nlattr **a, in ovs_key_from_nlattrs() argument
1501 err = metadata_from_nlattrs(net, match, &attrs, a, is_mask, log); in ovs_key_from_nlattrs()
1508 eth_key = nla_data(a[OVS_KEY_ATTR_ETHERNET]); in ovs_key_from_nlattrs()
1524 err = parse_eth_type_from_nlattrs(match, &attrs, a, is_mask, in ovs_key_from_nlattrs()
1539 ipv4_key = nla_data(a[OVS_KEY_ATTR_IPV4]); in ovs_key_from_nlattrs()
1563 ipv6_key = nla_data(a[OVS_KEY_ATTR_IPV6]); in ovs_key_from_nlattrs()
1601 arp_key = nla_data(a[OVS_KEY_ATTR_ARP]); in ovs_key_from_nlattrs()
1623 if (nsh_key_put_from_nlattr(a[OVS_KEY_ATTR_NSH], match, in ovs_key_from_nlattrs()
1632 mpls_key = nla_data(a[OVS_KEY_ATTR_MPLS]); in ovs_key_from_nlattrs()
1642 tcp_key = nla_data(a[OVS_KEY_ATTR_TCP]); in ovs_key_from_nlattrs()
1650 nla_get_be16(a[OVS_KEY_ATTR_TCP_FLAGS]), in ovs_key_from_nlattrs()
1658 udp_key = nla_data(a[OVS_KEY_ATTR_UDP]); in ovs_key_from_nlattrs()
1667 sctp_key = nla_data(a[OVS_KEY_ATTR_SCTP]); in ovs_key_from_nlattrs()
1676 icmp_key = nla_data(a[OVS_KEY_ATTR_ICMP]); in ovs_key_from_nlattrs()
1687 icmpv6_key = nla_data(a[OVS_KEY_ATTR_ICMPV6]); in ovs_key_from_nlattrs()
1698 nd_key = nla_data(a[OVS_KEY_ATTR_ND]); in ovs_key_from_nlattrs()
1763 const struct nlattr *a[OVS_KEY_ATTR_MAX + 1]; in ovs_nla_get_match() local
1769 err = parse_flow_nlattrs(nla_key, a, &key_attrs, log); in ovs_nla_get_match()
1773 err = parse_vlan_from_nlattrs(match, &key_attrs, a, false, log); in ovs_nla_get_match()
1777 err = ovs_key_from_nlattrs(net, match, key_attrs, a, false, log); in ovs_nla_get_match()
1811 err = parse_flow_mask_nlattrs(nla_mask, a, &mask_attrs, log); in ovs_nla_get_match()
1819 err = parse_vlan_from_nlattrs(match, &mask_attrs, a, true, log); in ovs_nla_get_match()
1823 err = ovs_key_from_nlattrs(net, match, mask_attrs, a, true, in ovs_nla_get_match()
1911 const struct nlattr *a[OVS_KEY_ATTR_MAX + 1], in ovs_nla_get_flow_metadata()
1928 return metadata_from_nlattrs(net, &match, &attrs, a, false, log); in ovs_nla_get_flow_metadata()
2273 const struct nlattr *a; in ovs_nla_free_check_pkt_len_action() local
2276 nla_for_each_nested(a, action, rem) { in ovs_nla_free_check_pkt_len_action()
2277 switch (nla_type(a)) { in ovs_nla_free_check_pkt_len_action()
2280 ovs_nla_free_nested_actions(nla_data(a), nla_len(a)); in ovs_nla_free_check_pkt_len_action()
2288 const struct nlattr *a = nla_data(action); in ovs_nla_free_clone_action() local
2291 switch (nla_type(a)) { in ovs_nla_free_clone_action()
2294 a = nla_next(a, &rem); in ovs_nla_free_clone_action()
2295 ovs_nla_free_nested_actions(a, rem); in ovs_nla_free_clone_action()
2302 const struct nlattr *a = nla_data(action); in ovs_nla_free_sample_action() local
2305 switch (nla_type(a)) { in ovs_nla_free_sample_action()
2308 a = nla_next(a, &rem); in ovs_nla_free_sample_action()
2309 ovs_nla_free_nested_actions(a, rem); in ovs_nla_free_sample_action()
2314 static void ovs_nla_free_set_action(const struct nlattr *a) in ovs_nla_free_set_action() argument
2316 const struct nlattr *ovs_key = nla_data(a); in ovs_nla_free_set_action()
2329 const struct nlattr *a; in ovs_nla_free_nested_actions() local
2340 nla_for_each_attr(a, actions, len, rem) { in ovs_nla_free_nested_actions()
2341 switch (nla_type(a)) { in ovs_nla_free_nested_actions()
2343 ovs_nla_free_check_pkt_len_action(a); in ovs_nla_free_nested_actions()
2347 ovs_nla_free_clone_action(a); in ovs_nla_free_nested_actions()
2351 ovs_ct_free_action(a); in ovs_nla_free_nested_actions()
2355 ovs_nla_free_sample_action(a); in ovs_nla_free_nested_actions()
2359 ovs_nla_free_set_action(a); in ovs_nla_free_nested_actions()
2428 struct nlattr *a; in __add_action() local
2430 a = reserve_sfa_size(sfa, nla_attr_size(len), log); in __add_action()
2431 if (IS_ERR(a)) in __add_action()
2432 return a; in __add_action()
2434 a->nla_type = attrtype; in __add_action()
2435 a->nla_len = nla_attr_size(len); in __add_action()
2438 memcpy(nla_data(a), data, len); in __add_action()
2439 memset((unsigned char *) a + a->nla_len, 0, nla_padlen(len)); in __add_action()
2441 return a; in __add_action()
2447 struct nlattr *a; in ovs_nla_add_action() local
2449 a = __add_action(sfa, attrtype, data, len, log); in ovs_nla_add_action()
2451 return PTR_ERR_OR_ZERO(a); in ovs_nla_add_action()
2470 struct nlattr *a = (struct nlattr *) ((unsigned char *)sfa->actions + in add_nested_action_end() local
2473 a->nla_len = sfa->actions_len - st_offset; in add_nested_action_end()
2489 const struct nlattr *a; in validate_and_copy_sample() local
2494 nla_for_each_nested(a, attr, rem) { in validate_and_copy_sample()
2495 int type = nla_type(a); in validate_and_copy_sample()
2498 attrs[type] = a; in validate_and_copy_sample()
2634 struct nlattr *a; in validate_and_copy_set_tun() local
2677 a = __add_action(sfa, OVS_KEY_ATTR_TUNNEL_INFO, NULL, in validate_and_copy_set_tun()
2679 if (IS_ERR(a)) { in validate_and_copy_set_tun()
2681 return PTR_ERR(a); in validate_and_copy_set_tun()
2684 ovs_tun = nla_data(a); in validate_and_copy_set_tun()
2734 static int validate_set(const struct nlattr *a, in validate_set() argument
2739 const struct nlattr *ovs_key = nla_data(a); in validate_set()
2744 if (nla_total_size(nla_len(ovs_key)) != nla_len(a)) in validate_set()
2779 err = validate_and_copy_set_tun(a, sfa, log); in validate_set()
2865 if (!validate_nsh(nla_data(a), masked, false, log)) in validate_set()
2911 struct nlattr *a[OVS_USERSPACE_ATTR_MAX + 1]; in validate_userspace() local
2914 error = nla_parse_nested_deprecated(a, OVS_USERSPACE_ATTR_MAX, attr, in validate_userspace()
2919 if (!a[OVS_USERSPACE_ATTR_PID] || in validate_userspace()
2920 !nla_get_u32(a[OVS_USERSPACE_ATTR_PID])) in validate_userspace()
2940 struct nlattr *a[OVS_CHECK_PKT_LEN_ATTR_MAX + 1]; in validate_and_copy_check_pkt_len() local
2945 err = nla_parse_deprecated_strict(a, OVS_CHECK_PKT_LEN_ATTR_MAX, in validate_and_copy_check_pkt_len()
2951 if (!a[OVS_CHECK_PKT_LEN_ATTR_PKT_LEN] || in validate_and_copy_check_pkt_len()
2952 !nla_get_u16(a[OVS_CHECK_PKT_LEN_ATTR_PKT_LEN])) in validate_and_copy_check_pkt_len()
2955 acts_if_lesser_eq = a[OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL]; in validate_and_copy_check_pkt_len()
2956 acts_if_greater = a[OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER]; in validate_and_copy_check_pkt_len()
2968 arg.pkt_len = nla_get_u16(a[OVS_CHECK_PKT_LEN_ATTR_PKT_LEN]); in validate_and_copy_check_pkt_len()
3028 const struct nlattr *a; in __ovs_nla_copy_actions() local
3031 nla_for_each_nested(a, attr, rem) { in __ovs_nla_copy_actions()
3057 int type = nla_type(a); in __ovs_nla_copy_actions()
3061 (action_lens[type] != nla_len(a) && in __ovs_nla_copy_actions()
3071 err = validate_userspace(a); in __ovs_nla_copy_actions()
3077 if (nla_get_u32(a) >= DP_MAX_PORTS) in __ovs_nla_copy_actions()
3082 const struct ovs_action_trunc *trunc = nla_data(a); in __ovs_nla_copy_actions()
3090 const struct ovs_action_hash *act_hash = nla_data(a); in __ovs_nla_copy_actions()
3111 vlan = nla_data(a); in __ovs_nla_copy_actions()
3123 const struct ovs_action_push_mpls *mpls = nla_data(a); in __ovs_nla_copy_actions()
3159 err = validate_set(a, key, sfa, in __ovs_nla_copy_actions()
3167 err = validate_set(a, key, sfa, in __ovs_nla_copy_actions()
3175 bool last = nla_is_last(a, rem); in __ovs_nla_copy_actions()
3177 err = validate_and_copy_sample(net, a, key, sfa, in __ovs_nla_copy_actions()
3187 err = ovs_ct_copy_action(net, a, key, sfa, log); in __ovs_nla_copy_actions()
3221 if (!validate_nsh(nla_data(a), false, true, true)) in __ovs_nla_copy_actions()
3245 bool last = nla_is_last(a, rem); in __ovs_nla_copy_actions()
3247 err = validate_and_copy_clone(net, a, key, sfa, in __ovs_nla_copy_actions()
3257 bool last = nla_is_last(a, rem); in __ovs_nla_copy_actions()
3259 err = validate_and_copy_check_pkt_len(net, a, key, sfa, in __ovs_nla_copy_actions()
3274 err = copy_action(a, sfa, log); in __ovs_nla_copy_actions()
3374 const struct nlattr *a, *cpl_arg; in check_pkt_len_action_to_attr() local
3395 a = nla_next(cpl_arg, &rem); in check_pkt_len_action_to_attr()
3403 err = ovs_nla_put_actions(nla_data(a), nla_len(a), skb); in check_pkt_len_action_to_attr()
3414 a = nla_next(a, &rem); in check_pkt_len_action_to_attr()
3422 err = ovs_nla_put_actions(nla_data(a), nla_len(a), skb); in check_pkt_len_action_to_attr()
3438 static int set_action_to_attr(const struct nlattr *a, struct sk_buff *skb) in set_action_to_attr() argument
3440 const struct nlattr *ovs_key = nla_data(a); in set_action_to_attr()
3464 if (nla_put(skb, OVS_ACTION_ATTR_SET, nla_len(a), ovs_key)) in set_action_to_attr()
3472 static int masked_set_action_to_set_action_attr(const struct nlattr *a, in masked_set_action_to_set_action_attr() argument
3475 const struct nlattr *ovs_key = nla_data(a); in masked_set_action_to_set_action_attr()
3495 const struct nlattr *a; in ovs_nla_put_actions() local
3498 nla_for_each_attr(a, attr, len, rem) { in ovs_nla_put_actions()
3499 int type = nla_type(a); in ovs_nla_put_actions()
3503 err = set_action_to_attr(a, skb); in ovs_nla_put_actions()
3509 err = masked_set_action_to_set_action_attr(a, skb); in ovs_nla_put_actions()
3515 err = sample_action_to_attr(a, skb); in ovs_nla_put_actions()
3521 err = ovs_ct_action_to_attr(nla_data(a), skb); in ovs_nla_put_actions()
3527 err = clone_action_to_attr(a, skb); in ovs_nla_put_actions()
3533 err = check_pkt_len_action_to_attr(a, skb); in ovs_nla_put_actions()
3539 if (nla_put(skb, type, nla_len(a), nla_data(a))) in ovs_nla_put_actions()