1c00e0cb7c52d4533e9c593cb80480ba1666cafc
[dpdk.git] / lib / librte_lpm / rte_lpm.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Intel Corporation nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef _RTE_LPM_H_
35 #define _RTE_LPM_H_
36
37 /**
38  * @file
39  * RTE Longest Prefix Match (LPM)
40  */
41
42 #include <errno.h>
43 #include <sys/queue.h>
44 #include <stdint.h>
45 #include <stdlib.h>
46 #include <rte_branch_prediction.h>
47 #include <rte_byteorder.h>
48 #include <rte_memory.h>
49 #include <rte_common.h>
50 #include <rte_vect.h>
51 #include <rte_compat.h>
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56
57 /** Max number of characters in LPM name. */
58 #define RTE_LPM_NAMESIZE                32
59
60 /** Maximum depth value possible for IPv4 LPM. */
61 #define RTE_LPM_MAX_DEPTH               32
62
63 /** @internal Total number of tbl24 entries. */
64 #define RTE_LPM_TBL24_NUM_ENTRIES       (1 << 24)
65
66 /** @internal Number of entries in a tbl8 group. */
67 #define RTE_LPM_TBL8_GROUP_NUM_ENTRIES  256
68
69 /** @internal Total number of tbl8 groups in the tbl8. */
70 #define RTE_LPM_TBL8_NUM_GROUPS         256
71
72 /** @internal Total number of tbl8 entries. */
73 #define RTE_LPM_TBL8_NUM_ENTRIES        (RTE_LPM_TBL8_NUM_GROUPS * \
74                                         RTE_LPM_TBL8_GROUP_NUM_ENTRIES)
75
76 /** @internal Macro to enable/disable run-time checks. */
77 #if defined(RTE_LIBRTE_LPM_DEBUG)
78 #define RTE_LPM_RETURN_IF_TRUE(cond, retval) do { \
79         if (cond) return (retval);                \
80 } while (0)
81 #else
82 #define RTE_LPM_RETURN_IF_TRUE(cond, retval)
83 #endif
84
85 /** @internal bitmask with valid and valid_group fields set */
86 #define RTE_LPM_VALID_EXT_ENTRY_BITMASK 0x03000000
87
88 /** Bitmask used to indicate successful lookup */
89 #define RTE_LPM_LOOKUP_SUCCESS          0x01000000
90
91 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
92 /** @internal Tbl24 entry structure. */
93 struct rte_lpm_tbl_entry_v20 {
94         /**
95          * Stores Next hop (tbl8 or tbl24 when valid_group is not set) or
96          * a group index pointing to a tbl8 structure (tbl24 only, when
97          * valid_group is set)
98          */
99         union {
100                 uint8_t next_hop;
101                 uint8_t group_idx;
102         };
103         /* Using single uint8_t to store 3 values. */
104         uint8_t valid     :1;   /**< Validation flag. */
105         /**
106          * For tbl24:
107          *  - valid_group == 0: entry stores a next hop
108          *  - valid_group == 1: entry stores a group_index pointing to a tbl8
109          * For tbl8:
110          *  - valid_group indicates whether the current tbl8 is in use or not
111          */
112         uint8_t valid_group :1;
113         uint8_t depth       :6; /**< Rule depth. */
114 };
115
116 struct rte_lpm_tbl_entry {
117         /**
118          * Stores Next hop (tbl8 or tbl24 when valid_group is not set) or
119          * a group index pointing to a tbl8 structure (tbl24 only, when
120          * valid_group is set)
121          */
122         uint32_t next_hop    :24;
123         /* Using single uint8_t to store 3 values. */
124         uint32_t valid       :1;   /**< Validation flag. */
125         /**
126          * For tbl24:
127          *  - valid_group == 0: entry stores a next hop
128          *  - valid_group == 1: entry stores a group_index pointing to a tbl8
129          * For tbl8:
130          *  - valid_group indicates whether the current tbl8 is in use or not
131          */
132         uint32_t valid_group :1;
133         uint32_t depth       :6; /**< Rule depth. */
134 };
135
136 #else
137 struct rte_lpm_tbl_entry_v20 {
138         uint8_t depth       :6;
139         uint8_t valid_group :1;
140         uint8_t valid       :1;
141         union {
142                 uint8_t group_idx;
143                 uint8_t next_hop;
144         };
145 };
146
147 struct rte_lpm_tbl_entry {
148         uint32_t depth       :6;
149         uint32_t valid_group :1;
150         uint32_t valid       :1;
151         uint32_t next_hop    :24;
152
153 };
154
155 #endif
156
157 /** @internal Rule structure. */
158 struct rte_lpm_rule_v20 {
159         uint32_t ip; /**< Rule IP address. */
160         uint8_t  next_hop; /**< Rule next hop. */
161 };
162
163 struct rte_lpm_rule {
164         uint32_t ip; /**< Rule IP address. */
165         uint32_t next_hop; /**< Rule next hop. */
166 };
167
168 /** @internal Contains metadata about the rules table. */
169 struct rte_lpm_rule_info {
170         uint32_t used_rules; /**< Used rules so far. */
171         uint32_t first_rule; /**< Indexes the first rule of a given depth. */
172 };
173
174 /** @internal LPM structure. */
175 struct rte_lpm_v20 {
176         /* LPM metadata. */
177         char name[RTE_LPM_NAMESIZE];        /**< Name of the lpm. */
178         uint32_t max_rules; /**< Max. balanced rules per lpm. */
179         struct rte_lpm_rule_info rule_info[RTE_LPM_MAX_DEPTH]; /**< Rule info table. */
180
181         /* LPM Tables. */
182         struct rte_lpm_tbl_entry_v20 tbl24[RTE_LPM_TBL24_NUM_ENTRIES]
183                         __rte_cache_aligned; /**< LPM tbl24 table. */
184         struct rte_lpm_tbl_entry_v20 tbl8[RTE_LPM_TBL8_NUM_ENTRIES]
185                         __rte_cache_aligned; /**< LPM tbl8 table. */
186         struct rte_lpm_rule_v20 rules_tbl[0] \
187                         __rte_cache_aligned; /**< LPM rules. */
188 };
189
190 struct rte_lpm {
191         /* LPM metadata. */
192         char name[RTE_LPM_NAMESIZE];        /**< Name of the lpm. */
193         uint32_t max_rules; /**< Max. balanced rules per lpm. */
194         struct rte_lpm_rule_info rule_info[RTE_LPM_MAX_DEPTH]; /**< Rule info table. */
195
196         /* LPM Tables. */
197         struct rte_lpm_tbl_entry tbl24[RTE_LPM_TBL24_NUM_ENTRIES]
198                         __rte_cache_aligned; /**< LPM tbl24 table. */
199         struct rte_lpm_tbl_entry tbl8[RTE_LPM_TBL8_NUM_ENTRIES]
200                         __rte_cache_aligned; /**< LPM tbl8 table. */
201         struct rte_lpm_rule rules_tbl[0] \
202                         __rte_cache_aligned; /**< LPM rules. */
203 };
204
205 /**
206  * Create an LPM object.
207  *
208  * @param name
209  *   LPM object name
210  * @param socket_id
211  *   NUMA socket ID for LPM table memory allocation
212  * @param max_rules
213  *   Maximum number of LPM rules that can be added
214  * @param flags
215  *   This parameter is currently unused
216  * @return
217  *   Handle to LPM object on success, NULL otherwise with rte_errno set
218  *   to an appropriate values. Possible rte_errno values include:
219  *    - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
220  *    - E_RTE_SECONDARY - function was called from a secondary process instance
221  *    - EINVAL - invalid parameter passed to function
222  *    - ENOSPC - the maximum number of memzones has already been allocated
223  *    - EEXIST - a memzone with the same name already exists
224  *    - ENOMEM - no appropriate memory area found in which to create memzone
225  */
226 struct rte_lpm *
227 rte_lpm_create(const char *name, int socket_id, int max_rules, int flags);
228 struct rte_lpm_v20 *
229 rte_lpm_create_v20(const char *name, int socket_id, int max_rules, int flags);
230 struct rte_lpm *
231 rte_lpm_create_v1604(const char *name, int socket_id, int max_rules, int flags);
232
233 /**
234  * Find an existing LPM object and return a pointer to it.
235  *
236  * @param name
237  *   Name of the lpm object as passed to rte_lpm_create()
238  * @return
239  *   Pointer to lpm object or NULL if object not found with rte_errno
240  *   set appropriately. Possible rte_errno values include:
241  *    - ENOENT - required entry not available to return.
242  */
243 struct rte_lpm *
244 rte_lpm_find_existing(const char *name);
245 struct rte_lpm_v20 *
246 rte_lpm_find_existing_v20(const char *name);
247 struct rte_lpm *
248 rte_lpm_find_existing_v1604(const char *name);
249
250 /**
251  * Free an LPM object.
252  *
253  * @param lpm
254  *   LPM object handle
255  * @return
256  *   None
257  */
258 void
259 rte_lpm_free(struct rte_lpm *lpm);
260 void
261 rte_lpm_free_v20(struct rte_lpm_v20 *lpm);
262 void
263 rte_lpm_free_v1604(struct rte_lpm *lpm);
264
265 /**
266  * Add a rule to the LPM table.
267  *
268  * @param lpm
269  *   LPM object handle
270  * @param ip
271  *   IP of the rule to be added to the LPM table
272  * @param depth
273  *   Depth of the rule to be added to the LPM table
274  * @param next_hop
275  *   Next hop of the rule to be added to the LPM table
276  * @return
277  *   0 on success, negative value otherwise
278  */
279 int
280 rte_lpm_add(struct rte_lpm *lpm, uint32_t ip, uint8_t depth, uint32_t next_hop);
281 int
282 rte_lpm_add_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth,
283                 uint8_t next_hop);
284 int
285 rte_lpm_add_v1604(struct rte_lpm *lpm, uint32_t ip, uint8_t depth,
286                 uint32_t next_hop);
287
288 /**
289  * Check if a rule is present in the LPM table,
290  * and provide its next hop if it is.
291  *
292  * @param lpm
293  *   LPM object handle
294  * @param ip
295  *   IP of the rule to be searched
296  * @param depth
297  *   Depth of the rule to searched
298  * @param next_hop
299  *   Next hop of the rule (valid only if it is found)
300  * @return
301  *   1 if the rule exists, 0 if it does not, a negative value on failure
302  */
303 int
304 rte_lpm_is_rule_present(struct rte_lpm *lpm, uint32_t ip, uint8_t depth,
305 uint32_t *next_hop);
306 int
307 rte_lpm_is_rule_present_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth,
308 uint8_t *next_hop);
309 int
310 rte_lpm_is_rule_present_v1604(struct rte_lpm *lpm, uint32_t ip, uint8_t depth,
311 uint32_t *next_hop);
312
313 /**
314  * Delete a rule from the LPM table.
315  *
316  * @param lpm
317  *   LPM object handle
318  * @param ip
319  *   IP of the rule to be deleted from the LPM table
320  * @param depth
321  *   Depth of the rule to be deleted from the LPM table
322  * @return
323  *   0 on success, negative value otherwise
324  */
325 int
326 rte_lpm_delete(struct rte_lpm *lpm, uint32_t ip, uint8_t depth);
327 int
328 rte_lpm_delete_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth);
329 int
330 rte_lpm_delete_v1604(struct rte_lpm *lpm, uint32_t ip, uint8_t depth);
331
332 /**
333  * Delete all rules from the LPM table.
334  *
335  * @param lpm
336  *   LPM object handle
337  */
338 void
339 rte_lpm_delete_all(struct rte_lpm *lpm);
340 void
341 rte_lpm_delete_all_v20(struct rte_lpm_v20 *lpm);
342 void
343 rte_lpm_delete_all_v1604(struct rte_lpm *lpm);
344
345 /**
346  * Lookup an IP into the LPM table.
347  *
348  * @param lpm
349  *   LPM object handle
350  * @param ip
351  *   IP to be looked up in the LPM table
352  * @param next_hop
353  *   Next hop of the most specific rule found for IP (valid on lookup hit only)
354  * @return
355  *   -EINVAL for incorrect arguments, -ENOENT on lookup miss, 0 on lookup hit
356  */
357 static inline int
358 rte_lpm_lookup(struct rte_lpm *lpm, uint32_t ip, uint32_t *next_hop)
359 {
360         unsigned tbl24_index = (ip >> 8);
361         uint32_t tbl_entry;
362         const uint32_t *ptbl;
363
364         /* DEBUG: Check user input arguments. */
365         RTE_LPM_RETURN_IF_TRUE(((lpm == NULL) || (next_hop == NULL)), -EINVAL);
366
367         /* Copy tbl24 entry */
368         ptbl = (const uint32_t *)(&lpm->tbl24[tbl24_index]);
369         tbl_entry = *ptbl;
370
371         /* Copy tbl8 entry (only if needed) */
372         if (unlikely((tbl_entry & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==
373                         RTE_LPM_VALID_EXT_ENTRY_BITMASK)) {
374
375                 unsigned tbl8_index = (uint8_t)ip +
376                                 (((uint32_t)tbl_entry & 0x00FFFFFF) *
377                                                 RTE_LPM_TBL8_GROUP_NUM_ENTRIES);
378
379                 ptbl = (const uint32_t *)&lpm->tbl8[tbl8_index];
380                 tbl_entry = *ptbl;
381         }
382
383         *next_hop = ((uint32_t)tbl_entry & 0x00FFFFFF);
384         return (tbl_entry & RTE_LPM_LOOKUP_SUCCESS) ? 0 : -ENOENT;
385 }
386
387 /**
388  * Lookup multiple IP addresses in an LPM table. This may be implemented as a
389  * macro, so the address of the function should not be used.
390  *
391  * @param lpm
392  *   LPM object handle
393  * @param ips
394  *   Array of IPs to be looked up in the LPM table
395  * @param next_hops
396  *   Next hop of the most specific rule found for IP (valid on lookup hit only).
397  *   This is an array of two byte values. The most significant byte in each
398  *   value says whether the lookup was successful (bitmask
399  *   RTE_LPM_LOOKUP_SUCCESS is set). The least significant byte is the
400  *   actual next hop.
401  * @param n
402  *   Number of elements in ips (and next_hops) array to lookup. This should be a
403  *   compile time constant, and divisible by 8 for best performance.
404  *  @return
405  *   -EINVAL for incorrect arguments, otherwise 0
406  */
407 #define rte_lpm_lookup_bulk(lpm, ips, next_hops, n) \
408                 rte_lpm_lookup_bulk_func(lpm, ips, next_hops, n)
409
410 static inline int
411 rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,
412                 uint32_t *next_hops, const unsigned n)
413 {
414         unsigned i;
415         unsigned tbl24_indexes[n];
416         const uint32_t *ptbl;
417
418         /* DEBUG: Check user input arguments. */
419         RTE_LPM_RETURN_IF_TRUE(((lpm == NULL) || (ips == NULL) ||
420                         (next_hops == NULL)), -EINVAL);
421
422         for (i = 0; i < n; i++) {
423                 tbl24_indexes[i] = ips[i] >> 8;
424         }
425
426         for (i = 0; i < n; i++) {
427                 /* Simply copy tbl24 entry to output */
428                 ptbl = (const uint32_t *)&lpm->tbl24[tbl24_indexes[i]];
429                 next_hops[i] = *ptbl;
430
431                 /* Overwrite output with tbl8 entry if needed */
432                 if (unlikely((next_hops[i] & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==
433                                 RTE_LPM_VALID_EXT_ENTRY_BITMASK)) {
434
435                         unsigned tbl8_index = (uint8_t)ips[i] +
436                                         (((uint32_t)next_hops[i] & 0x00FFFFFF) *
437                                          RTE_LPM_TBL8_GROUP_NUM_ENTRIES);
438
439                         ptbl = (const uint32_t *)&lpm->tbl8[tbl8_index];
440                         next_hops[i] = *ptbl;
441                 }
442         }
443         return 0;
444 }
445
446 /* Mask four results. */
447 #define  RTE_LPM_MASKX4_RES     UINT64_C(0x00ffffff00ffffff)
448
449 /**
450  * Lookup four IP addresses in an LPM table.
451  *
452  * @param lpm
453  *   LPM object handle
454  * @param ip
455  *   Four IPs to be looked up in the LPM table
456  * @param hop
457  *   Next hop of the most specific rule found for IP (valid on lookup hit only).
458  *   This is an 4 elements array of two byte values.
459  *   If the lookup was succesfull for the given IP, then least significant byte
460  *   of the corresponding element is the  actual next hop and the most
461  *   significant byte is zero.
462  *   If the lookup for the given IP failed, then corresponding element would
463  *   contain default value, see description of then next parameter.
464  * @param defv
465  *   Default value to populate into corresponding element of hop[] array,
466  *   if lookup would fail.
467  */
468 static inline void
469 rte_lpm_lookupx4(const struct rte_lpm *lpm, __m128i ip, uint32_t hop[4],
470         uint32_t defv)
471 {
472         __m128i i24;
473         rte_xmm_t i8;
474         uint32_t tbl[4];
475         uint64_t idx, pt, pt2;
476         const uint32_t *ptbl;
477
478         const __m128i mask8 =
479                 _mm_set_epi32(UINT8_MAX, UINT8_MAX, UINT8_MAX, UINT8_MAX);
480
481         /*
482          * RTE_LPM_VALID_EXT_ENTRY_BITMASK for 2 LPM entries
483          * as one 64-bit value (0x0300000003000000).
484          */
485         const uint64_t mask_xv =
486                 ((uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK |
487                 (uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK << 32);
488
489         /*
490          * RTE_LPM_LOOKUP_SUCCESS for 2 LPM entries
491          * as one 64-bit value (0x0100000001000000).
492          */
493         const uint64_t mask_v =
494                 ((uint64_t)RTE_LPM_LOOKUP_SUCCESS |
495                 (uint64_t)RTE_LPM_LOOKUP_SUCCESS << 32);
496
497         /* get 4 indexes for tbl24[]. */
498         i24 = _mm_srli_epi32(ip, CHAR_BIT);
499
500         /* extract values from tbl24[] */
501         idx = _mm_cvtsi128_si64(i24);
502         i24 = _mm_srli_si128(i24, sizeof(uint64_t));
503
504         ptbl = (const uint32_t *)&lpm->tbl24[(uint32_t)idx];
505         tbl[0] = *ptbl;
506         ptbl = (const uint32_t *)&lpm->tbl24[idx >> 32];
507         tbl[1] = *ptbl;
508
509         idx = _mm_cvtsi128_si64(i24);
510
511         ptbl = (const uint32_t *)&lpm->tbl24[(uint32_t)idx];
512         tbl[2] = *ptbl;
513         ptbl = (const uint32_t *)&lpm->tbl24[idx >> 32];
514         tbl[3] = *ptbl;
515
516         /* get 4 indexes for tbl8[]. */
517         i8.x = _mm_and_si128(ip, mask8);
518
519         pt = (uint64_t)tbl[0] |
520                 (uint64_t)tbl[1] << 32;
521         pt2 = (uint64_t)tbl[2] |
522                 (uint64_t)tbl[3] << 32;
523
524         /* search successfully finished for all 4 IP addresses. */
525         if (likely((pt & mask_xv) == mask_v) &&
526                         likely((pt2 & mask_xv) == mask_v)) {
527                 *(uint64_t *)hop = pt & RTE_LPM_MASKX4_RES;
528                 *(uint64_t *)(hop + 2) = pt2 & RTE_LPM_MASKX4_RES;
529                 return;
530         }
531
532         if (unlikely((pt & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==
533                         RTE_LPM_VALID_EXT_ENTRY_BITMASK)) {
534                 i8.u32[0] = i8.u32[0] +
535                         (uint8_t)tbl[0] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;
536                 ptbl = (const uint32_t *)&lpm->tbl8[i8.u32[0]];
537                 tbl[0] = *ptbl;
538         }
539         if (unlikely((pt >> 32 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==
540                         RTE_LPM_VALID_EXT_ENTRY_BITMASK)) {
541                 i8.u32[1] = i8.u32[1] +
542                         (uint8_t)tbl[1] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;
543                 ptbl = (const uint32_t *)&lpm->tbl8[i8.u32[1]];
544                 tbl[1] = *ptbl;
545         }
546         if (unlikely((pt2 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==
547                         RTE_LPM_VALID_EXT_ENTRY_BITMASK)) {
548                 i8.u32[2] = i8.u32[2] +
549                         (uint8_t)tbl[2] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;
550                 ptbl = (const uint32_t *)&lpm->tbl8[i8.u32[2]];
551                 tbl[2] = *ptbl;
552         }
553         if (unlikely((pt2 >> 32 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==
554                         RTE_LPM_VALID_EXT_ENTRY_BITMASK)) {
555                 i8.u32[3] = i8.u32[3] +
556                         (uint8_t)tbl[3] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;
557                 ptbl = (const uint32_t *)&lpm->tbl8[i8.u32[3]];
558                 tbl[3] = *ptbl;
559         }
560
561         hop[0] = (tbl[0] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[0] & 0x00FFFFFF : defv;
562         hop[1] = (tbl[1] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[1] & 0x00FFFFFF : defv;
563         hop[2] = (tbl[2] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[2] & 0x00FFFFFF : defv;
564         hop[3] = (tbl[3] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[3] & 0x00FFFFFF : defv;
565 }
566
567 #ifdef __cplusplus
568 }
569 #endif
570
571 #endif /* _RTE_LPM_H_ */