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 C09A3A04F9; Fri, 10 Jan 2020 15:47:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 085E41EAB1; Fri, 10 Jan 2020 15:47:15 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 63F711EAAA for ; Fri, 10 Jan 2020 15:47:12 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00AEimHF011630; Fri, 10 Jan 2020 06:47:11 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=V2ax9Xn3flsuSbcxpDeMVztYSWutRXShK1nE2LqjJIA=; b=VfaagJF8YSyZ3XDyH8GvsPVdJt6nx2nu5uVfGZbMq90bDeQ0SrxtgEfME6VMl9rEGa0Z uwI4+vQU1FwiiVZQQXroYuzMeiNE7MA440INZYaHRjGTBVyFucNFOrpKJsNUFlppKgNJ MZguYi89jQhb2ByhNds7jw4aCexEtK4wsi7/Z/oqFlOkz27xA8CgMWqZKGaFBx1P/12J 1uHk8Ev/uUlWYI7pWh3lhVcJTKQgwjJfrgArBXgVym/GHtY4Ypg4FnfMZ2B44SG86mc2 78Cs98zOYJkRZ1MaeY0d5o6TH9Q86SUj0IqDcao14M6qGzZAsguZQeBSbUhFTYT+yXA4 cg== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2xeqey8r2v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 10 Jan 2020 06:47:11 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 10 Jan 2020 06:47:09 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 10 Jan 2020 06:47:10 -0800 Received: from ajoseph83.caveonetworks.com (unknown [10.29.45.60]) by maili.marvell.com (Postfix) with ESMTP id 66EAA3F7040; Fri, 10 Jan 2020 06:47:07 -0800 (PST) From: Anoob Joseph To: Akhil Goyal , Konstantin Ananyev , Radu Nicolau CC: Anoob Joseph , Jerin Jacob , Lukasz Bartosik , Narayana Prasad , Date: Fri, 10 Jan 2020 20:16:38 +0530 Message-ID: <1578667598-18942-1-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-01-10_01:2020-01-10, 2020-01-09 signatures=0 Subject: [dpdk-dev] [PATCH] examples/ipsec-secgw: increase number of qps to lcore_params 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" Currently only one qp will be used for one core. The number of qps can be increased to match the number of lcore params. Signed-off-by: Anoob Joseph --- examples/ipsec-secgw/ipsec-secgw.c | 39 +++++++++++++++++++------------------- examples/ipsec-secgw/ipsec.h | 4 +++- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 3b5aaf6..d8c435e 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1709,6 +1709,8 @@ add_mapping(struct rte_hash *map, const char *str, uint16_t cdev_id, unsigned long i; struct cdev_key key = { 0 }; + key.port_id = params->port_id; + key.queue_id = params->queue_id; key.lcore_id = params->lcore_id; if (cipher) key.cipher_algo = cipher->sym.cipher.algo; @@ -1721,23 +1723,17 @@ add_mapping(struct rte_hash *map, const char *str, uint16_t cdev_id, if (ret != -ENOENT) return 0; - for (i = 0; i < ipsec_ctx->nb_qps; i++) - if (ipsec_ctx->tbl[i].id == cdev_id) - break; - - if (i == ipsec_ctx->nb_qps) { - if (ipsec_ctx->nb_qps == MAX_QP_PER_LCORE) { - printf("Maximum number of crypto devices assigned to " - "a core, increase MAX_QP_PER_LCORE value\n"); - return 0; - } - ipsec_ctx->tbl[i].id = cdev_id; - ipsec_ctx->tbl[i].qp = qp; - ipsec_ctx->nb_qps++; - printf("%s cdev mapping: lcore %u using cdev %u qp %u " - "(cdev_id_qp %lu)\n", str, key.lcore_id, - cdev_id, qp, i); + i = ipsec_ctx->nb_qps; + if (ipsec_ctx->nb_qps == MAX_QP_PER_LCORE) { + printf("Maximum number of crypto devices assigned to a core, " + "increase MAX_QP_PER_LCORE value\n"); + return 0; } + ipsec_ctx->tbl[i].id = cdev_id; + ipsec_ctx->tbl[i].qp = qp; + ipsec_ctx->nb_qps++; + printf("%s cdev mapping: lcore %u using cdev %u qp %u " + "(cdev_id_qp %lu)\n", str, key.lcore_id, cdev_id, qp, i); ret = rte_hash_add_key_data(map, &key, (void *)i); if (ret < 0) { @@ -1785,8 +1781,10 @@ add_cdev_mapping(struct rte_cryptodev_info *dev_info, uint16_t cdev_id, continue; if (i->sym.xform_type == RTE_CRYPTO_SYM_XFORM_AEAD) { - ret |= add_mapping(map, str, cdev_id, qp, params, + ret = add_mapping(map, str, cdev_id, qp, params, ipsec_ctx, NULL, NULL, i); + if (ret) + return ret; continue; } @@ -1801,12 +1799,15 @@ add_cdev_mapping(struct rte_cryptodev_info *dev_info, uint16_t cdev_id, if (j->sym.xform_type != RTE_CRYPTO_SYM_XFORM_AUTH) continue; - ret |= add_mapping(map, str, cdev_id, qp, params, + ret = add_mapping(map, str, cdev_id, qp, params, ipsec_ctx, i, j, NULL); + if (ret) + return ret; + continue; } } - return ret; + return 0; } /* Check if the device is enabled by cryptodev_mask */ diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h index 8e07521..92fd5eb 100644 --- a/examples/ipsec-secgw/ipsec.h +++ b/examples/ipsec-secgw/ipsec.h @@ -200,7 +200,9 @@ struct ipsec_ctx { }; struct cdev_key { - uint16_t lcore_id; + uint16_t port_id; + uint8_t queue_id; + uint8_t lcore_id; uint8_t cipher_algo; uint8_t auth_algo; uint8_t aead_algo; -- 2.7.4