| 26 | int ipsec_sad_lcore_cache_init(uint32_t nb_cache_ent); |
| 27 | |
| 28 | static inline int |
| 29 | cmp_sa_key(struct ipsec_sa *sa, int is_v4, struct rte_ipv4_hdr *ipv4, |
| 30 | struct rte_ipv6_hdr *ipv6) |
| 31 | { |
| 32 | int sa_type = WITHOUT_TRANSPORT_VERSION(sa->flags); |
| 33 | if ((sa_type == TRANSPORT) || |
| 34 | /* IPv4 check */ |
| 35 | (is_v4 && (sa_type == IP4_TUNNEL) && |
| 36 | (sa->src.ip.ip4 == ipv4->src_addr) && |
| 37 | (sa->dst.ip.ip4 == ipv4->dst_addr)) || |
| 38 | /* IPv6 check */ |
| 39 | (!is_v4 && (sa_type == IP6_TUNNEL) && |
| 40 | (!memcmp(sa->src.ip.ip6.ip6, ipv6->src_addr, 16)) && |
| 41 | (!memcmp(sa->dst.ip.ip6.ip6, ipv6->dst_addr, 16)))) |
| 42 | return 1; |
| 43 | |
| 44 | return 0; |
| 45 | } |
| 46 | |
| 47 | static inline void |
| 48 | sa_cache_update(struct ipsec_sa **sa_cache, struct ipsec_sa *sa, uint32_t mask) |