From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EAC7AA0597; Wed, 8 Apr 2020 13:32:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3BA871C192; Wed, 8 Apr 2020 13:32:07 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id D42E11C12F for ; Wed, 8 Apr 2020 13:32:05 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 038BUdlg032084; Wed, 8 Apr 2020 04:32:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=mM1h01JYCZS+Qn8P0Nh5t/rQqWyjj2SLMaasMg1+A3Y=; b=vuTrkenr9DWH+JpGIqWU5UqUOPOW/hqkoWnNIflk+S+45ltJeh3O9vl9QX+65H7f25JQ 1EpXuC0D/OOcGkuCtOmFmAhMrI9c176hzrX+WiyGPs3DkzZ7AgQxYQH55cnK4TUW3qcB ABs1msQxIEPZHNcWsG38HS964ThWdBFM76Mu1YaPl2pR5sF/U1vpqqVTh3HS/ko2iHgB V2vXBjL5ZtO6PEPj2k2UfHpzxE9aYSmzO5O6G5fQlBFv4qW93dYkAVfY5R3h9hcbxPiM yC5bCScXUu0rgzYcccEMiP1ZCsJTZop78w90hoqf5oBvFLW+r2VQDKwxKj37OvvzYe95 9g== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3091me2xht-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 08 Apr 2020 04:32:04 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 8 Apr 2020 04:32:02 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 8 Apr 2020 04:32:02 -0700 Received: from luke.marvell.com (unknown [10.95.131.249]) by maili.marvell.com (Postfix) with ESMTP id 5BE503F703F; Wed, 8 Apr 2020 04:32:01 -0700 (PDT) From: Lukasz Bartosik To: , CC: , , , Date: Wed, 8 Apr 2020 13:32:00 +0200 Message-ID: <1586345520-3205-1-git-send-email-lbartosik@marvell.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-07_10:2020-04-07, 2020-04-07 signatures=0 Subject: [dpdk-dev] [PATCH] examples/ipsec-secgw: fix dropping of initial IPsec pkts X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In inline event mode when traffic flows and the ipsec-secgw app is started then for short period of time IPsec packets arrive at application without being decrypted and are dropped by the application. This happens because eth ports are started before creation of inline sessions and IPsec flows. This fix rearranges the code in such a way that eth ports are always started after creation of inline sessions and IPsec flows. Change-Id: Ifddc446082fb2897f81559517f90e1ee603e13f3 Signed-off-by: Lukasz Bartosik --- examples/ipsec-secgw/event_helper.c | 26 -------------------------- examples/ipsec-secgw/ipsec-secgw.c | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 39 deletions(-) diff --git a/examples/ipsec-secgw/event_helper.c b/examples/ipsec-secgw/event_helper.c index 076f1f2..da861e4 100644 --- a/examples/ipsec-secgw/event_helper.c +++ b/examples/ipsec-secgw/event_helper.c @@ -1526,7 +1526,6 @@ int32_t eh_devs_init(struct eh_conf *conf) { struct eventmode_conf *em_conf; - uint16_t port_id; int ret; if (conf == NULL) { @@ -1558,16 +1557,6 @@ eh_devs_init(struct eh_conf *conf) /* Display the current configuration */ eh_display_conf(conf); - /* Stop eth devices before setting up adapter */ - RTE_ETH_FOREACH_DEV(port_id) { - - /* Use only the ports enabled */ - if ((conf->eth_portmask & (1 << port_id)) == 0) - continue; - - rte_eth_dev_stop(port_id); - } - /* Setup eventdev */ ret = eh_initialize_eventdev(em_conf); if (ret < 0) { @@ -1589,21 +1578,6 @@ eh_devs_init(struct eh_conf *conf) return ret; } - /* Start eth devices after setting up adapter */ - RTE_ETH_FOREACH_DEV(port_id) { - - /* Use only the ports enabled */ - if ((conf->eth_portmask & (1 << port_id)) == 0) - continue; - - ret = rte_eth_dev_start(port_id); - if (ret < 0) { - EH_LOG_ERR("Failed to start eth dev %d, %d", - port_id, ret); - return ret; - } - } - return 0; } diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 5fde4f7..e03bd89 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -2829,6 +2829,19 @@ main(int32_t argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "eh_devs_init failed, err=%d\n", ret); + /* Replicate each context per socket */ + for (i = 0; i < NB_SOCKETS && i < rte_socket_count(); i++) { + socket_id = rte_socket_id_by_idx(i); + if ((socket_ctx[socket_id].mbuf_pool != NULL) && + (socket_ctx[socket_id].sa_in == NULL) && + (socket_ctx[socket_id].sa_out == NULL)) { + sa_init(&socket_ctx[socket_id], socket_id); + sp4_init(&socket_ctx[socket_id], socket_id); + sp6_init(&socket_ctx[socket_id], socket_id); + rt_init(&socket_ctx[socket_id], socket_id); + } + } + /* start ports */ RTE_ETH_FOREACH_DEV(portid) { if ((enabled_port_mask & (1 << portid)) == 0) @@ -2866,19 +2879,6 @@ main(int32_t argc, char **argv) rte_exit(EXIT_FAILURE, "failed at reassemble init"); } - /* Replicate each context per socket */ - for (i = 0; i < NB_SOCKETS && i < rte_socket_count(); i++) { - socket_id = rte_socket_id_by_idx(i); - if ((socket_ctx[socket_id].mbuf_pool != NULL) && - (socket_ctx[socket_id].sa_in == NULL) && - (socket_ctx[socket_id].sa_out == NULL)) { - sa_init(&socket_ctx[socket_id], socket_id); - sp4_init(&socket_ctx[socket_id], socket_id); - sp6_init(&socket_ctx[socket_id], socket_id); - rt_init(&socket_ctx[socket_id], socket_id); - } - } - check_all_ports_link_status(enabled_port_mask); /* launch per-lcore init on every lcore */ -- 2.7.4