Direct address match, unlike the other tables, does not involve a comparison but instead uses the key as the direct address to access the stored value at that location (the table is effectively a RAM).
- Key width: from 1 to 16 bits
- Response width: from 1 to 7k bits
- Table depth (max. number of entries): 2KeyWidth
- Direct match: True/False
- Hit/miss flag: Yes
Here is an example of how to instantiate a direct table in a P4 file:
table forwardIPv4 { key = { hdr.ipv4.tos : exact; } actions = { forwardPacket; NoAction; } size = 64; default_action = NoAction; direct_match = true; }
For more details on how the compiler selects a direct table, see the Compiler Table Selection section of this chapter. Note that
in this type of table the total number of entries specified (size
field) is ignored and is instead calculated from 2Keywidth.