From cd7ce8f25a81fb390ed0cc66992fda8ab1b021cb Mon Sep 17 00:00:00 2001 From: Anand B Jyoti Date: Mon, 8 May 2017 11:04:07 +0530 Subject: CT: Perf optimization through prefetch and condition checks in CT JIRA: SAMPLEVNF-10 LLC miss is possible when the connection data structure is accessed after retrieved from hash table entries for TCP/UDP connection. CPI for rte_ct_udp_packet() is not good due to if/else condition checks. This patch provide a prefetch instructions to pre-fetch the cnxn data entry structure to avoid the LLC miss and also optimize the if/else condition check to improve the CPI for rte_ct_udp_packet() function. Change-Id: Ieaf70815c919ddbe1ff34921222eac030fb41756 Signed-off-by: Anand B Jyoti --- common/VIL/conntrack/rte_ct_udp.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'common/VIL/conntrack/rte_ct_udp.c') diff --git a/common/VIL/conntrack/rte_ct_udp.c b/common/VIL/conntrack/rte_ct_udp.c index 88f3a9a4..6caa788f 100644 --- a/common/VIL/conntrack/rte_ct_udp.c +++ b/common/VIL/conntrack/rte_ct_udp.c @@ -33,17 +33,17 @@ enum rte_ct_packet_action rte_ct_udp_packet(struct rte_ct_cnxn_tracker *ct, uint8_t key_was_flipped) { enum rte_ct_pkt_direction dir; - + enum rte_ct_udp_states ustate = RTE_CT_UDP_UNREPLIED; dir = (cd->key_is_client_order == !key_was_flipped); /* printf("packet received verify"); */ - if (dir == RTE_CT_DIR_REPLY && - cd->connstatus == RTE_INIT_CONN) { - rte_ct_set_cnxn_timer_for_udp(ct, cd, RTE_CT_UDP_REPLIED); + if (dir == RTE_CT_DIR_REPLY && ( + (cd->connstatus == RTE_INIT_CONN) || + (cd->connstatus == RTE_ASSURED_CONN))) + { + ustate = RTE_CT_UDP_REPLIED; cd->connstatus = RTE_ASSURED_CONN; - } else if (dir == RTE_CT_DIR_REPLY && - cd->connstatus == RTE_ASSURED_CONN) - rte_ct_set_cnxn_timer_for_udp(ct, cd, RTE_CT_UDP_REPLIED); - else - rte_ct_set_cnxn_timer_for_udp(ct, cd, RTE_CT_UDP_UNREPLIED); + } + rte_ct_set_cnxn_timer_for_udp(ct, cd, ustate); + return RTE_CT_FORWARD_PACKET; } -- cgit 1.2.3-korg