From patchwork Thu Jan 30 16:38:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anoob Joseph X-Patchwork-Id: 65381 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D4504A0524; Thu, 30 Jan 2020 17:39:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0EAAC1BFE6; Thu, 30 Jan 2020 17:39:12 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 51C281BFE0 for ; Thu, 30 Jan 2020 17:39:10 +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 00UGaEwb002098; Thu, 30 Jan 2020 08:39:09 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=Vj0P46cAcrnD8X4o0gBjnUM8XECjJIXP9OnZ1oYFqNw=; b=f7rfjyKp9P5xCGg5JPODS6brR7Uy9sIiok93/Eqnqc86ud0X35uTlU3hgbnXhyYvr+jz 9dFn0TXJ9soLvHA+D+AADeaPxb/kkwfYrQ6XFHpEWMBHDdPKmvdBgu2eOClmaHsgRkZO HldJJS3iULWZtCht65z5RmHMC686SS9YivxKuaGtYKrGJX5TL6rxavz9SU46Ivwz7nFR hRC2jkDByXAWm1azBq2YXf1hRYRl0vdEMobVwtif5I5qgydL6DI3nJhz4Y9fcHXFQ4v9 5YHvz/lAdmsfQ24MHoq8aRZlSsnTd0+0xrrERI3E5XBc+ghJ28fzdRIbQEg7w+Fl+Scy zg== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2xupkhtxq7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 30 Jan 2020 08:39:09 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 30 Jan 2020 08:39:08 -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; Thu, 30 Jan 2020 08:39:08 -0800 Received: from ajoseph83.caveonetworks.com (unknown [10.29.45.60]) by maili.marvell.com (Postfix) with ESMTP id 8F5A63F7040; Thu, 30 Jan 2020 08:39:05 -0800 (PST) From: Anoob Joseph To: Akhil Goyal , Radu Nicolau CC: Anoob Joseph , Jerin Jacob , Narayana Prasad , Lukasz Bartosik , Konstantin Ananyev , Date: Thu, 30 Jan 2020 22:08:38 +0530 Message-ID: <1580402318-3307-1-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1578667598-18942-1-git-send-email-anoobj@marvell.com> References: <1578667598-18942-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-01-30_05:2020-01-28, 2020-01-30 signatures=0 Subject: [dpdk-dev] [PATCH v2] 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 Signed-off-by: Lukasz Bartosik --- examples/ipsec-secgw/ipsec-secgw.c | 32 ++++++++++++++++++++++---------- examples/ipsec-secgw/ipsec.c | 13 +++++++------ examples/ipsec-secgw/ipsec.h | 9 ++++++++- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 3b5aaf6..b49dfef 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -72,7 +72,7 @@ #define MAX_LCORE_PARAMS 1024 -#define UNPROTECTED_PORT(port) (unprotected_port_mask & (1 << portid)) +#define UNPROTECTED_PORT(port) (unprotected_port_mask & (1 << port)) /* * Configurable number of RX/TX ring descriptors @@ -968,20 +968,25 @@ route6_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint8_t nb_pkts) } static inline void -process_pkts(struct lcore_conf *qconf, struct rte_mbuf **pkts, - uint8_t nb_pkts, uint16_t portid) +process_pkts(struct lcore_conf *qconf, struct lcore_rx_queue *rx_queue, + struct rte_mbuf **pkts, uint8_t nb_pkts) { struct ipsec_traffic traffic; prepare_traffic(pkts, &traffic, nb_pkts); + qconf->inbound.port_id = rx_queue->port_id; + qconf->inbound.queue_id = rx_queue->queue_id; + qconf->outbound.port_id = rx_queue->port_id; + qconf->outbound.queue_id = rx_queue->queue_id; + if (unlikely(single_sa)) { - if (UNPROTECTED_PORT(portid)) + if (UNPROTECTED_PORT(rx_queue->port_id)) process_pkts_inbound_nosp(&qconf->inbound, &traffic); else process_pkts_outbound_nosp(&qconf->outbound, &traffic); } else { - if (UNPROTECTED_PORT(portid)) + if (UNPROTECTED_PORT(rx_queue->port_id)) process_pkts_inbound(&qconf->inbound, &traffic); else process_pkts_outbound(&qconf->outbound, &traffic); @@ -1169,7 +1174,7 @@ main_loop(__attribute__((unused)) void *dummy) pkts, MAX_PKT_BURST); if (nb_rx > 0) - process_pkts(qconf, pkts, nb_rx, portid); + process_pkts(qconf, &rxql[i], pkts, nb_rx); /* dequeue and process completed crypto-ops */ if (UNPROTECTED_PORT(portid)) @@ -1709,6 +1714,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; @@ -1722,7 +1729,9 @@ add_mapping(struct rte_hash *map, const char *str, uint16_t cdev_id, return 0; for (i = 0; i < ipsec_ctx->nb_qps; i++) - if (ipsec_ctx->tbl[i].id == cdev_id) + if (ipsec_ctx->tbl[i].id == cdev_id && + ipsec_ctx->tbl[i].port_id == key.port_id && + ipsec_ctx->tbl[i].port_queue_id == key.queue_id) break; if (i == ipsec_ctx->nb_qps) { @@ -1733,9 +1742,12 @@ add_mapping(struct rte_hash *map, const char *str, uint16_t cdev_id, } ipsec_ctx->tbl[i].id = cdev_id; ipsec_ctx->tbl[i].qp = qp; + ipsec_ctx->tbl[i].port_id = key.port_id; + ipsec_ctx->tbl[i].port_queue_id = key.queue_id; ipsec_ctx->nb_qps++; - printf("%s cdev mapping: lcore %u using cdev %u qp %u " - "(cdev_id_qp %lu)\n", str, key.lcore_id, + printf("%s cdev mapping: lcore %u, portid %u, queueid %u " + "using cdev %u qp %u (cdev_id_qp %lu)\n", + str, key.lcore_id, key.port_id, key.queue_id, cdev_id, qp, i); } @@ -1849,7 +1861,7 @@ cryptodevs_init(void) rte_panic("Failed to create cdev_map hash table, errno = %d\n", rte_errno); - printf("lcore/cryptodev/qp mappings:\n"); + printf("lcore/portid/queueid/cryptodev/qp mappings:\n"); idx = 0; for (cdev_id = 0; cdev_id < rte_cryptodev_count(); cdev_id++) { diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index d4b5712..68059d8 100644 --- a/examples/ipsec-secgw/ipsec.c +++ b/examples/ipsec-secgw/ipsec.c @@ -63,6 +63,8 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa, struct cdev_key key = { 0 }; key.lcore_id = (uint8_t)rte_lcore_id(); + key.port_id = ipsec_ctx->port_id; + key.queue_id = ipsec_ctx->queue_id; key.cipher_algo = (uint8_t)sa->cipher_algo; key.auth_algo = (uint8_t)sa->auth_algo; @@ -72,12 +74,11 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa, (void **)&cdev_id_qp); if (ret < 0) { RTE_LOG(ERR, IPSEC, - "No cryptodev: core %u, cipher_algo %u, " - "auth_algo %u, aead_algo %u\n", - key.lcore_id, - key.cipher_algo, - key.auth_algo, - key.aead_algo); + "No cryptodev: core %u, port_id %u, " + "queue_id %u, cipher_algo %u, auth_algo %u, " + "aead_algo %u\n", + key.lcore_id, key.port_id, key.queue_id, + key.cipher_algo, key.auth_algo, key.aead_algo); return -1; } diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h index 8e07521..b76cb50 100644 --- a/examples/ipsec-secgw/ipsec.h +++ b/examples/ipsec-secgw/ipsec.h @@ -180,6 +180,8 @@ struct cdev_qp { uint16_t qp; uint16_t in_flight; uint16_t len; + uint16_t port_id; + uint16_t port_queue_id; struct rte_crypto_op *buf[MAX_PKT_BURST] __rte_aligned(sizeof(void *)); }; @@ -197,10 +199,15 @@ struct ipsec_ctx { uint16_t ol_pkts_cnt; uint64_t ipv4_offloads; uint64_t ipv6_offloads; + /* port_id and queue_id are used to select crypto qp */ + uint16_t port_id; + uint16_t queue_id; }; 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;