Claims
- 1. A method of processing packets, comprising:
determining an availability of a queue, the queue being shared by a plurality of receive threads and having an associated produce index; incrementing the produce index while the produce index is locked, if the queue is determined to be available; and writing a packet to the queue while the produce index is unlocked.
- 2. The method of claim 1 further including:
reading a produce count from an on-chip memory of a network processor; reading a consume count from the on-chip memory of the network processor; and determining the availability of the queue based on the produce count and the consume count.
- 3. The method of claim 2 further including subtracting the consume count from the produce count.
- 4. The method of claim 2 wherein the queue is part of a first off-chip memory and the produce index is stored in a second off-chip memory.
- 5. The method of claim 4 wherein the first off-chip memory is a dynamic random access memory (DRAM) and the second off-chip memory is a static random access memory (SRAM).
- 6. The method of claim 1 further including:
locking the produce index; reading a value of the produce index; incrementing the read value based on a size of the packet; writing the incremented value to the produce index; and unlocking the produce index.
- 7. The method of claim 1 further including:
writing the packet to the queue; and atomically incrementing a produce count stored in an on-chip memory.
- 8. A method of processing packets, comprising:
determining whether data is stored in a queue of an off-chip memory of a network processor based on a produce count and a consume count, the produce count and the consume count being stored in an on-chip memory of the network processor.
- 9. The method of claim 8 further including reading multiple packets from the queue if data is determined to be stored in the queue.
- 10. The method of claim 9 further including:
transmitting a first packet of the multiple packets to a transmit buffer; and storing a second packet of the multiple packets to an on-chip cache.
- 11. The method of claim 9 further including:
incrementing the consume count in accordance with the reading of the multiple packets; and writing the incremented consume count to the on-chip memory.
- 12. The method of claim 8 further including:
determining whether data is stored in an on-chip cache before determining whether data is stored in the queue; and reading a packet from the on-chip cache if data is determined to be stored in the on-chip cache.
- 13. The method of claim 8 further including:
reading the consume count; reading the produce count; and subtracting the consume count from the produce count.
- 14. A method of processing packets, comprising:
reading a produce count from an on-chip memory of a network processor; reading a consume count from the on-chip memory of the network processor; subtracting the produce count from the consume count to determine an availability of the queue, the queue having an associated produce index; locking the produce index; reading a value of the produce index; incrementing the read value based on a size of a incoming packet; writing the incremented value to the produce index; unlocking the produce index; writing the incoming packet to the queue while the produce index is unlocked; and atomically incrementing the produce count.
- 15. The method of claim 14 further including determining whether data is stored in the queue based on the produce count and the consume count.
- 16. The method of claim 15 further including reading multiple outgoing packets queue if data is determined to be stored in the queue.
- 17. The method of claim 15 further including:
determining whether data is stored in an on-chip cache before determining whether data is stored in the queue; and reading an outgoing packet from the on-chip cache if data is determined to be stored in the on-chip cache.
- 18. A network processor comprising:
a receive micro-engine to use a first receive thread to determine an availability of a queue, the queue being shared by a plurality of receive threads and having an associated produce index, the receive micro-engine to use the first receive thread to increment the produce index while the produce index is locked, if the queue is determined to be available, and to write an incoming packet to the queue while the produce index is unlocked.
- 19. The network processor of claim 18 further including an on-chip memory operatively coupled to the receive micro-engine, the on-chip memory to store a produce count and a consume count, the receive micro-engine to use the first receive thread to determine the availability of the queue based on the produce count and the consume count.
- 20. The network processor of claim 19 further including a transmit micro-engine to use a first transmit thread to determine whether data is stored in the queue based on the produce count and the consume count, the queue being shared by a plurality of transmit threads.
- 21. The network processor of claim 20 wherein the transmit micro-engine is to use the first transmit thread to read multiple packets from the queue if data is determined to be stored in the queue.
- 22. The network processor of claim 20 wherein the transmit micro-engine includes an on-chip cache, the transmit micro-engine to use the first transmit thread to determine whether data is stored in the on-chip cache before determining whether data is stored in the queue, and to read an outgoing packet from the on-chip cache if data is determined to be stored in the on-chip cache.
- 23. The network processor of claim 20 further including a plurality of transmit micro-engines and a plurality of receive micro-engines.
- 24. The network processor of claim 18 wherein the queue is part of a first off-chip memory and the produce index is stored in a second off-chip memory.
- 25. A networking architecture comprising:
a first off-chip memory having a plurality of queues; a second off-chip memory to store a plurality of produce indices corresponding to the plurality of queues; and a network processor operatively coupled to the off-chip memories, the network processor having a receive micro-engine to use a first receive thread to determine an availability of a queue, the queue being shared by a plurality of receive threads and having an associated produce index, the receive micro-engine to use the first receive thread to increment the produce index while the produce index is locked, if the queue is determined to be available, and to write an incoming packet to the queue while the produce index is unlocked.
- 26. The networking architecture of claim 25 wherein the network processor further includes an on-chip memory operatively coupled to the receive micro-engine, the on-chip memory to store a produce count and a consume count, the receive micro-engine to use the first receive thread to determine the availability of the queue based on the produce count and the consume count.
- 27. The networking architecture of claim 26 wherein the network processor further includes a transmit micro-engine to use a first transmit thread to determine whether data is stored in the queue based on the produce count and the consume count, the queue being shared by a plurality of transmit threads.
- 28. The networking architecture of claim 27 wherein the transmit receive micro-engine is to read multiple packets from the queue if data is determined to be stored in the queue.
- 29. The networking architecture of claim 27 wherein the transmit micro-engine includes an on-chip cache, the transmit micro-engine to use the first transmit thread to determine whether data is stored in the on-chip cache before determining whether data is stored in the queue, and to read an outgoing packet from the on-chip cache if data is determined to be stored in the on-chip cache.
- 30. A machine readable storage medium storing a set of instructions capable of being executed by a processor to:
determine an availability of a queue, the queue being shared by a plurality of receive threads and having an associated produce index; increment the produce index while the produce index is locked, if the queue is determined to be available; and write a packet to the queue while the produce index is unlocked.
- 31. The medium of claim 30 wherein the instructions are further capable of being executed to:
read a produce count from an on-chip memory of a network processor; read a consume count from the on-chip memory of the network processor; and determine the availability of the queue based on the produce count and the consume count.
- 32. A machine readable storage medium storing a set of instructions capable of being executed by a processor to:
determine whether data is stored in a queue of an off-chip memory of a network processor based on a produce count and a consume count, the produce count and the consume count being stored in an on-chip memory of the network processor.
- 33. The medium of claim 32 wherein the instructions are further capable of being executed to read multiple packets if data is determined to be stored in the queue.
- 34. The medium of claim 33 wherein the instructions are further capable of being executed to:
transmit a first packet of the multiple packets to a transmit buffer; and store a second packet of the multiple packets to an on-chip cache.
CROSS REFERENCE TO RELATED APPLICATIONS
[0001] The present application is related to the U.S. patent application of Prashant R. Chandra et al. entitled “Efficient Multi-Threaded Multi-Processor Scheduling Implementation,” filed Jun. 14, 2002.