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 E1AF9A3160 for ; Wed, 9 Oct 2019 17:12:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9E34B1E94A; Wed, 9 Oct 2019 17:11:29 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 8BA321E89B for ; Wed, 9 Oct 2019 17:11:21 +0200 (CEST) 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 x99Et8xi020602; Wed, 9 Oct 2019 08:11:20 -0700 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=MNlbma6HTJ5sOrDF2bb7tsCngxfCCeOfVej1bmzS4YA=; b=JCDczx0+1aSN80ScC/0rIOAl8fdSvQLBLOUsJsrVX/fWt9323Zah8OuSXHXQz4piOSQf M8An1OeG9EVZEz8ruA/oVcmDxnWd5APspPMW0XIQHmKoX60CQq8h48iHKg+IEXWIO5MA XtVSBtVoqJV8RNwP7Vx0eDCIOgPYG7pQf4jHIEfYj5HSEKH9Ox3h+E/xLo3FLRSyqR+X YrR2lpTTzmaT0hjfUoZgq7DhJWVHjA/SK2yIyL4ecvT+fOj/E5sS1fPyhSuwAlLmvPKd 47nffM7FiiFcPTYOCdu35DSg80JtZCaMdNrilSTrL71Q+CXyJ8cXtMUiGSmKKBvrn7hP rA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2vh5rqjkpt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 09 Oct 2019 08:11:20 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 9 Oct 2019 08:11:19 -0700 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.1367.3 via Frontend Transport; Wed, 9 Oct 2019 08:11:19 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.60]) by maili.marvell.com (Postfix) with ESMTP id BD8793F703F; Wed, 9 Oct 2019 08:11:16 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal , Radu Nicolau CC: Anoob Joseph , Thomas Monjalon , Jerin Jacob , Narayana Prasad , , Lukasz Bartosik Date: Wed, 9 Oct 2019 20:40:14 +0530 Message-ID: <1570633816-4706-12-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1570633816-4706-1-git-send-email-anoobj@marvell.com> References: <1570633816-4706-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-09_06:2019-10-08,2019-10-09 signatures=0 Subject: [dpdk-dev] [RFC PATCH 11/13] examples/ipsec-secgw: add driver outbound worker 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" This patch adds the driver outbound worker thread for ipsec-secgw. In this mode the security session is a fixed one and sa update is not done. Signed-off-by: Anoob Joseph Signed-off-by: Lukasz Bartosik --- examples/ipsec-secgw/ipsec-secgw.c | 6 +++ examples/ipsec-secgw/ipsec.c | 4 ++ examples/ipsec-secgw/ipsec_worker.c | 91 ++++++++++++++++++++++++++++++++++++- 3 files changed, 100 insertions(+), 1 deletion(-) diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 1c102cf..f43e1b1 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1981,6 +1981,12 @@ cryptodevs_init(void) i++; } + /* + * Setting the queue pair to atleast the number of ethernet + * devices for inline outbound. + */ + qp = RTE_MAX(rte_eth_dev_count_avail(), qp); + if (qp == 0) continue; diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index 1145ca1..53a868a 100644 --- a/examples/ipsec-secgw/ipsec.c +++ b/examples/ipsec-secgw/ipsec.c @@ -137,6 +137,8 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa) return 0; } +uint16_t sa_no; +struct rte_security_session *sec_session_fixed[10]; int create_inline_session(struct socket_ctx *skt_ctx, struct ipsec_sa *sa) { @@ -382,6 +384,8 @@ create_inline_session(struct socket_ctx *skt_ctx, struct ipsec_sa *sa) sa->ol_flags = sec_cap->ol_flags; sa->security_ctx = sec_ctx; + sec_session_fixed[sa_no] = sa->sec_session; + sa_no++; } sa->cdev_id_qp = 0; diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c index f93da4d..842fd5d 100644 --- a/examples/ipsec-secgw/ipsec_worker.c +++ b/examples/ipsec-secgw/ipsec_worker.c @@ -263,7 +263,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt, */ /* Workers registered */ -#define IPSEC_EVENTMODE_WORKERS 2 +#define IPSEC_EVENTMODE_WORKERS 3 /* * Event mode worker @@ -425,6 +425,85 @@ ipsec_wrkr_non_burst_int_port_app_mode_inb(struct eh_conf *mode_conf, return; } +/* + * Event mode worker + * Operating parameters : non-burst - Tx internal port - driver mode - outbound + */ +extern struct rte_security_session *sec_session_fixed[10]; +static void +ipsec_wrkr_non_burst_int_port_drvr_mode_outb(struct eh_conf *mode_conf, + struct eh_event_link_info *links, uint8_t nb_links) +{ + struct rte_event ev; + struct rte_mbuf *pkt; + uint32_t lcore_id; + unsigned int nb_rx = 0; + unsigned int portid; + + RTE_SET_USED(mode_conf); + + /* Check if we have links registered for this lcore */ + if (nb_links == 0) { + /* No links registered - exit */ + goto exit; + } + + /* Get core ID */ + lcore_id = rte_lcore_id(); + + RTE_LOG(INFO, IPSEC, + "Launching event mode worker (non-burst - Tx internal port - " + "driver mode - outbound) on lcore %d\n", lcore_id); + + /* We have valid links */ + + /* See if it's single link */ + if (nb_links != 1) { + RTE_LOG(INFO, IPSEC, + "Multiple links not supported. Using first link\n"); + } + + RTE_LOG(INFO, IPSEC, " -- lcoreid=%u event_port_id=%u\n", lcore_id, + links[0].event_portid); + while (!force_quit) { + /* Read packet from event queues */ + nb_rx = rte_event_dequeue_burst(links[0].eventdev_id, + links[0].event_portid, + &ev, /* events */ + 1, /* nb_events */ + 0 /* timeout_ticks */); + + if (nb_rx == 0) + continue; + + portid = ev.queue_id; + pkt = ev.mbuf; + + rte_prefetch0(rte_pktmbuf_mtod(pkt, void *)); + + /* Process packet */ + ipsec_event_pre_forward(pkt, portid); + + pkt->udata64 = (uint64_t) sec_session_fixed[portid]; + + /* Mark the packet for Tx security offload */ + pkt->ol_flags |= PKT_TX_SEC_OFFLOAD; + + /* + * Since tx internal port is available, events can be + * directly enqueued to the adapter and it would be + * internally submitted to the eth device. + */ + rte_event_eth_tx_adapter_enqueue(links[0].eventdev_id, + links[0].event_portid, + &ev, /* events */ + 1 /* nb_events */); + } + +exit: + return; +} + static uint8_t ipsec_eventmode_populate_wrkr_params(struct eh_app_worker_params *wrkrs) { @@ -451,6 +530,16 @@ ipsec_eventmode_populate_wrkr_params(struct eh_app_worker_params *wrkrs) wrkr->cap.ipsec_dir = EH_IPSEC_DIR_TYPE_INBOUND; wrkr->worker_thread = ipsec_wrkr_non_burst_int_port_app_mode_inb; + wrkr++; + nb_wrkr_param++; + + /* Non-burst - Tx internal port - driver mode - outbound */ + wrkr->cap.burst = EH_RX_TYPE_NON_BURST; + wrkr->cap.tx_internal_port = EH_TX_TYPE_INTERNAL_PORT; + wrkr->cap.ipsec_mode = EH_IPSEC_MODE_TYPE_DRIVER; + wrkr->cap.ipsec_dir = EH_IPSEC_DIR_TYPE_OUTBOUND; + wrkr->worker_thread = ipsec_wrkr_non_burst_int_port_drvr_mode_outb; + nb_wrkr_param++; return nb_wrkr_param; } -- 2.7.4