From patchwork Tue Sep 8 09:15:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Dwivedi X-Patchwork-Id: 76898 X-Patchwork-Delegate: jerinj@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 1D334A04AA; Tue, 8 Sep 2020 11:17:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0537E1C1AF; Tue, 8 Sep 2020 11:16:10 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 0F16B1C0CA for ; Tue, 8 Sep 2020 11:16:03 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0889AxwG007267; Tue, 8 Sep 2020 02:16:03 -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=pfpt0220; bh=y+CnRYVh9T6ULkTDdfsqJ813qCek04+gvjl/10+kJ8k=; b=B4Hg5ZLd1j9S9prFre5XeMZOxnkjdDLzlQUzPnyn9drT9+7xxGVjg5nELmwkUjCC6fa0 wf44sWYxKc1HM0rJtLs7H5fHn2RZHPI1U3/FrZ29DuzlH8qm3m/6iFHYWsIu277pUf/w 59gCZyqA2CfVJr+FbpkYN/7j4C/dRIUB2D+EJ09nevwx6JzfDBogXHzxhKZcrVrsYuAt o0gXdzqSGSz8JbGIP+y200olNAIk1xQCr9kSlKZ6LxS08RegW19jI+BQd+6zxbjeiSWL xL4eL6BLXiQvPJAjQ/yoolZkSLj69TfXFPxOzTNoEBIqTqK2s43Dpn5z1f5GgjuFc5m1 qw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 33ccvr1q8h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 08 Sep 2020 02:16:03 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 8 Sep 2020 02:16:02 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 8 Sep 2020 02:16:01 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 8 Sep 2020 02:16:01 -0700 Received: from hyd1349.t110.caveonetworks.com (unknown [10.29.45.13]) by maili.marvell.com (Postfix) with ESMTP id 323C93F7043; Tue, 8 Sep 2020 02:15:58 -0700 (PDT) From: Ankur Dwivedi To: CC: , , , Ankur Dwivedi Date: Tue, 8 Sep 2020 14:45:32 +0530 Message-ID: <20200908091534.24305-2-adwivedi@marvell.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908091534.24305-1-adwivedi@marvell.com> References: <20200908091534.24305-1-adwivedi@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-08_04:2020-09-08, 2020-09-08 signatures=0 Subject: [dpdk-dev] [PATCH 1/3] test/event_crypto_adapter: return error with unsupported mode 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" The capability of a event device should be checked before creating a event crypto adapter in a particular mode. The test case returns error if the mode is not supported. Signed-off-by: Ankur Dwivedi Acked-by: abhinandan.gujjar@intel.com (For series) --- app/test/test_event_crypto_adapter.c | 30 ++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c index 8d42462d8..930c2a9bc 100644 --- a/app/test/test_event_crypto_adapter.c +++ b/app/test/test_event_crypto_adapter.c @@ -750,15 +750,23 @@ configure_event_crypto_adapter(enum rte_event_crypto_adapter_mode mode) uint32_t cap; int ret; + ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID, &cap); + TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n"); + + if ((mode == RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD) && + !(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD)) + return -ENOTSUP; + + if ((mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW) && + !(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW)) + return -ENOTSUP; + /* Create adapter with default port creation callback */ ret = rte_event_crypto_adapter_create(TEST_ADAPTER_ID, - TEST_CDEV_ID, + evdev, &conf, mode); TEST_ASSERT_SUCCESS(ret, "Failed to create event crypto adapter\n"); - ret = rte_event_crypto_adapter_caps_get(TEST_ADAPTER_ID, evdev, &cap); - TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n"); - if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND) { ret = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID, TEST_CDEV_ID, TEST_CDEV_QP_ID, &response_info); @@ -813,6 +821,8 @@ test_crypto_adapter_conf(enum rte_event_crypto_adapter_mode mode) TEST_ASSERT(ret >= 0, "Failed to link queue %d " "port=%u\n", qid, params.crypto_event_port_id); + } else { + return ret; } crypto_adapter_setup_done = 1; } @@ -845,24 +855,24 @@ static int test_crypto_adapter_conf_op_forward_mode(void) { enum rte_event_crypto_adapter_mode mode; + int ret; mode = RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD; - TEST_ASSERT_SUCCESS(test_crypto_adapter_conf(mode), - "Failed to config crypto adapter"); + ret = test_crypto_adapter_conf(mode); - return TEST_SUCCESS; + return ret; } static int test_crypto_adapter_conf_op_new_mode(void) { enum rte_event_crypto_adapter_mode mode; + int ret; mode = RTE_EVENT_CRYPTO_ADAPTER_OP_NEW; - TEST_ASSERT_SUCCESS(test_crypto_adapter_conf(mode), - "Failed to config crypto adapter"); + ret = test_crypto_adapter_conf(mode); - return TEST_SUCCESS; + return ret; }