X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=datapath%2Fflow.c;h=fe05df324c529af3b10f771631d074f93c09ff8f;hb=878ae780124c64547591e3e67371d7e5eea8fd5a;hp=735e147959edfa8f47933befaa72d897761a9f36;hpb=535d6987a7af3bef33bf2db21b52bb81e3ea64ee;p=openvswitch diff --git a/datapath/flow.c b/datapath/flow.c index 735e1479..fe05df32 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -34,6 +34,8 @@ #include #include +#include "vlan.h" + static struct kmem_cache *flow_cache; static unsigned int hash_seed __read_mostly; @@ -449,8 +451,12 @@ int flow_extract(struct sk_buff *skb, u16 in_port, struct sw_flow_key *key, /* dl_type, dl_vlan, dl_vlan_pcp. */ __skb_pull(skb, 2 * ETH_ALEN); - if (eth->h_proto == htons(ETH_P_8021Q)) + + if (vlan_tx_tag_present(skb)) + key->dl_tci = htons(vlan_get_tci(skb)); + else if (eth->h_proto == htons(ETH_P_8021Q)) parse_vlan(skb, key); + key->dl_type = parse_ethertype(skb); skb_reset_network_header(skb); __skb_push(skb, skb->data - (unsigned char *)eth); @@ -813,6 +819,11 @@ int flow_to_nlattrs(const struct sw_flow_key *swkey, struct sk_buff *skb) struct odp_key_ethernet *eth_key; struct nlattr *nla; + /* This is an imperfect sanity-check that FLOW_BUFSIZE doesn't need + * to be updated, but will at least raise awareness when new ODP key + * types are added. */ + BUILD_BUG_ON(__ODP_KEY_ATTR_MAX != 14); + if (swkey->tun_id != cpu_to_be64(0)) NLA_PUT_BE64(skb, ODP_KEY_ATTR_TUN_ID, swkey->tun_id);