Skip to content
  • Jan Scheurich's avatar
    userspace: Add packet_type in dp_packet and flow · 2482b0b0
    Jan Scheurich authored
    
    
    This commit adds a packet_type attribute to the structs dp_packet and flow
    to explicitly carry the type of the packet as prepration for the
    introduction of the so-called packet type-aware pipeline (PTAP) in OVS.
    
    The packet_type is a big-endian 32 bit integer with the encoding as
    specified in OpenFlow verion 1.5.
    
    The upper 16 bits contain the packet type name space. Pre-defined values
    are defined in openflow-common.h:
    
    enum ofp_header_type_namespaces {
        OFPHTN_ONF = 0,             /* ONF namespace. */
        OFPHTN_ETHERTYPE = 1,       /* ns_type is an Ethertype. */
        OFPHTN_IP_PROTO = 2,        /* ns_type is a IP protocol number. */
        OFPHTN_UDP_TCP_PORT = 3,    /* ns_type is a TCP or UDP port. */
        OFPHTN_IPV4_OPTION = 4,     /* ns_type is an IPv4 option number. */
    };
    
    The lower 16 bits specify the actual type in the context of the name space.
    
    Only name spaces 0 and 1 will be supported for now.
    
    For name space OFPHTN_ONF the relevant packet type is 0 (Ethernet).
    This is the default packet_type in OVS and the only one supported so far.
    Packets of type (OFPHTN_ONF, 0) are called Ethernet packets.
    
    In name space OFPHTN_ETHERTYPE the type is the Ethertype of the packet.
    A packet of type (OFPHTN_ETHERTYPE, <Ethertype>) is a standard L2 packet
    whith the Ethernet header (and any VLAN tags) removed to expose the L3
    (or L2.5) payload of the packet. These will simply be called L3 packets.
    
    The Ethernet address fields dl_src and dl_dst in struct flow are not
    applicable for an L3 packet and must be zero. However, to maintain
    compatibility with the large code base, we have chosen to copy the
    Ethertype of an L3 packet into the the dl_type field of struct flow.
    
    This does not mean that it will be possible to match on dl_type for L3
    packets with PTAP later on. Matching must be done on packet_type instead.
    
    New dp_packets are initialized with packet_type Ethernet. Ports that
    receive L3 packets will have to explicitly adjust the packet_type.
    
    Signed-off-by: default avatarJean Tourrilhes <jt@labs.hpe.com>
    Signed-off-by: default avatarJan Scheurich <jan.scheurich@ericsson.com>
    Co-authored-by: default avatarZoltan Balogh <zoltan.balogh@ericsson.com>
    Signed-off-by: default avatarBen Pfaff <blp@ovn.org>
    2482b0b0