Skip to content
  • Jan Scheurich's avatar
    OF support and translation of generic encap and decap · f839892a
    Jan Scheurich authored
    
    
    This commit adds support for the OpenFlow actions generic encap
    and decap (as specified in ONF EXT-382) to the OVS control plane.
    
    CLI syntax for encap action with properties:
      encap(<header>)
      encap(<header>(<prop>=<value>,<tlv>(<class>,<type>,<value>),...))
    
    For example:
      encap(ethernet)
      encap(nsh(md_type=1))
      encap(nsh(md_type=2,tlv(0x1000,10,0x12345678),tlv(0x2000,20,0xfedcba9876543210)))
    
    CLI syntax for decap action:
      decap()
      decap(packet_type(ns=<pt_ns>,type=<pt_type>))
    
    For example:
      decap()
      decap(packet_type(ns=0,type=0xfffe))
      decap(packet_type(ns=1,type=0x894f))
    
    The first header supported for encap and decap is "ethernet" to convert
    packets between packet_type (1,Ethertype) and (0,0).
    
    This commit also implements a skeleton for the translation of generic
    encap and decap actions in ofproto-dpif and adds support to encap and
    decap an Ethernet header.
    
    In general translation of encap commits pending actions and then rewrites
    struct flow in accordance with the new packet type and header. In the
    case of encap(ethernet) it suffices to change the packet type from
    (1, Ethertype) to (0,0) and set the dl_type accordingly. A new
    pending_encap flag in xlate ctx is set to mark that an corresponding
    datapath encap action must be triggered at the next commit. In the
    case of encap(ethernet) ofproto generetas a push_eth action.
    
    The general case for translation of decap() is to emit a datapath action
    to decap the current outermost header and then recirculate the packet
    to reparse the inner headers. In the special case of an Ethernet packet,
    decap() just changes the packet type from (0,0) to (1, dl_type) without
    a need to recirculate. The emission of the pop_eth action for the
    datapath is postponed to the next commit.
    
    Hence encap(ethernet) and decap() on an Ethernet packet are OF octions
    that only incur a cost in the dataplane when a modifed packet is
    actually committed, e.g. because it is sent out. They can freely be
    used for normalizing the packet type in the OF pipeline without
    degrading performance.
    
    Signed-off-by: default avatarJan Scheurich <jan.scheurich@ericsson.com>
    Signed-off-by: default avatarYi Yang <yi.y.yang@intel.com>
    Signed-off-by: default avatarZoltan Balogh <zoltan.balogh@ericsson.com>
    Co-authored-by: default avatarZoltan Balogh <zoltan.balogh@ericsson.com>
    Signed-off-by: default avatarBen Pfaff <blp@ovn.org>
    f839892a