[ovs-dev] About the parse_8021q_onward function

openvswitcher openvswitcher at 163.com
Thu Sep 17 07:42:37 UTC 2015


Hi, all


I want to ask one question about parse_8021q_onward.


parse_8021q_onward:


   (...skip...)
    /* Get the VLAN TCI value. */
    if (!is_mask && !(present_attrs & (UINT64_C(1) << OVS_KEY_ATTR_VLAN))) {
        return ODP_FIT_TOO_LITTLE;
    } else {
        tci = (present_attrs & (UINT64_C(1) << OVS_KEY_ATTR_VLAN)
               ? nl_attr_get_be16(attrs[OVS_KEY_ATTR_VLAN])
               : htons(0));
        if (!is_mask) {
            if (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 (!(tci & htons(VLAN_CFI))) {
                VLOG_ERR_RL(&rl, "OVS_KEY_ATTR_VLAN 0x%04"PRIx16" is nonzero "
                            "but CFI bit is not set", ntohs(tci));
                return ODP_FIT_ERROR;
            }
        }
        /* Set vlan_tci.
         * Remove the TPID from dl_type since it's not the real Ethertype.  */
        flow->dl_type = htons(0);
        flow->vlan_tci = tci;
    }
   (...skip...)


    Why should the ODP_FIT_TOO_MUCH be returned in ☆★? 



More information about the dev mailing list