From patchwork Tue Oct 31 16:00:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 117645 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4092378qgn; Tue, 31 Oct 2017 09:02:52 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RiU2nQLQkF3A6xXz9G4ksr4CgcGa076fDXV76J7ONbaCXN8GlWS7TK0zQig34fP3gygrQh X-Received: by 10.200.63.167 with SMTP id d36mr3773968qtk.7.1509465772735; Tue, 31 Oct 2017 09:02:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509465772; cv=none; d=google.com; s=arc-20160816; b=HBk1jpNsVPCy5FVm9QPAnQFPKqLkLF02i/B2w6tuEPMBsDYdcxlBDoAjFJdx+VFVlo 3HtsUSVFYyE+t+krBfh6Qux9agRinSwOKNY4R7pgDwUONTcQDPiDwh4KwQL5VFU6SDKB 5F1Oh3Lf7UTF0d5xQkYJ/Jc0JSJx1kLvIPzdAiU/6OlSWQsVxtQrGqfsoShY/67gDYx5 XzspAOt6+tGtDGT2clpNADhJ7BNzhh97Ovy/kZIVzZQcVXldgU2F7GFgs2D/8e44zOuR 4RYbB05tCJSyxQqBhGkv/l0tTz57g77MsU0RnUdmkZp4MxYCt50k/MUinAZkIGYj2nYX v3VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=pkxu7sx72BuXNR3hzUAAvA7NzgmcP4tA2eogXUh4SAo=; b=n8B++BsTuu28ylVJy9jcMybBi0QRa/shViIiLbv9zIa6PI//X0/Mym7kX9STzu5ArI p2EoI8ODyg4q9QSaOxrPB3bnL5D0WpBY52P/RCdpaZnZ6/Nx/QV31iukNwCpxbcTvOPP BRfLySUtYggnzLys+7pkTcwhrX/K0QJKthjSMvk/WaxiEnAaqirW+t5I0HXdUoe3I3Cr IyRK/KvKHkEcv667OAAWkMTNG7dMCwn2S+Ik/U7BFxwqxghVUx5+Gx1Esucp1pqI65ft tgoXoObIWoASc/5yoFCiExY9BKsBMddMrhyrek1DRkJl4hiHaG4qGDYHnr7vjnjBtgg7 oNWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id n89si1695813qte.52.2017.10.31.09.02.52; Tue, 31 Oct 2017 09:02:52 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id E2EA660B3D; Tue, 31 Oct 2017 16:02:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 94F6660C0C; Tue, 31 Oct 2017 16:00:56 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 59B9460C2F; Tue, 31 Oct 2017 16:00:31 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id 9AF0C6069D for ; Tue, 31 Oct 2017 16:00:22 +0000 (UTC) Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 5BF39471C4 for ; Tue, 31 Oct 2017 19:00:21 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id gC9rXNIrVy-0LDmZROr; Tue, 31 Oct 2017 19:00:21 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id fRI2MH6OIq-0Ko46e8E; Tue, 31 Oct 2017 19:00:20 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 31 Oct 2017 19:00:07 +0300 Message-Id: <1509465617-2530-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509465617-2530-1-git-send-email-odpbot@yandex.ru> References: <1509465617-2530-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 243 Subject: [lng-odp] [PATCH API-NEXT v4 3/13] validation: ipsec: verify odp_ipsec_sa_context X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 243 (lumag:ipsec-packet-impl-3) ** https://github.com/Linaro/odp/pull/243 ** Patch: https://github.com/Linaro/odp/pull/243.patch ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375 ** Merge commit sha: edc1f88ae0a1e8cae8a229f024181ded1f17de56 **/ test/validation/api/ipsec/ipsec.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index a8fdf2b14..853bd88a9 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -19,6 +19,9 @@ struct suite_context_s suite_context; #define PKT_POOL_NUM 64 #define PKT_POOL_LEN (1 * 1024) +#define PACKET_USER_PTR ((void *)0x1212fefe) +#define IPSEC_SA_CTX ((void *)0xfefefafa) + static odp_pktio_t pktio_create(odp_pool_t pool) { odp_pktio_t pktio; @@ -300,6 +303,8 @@ void ipsec_sa_param_fill(odp_ipsec_sa_param_t *param, param->dest_queue = suite_context.queue; + param->context = IPSEC_SA_CTX; + param->crypto.cipher_alg = cipher_alg; if (cipher_key) param->crypto.cipher_key = *cipher_key; @@ -317,6 +322,8 @@ void ipsec_sa_destroy(odp_ipsec_sa_t sa) odp_event_t event; odp_ipsec_status_t status; + CU_ASSERT_EQUAL(IPSEC_SA_CTX, odp_ipsec_sa_context(sa)); + CU_ASSERT_EQUAL(ODP_IPSEC_OK, odp_ipsec_sa_disable(sa)); if (ODP_QUEUE_INVALID != suite_context.queue) { @@ -339,8 +346,6 @@ void ipsec_sa_destroy(odp_ipsec_sa_t sa) CU_ASSERT_EQUAL(ODP_IPSEC_OK, odp_ipsec_sa_destroy(sa)); } -#define PACKET_USER_PTR ((void *)0x1212fefe) - odp_packet_t ipsec_packet(const ipsec_test_packet *itp) { odp_packet_t pkt = odp_packet_alloc(suite_context.pool, itp->len); @@ -608,7 +613,13 @@ void ipsec_check_in_one(const ipsec_test_part *part, odp_ipsec_sa_t sa) CU_ASSERT_EQUAL(0, odp_ipsec_result(&result, pkto[i])); CU_ASSERT_EQUAL(part->out[i].status.error.all, result.status.error.all); + CU_ASSERT_EQUAL(suite_context.inbound_op_mode == + ODP_IPSEC_OP_MODE_INLINE, + result.flag.inline_mode); CU_ASSERT_EQUAL(sa, result.sa); + if (ODP_IPSEC_SA_INVALID != sa) + CU_ASSERT_EQUAL(IPSEC_SA_CTX, + odp_ipsec_sa_context(sa)); } ipsec_check_packet(part->out[i].pkt_out, pkto[i]); @@ -642,6 +653,8 @@ void ipsec_check_out_one(const ipsec_test_part *part, odp_ipsec_sa_t sa) CU_ASSERT_EQUAL(part->out[i].status.error.all, result.status.error.all); CU_ASSERT_EQUAL(sa, result.sa); + CU_ASSERT_EQUAL(IPSEC_SA_CTX, + odp_ipsec_sa_context(sa)); } ipsec_check_packet(part->out[i].pkt_out, pkto[i]); @@ -679,6 +692,8 @@ void ipsec_check_out_in_one(const ipsec_test_part *part, CU_ASSERT_EQUAL(part->out[i].status.error.all, result.status.error.all); CU_ASSERT_EQUAL(sa, result.sa); + CU_ASSERT_EQUAL(IPSEC_SA_CTX, + odp_ipsec_sa_context(sa)); } CU_ASSERT_FATAL(odp_packet_len(pkto[i]) <= sizeof(pkt_in.data));