• Jiri Benc's avatar
    openvswitch: add mac_proto field to the flow key · 329f45bc
    Jiri Benc authored
    Use a hole in the structure. We support only Ethernet so far and will add
    a support for L2-less packets shortly. We could use a bool to indicate
    whether the Ethernet header is present or not but the approach with the
    mac_proto field is more generic and occupies the same number of bytes in the
    struct, while allowing later extensibility. It also makes the code in the
    next patches more self explaining.
    
    It would be nice to use ARPHRD_ constants but those are u16 which would be
    waste. Thus define our own constants.
    
    Another upside of this is that we can overload this new field to also denote
    whether the flow key is valid. This has the advantage that on
    refragmentation, we don't have to reparse the packet but can rely on the
    stored eth.type. This is especially important for the next patches in this
    series - instead of adding another branch for L2-less packets before calling
    ovs_fragment, we can just remove all those branches completely.
    Signed-off-by: default avatarJiri Benc <jbenc@redhat.com>
    Acked-by: default avatarPravin B Shelar <pshelar@ovn.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    329f45bc
flow.c 19.8 KB