摘要 |
Disclosed are a buffer allocation method and device. The method comprises: upon detection of first configuration information for scheduling queues according to a weighted round robin (WRR) scheduling algorithm, acquiring a proportion of each queue in a first port corresponding to the first configuration information, the size of a packet to be sent having the largest data size in the first port and a minimum buffer occupation unit for a forward packet of a switch associated with the first port; calculating, according to the proportion, the size of the packet to be sent and the minimum unit, a first buffer respectively allocated to each queue in the first port; and allocating, according to each first buffer, a static buffer respectively to each queue in the first port. The present invention enables both a queue having a high priority level and a queue having a low priority level to occupy buffer resources corresponding to proportions of respective queues in a first port using WRR queue scheduling, thus realizing more reasonable allocation of buffer resources in a switch and improving accuracy of WRR queue scheduling and efficiency of the switch. |