summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec/ipsec_output.c
diff options
context:
space:
mode:
authorRadu Nicolau <radu.nicolau@intel.com>2018-03-12 13:52:41 +0000
committerDamjan Marion <dmarion.lists@gmail.com>2018-05-22 12:09:23 +0000
commitde412ce51f6f9ca879a09e49594b907e9e99a7ed (patch)
tree742832ae6b6ce5f53de3771462c302bac069b7d4 /src/vnet/ipsec/ipsec_output.c
parent1c8ff632159213042d23b687a1d487a4c58a217d (diff)
CSIT-928 dpdk/ipsec: performance improvement
Replace hash with a vector to improve performance. Plus other minor performance improvements. Change-Id: I3f0ebd909782ce3727f6360ce5ff5ddd131f8574 Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Diffstat (limited to 'src/vnet/ipsec/ipsec_output.c')
-rw-r--r--src/vnet/ipsec/ipsec_output.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/vnet/ipsec/ipsec_output.c b/src/vnet/ipsec/ipsec_output.c
index d56b665157d..4bfbf603072 100644
--- a/src/vnet/ipsec/ipsec_output.c
+++ b/src/vnet/ipsec/ipsec_output.c
@@ -88,16 +88,16 @@ ipsec_output_policy_match (ipsec_spd_t * spd, u8 pr, u32 la, u32 ra, u16 lp,
if (PREDICT_FALSE (p->protocol && (p->protocol != pr)))
continue;
- if (la < clib_net_to_host_u32 (p->laddr.start.ip4.as_u32))
+ if (ra < clib_net_to_host_u32 (p->raddr.start.ip4.as_u32))
continue;
- if (la > clib_net_to_host_u32 (p->laddr.stop.ip4.as_u32))
+ if (ra > clib_net_to_host_u32 (p->raddr.stop.ip4.as_u32))
continue;
- if (ra < clib_net_to_host_u32 (p->raddr.start.ip4.as_u32))
+ if (la < clib_net_to_host_u32 (p->laddr.start.ip4.as_u32))
continue;
- if (ra > clib_net_to_host_u32 (p->raddr.stop.ip4.as_u32))
+ if (la > clib_net_to_host_u32 (p->laddr.stop.ip4.as_u32))
continue;
if (PREDICT_FALSE
@@ -274,11 +274,9 @@ ipsec_output_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
{
if (p0->policy == IPSEC_POLICY_ACTION_PROTECT)
{
- u32 sa_index = 0;
ipsec_sa_t *sa = 0;
nc_protect++;
- sa_index = ipsec_get_sa_index_by_sa_id (p0->sa_id);
- sa = pool_elt_at_index (im->sad, sa_index);
+ sa = pool_elt_at_index (im->sad, p0->sa_index);
if (sa->protocol == IPSEC_PROTOCOL_ESP)
next_node_index = im->esp_encrypt_node_index;
else