# A Method for 5G-ICN Seamless Mobility Support Based on Router Buffered Data
## 4 Dynamic Buffer Resource Allocation Strategy
However, due to the memoryless nature of arrival and service times, in the absence of losses we assume that actions are taken only upon arrival or departure. (1) Join operation: Use the source EID and destination EID of the arriving packet to jointly query whether the corresponding buffer queue exists in the corresponding virtual partition. If there is a corresponding buffer queue, insert it directly into the tail of the corresponding queue. If there is no corresponding buffer queue, a new buffer queue is created. Then update the relevant status value of the buffer queue. (2) Replacement operation: Drop a packet from the end of a selected buffer queue; next, add the arriving packet to the buffer. Then update the relevant status value of the buffer queue. (3) Discard operation: Discard the packet that has just arrived. If there is a corresponding buffer queue, the relevant status value needs to be updated. The dynamic buffer resource allocation strategy is shown in Algorithm 1. When the mobile buffer receives the incoming packet belonging to the mobile data flow \(Flow_{A}\), it first finds its business type \(I\) according to the service type field carried by the packet and updates \(S_{I,n}\). Next, use Formulas (4) and (5) to calculate the total queue length of all virtual partitions. Then use Formula (6) to determine the current mobile buffer status. When the buffer state is in the allowed state, the incoming packet is allowed to join the virtual partition \(VP_{I}\) and perform the joining operation. If the buffer state is in a diagonal state, it is necessary to determine whether the total queue length \(Q_{I}\) of the virtual partition \(VP_{I}\) exceeds its threshold \(T_{I}\). If the total queue length \(Q_{I}\) of the virtual partition \(VP_{I}\) does not exceed its threshold \(T_{I}\), a replacement operation is required. Find the virtual partition \(VP_{I}\) whose total queue length exceeds the threshold and has the lowest priority. In order to ensure packet loss fairness among multiple data flows belonging to the same type, the buffer queue \(q_{I,k}\) with the smallest packet loss rate is selected from the virtual partition \(VP_{I}\) for replacement operation. If the total queue length \(Q_{I}\) of the virtual partition \(VP_{I}\) exceeds its threshold \(T_{I}\), the discard operation is performed. Assuming that there are \(G\) business types, that is, there are \(G\) virtual partitions, and each virtual partition has \(F\) data flows, then the algorithm complexity of DBRAS is \(O(GF+G+2F)\). ```
0: incoming packet, \(q_{i,k}\), \(l_{i,k}\), \(d_{i,k}\), \(\sigma_{i,k}\), \(Q_{i}\), \(S_{i,n}\), \(B\), \(i=1\ldots G\), \(k=1\ldots F\)
0:\(q_{i,k}\)
1:for each incoming packet do
2: Find the business type \(I\) of the incoming packet
3:\(S_{I,n}=S_{I,n}+1\)
4: calculate \(Q_{i}\) by Equation (4)
5: calculate \(Q\) by Equation (5)
6:if\(Q<B\)then
7:if\(q_{I,A}\
eq\emptyset\)then
8: The incoming packet is inserted into the \(q_{I,A}\)
9:else
10: Create a new queue \(q_{i,a}\) and insertthe incoming packet
11:\(l_{I,A}=l_{I,A}+1\), \(\sigma_{I,A}=\sigma_{I,A}+1\)
12:endif
13:else
14:if\(Q_{I}<T_{I}\)then
15: Find the lowest priority overlimit \(VP_{I}\)
16:\(q_{I,K}=argmin_{I,K}\left\{\frac{d_{I,k}}{\sigma_{I,k}}\right\}\)
17: discard a packet at the end of the \(q_{I,K}\)
18:\(l_{I,K}=l_{I,K}-1\), \(d_{I,K}=d_{I,K}+1\)
19: goto 7
20:else
21: drop the incoming packet
22:if\(q_{I,A}\
eq\emptyset\)then
23:\(d_{I,K}=d_{I,K}+1\)
24:endif
25:endif
26:endif
```  
**Algorithm 1** Dynamic Buffer Resource Allocation Strategy