# Network Slicing for mMTC and URLLC Using Software-Defined Networking with P4 Switches
## 4 Performance Evaluation
### Simulation Settings  
The SDN topology used for performance evaluation is depicted in Figure 10. The parameters and their values used in the simulation are summarized in Table 4. We set up an SDN environment comprising four hosts and six P4 switches on the Mininet simulator [47]. The well-established Ryu controller is adopted for the control plane [48]. The communication interface between the data and control planes is OpenFlow Protocol V1.3 for traditional switches and SDNPS for the P4 switches. The Behavioral Model version 2 (BMv2) [49], employing the P4 language, is deployed in Mininet. The bandwidth of each link between the two switches is 20, 30, or 60 Mbps (Figure 10). The queue size of each switch is 50 packets. The Iperf tool [50] is used to generate UDP flows at a constant data rate of 50 Kbps for each machine-type device, and the number of machine-type devices varies from 100 to 500. Two URLLC UDP flows are transmitted at 5 and 17 Mbps. The source and destination hosts of the mMTC flows are H1 and H3, respectively, and those of the URLLC flows are H2 and H4, respectively.  
\begin{table}
\begin{tabular}{l} \hline \hline
**Network Slicing** \\ \hline \(m\) paths in the mMTC slice: \(M=\{\hat{H_{j}}\ 11\leq j\leq m\}\) \\ \(r\) paths in the URLLC slice: \(R=\{\hat{H_{j}}\ 11\leq j\leq r\}\) \\
**Packet forwarding:** \\
1. **If** (an mMTC flow) \\
2. Assign the path with the minimum load in \(M\); \\
3. Flow\_h.RouteID = \(\hat{H_{j}}\); \\
4. **If** (a URLLC flow) \\
5. Assign the path with the minimum load in \(R\); \\
6. Flow\_h.RouteID = \(\hat{H_{j}}\); \\
7. Flow\_h.Protocol = 0 \(\times\) 01 every Ts seconds at the ingress switch; \\
8. **If** (Flow\_h.Protocol = 0 \(\times\) 01) \\
9. Flow\_h.Counter++; \\
10. Record INT data by concatenating an INT\_h; \\
11. Forward the packet carrying INT data to the next hop; \\
12. **If** (at the egress switch) \\
13. Duplicate all of the INT data; \\
14. Send the above INT packet to the INT Data Collector; \\
15. Forward the original packet to the destination; \\
16. **Else** //Flow\_h.Protocol = 0 \(\times\) 00 \\
17. Flow\_h.Counter++; \\
18. Forward the packet to the next hop; \\
**Network slice controller:** \\
19. **If** (Qi \(>Hq\) or \(Li>Hu\) on RouteID = \(\hat{H_{j}}\)) \\
20. Reroute to another path in \(M\) that can afford the mMTC flow; \\
21. **If** (Di \(>Hd\) or \(Qi>Hq\) or \(Li>Hu\) on RouteID = \(\hat{H_{j}}\)) \\
22. Reroute to another path in \(R\) that can afford the URLLC flow; \\ \hline \hline \end{tabular}
\end{table}
Table 3: Pseudocode of SDNPS.  
The URLLC slice is assigned two flow paths, S1-S3-S5-S6 and S1-S3-S4-S6, with the fewest hops. To achieve high connection density instead of latency, the mMTC slice is assigned two flow paths, S1-S2-S5-S4-S6 and S1-S2-S4-S5-S6. Initially, the first flow path in either slice is always used, and the second flow path is used if the first path has service quality degradation. The sampling period for INT data is 0.5 s. The threshold values for the INT data are listed in Table 4. The simulation duration is 10 s. During the simulation, a URLLC flow of 5 Mbps is generated initially, and another URLLC flow of 17 Mbps is generated after 3 s; 100, 250, or 500 mMTC flows are simultaneously generated from the beginning to the end of the simulation.