# A Programmable SRv6 Processor for SFC
## 3 Protocol-Independent Pipeline Design
### Protocol-Independent Programmable Deparser Plus  
Deparser plus receives metadata and PHVs sent by the ingress RMT as shown in Figure 2. The metadata carries the packet type and flow ID to determine what needs to be carried out in the packet. Deparser plus can process any location of the packets by, for example, inserting a segment routing header (SRH) or encapsulating VXLAN packets. Deparser plus sends the modified packets and parsing results to the egress RMT for modification and forwarding. Deparser plus, which is responsible for complex stateful operations, such as header compression, encapsulation, and protocol header insertion, uses a complex instruction set, and is an RTC architecture in the model of NP forwarding.  
Figure 2: Example of PDT processing.  
We use the processing description table (PDT) module in deparser plus to control the RTC processing of packets by the action module as shown in Figure 3. The PDT can be configured by the result parser module or compiled by a developer using the P4 program. Each MA processor maintains a local PDT, and all packets arriving at the port will first hit a default entry in the PDT to activate packet processing. Each entry stores an instruction for a program element that represents a specific operation and contains a pointer to the next instruction. Instructions contain opcodes and other information needed to process data, such as pointers to resources that are implemented by the instruction. Pointer addresses can be static random access memory (SRAM) locations or ternary content addressable memory (TCAM) locations, because only one pointer type is valid for a PDT entry. Taking SRH insertion as an example, the PDT entries and control flow are shown in Figure 3.  
As shown in Figure 1, Deparser plus consists of the result parser, PDT, and the action modules. The result parser module receives metadata and PHVs sent by two FIFO queues in the previous stage. The result parser module determines the packet type based on metadata and searches the action table to obtain action instructions. The content of instruction contains opcodes and additional fields of other information. The action table contains a series of specific operations corresponding to each instruction, such as inserting data and modifying the packet length. The result parser parses the instructions and configures the PDT module in this manner. Then, the PDT module will set up the program to call the action module to deal with the PHV according to the instructions. The mapping table contains the data needed by PDT to process the header, such as SRH. The action module is controlled by the PDT module to obtain the offset, the offset length, and the information to be inserted or modified. The offset indicates the location of the packet to be operated on. Finally, the modified PHV is sent to the egress RMT.  
Some simple instructions such as add, subtract, and replace can be performed in the RMT pipeline, thus, we only need to define instructions for complex operations in deparser plus. At present, we have defined seven instructions, as follows: insert data into the packet header, delete the packet header data, encapsulate the packet header, decapsulate the packet header, alter instructions in the action table, and compress and decompress the packet header. The definitions and formats of these seven instructions are shown in Table 2.