Lock-less access of pre-allocated memory buffers used by a network device
AssigneeJuniper Networks, Inc.
InventorsMonty S. Gill, Yi Sun
Life of this patent
Estimating the term…
Abstract
In general, the present disclosure describes techniques for both removing memory buffers from and adding memory buffers to a list (e.g., a linked list) of available buffers, for use by a network device, without locking the list during access. One example method includes allocating a list of memory buffers that are each available for use by multiple modules executed within the network device, wherein the list includes a first end and a second, opposite end, and removing a first memory buffer from the first end of the list by a first module of the multiple modules without locking the list. The method further includes adding the first memory buffer to the second end of the list by a second module of the multiple modules without locking the list.
Claims28
A method comprising:
- allocating a list of memory buffers that are each available for use by multiple modules executed within a network device, wherein the list includes a first end and a second, opposite end;
- removing a first memory buffer from the first end of the list by a first module of the multiple modules without locking the list, wherein the first module manipulates memory buffers only on the first end of the list and is further configured to add memory buffers to the first end of the list without locking the list;
- storing, by the first module of the multiple modules, data in the first memory buffer;
- extracting, by a second module of the multiple modules, the data stored in the first memory buffer;
- and
- after extracting the data stored in the first memory buffer, adding the first memory buffer to the second end of the list by the second module of the multiple modules without locking the list, wherein the second module manipulates memory buffers only on the second end of the list and is further configured to remove memory buffers from the second end of the list without locking the list.
A non-transitory computer-readable medium comprising instructions that cause one or more processors to:
- allocate a list of memory buffers that are each available for use by multiple modules executed within a network device, wherein the list includes a first end and a second, opposite end;
- remove a first memory buffer from the first end of the list by a first module of the multiple modules without locking the list, wherein the first module manipulates memory buffers only on the first end of the list and is further configured to add memory buffers to the first end of the list without locking the list;
- store, by the first module of the multiple modules, data in the first memory buffer;
- extract, by a second module of the multiple modules, the data stored in the first memory buffer;
- and
- after extracting the data stored in the first memory buffer, add the first memory buffer to the second end of the list by the second module of the multiple modules without locking the list, wherein the second module manipulates memory buffers only on the second end of the list and is further configured to remove memory buffers from the second end of the list without locking the list.
A network device comprising:
- a memory configured to store a pre-allocated list of memory buffers that are each available for use by multiple modules of the network device, wherein the list includes a first end and a second, opposite end;
- a first module of the multiple modules configured to remove a first memory buffer from the first end of the list without locking the list, and further configured to store data in the first memory buffer, wherein the first module manipulates memory buffers only on the first end of the list and is further configured to add memory buffers to the first end of the list without locking the list;
- and
- a second module of the multiple modules configured to extract the data stored in the first memory buffer, and further configured to add the first memory buffer to the second end of the list, without locking the list, after extracting the data stored in the first memory buffer, wherein the second module manipulates memory buffers only on the second end of the list and is further configured to remove memory buffers from the second end of the list without locking the list.
A network device comprising:
- means for allocating a list of memory buffers that are each available for use by multiple modules executed within a network device, wherein the list includes a first end and a second, opposite end;
- means for removing a first memory buffer from the first end of the list by a first module of the multiple modules without locking the list, wherein the first module manipulates memory buffers only on the first end of the list and is further configured to add memory buffers to the first end of the list without locking the list;
- means for storing, by the first module of the multiple modules, data in the first memory buffer;
- means for extracting, by a second module of the multiple modules, the data stored in the first memory buffer;
- and
- means for adding the first memory buffer to the second end of the list by a second module of the multiple modules, without locking the list, after the data stored in the first memory buffer is extracted, wherein the second module manipulates memory buffers only on the second end of the list and is further configured to remove memory buffers from the second end of the list without locking the list.
Dependencies are inferred from the claim text.