# SDN-Based Congestion Control and Bandwidth Allocation Scheme in 5G Networks
## 3 System Design
### Bandwidth Allocation Scheme  
Data flow refers to the flow of data from the source end to the destination end in network transmission. According to the application layer's restrictions on the data transmission speed, data flows can be divided into two categories: application-layer restricted flow (app_limited) and application-layer unrestricted flow (app_no_limited). Application-layer restricted flow often comes from certain applications, such as video websites; in this case, its video buffer is often restricted by the application layer. When a user watches a video, if the network bandwidth is small or there is not enough data in the buffer for other reasons, problems such as stalling and stopping playback may occur. In this case, the user must adjust the cache size or increase the bandwidth and other ways to solve the problem. In contrast, unrestricted streams at the application layer can be transmitted at maximum speed without any limitations on their velocity. Such data flow is commonly observed in scenarios that demand high real-time and low latency requirements, such as online gaming, voice chat, and other applications that necessitate rapid response times while ensuring stability. We set the total bandwidth of the NIC of a link to C, and the switch is divided into three queues (BRF flow, CUBIC flow, UDP flow), where the bandwidth of the BRF flow  
Figure 6: Multipath mode. queue is C\({}_{\text{BRF}}\), the bandwidth of the CUBIC flow is C\({}_{\text{CUBIC}}\), the number of BRF flows is N\({}_{\text{BRF}}\), and the number of CUBIC flows is N\({}_{\text{CUBIC}}\); then  
\[\text{C}_{\text{BRF}}=\frac{\text{N}_{\text{BRF}}}{\text{N}_{\text{CUBIC}}+\text {N}_{\text{BRF}}}*\text{C},\text{ C}_{\text{CUBIC}}=\frac{\text{N}_{\text{CUBIC}}}{\text{N}_{\text{CUBIC}}+ \text{N}_{\text{BRF}}}*\text{C} \tag{8}\]  
Due to protocol limitations, the bandwidth of each CUBIC flow cannot be accurately controlled. However, a queue can be set for CUBIC at the switch level, and its total bandwidth can be set. The total bandwidth of the queue can be allocated proportionally according to the number of flows to achieve fairness between CUBIC flows and BRF flows. For BRF flows, the specific bandwidth allocation scheme is as follows:  
For the newly added flow i (i \(\in\) N\({}_{\text{BRF}}\)), the initial bandwidth is allocated according to the network quintuple:  
\[\text{BW}_{\text{i-init}}=\text{F}\big{(}\text{s}_{\text{addr}},\text{d}_{ \text{addr}},\text{s}_{\text{port}},\text{d}_{\text{port}},\text{type}\big{)} \tag{9}\]  
To ensure fairness, the BW\({}_{\text{i-init}}\) value should not exceed the average bandwidth value, which can be expressed a:  
\[\text{BW}_{\text{i-init}}= \begin{cases}\text{BW}_{\text{init}},\text{BW}_{ \text{init}}<\text{BW}_{\text{avg}},\text{BW}_{\text{avg}}=\text{C}_{\text{ BRF}}\\ \text{BW}_{\text{avg}},\text{BW}_{\text{init}}\geq\text{BW}_{\text{avg}} \end{cases}  \tag{10}\]  
The residual bandwidth RBW is defined as the difference between the total bandwidth of the BRF flow and its utilized bandwidth, which can be mathematically expressed as follows. \[\text{RBW}=\text{C}_{\text{BRF}}-\sum_{i=0}^{\text{N}_{\text{BRF}}}\text{BW}_ {\text{i-real}} \tag{11}\]  
If \(\text{RBW}\geq\text{BW}_{\text{i-init}}\), then the bandwidth value BW\({}_{\text{i}}\) allocated by the newly added flow i and the bandwidth value allocated by other BRF flows can be expressed as follows. \[ \begin{cases}\text{BW}_{\text{i}}=\text{BW}_{\text{i-init}}\\ \text{BW}_{\text{j}}=\text{BW}_{\text{j}},\text{(j}\in\text{N}_{\text{BRF}}, \text{j}\
eq\text{i})\end{cases}  \tag{12}\]  
If \(\text{RBW}<\text{BW}_{\text{i-init}}\), then the bandwidth value BW\({}_{\text{i}}\) allocated by the newly added flow i and the bandwidth value allocated by other BRF flows can be expressed as follows. \[ \begin{cases}\text{BW}_{\text{j}}=\text{BW}_{\text{j}}*\frac{\text{BW}_{\text {i}}=\text{BW}_{\text{i-init}}}{\sum_{i=0}^{\text{N}_{\text{BRF}}}\text{BW}_ {\text{i-real}}},\text{(j}\in\text{N}_{\text{BRF}},\text{j}\
eq\text{i})\end{cases}