X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=datapath%2Fflow.c;h=d30fb73fa21595a154112bdd527bd9ee51e20776;hb=dfdfc8d43d102f4b5851d26773c1786ee2b13877;hp=dfbf76938e0c8f7d1979384b8b0adcb1048318f9;hpb=fb8c93473efacd67a50117d0f2a3084f2d96ceca;p=openvswitch diff --git a/datapath/flow.c b/datapath/flow.c index dfbf7693..d30fb73f 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -32,7 +32,7 @@ #include "compat.h" struct kmem_cache *flow_cache; -static unsigned int hash_seed; +static unsigned int hash_seed __read_mostly; static inline bool arphdr_ok(struct sk_buff *skb) { @@ -205,8 +205,7 @@ static void parse_vlan(struct sk_buff *skb, struct odp_flow_key *key) return; qp = (struct qtag_prefix *) skb->data; - key->dl_vlan = qp->tci & htons(VLAN_VID_MASK); - key->dl_vlan_pcp = (ntohs(qp->tci) & VLAN_PCP_MASK) >> VLAN_PCP_SHIFT; + key->dl_tci = qp->tci | htons(ODP_TCI_PRESENT); __skb_pull(skb, sizeof(struct qtag_prefix)); } @@ -247,6 +246,8 @@ static __be16 parse_ethertype(struct sk_buff *skb) * Ethernet header * @in_port: port number on which @skb was received. * @key: output flow key + * @is_frag: set to 1 if @skb contains an IPv4 fragment, or to 0 if @skb does + * not contain an IPv4 packet or if it is not a fragment. * * The caller must ensure that skb->len >= ETH_HLEN. * @@ -263,19 +264,16 @@ static __be16 parse_ethertype(struct sk_buff *skb) * past the IPv4 header, if one is present and of a correct length, * otherwise the same as skb->network_header. For other key->dl_type * values it is left untouched. - * - * Sets OVS_CB(skb)->is_frag to %true if @skb is an IPv4 fragment, otherwise to - * %false. */ -int flow_extract(struct sk_buff *skb, u16 in_port, struct odp_flow_key *key) +int flow_extract(struct sk_buff *skb, u16 in_port, struct odp_flow_key *key, + bool *is_frag) { struct ethhdr *eth; memset(key, 0, sizeof *key); key->tun_id = OVS_CB(skb)->tun_id; key->in_port = in_port; - key->dl_vlan = htons(ODP_VLAN_NONE); - OVS_CB(skb)->is_frag = false; + *is_frag = false; /* * We would really like to pull as many bytes as we could possibly @@ -356,9 +354,9 @@ int flow_extract(struct sk_buff *skb, u16 in_port, struct odp_flow_key *key) key->tp_dst = htons(icmp->code); } } - } else { - OVS_CB(skb)->is_frag = true; - } + } else + *is_frag = true; + } else if (key->dl_type == htons(ETH_P_ARP) && arphdr_ok(skb)) { struct arp_eth_header *arp; @@ -370,9 +368,8 @@ int flow_extract(struct sk_buff *skb, u16 in_port, struct odp_flow_key *key) && arp->ar_pln == 4) { /* We only match on the lower 8 bits of the opcode. */ - if (ntohs(arp->ar_op) <= 0xff) { + if (ntohs(arp->ar_op) <= 0xff) key->nw_proto = ntohs(arp->ar_op); - } if (key->nw_proto == ARPOP_REQUEST || key->nw_proto == ARPOP_REPLY) {