DPDK  24.03.0
rte_lpm_scalar.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2022 StarFive
3  * Copyright(c) 2022 SiFive
4  * Copyright(c) 2022 Semihalf
5  */
6 
7 #ifndef _RTE_LPM_SCALAR_H_
8 #define _RTE_LPM_SCALAR_H_
9 
10 #include <rte_vect.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 static inline void
17 rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4],
18  uint32_t defv)
19 {
20  rte_xmm_t xip = { .x = ip };
21  uint32_t nh;
22  int ret;
23 
24  ret = rte_lpm_lookup(lpm, xip.u32[0], &nh);
25  hop[0] = (ret == 0) ? nh : defv;
26  ret = rte_lpm_lookup(lpm, xip.u32[1], &nh);
27  hop[1] = (ret == 0) ? nh : defv;
28  ret = rte_lpm_lookup(lpm, xip.u32[2], &nh);
29  hop[2] = (ret == 0) ? nh : defv;
30  ret = rte_lpm_lookup(lpm, xip.u32[3], &nh);
31  hop[3] = (ret == 0) ? nh : defv;
32 }
33 
34 #ifdef __cplusplus
35 }
36 #endif
37 
38 #endif /* _RTE_LPM_SCALAR_H_ */
static int rte_lpm_lookup(const struct rte_lpm *lpm, uint32_t ip, uint32_t *next_hop)
Definition: rte_lpm.h:279
static void rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4], uint32_t defv)