Lines Matching +full:key +full:-

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2007-2014 Nicira, Inc.
52 idle_ms = jiffies_to_msecs(jiffies - flow_jiffies); in ovs_flow_used_time()
56 return cur_ms - idle_ms; in ovs_flow_used_time()
66 int len = skb->len + (skb_vlan_tag_present(skb) ? VLAN_HLEN : 0); in ovs_flow_stats_update()
68 stats = rcu_dereference(flow->stats[cpu]); in ovs_flow_stats_update()
70 /* Check if already have CPU-specific stats. */ in ovs_flow_stats_update()
72 spin_lock(&stats->lock); in ovs_flow_stats_update()
73 /* Mark if we write on the pre-allocated stats. */ in ovs_flow_stats_update()
74 if (cpu == 0 && unlikely(flow->stats_last_writer != cpu)) in ovs_flow_stats_update()
75 flow->stats_last_writer = cpu; in ovs_flow_stats_update()
77 stats = rcu_dereference(flow->stats[0]); /* Pre-allocated. */ in ovs_flow_stats_update()
78 spin_lock(&stats->lock); in ovs_flow_stats_update()
81 * pre-allocated stats keep using them. in ovs_flow_stats_update()
83 if (unlikely(flow->stats_last_writer != cpu)) { in ovs_flow_stats_update()
85 * stats, so we need to check again. If CPU-specific in ovs_flow_stats_update()
86 * stats were already allocated, we update the pre- in ovs_flow_stats_update()
89 if (likely(flow->stats_last_writer != -1) && in ovs_flow_stats_update()
90 likely(!rcu_access_pointer(flow->stats[cpu]))) { in ovs_flow_stats_update()
91 /* Try to allocate CPU-specific stats. */ in ovs_flow_stats_update()
102 new_stats->used = jiffies; in ovs_flow_stats_update()
103 new_stats->packet_count = 1; in ovs_flow_stats_update()
104 new_stats->byte_count = len; in ovs_flow_stats_update()
105 new_stats->tcp_flags = tcp_flags; in ovs_flow_stats_update()
106 spin_lock_init(&new_stats->lock); in ovs_flow_stats_update()
108 rcu_assign_pointer(flow->stats[cpu], in ovs_flow_stats_update()
111 flow->cpu_used_mask); in ovs_flow_stats_update()
115 flow->stats_last_writer = cpu; in ovs_flow_stats_update()
119 stats->used = jiffies; in ovs_flow_stats_update()
120 stats->packet_count++; in ovs_flow_stats_update()
121 stats->byte_count += len; in ovs_flow_stats_update()
122 stats->tcp_flags |= tcp_flags; in ovs_flow_stats_update()
124 spin_unlock(&stats->lock); in ovs_flow_stats_update()
140 cpu = cpumask_next(cpu, flow->cpu_used_mask)) { in ovs_flow_stats_get()
141 struct sw_flow_stats *stats = rcu_dereference_ovsl(flow->stats[cpu]); in ovs_flow_stats_get()
144 /* Local CPU may write on non-local stats, so we must in ovs_flow_stats_get()
145 * block bottom-halves here. in ovs_flow_stats_get()
147 spin_lock_bh(&stats->lock); in ovs_flow_stats_get()
148 if (!*used || time_after(stats->used, *used)) in ovs_flow_stats_get()
149 *used = stats->used; in ovs_flow_stats_get()
150 *tcp_flags |= stats->tcp_flags; in ovs_flow_stats_get()
151 ovs_stats->n_packets += stats->packet_count; in ovs_flow_stats_get()
152 ovs_stats->n_bytes += stats->byte_count; in ovs_flow_stats_get()
153 spin_unlock_bh(&stats->lock); in ovs_flow_stats_get()
165 cpu = cpumask_next(cpu, flow->cpu_used_mask)) { in ovs_flow_stats_clear()
166 struct sw_flow_stats *stats = ovsl_dereference(flow->stats[cpu]); in ovs_flow_stats_clear()
169 spin_lock_bh(&stats->lock); in ovs_flow_stats_clear()
170 stats->used = 0; in ovs_flow_stats_clear()
171 stats->packet_count = 0; in ovs_flow_stats_clear()
172 stats->byte_count = 0; in ovs_flow_stats_clear()
173 stats->tcp_flags = 0; in ovs_flow_stats_clear()
174 spin_unlock_bh(&stats->lock); in ovs_flow_stats_clear()
181 if (unlikely(skb->len < len)) in check_header()
182 return -EINVAL; in check_header()
184 return -ENOMEM; in check_header()
206 skb->len < nh_ofs + ip_len)) in check_iphdr()
207 return -EINVAL; in check_iphdr()
223 skb->len < th_ofs + tcp_len)) in tcphdr_ok()
248 * get_ipv6_ext_hdrs() - Parses packet and sets IPv6 extension header flags.
264 * Hop-by-Hop Options header
271 * upper-layer header
276 u8 next_type = nh->nexthdr; in get_ipv6_ext_hdrs()
363 /* OFPIEH12_HOP is set to 1 if a hop-by-hop IPv6 in get_ipv6_ext_hdrs()
380 next_type = hp->nexthdr; in get_ipv6_ext_hdrs()
385 static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key) in parse_ipv6hdr() argument
400 get_ipv6_ext_hdrs(skb, nh, &key->ipv6.exthdrs); in parse_ipv6hdr()
402 key->ip.proto = NEXTHDR_NONE; in parse_ipv6hdr()
403 key->ip.tos = ipv6_get_dsfield(nh); in parse_ipv6hdr()
404 key->ip.ttl = nh->hop_limit; in parse_ipv6hdr()
405 key->ipv6.label = *(__be32 *)nh & htonl(IPV6_FLOWINFO_FLOWLABEL); in parse_ipv6hdr()
406 key->ipv6.addr.src = nh->saddr; in parse_ipv6hdr()
407 key->ipv6.addr.dst = nh->daddr; in parse_ipv6hdr()
409 nexthdr = ipv6_find_hdr(skb, &payload_ofs, -1, &frag_off, &flags); in parse_ipv6hdr()
412 key->ip.frag = OVS_FRAG_TYPE_LATER; in parse_ipv6hdr()
413 key->ip.proto = NEXTHDR_FRAGMENT; in parse_ipv6hdr()
416 key->ip.frag = OVS_FRAG_TYPE_FIRST; in parse_ipv6hdr()
418 key->ip.frag = OVS_FRAG_TYPE_NONE; in parse_ipv6hdr()
423 * used to set key->ip.frag above. in parse_ipv6hdr()
426 return -EPROTO; in parse_ipv6hdr()
428 nh_len = payload_ofs - nh_ofs; in parse_ipv6hdr()
430 key->ip.proto = nexthdr; in parse_ipv6hdr()
441 * parse_vlan_tag - Parse vlan tag from vlan header.
447 * %0 if it encounters a non-vlan or incomplete packet.
453 struct vlan_head *vh = (struct vlan_head *)skb->data; in parse_vlan_tag()
455 if (likely(!eth_type_vlan(vh->tpid))) in parse_vlan_tag()
458 if (unlikely(skb->len < sizeof(struct vlan_head) + sizeof(__be16))) in parse_vlan_tag()
463 return -ENOMEM; in parse_vlan_tag()
465 vh = (struct vlan_head *)skb->data; in parse_vlan_tag()
466 key_vh->tci = vh->tci | htons(VLAN_CFI_MASK); in parse_vlan_tag()
467 key_vh->tpid = vh->tpid; in parse_vlan_tag()
470 int offset = skb->data - skb_mac_header(skb); in parse_vlan_tag()
479 __vlan_hwaccel_put_tag(skb, key_vh->tpid, tci); in parse_vlan_tag()
486 static void clear_vlan(struct sw_flow_key *key) in clear_vlan() argument
488 key->eth.vlan.tci = 0; in clear_vlan()
489 key->eth.vlan.tpid = 0; in clear_vlan()
490 key->eth.cvlan.tci = 0; in clear_vlan()
491 key->eth.cvlan.tpid = 0; in clear_vlan()
494 static int parse_vlan(struct sk_buff *skb, struct sw_flow_key *key) in parse_vlan() argument
499 key->eth.vlan.tci = htons(skb->vlan_tci) | htons(VLAN_CFI_MASK); in parse_vlan()
500 key->eth.vlan.tpid = skb->vlan_proto; in parse_vlan()
502 /* Parse outer vlan tag in the non-accelerated case. */ in parse_vlan()
503 res = parse_vlan_tag(skb, &key->eth.vlan, true); in parse_vlan()
509 res = parse_vlan_tag(skb, &key->eth.cvlan, false); in parse_vlan()
528 proto = *(__be16 *) skb->data; in parse_ethertype()
534 if (skb->len < sizeof(struct llc_snap_hdr)) in parse_ethertype()
540 llc = (struct llc_snap_hdr *) skb->data; in parse_ethertype()
541 if (llc->dsap != LLC_SAP_SNAP || in parse_ethertype()
542 llc->ssap != LLC_SAP_SNAP || in parse_ethertype()
543 (llc->oui[0] | llc->oui[1] | llc->oui[2]) != 0) in parse_ethertype()
548 if (eth_proto_is_802_3(llc->ethertype)) in parse_ethertype()
549 return llc->ethertype; in parse_ethertype()
554 static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key, in parse_icmpv6() argument
559 /* The ICMPv6 type and code fields use the 16-bit transport port in parse_icmpv6()
560 * fields, so we need to store them in 16-bit network byte order. in parse_icmpv6()
562 key->tp.src = htons(icmp->icmp6_type); in parse_icmpv6()
563 key->tp.dst = htons(icmp->icmp6_code); in parse_icmpv6()
565 if (icmp->icmp6_code == 0 && in parse_icmpv6()
566 (icmp->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION || in parse_icmpv6()
567 icmp->icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT)) { in parse_icmpv6()
568 int icmp_len = skb->len - skb_transport_offset(skb); in parse_icmpv6()
572 memset(&key->ipv6.nd, 0, sizeof(key->ipv6.nd)); in parse_icmpv6()
581 return -ENOMEM; in parse_icmpv6()
584 key->ipv6.nd.target = nd->target; in parse_icmpv6()
586 icmp_len -= sizeof(*nd); in parse_icmpv6()
590 (struct nd_opt_hdr *)(nd->opt + offset); in parse_icmpv6()
591 int opt_len = nd_opt->nd_opt_len * 8; in parse_icmpv6()
600 if (nd_opt->nd_opt_type == ND_OPT_SOURCE_LL_ADDR in parse_icmpv6()
602 if (unlikely(!is_zero_ether_addr(key->ipv6.nd.sll))) in parse_icmpv6()
604 ether_addr_copy(key->ipv6.nd.sll, in parse_icmpv6()
605 &nd->opt[offset+sizeof(*nd_opt)]); in parse_icmpv6()
606 } else if (nd_opt->nd_opt_type == ND_OPT_TARGET_LL_ADDR in parse_icmpv6()
608 if (unlikely(!is_zero_ether_addr(key->ipv6.nd.tll))) in parse_icmpv6()
610 ether_addr_copy(key->ipv6.nd.tll, in parse_icmpv6()
611 &nd->opt[offset+sizeof(*nd_opt)]); in parse_icmpv6()
614 icmp_len -= opt_len; in parse_icmpv6()
622 memset(&key->ipv6.nd.target, 0, sizeof(key->ipv6.nd.target)); in parse_icmpv6()
623 memset(key->ipv6.nd.sll, 0, sizeof(key->ipv6.nd.sll)); in parse_icmpv6()
624 memset(key->ipv6.nd.tll, 0, sizeof(key->ipv6.nd.tll)); in parse_icmpv6()
629 static int parse_nsh(struct sk_buff *skb, struct sw_flow_key *key) in parse_nsh() argument
645 return -EINVAL; in parse_nsh()
652 key->nsh.base.flags = nsh_get_flags(nh); in parse_nsh()
653 key->nsh.base.ttl = nsh_get_ttl(nh); in parse_nsh()
654 key->nsh.base.mdtype = nh->mdtype; in parse_nsh()
655 key->nsh.base.np = nh->np; in parse_nsh()
656 key->nsh.base.path_hdr = nh->path_hdr; in parse_nsh()
657 switch (key->nsh.base.mdtype) { in parse_nsh()
660 return -EINVAL; in parse_nsh()
661 memcpy(key->nsh.context, nh->md1.context, in parse_nsh()
662 sizeof(nh->md1)); in parse_nsh()
665 memset(key->nsh.context, 0, in parse_nsh()
666 sizeof(nh->md1)); in parse_nsh()
669 return -EINVAL; in parse_nsh()
676 * key_extract_l3l4 - extracts L3/L4 header information.
677 * @skb: sk_buff that contains the frame, with skb->data pointing to the
679 * @key: output flow key
683 static int key_extract_l3l4(struct sk_buff *skb, struct sw_flow_key *key) in key_extract_l3l4() argument
688 if (key->eth.type == htons(ETH_P_IP)) { in key_extract_l3l4()
694 memset(&key->ip, 0, sizeof(key->ip)); in key_extract_l3l4()
695 memset(&key->ipv4, 0, sizeof(key->ipv4)); in key_extract_l3l4()
696 if (error == -EINVAL) { in key_extract_l3l4()
697 skb->transport_header = skb->network_header; in key_extract_l3l4()
704 key->ipv4.addr.src = nh->saddr; in key_extract_l3l4()
705 key->ipv4.addr.dst = nh->daddr; in key_extract_l3l4()
707 key->ip.proto = nh->protocol; in key_extract_l3l4()
708 key->ip.tos = nh->tos; in key_extract_l3l4()
709 key->ip.ttl = nh->ttl; in key_extract_l3l4()
711 offset = nh->frag_off & htons(IP_OFFSET); in key_extract_l3l4()
713 key->ip.frag = OVS_FRAG_TYPE_LATER; in key_extract_l3l4()
714 memset(&key->tp, 0, sizeof(key->tp)); in key_extract_l3l4()
717 if (nh->frag_off & htons(IP_MF) || in key_extract_l3l4()
718 skb_shinfo(skb)->gso_type & SKB_GSO_UDP) in key_extract_l3l4()
719 key->ip.frag = OVS_FRAG_TYPE_FIRST; in key_extract_l3l4()
721 key->ip.frag = OVS_FRAG_TYPE_NONE; in key_extract_l3l4()
724 if (key->ip.proto == IPPROTO_TCP) { in key_extract_l3l4()
727 key->tp.src = tcp->source; in key_extract_l3l4()
728 key->tp.dst = tcp->dest; in key_extract_l3l4()
729 key->tp.flags = TCP_FLAGS_BE16(tcp); in key_extract_l3l4()
731 memset(&key->tp, 0, sizeof(key->tp)); in key_extract_l3l4()
734 } else if (key->ip.proto == IPPROTO_UDP) { in key_extract_l3l4()
737 key->tp.src = udp->source; in key_extract_l3l4()
738 key->tp.dst = udp->dest; in key_extract_l3l4()
740 memset(&key->tp, 0, sizeof(key->tp)); in key_extract_l3l4()
742 } else if (key->ip.proto == IPPROTO_SCTP) { in key_extract_l3l4()
745 key->tp.src = sctp->source; in key_extract_l3l4()
746 key->tp.dst = sctp->dest; in key_extract_l3l4()
748 memset(&key->tp, 0, sizeof(key->tp)); in key_extract_l3l4()
750 } else if (key->ip.proto == IPPROTO_ICMP) { in key_extract_l3l4()
753 /* The ICMP type and code fields use the 16-bit in key_extract_l3l4()
755 * them in 16-bit network byte order. */ in key_extract_l3l4()
756 key->tp.src = htons(icmp->type); in key_extract_l3l4()
757 key->tp.dst = htons(icmp->code); in key_extract_l3l4()
759 memset(&key->tp, 0, sizeof(key->tp)); in key_extract_l3l4()
763 } else if (key->eth.type == htons(ETH_P_ARP) || in key_extract_l3l4()
764 key->eth.type == htons(ETH_P_RARP)) { in key_extract_l3l4()
771 arp->ar_hrd == htons(ARPHRD_ETHER) && in key_extract_l3l4()
772 arp->ar_pro == htons(ETH_P_IP) && in key_extract_l3l4()
773 arp->ar_hln == ETH_ALEN && in key_extract_l3l4()
774 arp->ar_pln == 4) { in key_extract_l3l4()
777 if (ntohs(arp->ar_op) <= 0xff) in key_extract_l3l4()
778 key->ip.proto = ntohs(arp->ar_op); in key_extract_l3l4()
780 key->ip.proto = 0; in key_extract_l3l4()
782 memcpy(&key->ipv4.addr.src, arp->ar_sip, sizeof(key->ipv4.addr.src)); in key_extract_l3l4()
783 memcpy(&key->ipv4.addr.dst, arp->ar_tip, sizeof(key->ipv4.addr.dst)); in key_extract_l3l4()
784 ether_addr_copy(key->ipv4.arp.sha, arp->ar_sha); in key_extract_l3l4()
785 ether_addr_copy(key->ipv4.arp.tha, arp->ar_tha); in key_extract_l3l4()
787 memset(&key->ip, 0, sizeof(key->ip)); in key_extract_l3l4()
788 memset(&key->ipv4, 0, sizeof(key->ipv4)); in key_extract_l3l4()
790 } else if (eth_p_mpls(key->eth.type)) { in key_extract_l3l4()
793 memset(&key->mpls, 0, sizeof(key->mpls)); in key_extract_l3l4()
794 skb_set_inner_network_header(skb, skb->mac_len); in key_extract_l3l4()
798 error = check_header(skb, skb->mac_len + in key_extract_l3l4()
806 memcpy(&key->mpls.lse[label_count - 1], &lse, in key_extract_l3l4()
809 skb_set_inner_network_header(skb, skb->mac_len + in key_extract_l3l4()
819 key->mpls.num_labels_mask = GENMASK(label_count - 1, 0); in key_extract_l3l4()
820 } else if (key->eth.type == htons(ETH_P_IPV6)) { in key_extract_l3l4()
823 nh_len = parse_ipv6hdr(skb, key); in key_extract_l3l4()
826 case -EINVAL: in key_extract_l3l4()
827 memset(&key->ip, 0, sizeof(key->ip)); in key_extract_l3l4()
828 memset(&key->ipv6.addr, 0, sizeof(key->ipv6.addr)); in key_extract_l3l4()
830 case -EPROTO: in key_extract_l3l4()
831 skb->transport_header = skb->network_header; in key_extract_l3l4()
840 if (key->ip.frag == OVS_FRAG_TYPE_LATER) { in key_extract_l3l4()
841 memset(&key->tp, 0, sizeof(key->tp)); in key_extract_l3l4()
844 if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP) in key_extract_l3l4()
845 key->ip.frag = OVS_FRAG_TYPE_FIRST; in key_extract_l3l4()
848 if (key->ip.proto == NEXTHDR_TCP) { in key_extract_l3l4()
851 key->tp.src = tcp->source; in key_extract_l3l4()
852 key->tp.dst = tcp->dest; in key_extract_l3l4()
853 key->tp.flags = TCP_FLAGS_BE16(tcp); in key_extract_l3l4()
855 memset(&key->tp, 0, sizeof(key->tp)); in key_extract_l3l4()
857 } else if (key->ip.proto == NEXTHDR_UDP) { in key_extract_l3l4()
860 key->tp.src = udp->source; in key_extract_l3l4()
861 key->tp.dst = udp->dest; in key_extract_l3l4()
863 memset(&key->tp, 0, sizeof(key->tp)); in key_extract_l3l4()
865 } else if (key->ip.proto == NEXTHDR_SCTP) { in key_extract_l3l4()
868 key->tp.src = sctp->source; in key_extract_l3l4()
869 key->tp.dst = sctp->dest; in key_extract_l3l4()
871 memset(&key->tp, 0, sizeof(key->tp)); in key_extract_l3l4()
873 } else if (key->ip.proto == NEXTHDR_ICMP) { in key_extract_l3l4()
875 error = parse_icmpv6(skb, key, nh_len); in key_extract_l3l4()
879 memset(&key->tp, 0, sizeof(key->tp)); in key_extract_l3l4()
882 } else if (key->eth.type == htons(ETH_P_NSH)) { in key_extract_l3l4()
883 error = parse_nsh(skb, key); in key_extract_l3l4()
891 * key_extract - extracts a flow key from an Ethernet frame.
892 * @skb: sk_buff that contains the frame, with skb->data pointing to the
894 * @key: output flow key
896 * The caller must ensure that skb->len >= ETH_HLEN.
900 * - skb->mac_header: the L2 header.
902 * - skb->network_header: just past the L2 header, or just past the
905 * - skb->transport_header: If key->eth.type is ETH_P_IP or ETH_P_IPV6
907 * of a correct length, otherwise the same as skb->network_header.
908 * For other key->eth.type values it is left untouched.
910 * - skb->protocol: the type of the data starting at skb->network_header.
911 * Equals to key->eth.type.
915 static int key_extract(struct sk_buff *skb, struct sw_flow_key *key) in key_extract() argument
920 key->tp.flags = 0; in key_extract()
925 clear_vlan(key); in key_extract()
926 if (ovs_key_mac_proto(key) == MAC_PROTO_NONE) { in key_extract()
927 if (unlikely(eth_type_vlan(skb->protocol))) in key_extract()
928 return -EINVAL; in key_extract()
931 key->eth.type = skb->protocol; in key_extract()
934 ether_addr_copy(key->eth.src, eth->h_source); in key_extract()
935 ether_addr_copy(key->eth.dst, eth->h_dest); in key_extract()
939 * update skb->csum here. in key_extract()
942 if (unlikely(parse_vlan(skb, key))) in key_extract()
943 return -ENOMEM; in key_extract()
945 key->eth.type = parse_ethertype(skb); in key_extract()
946 if (unlikely(key->eth.type == htons(0))) in key_extract()
947 return -ENOMEM; in key_extract()
951 * skb->protocol. in key_extract()
953 if (key->eth.cvlan.tci & htons(VLAN_CFI_MASK)) in key_extract()
954 skb->protocol = key->eth.cvlan.tpid; in key_extract()
956 skb->protocol = key->eth.type; in key_extract()
959 __skb_push(skb, skb->data - skb_mac_header(skb)); in key_extract()
964 /* Fill out L3/L4 key info, if any */ in key_extract()
965 return key_extract_l3l4(skb, key); in key_extract()
971 int ovs_flow_key_update_l3l4(struct sk_buff *skb, struct sw_flow_key *key) in ovs_flow_key_update_l3l4() argument
973 return key_extract_l3l4(skb, key); in ovs_flow_key_update_l3l4()
976 int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key) in ovs_flow_key_update() argument
980 res = key_extract(skb, key); in ovs_flow_key_update()
982 key->mac_proto &= ~SW_FLOW_KEY_INVALID; in ovs_flow_key_update()
989 switch (skb->dev->type) { in key_extract_mac_proto()
993 if (skb->protocol == htons(ETH_P_TEB)) in key_extract_mac_proto()
998 return -EINVAL; in key_extract_mac_proto()
1002 struct sk_buff *skb, struct sw_flow_key *key) in ovs_flow_key_extract() argument
1013 key->tun_proto = ip_tunnel_info_af(tun_info); in ovs_flow_key_extract()
1014 memcpy(&key->tun_key, &tun_info->key, sizeof(key->tun_key)); in ovs_flow_key_extract()
1016 if (tun_info->options_len) { in ovs_flow_key_extract()
1017 BUILD_BUG_ON((1 << (sizeof(tun_info->options_len) * in ovs_flow_key_extract()
1018 8)) - 1 in ovs_flow_key_extract()
1019 > sizeof(key->tun_opts)); in ovs_flow_key_extract()
1021 ip_tunnel_info_opts_get(TUN_METADATA_OPTS(key, tun_info->options_len), in ovs_flow_key_extract()
1023 key->tun_opts_len = tun_info->options_len; in ovs_flow_key_extract()
1025 key->tun_opts_len = 0; in ovs_flow_key_extract()
1028 key->tun_proto = 0; in ovs_flow_key_extract()
1029 key->tun_opts_len = 0; in ovs_flow_key_extract()
1030 memset(&key->tun_key, 0, sizeof(key->tun_key)); in ovs_flow_key_extract()
1033 key->phy.priority = skb->priority; in ovs_flow_key_extract()
1034 key->phy.in_port = OVS_CB(skb)->input_vport->port_no; in ovs_flow_key_extract()
1035 key->phy.skb_mark = skb->mark; in ovs_flow_key_extract()
1036 key->ovs_flow_hash = 0; in ovs_flow_key_extract()
1040 key->mac_proto = res; in ovs_flow_key_extract()
1045 key->recirc_id = tc_ext && !tc_ext->act_miss ? in ovs_flow_key_extract()
1046 tc_ext->chain : 0; in ovs_flow_key_extract()
1047 OVS_CB(skb)->mru = tc_ext ? tc_ext->mru : 0; in ovs_flow_key_extract()
1048 post_ct = tc_ext ? tc_ext->post_ct : false; in ovs_flow_key_extract()
1049 post_ct_snat = post_ct ? tc_ext->post_ct_snat : false; in ovs_flow_key_extract()
1050 post_ct_dnat = post_ct ? tc_ext->post_ct_dnat : false; in ovs_flow_key_extract()
1051 zone = post_ct ? tc_ext->zone : 0; in ovs_flow_key_extract()
1053 key->recirc_id = 0; in ovs_flow_key_extract()
1056 key->recirc_id = 0; in ovs_flow_key_extract()
1059 err = key_extract(skb, key); in ovs_flow_key_extract()
1061 ovs_ct_fill_key(skb, key, post_ct); /* Must be after key_extract(). */ in ovs_flow_key_extract()
1064 key->ct_zone = zone; in ovs_flow_key_extract()
1067 key->ct_state &= ~OVS_CS_F_DST_NAT; in ovs_flow_key_extract()
1069 key->ct_state &= ~OVS_CS_F_SRC_NAT; in ovs_flow_key_extract()
1078 struct sw_flow_key *key, bool log) in ovs_flow_key_extract_userspace() argument
1086 return -EINVAL; in ovs_flow_key_extract_userspace()
1089 err = ovs_nla_get_flow_metadata(net, a, attrs, key, log); in ovs_flow_key_extract_userspace()
1093 /* key_extract assumes that skb->protocol is set-up for in ovs_flow_key_extract_userspace()
1098 * For L2 packet key eth type would be zero. skb protocol in ovs_flow_key_extract_userspace()
1099 * would be set to correct value later during key-extact. in ovs_flow_key_extract_userspace()
1102 skb->protocol = key->eth.type; in ovs_flow_key_extract_userspace()
1103 err = key_extract(skb, key); in ovs_flow_key_extract_userspace()
1108 * for packets for which it makes sense. Otherwise the key may be in ovs_flow_key_extract_userspace()
1109 * corrupted due to overlapping key fields. in ovs_flow_key_extract_userspace()
1112 key->eth.type != htons(ETH_P_IP)) in ovs_flow_key_extract_userspace()
1113 return -EINVAL; in ovs_flow_key_extract_userspace()
1115 (key->eth.type != htons(ETH_P_IPV6) || in ovs_flow_key_extract_userspace()
1116 sw_flow_key_is_nd(key))) in ovs_flow_key_extract_userspace()
1117 return -EINVAL; in ovs_flow_key_extract_userspace()