* Converts given depth value to its corresponding range value. */
| 97 | * Converts given depth value to its corresponding range value. |
| 98 | */ |
| 99 | static uint32_t __attribute__((pure)) |
| 100 | depth_to_range(uint8_t depth) |
| 101 | { |
| 102 | VERIFY_DEPTH(depth); |
| 103 | |
| 104 | /* |
| 105 | * Calculate tbl24 range. (Note: 2^depth = 1 << depth) |
| 106 | */ |
| 107 | if (depth <= MAX_DEPTH_TBL24) |
| 108 | return 1 << (MAX_DEPTH_TBL24 - depth); |
| 109 | |
| 110 | /* Else if depth is greater than 24 */ |
| 111 | return 1 << (RTE_LPM_MAX_DEPTH - depth); |
| 112 | } |
| 113 | |
| 114 | /* |
| 115 | * Find an existing lpm table and return a pointer to it. |
no outgoing calls
no test coverage detected