Hi, all
I read the source in kernel mode, the function named 'ovs_nla_put_flow', and I see when the eth.type is ETH_P_8021Q but eth.tci is 0, the OVS_KEY_ATTR_ENCAP field will only have a header but no nested fields. But I don't think this is one correct case because I think if the eth.type is ETH_P_8021Q the tci should not be 0. Could you explain why? Looking forward for your reply. Thanks. int ovs_nla_put_flow(const struct sw_flow_key *swkey, const struct sw_flow_key *output, struct sk_buff *skb) { (...skip....) if (swkey->eth.tci || swkey->eth.type == htons(ETH_P_8021Q)) { __be16 eth_type; eth_type = !is_mask ? htons(ETH_P_8021Q) : htons(0xffff); if (nla_put_be16(skb, OVS_KEY_ATTR_ETHERTYPE, eth_type) || nla_put_be16(skb, OVS_KEY_ATTR_VLAN, output->eth.tci)) goto nla_put_failure; encap = nla_nest_start(skb, OVS_KEY_ATTR_ENCAP); if (!swkey->eth.tci) goto unencap; } else encap = NULL; (...skip....) unencap: if (encap) nla_nest_end(skb, encap); return 0; nla_put_failure: return -EMSGSIZE; } At 2015-09-17 23:43:49, "openvswitcher" <openvswitc...@163.com> wrote: Hi, all I want to ask a question about the function parse_8021q_onward. (...skip...) if (!is_mask) { if (!(present_attrs & (UINT64_C(1) << OVS_KEY_ATTR_VLAN))) { return ODP_FIT_TOO_LITTLE; } else if (flow->vlan_tci == htons(0)) { /* Corner case for a truncated 802.1Q header. */ if (fitness == ODP_FIT_PERFECT && nl_attr_get_size(encap)) { return ODP_FIT_TOO_MUCH; } return fitness; ★★★★★★★★★★★★★★★ } else if (!(flow->vlan_tci & htons(VLAN_CFI))) { VLOG_ERR_RL(&rl, "OVS_KEY_ATTR_VLAN 0x%04"PRIx16" is nonzero " "but CFI bit is not set", ntohs(flow->vlan_tci)); return ODP_FIT_ERROR; } } (...skip...) Why the ★★★★★★★★★★★★★★★ return directly without parsing the IP and Transport Level header. Looking forward to your reply. Thanks. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev