## 3 Multi-Scope State Area (MSSA)  
### MSSA Structure  
MSSA is a state-storage hierarchical tree structure. The MSSA structure has four layers, as shown in Figure 2, namely the global state area, the table state area, the flow state area, and the packet state area, where the state area is a sub-unit that records the state. In order to classify state areas, each state is assigned a specific sharing scope, and all of the states in the same state area have the same sharing scope. The state-sharing scope refers to the set of packets that are allowed to share the same state in a switch. We divided four packet scopes in the switch by using the multilevel match-action table: all packets in the switch, packets entering the same match-action table, packets matching the same entry, and a single packet. The state is divided into four types based on these four packet scopes. **Global state (gs)**. Packets entering different tables share it. As shown in Figure 3a, the global state, \(S_{0}\), is shared by packets entering the \(T_{0}\) or \(T_{2}\) tables. **Table state (ts)**. Packets entering the same table share it. As shown in Figure 3b, the states \(S_{1}\), \(S_{2}\), and \(S_{5}\) are shared by all packets entering the \(T_{0}\) table, they are \(T_{0}\)'s table state. Similarly, T1's table state is \(S_{3}\), \(S_{4}\). **Flow state (fs)**. Packets matching the same entry share it. As shown in Figure 3c, \(S_{5}\) is only used by packets matching entry \(R_{0}\), so \(S_{5}\) is further divided into entry \(R_{0}\) flow state. Similarly, \(S_{2}\) is the flow state of the \(R_{2}\) entry. Figure 3: Fine-grained state division via a multilevel match–action table structure. (**a**) global state; (**b**) table state; (**c**) Flow state; (**d**) Packet state. Figure 2: MSSA structure. **Packet state (ps)**. Shared by a single packet. As illustrated in Figure 3d, the state \(S_{6}\) is only shared by the packet \(P\), which is used to transfer information between different flow tables. The global state, table state, and flow state are all saved in their respective areas (global state area, table state area, and flow state area), as is the packet state in the packet state area. Although there are only four types of states, there are more than four state areas. Consider the table state in Figure 3b. \(S_{1}\) and \(S_{3}\) are both table states, but \(S_{1}\) is shared by packets entering table \(T_{0}\) and \(S_{3}\) is shared by packets entering table \(T_{1}\). Their sharing scopes differ, and they must be placed in different state areas. As shown in Figure 4, we associate MSSA with the switch's multilevel match-action tables to clearly define the state's shared scope. In the switch, each table has a table state field, each table entry has a flow state area, and each packet has a packet state area. The switch maintains one global state area. Then, at time \(T\), the total number of state areas in the switch is shown in Equation (1). \[\text{sa}_{\text{T}}=1+t+\sum_{i=0}^{t}f_{i}+\sum_{i=0}^{p}P_{i} \tag{1}\]  
In detail, at time \(T\), 1 represents the number of global state areas, \(t\) represents the number of tables in the switch, \(\sum_{i=0}^{t}f_{i}\) represents the total number of entries in the switch, and \(\sum_{i=0}^{p}P_{i}\) represents the total number of packets received by each switch port. State access will be restricted after dividing it by sharing scope. The state cannot be accessed when the packet is not within its shared scope. As shown in Figure 3c, the state \(S_{2}\) is only accessible when the packet matches the entry \(R_{2}\). Similarly, the state in the \(T_{0}\) table state area can only be accessed by packets entering the \(T_{0}\) table, the state in the packet state area can only be accessed by its associated packet, and the state in the global state area can be accessed by all packets entering the switch. The following are the advantages of using MSSA:  
1. Fine-grained division states. The state is fine-grained divided into state areas based on shared packet scope.