systems and methods that allow for extracting a field from data stored in a pair of registers using two instructions. A first instruction extracts any part of the field from a first register designated as a first source register, and executes a second instruction extracting any part of the field from a second general register designated as a second source register. The second instruction inserts any extracted field parts in a result register.
|
20. A method for extracting a field from a packet comprising:
storing at least a portion of the packet in a pair of general registers;
executing a first instruction extracting any part of the field from a first one of the pair of general registers designated as a first source register;
executing a second instruction extracting any part of the field from a second one of the pair of general registers designated as a second source register; and
storing any extracted part of the field extracted from the first source register in a temporary result register, wherein said step of executing a second instruction includes the step of inserting any portion of the field extracted from the second one of the general registers, along with any part of the field in the temporary result register, into a final result register.
1. A processing system for extracting a field from a packet, said system comprising:
an instruction memory having a pair of instructions;
a processor having a set of general registers, at least a portion of said packet being stored in a pair of general registers, said processor being configured to
extract, responsive to a first one of the instructions, any part of said field in a first one of the pair of general registers designated as a first source register, and
extract, responsive to a second one of the instructions, any part of said field in a second one of the pair of general registers designated as a second source register
store any extracted part of the field extracted from the first source register in a temporary result register; and
insert, responsive to the second instruction, any portion of the field extracted from the second one of the general registers, along with any part of the field in the temporary result register, into a final result register.
2. The system of
extract additional fields from the packet;
insert a value contained in the additional fields in the final result register; and
access a table lookup unit using the value in the final result register as a key.
3. The system of
parse the packet to determine a packet formal.
4. The system of
determine field information for the field to be extracted based on the packet format, wherein said field information includes a width of the field and an extraction offset indicating a position of the field in the packet.
5. The system of
determine whether the field to be extracted is stored entirely within the first source register.
6. The system of
determine that the field to be extracted is stored entirely within the first source register when an extraction offset is less than n bits and a sum of the extraction offset and the width minus one is less than n bits, where n is a width of the first source register.
7. The system of
determine whether the field to be extracted is partly in the first source register.
8. The system of
determine that the field to be extracted is partly in the first source register when an extraction offset is less than n bits and a sum of the extraction offset and the width minus one is greater than n minus one bits, where n is the width of the first source register.
9. The system of
determine whether the field to be extracted is absent from the source register.
10. The system of
determine that the field to be extracted is absent from the source register when the extraction offset is greater than n minus one bits, where n is the width of the source register.
11. The system of
determine whether the field to be extracted is entirely held in the second source register.
12. The system of
determine that the field to be extracted is entirely held in the second source register when the extraction offset is greater than n minus one bits, where n is the width of the second source register.
13. The system of
extract the field from the second source register and store the result in the final result register when the field to be extracted is entirely held in the second source register.
14. The system of
determine whether the field is partially in the second source register.
15. The system of
determine that the field is partially in the second source register when the extraction offset is less than n bits and the sum of the extract offset and the width minus one is greater than n minus one bits, where n is the width of the second source register.
16. The system of
extract, when the field is partially in the second register, the portion of the field in the second source register and inserting the result, along with the part of the field extracted by the first instruction, into a final result register offset by the insertion offset.
17. The system of
determine whether the field is absent from the second source register.
18. The system of
determine that the field is absent from the second source register when an extraction offset is less than n bits and the sum of the extraction offset and the width minus one is less than n bits, where n is the width of the source register.
19. The system of
copy a field extracted by the first instruction to a final result register when the field is absent from the second source register.
21. The method of
extracting additional fields from the packet and inserting a value contained in the additional fields in the final result register.
22. The method of
accessing a table lookup unit using the value in the final result register as a key.
24. The method of
determining field information for the field to be extracted based on the packet format, wherein said field information includes a size of the field and an extraction offset indicating a position of the field in the packet.
25. The method of
determining whether the field to be extracted is stored entirely within the first source register.
26. The method of
determining whether an extraction offset is less than n bits and a sum of the extraction offset and a width minus one is less than n bits, where n is the width of the first source register.
27. The method of
determining whether the field of interest is partly in the first source register.
28. The method of
determining whether an extraction offset is less than n bits and a sum of the extraction offset and a width minus one is greater than n minus one bits, where n is the width of the first source register.
29. The method of
determining whether the field of interest is absent from the source register.
30. The method of
determining whether the extraction offset is greater than n minus one bits, where n is the width of the source register.
31. The method of
determining whether the field to be extracted is entirely held in the second source register.
32. The method of
determining whether the extraction offset is greater than n minus one bits, where n is the width of the second source register.
33. The method of
extracting the field from the second source register; and
storing the result in the final result register when the field to be extracted is entirely held in the second source register.
34. The method of
determining whether the field is partially in the second source register.
35. The method of
determining whether the extraction offset is less than n bits and the sum of the extract offset and a width minus one is greater than n minus one bits, where n is the width of the second source register.
36. The method of
extracting, when the field is partially in the second register, the portion of the field in the second source register; and
inserting the result, along with the part of the field extracted by the first instruction, into a final result register offset by the insertion offset.
37. The method of
determining whether the field is absent from the second source register.
38. The method of
determining whether an extraction offset is less than n bits and the sum of the extraction offset and the width minus one is less than n bits, where n is the width of the second source register.
39. The method of
copying a field extracted by the first instruction to a final result register when the field is absent from the second source register.
|
This invention relates generally to the field of network communication processors, and more specifically to the field of extracting bit fields from a packet.
Network communication systems demand fast performance. The performance of conventional processors in network communication systems is degraded by slow accessing of bit fields in received packets.
When a packet is received at a network processor it is stored in registers. The stored packets are not always aligned the same way in the registers. A stored packet may be stored over one or more registers and be offset. Conventional systems have a plurality of code paths written to handle the different possibilities of packet positioning within registers. For example,
Therefore, it would be desirable to have a single set of instructions that may be used, regardless of the bit field's positioning in the registers to extract the bit field from the packet and insert in a result register.
Systems and methods consistent with the present invention extract fields from a packet using a pair of instructions.
A processing system for extracting a field from a packet consistent with the present invention includes an instruction memory having a pair of instructions, a processor having a set of general registers and temporary registers, a portion of the packet being stored in a pair of general registers. The processor is configured to extract, responsive to a first instruction, any part of the field in a first general register designated as a first source register. The processor is further configured to extract, responsive to a second instruction, any part of the field in a second general register designated as a second source register.
A method for extracting a field from a packet consistent with the present invention stores a portion of the packet in a pair of general registers, executes a first instruction extracting any part of the field from a first general register designated as a first source register, and executes a second instruction extracting any part of the field from a second general register designated as a second source register.
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate one embodiment of the invention and, together with the description, serve to explain the objects, advantages, and principles of the invention. In the drawings:
Reference will now be made in detail to embodiments consistent with this invention that are illustrated in the accompanying drawings. The same reference numbers in different drawings generally refer to the same or like parts.
Current processing systems for network communications require a plurality of code paths to extract bit fields from a packet stored across a plurality of registers. Systems and methods consistent with the present invention provide a pair of instructions that may be used, regardless of the packet's position in registers, to extract and insert a field from the packet into a result register. Systems consistent with this invention can extract a field from data stored in a pair of words. For example, referring to
One example application of the systems and methods consistent with the present invention is the formation of a key used for a table lookup operation. In order to look up data in a table lookup unit, a processor sends an operation with data to the table lookup unit (TLU). The operation commands the TLU to look up data in a table using a key. This key is typically comprised of a number of unaligned fields in packet data. To form a key for accessing the TLU, the fields need to be extracted and then inserted in a result register in a specific order.
An INSV instruction is executed following an EXTIV instruction to ensure that a complete field is extracted and stored in a result register.
To allow extraction of a particular field from the pair of registers holding at least a portion of the packet, the program forms a constant using the extraction width (m), extraction offset (n), and insert offset (p) for the field (step 530). This constant is combined with the packet information in R1 and stored in another general purpose register R2 (step 540). The program loads a first 32-bit word from the packet into a general purpose register R3 and loads the second 32-bit word of the packet into a general register R4 (step 550).
A field of interest in the packet may be in any of the positions shown in
After performing an EXTIV instruction, the program must execute an INSV instruction to extract any portion of the field in the upper order word in register R3. Using this example, the INSV instruction in
If the program requires the extraction of additional fields (step 580), then steps 530–570 are repeated for each additional field. Once all fields of interest have been extracted, the result registers R5, R6, . . . contain a concatenation of the fields extracted from the packet (step 590).
If the extraction offset is less than 32 bits and the sum of the width of the field and the extraction offset minus 1 is greater than 31 bits (step 750), then the field is contained in both the low order and high order words. The portion of the field extracted in the EXTIV instruction is copied from a temporary register temp2 to a final result register along with the portion of the field in the high order word (step 760). The entire field is then contained in the final result register.
If the extraction offset is greater than 31 bits, then the entire field is contained in the high order word. The field is copied from the register containing the high order word rT2 into the result register and any remaining bits in the result register are set to zero (step 770). No data needs to be copied from the temporary register temp2 because the EXTIV instruction did not extract any part of the field. The contents of the final result register are copied to the destination register rD2 and the remaining bits of rD2 not holding the field, are copied from rS2. Register rS2 holds a copy of data from rD2 so that bits not holding field data may be reinstated.
There are many variations that may be made consistent with the present invention. For example, in another embodiment, the extraction offset is relative to a position of a first field to be extracted. In this case, the extraction offset n refers to the fixed offset value of a field to be extracted relative to a position of a first field to be extracted. For example, if the first field's least significant bit is 60, and a current field to be extracted has a LSB of 40, the difference between these locations, −20, is stored as the extraction offset n for the current field.
Further, while the implementations above use registers being a word in size, systems and methods consistent with the present invention may be used with other sized registers.
The foregoing description is presented for purposes of illustration and description. It is not exhaustive and does not limit the invention to the precise form disclosed. Modifications and variations are possible in light of the above teachings or may be acquired from practicing the invention. The scope of the invention is defined by the claims and their equivalents.
Gelinas, Robert, Hays, W. Patrick, Katzman, Sol
Patent | Priority | Assignee | Title |
7895423, | Mar 07 2001 | ARM Finance Overseas Limited | Method for extracting fields from packets having fields spread over more than one register |
8209522, | Mar 07 2001 | ARM Finance Overseas Limited | System and method for extracting fields from packets having fields spread over more than one register |
Patent | Priority | Assignee | Title |
6032190, | Oct 03 1997 | Ascend Communications, Inc. | System and method for processing data packets |
20010020266, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Aug 28 2001 | KATZMAN, SOL | LEXRA, INC | CORRECTIVE DOCUMENT REEL FRAME 012170 0295 | 017112 | /0794 | |
Aug 28 2001 | HAYS, W PATRICK | LEXRA, INC | CORRECTIVE DOCUMENT REEL FRAME 012170 0295 | 017112 | /0794 | |
Aug 28 2001 | GELINAS, ROBERT | LEXRA, INC | CORRECTIVE DOCUMENT REEL FRAME 012170 0295 | 017112 | /0794 | |
Aug 28 2001 | KATZMAN, SOL | LEXRA COMPUTING ENGINES | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 012170 | /0295 | |
Aug 28 2001 | GELINAS, ROBERT | LEXRA COMPUTING ENGINES | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 012170 | /0295 | |
Aug 28 2001 | HAYS, W PATRICK | LEXRA COMPUTING ENGINES | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 012170 | /0295 | |
Dec 31 2001 | LEXRA, INC | MIPS Technologies, Inc | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 013174 | /0315 | |
Jul 10 2002 | KATZMAN, SOL | LEXRA, INC | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 013174 | /0322 | |
Jul 10 2002 | GELINAS, ROBERT | LEXRA, INC | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 013174 | /0322 | |
Jul 10 2002 | HAYS, W PATRICK | LEXRA, INC | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 013174 | /0322 | |
Aug 24 2007 | MIPS Technologies, Inc | JEFFERIES FINANCE LLC, AS COLLATERAL AGENT | SECURITY AGREEMENT | 019744 | /0001 | |
Dec 05 2008 | JEFFERIES FINANCE LLC, AS COLLATERAL AGENT | MIPS Technologies, Inc | RELEASE BY SECURED PARTY SEE DOCUMENT FOR DETAILS | 021985 | /0015 | |
Feb 06 2013 | MIPS Technologies, Inc | Bridge Crossing, LLC | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 030202 | /0440 | |
Jan 31 2014 | Bridge Crossing, LLC | ARM Finance Overseas Limited | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 033074 | /0058 |
Date | Maintenance Fee Events |
Aug 14 2009 | ASPN: Payor Number Assigned. |
Aug 14 2009 | RMPN: Payer Number De-assigned. |
Nov 02 2009 | M1551: Payment of Maintenance Fee, 4th Year, Large Entity. |
Nov 04 2013 | M1552: Payment of Maintenance Fee, 8th Year, Large Entity. |
Oct 19 2017 | M1553: Payment of Maintenance Fee, 12th Year, Large Entity. |
Date | Maintenance Schedule |
May 02 2009 | 4 years fee payment window open |
Nov 02 2009 | 6 months grace period start (w surcharge) |
May 02 2010 | patent expiry (for year 4) |
May 02 2012 | 2 years to revive unintentionally abandoned end. (for year 4) |
May 02 2013 | 8 years fee payment window open |
Nov 02 2013 | 6 months grace period start (w surcharge) |
May 02 2014 | patent expiry (for year 8) |
May 02 2016 | 2 years to revive unintentionally abandoned end. (for year 8) |
May 02 2017 | 12 years fee payment window open |
Nov 02 2017 | 6 months grace period start (w surcharge) |
May 02 2018 | patent expiry (for year 12) |
May 02 2020 | 2 years to revive unintentionally abandoned end. (for year 12) |