From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0056.outbound.protection.outlook.com [104.47.41.56]) by dpdk.org (Postfix) with ESMTP id 66D7611D4 for ; Mon, 22 Jan 2018 14:11:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UgmtJk7w5/1A8nPIR18FdhXx/tZqRTF+r/XzUROhMDA=; b=f3n35bLEAZg9VxQ2kbtt3P9jOlJwk5G51q3Zs14t5mAPkY0U6rabKt72A9BnCunT/OaMhX0vYvv/NPe7CmftinSlzlLjBHM33VwtgY5bK8FNlHQjQbRpF7bOuNzuwOyZRHZP1ykXTXd7Mp8pfPLjMMLJKBHPsgkEjb3mDatRAuw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com (115.113.156.2) by SN2PR0701MB1071.namprd07.prod.outlook.com (2a01:111:e400:341f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Mon, 22 Jan 2018 13:11:53 +0000 From: Anoob Joseph To: Akhil Goyal , Declan Doherty , Radu Nicolau , Sergio Gonzalez Monroy Cc: Anoob Joseph , Jerin Jacob , Narayana Prasad , Nelio Laranjeiro , dev@dpdk.org Date: Mon, 22 Jan 2018 13:11:08 +0000 Message-Id: <1516626668-9031-4-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516626668-9031-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1516626668-9031-1-git-send-email-anoob.joseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: MWHPR14CA0068.namprd14.prod.outlook.com (2603:10b6:300:81::30) To SN2PR0701MB1071.namprd07.prod.outlook.com (2a01:111:e400:341f::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 39265e22-fe7d-44ef-9b4a-08d56199b6b2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534125)(4602075)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020); SRVR:SN2PR0701MB1071; X-Microsoft-Exchange-Diagnostics: 1; SN2PR0701MB1071; 3:rA+m0y0DCGetYmpmgJHGJJlE/VhbIel8cOo67aTqO8fEpwJmEeHUXjrHHZcTlGvF1qBx+SPe99l59cx2VrTmFOOO0shQZcWZNSul7AmbbcV0sxNMQmL6tbY1QBksGD1ByVqstsEWRUaz35G9h/JjNqu7ZUO0/PG6OOTJ6TdAV/JzindkWEzK+nY9DAxUF+kt3zDuN4PvIDp1obilh+F3wSgNbkgOUWTetFHo422jOksV1NGu1YQFRBAaKyfmR0Qz; 25:SNemt4tnHSYCeB1T0Uw89LaG9TPP/rQtb7QWENoaOmF/TXjugRTLW5ksKCOD9IG39URC2ZWG/X6vcGO5tO9VwqwVc1opQ19eXjArJokT+hdBP/cqTb2oRHB0TlhFOWg1wGIG3CbEfQ/566keAXM6jWUi5aOEwcBfjjrBfpuCPwkkd6Opy72jK1cBR8WaIMy0OGeveZtJi82Fg67oFK75H88TbYYiE/F7L2DmeLm6EF5PK53Pw+UZbmQlxF3xraaGPJ6qV1U8OS3PGqXpzIyX1zAlDNhODwZF8RT6Yqjei9zIMQWLhD2cuZBbmB2DbgZ1mac4GOUBymu9haxwbSi1wA==; 31:0RwmWAEp4ft4BqErHQu12q+2uTfuJhAnqOufczFp2jBKsAaM5b5RVIpGBETln14p/MbIsvZxgp4pVHUtFS6qnNuKitSYua7f2nlgUY5m74273LLZcSmMUYq1kqMvINNdbcawPIjlJbi26iA/P7coU5UkAO74QTHaGophKaDQ/x6tbrFIce6uS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-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(3231023)(2400081)(944501161)(6041288)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:SN2PR0701MB1071; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN2PR0701MB1071; X-Forefront-PRVS: 0560A2214D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(376002)(396003)(39850400004)(366004)(346002)(199004)(189003)(6506007)(47776003)(16526018)(69596002)(72206003)(8936002)(8656006)(25786009)(6512007)(3846002)(6116002)(68736007)(53936002)(6486002)(4326008)(386003)(8676002)(66066001)(6666003)(2906002)(55236004)(2950100002)(50466002)(81166006)(36756003)(81156014)(42882006)(110136005)(54906003)(106356001)(16586007)(48376002)(316002)(105586002)(53416004)(478600001)(305945005)(50226002)(7736002)(5660300001)(51416003)(97736004)(52116002)(76176011)(26005)(59450400001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR0701MB1071; H:ajoseph83.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR0701MB1071; 23:3iJ8YRyajGjleJm06NhA+qpkPL+IR3GPuEzjwbs?= =?us-ascii?Q?f5Vsi/xAlKtlMx0Y35qmnDyLI0fULrNoD/Xr/UlxjNMuCy90SOPovGoJ8xHC?= =?us-ascii?Q?ixbnN17yJrAr/TvQgjxTgugaEo0NY1OS+f1riDmlIBWelMWsI/ohZhwIeu1+?= =?us-ascii?Q?rnY+wB8hJUfulsog93vvQ2aAkmtYJifhuLpMZ69sPXioBwU8LC0nUghEh+65?= =?us-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JMSAO5c1gy/v0if0cQimoN+fKAHONfjftcjWocqemFmkZpQ2H2LSyI+prD/nnA6m+IECz2ZyaDrN70jdHH2JRN81BTsJu5F SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2018 13:11:53.5529 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 39265e22-fe7d-44ef-9b4a-08d56199b6b2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR0701MB1071 Subject: [dpdk-dev] [RFC 3/3] examples/ipsec-secgw: support for setting seq no 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: , X-List-Received-Date: Mon, 22 Jan 2018 13:11:58 -0000 Adding support for setting sequence number for inline protocol processed packets. Signed-off-by: Anoob Joseph --- examples/ipsec-secgw/esp.h | 9 +++++++++ examples/ipsec-secgw/ipsec.c | 42 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/examples/ipsec-secgw/esp.h b/examples/ipsec-secgw/esp.h index 792312c..ec9dbd1 100644 --- a/examples/ipsec-secgw/esp.h +++ b/examples/ipsec-secgw/esp.h @@ -6,6 +6,15 @@ struct mbuf; +static inline int +esp_inline_protocol_fill_mdata(struct ipsec_sa *sa, + struct rte_security_ipsec_mdata *md_ipsec) +{ + /* Set sequence number */ + md_ipsec->seq_no = ++(sa->seq); + + return 0; +} int esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index 05e89a1..d602c6b 100644 --- a/examples/ipsec-secgw/ipsec.c +++ b/examples/ipsec-secgw/ipsec.c @@ -359,6 +359,40 @@ enqueue_cop(struct cdev_qp *cqp, struct rte_crypto_op *cop) } } +static inline int +inline_protocol_set_pkt_metadata(struct ipsec_sa *sa, struct rte_mbuf *pkt) +{ + int ret; + struct rte_security_mdata md = { 0 }; + + md.sess = sa->sec_session; + + ret = esp_inline_protocol_fill_mdata(sa, &md.ipsec); + + if (ret != 0) { + RTE_LOG(ERR, IPSEC, + "Could not generate per packet metadata for IPsec offload\n"); + return ret; + } + + /* Update flags to hint the PMD to use seq_no provided */ + md.mdata_flags.set = RTE_SECURITY_IPSEC_MDATA_FLAGS_SEQ_NO; + + rte_security_set_pkt_metadata(sa->security_ctx, &md, pkt); + + return 0; +} + +static inline void +inline_crypto_set_pkt_metadata(struct ipsec_sa *sa, struct rte_mbuf *pkt) +{ + struct rte_security_mdata mdata = { 0 }; + + mdata.sess = sa->sec_session; + + rte_security_set_pkt_metadata(sa->security_ctx, &mdata, pkt); +} + static inline void ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx, struct rte_mbuf *pkts[], struct ipsec_sa *sas[], @@ -434,9 +468,7 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx, cqp = &ipsec_ctx->tbl[sa->cdev_id_qp]; cqp->ol_pkts[cqp->ol_pkts_cnt++] = pkts[i]; if (sa->ol_flags & RTE_SECURITY_TX_OLOAD_NEED_MDATA) - rte_security_set_pkt_metadata( - sa->security_ctx, - sa->sec_session, pkts[i], NULL); + inline_protocol_set_pkt_metadata(sa, pkts[i]); continue; case RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO: priv->cop.type = RTE_CRYPTO_OP_TYPE_SYMMETRIC; @@ -462,9 +494,7 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx, cqp = &ipsec_ctx->tbl[sa->cdev_id_qp]; cqp->ol_pkts[cqp->ol_pkts_cnt++] = pkts[i]; if (sa->ol_flags & RTE_SECURITY_TX_OLOAD_NEED_MDATA) - rte_security_set_pkt_metadata( - sa->security_ctx, - sa->sec_session, pkts[i], NULL); + inline_crypto_set_pkt_metadata(sa, pkts[i]); continue; } -- 2.7.4