From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0043.outbound.protection.outlook.com [104.47.37.43]) by dpdk.org (Postfix) with ESMTP id 3D91B1B471 for ; Tue, 10 Jul 2018 16:44:48 +0200 (CEST) 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:X-MS-Exchange-SenderADCheck; bh=3V90duVWUjeZRbx2CVdbA1TGmYL+WXo9G9dL7Dgo3xU=; b=dY6IYC1ENXUyGazOYXDoDkGlDcMFrAsdSus4U2tW3FxbL2nTghQvAwx5QjaaylVi8taJ2InLYdmBdG0FGyb70ZAyoHE2vYkB1+bgXN0+opeQnSIjTkEnEu3HouA54Zdvzv5LDqziLR3o1i4bqLCznlxta6v7PnIXreTWTvXOEwY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.caveonetworks.com (115.113.156.2) by DM6PR07MB4905.namprd07.prod.outlook.com (2603:10b6:5:a3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.20; Tue, 10 Jul 2018 14:43:25 +0000 From: Anoob Joseph To: Declan Doherty , Pablo de Lara Cc: Anoob Joseph , Akhil Goyal , Ankur Dwivedi , Jerin Jacob , Narayana Prasad , dev@dpdk.org Date: Tue, 10 Jul 2018 20:12:39 +0530 Message-Id: <1531233760-4929-4-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531233760-4929-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1530712550-18099-1-git-send-email-anoob.joseph@caviumnetworks.com> <1531233760-4929-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: BM1PR01CA0100.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::16) To DM6PR07MB4905.namprd07.prod.outlook.com (2603:10b6:5:a3::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a732149a-cec9-4a80-c39f-08d5e6737ffc X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(5600053)(711020)(2017052603328)(7153060)(7193020); SRVR:DM6PR07MB4905; X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4905; 3:i4fqvzcfPkvNPt35LEVMpHPdy39I0yM5QfiqeeLWbxQn4t8QC26PQ8WSwdEEdHEf5BoidAG7g2+DqNXga0bYxzvD+nIsyT055LlLG76bNY6bfn5XkSqHfMtbTZw/8PA+Bw8NF3co+VrvbpdAIuow0UoDbA++pu2x49RKI3vOd19heT1fudrSv3DtGnhHdaIAfSLvOS1RyeSCvr2w1Sm+00uiePBj72RaEzJjt9LQPj7czvCp2soFarEk2J4pvMfX; 25:MqzT9Fh14rj4h5sNbccEYdRHaHESWCWBqirI8KjZto8IhL0Ax4T73tU9WrxZJDsjbK3qH0TGvbrodKEGAIZVW7hmagSER+LclrXqLb+07GDWSJHyTmouSzulA+ywSJsHghnGSjv93DhRDZIR/bLh3jL+pIVaDLJij9qGL4W7xpcdUfTDGzPenZ6JKWLsai4PrXjyxan/1PXjyEgAgOPA7DPtjFG3UUINjLqkY6mRdJXA2guDI97Ihh9/mHLlRlcHWo8OKaxFvQ6ZyG/1TmwlS9ix3gLaMhGttWNcJY3i1ZixkgtNCfSEtJc3QX1A1Hcrk6devUQaThRt0k4MBQliQw==; 31:5eT4mR2VLDVmAGO9aDqliHgtR7NscF/ZYlSdE8lrmnbCudmlYbPeVpulqOIbaTbAZnWBH2B29tAT/e0xW97HuMgFPq2GavEGgk/E4fbAWyKWSXrz+NegI3tCZxgnTKbHfV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ft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(3002001)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DM6PR07MB4905; BCL:0; PCL:0; RULEID:; SRVR:DM6PR07MB4905; X-Forefront-PRVS: 0729050452 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(376002)(346002)(39860400002)(396003)(366004)(199004)(189003)(14444005)(476003)(26005)(3846002)(16526019)(386003)(54906003)(55236004)(110136005)(2616005)(6506007)(186003)(16586007)(51416003)(6116002)(7736002)(478600001)(105586002)(25786009)(106356001)(305945005)(8676002)(81156014)(81166006)(575784001)(76176011)(44832011)(486006)(956004)(42882007)(68736007)(11346002)(446003)(52116002)(2906002)(316002)(50226002)(8936002)(6666003)(97736004)(5660300001)(50466002)(66066001)(72206003)(36756003)(6512007)(48376002)(6486002)(4326008)(53936002)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR07MB4905; H:ajoseph83.caveonetworks.com.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM6PR07MB4905; 23:+GvSxRixkWJ7E0gpnnPhdrtgajnOWvPCRvvCzDlUX?= =?us-ascii?Q?3H8CDc8Z8dIPIXHyfJ1PT7GdHmPg0DKgS2foCxW9syDymJ6EngmUNlNpP6fV?= =?us-ascii?Q?TNE5fnfeFmN4T334W4V1INv0RPEbEDDicL8Cc5Xxa1ymtp92a+zHFI3n+c5H?= =?us-ascii?Q?vwr5D+dHbbXkk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yPJ?= =?us-ascii?Q?WLqMnzSO0Nevc4gK1FHd/J8kcQ3iVdt3Lsu15xG1ohCWhQoNxI4wWWAzl/in?= =?us-ascii?Q?ifzbFHHNGrnwPfHGQSAJQaMGLrHgWLFjeMJfcDcGfEq7GMCzcqn+5wjbO96P?= =?us-ascii?Q?osScIf/PzOu98fswryRT/nV6JF3WifMp0LY9RGhbyqODkmkDi7kX8fPvispQ?= =?us-ascii?Q?h6rSe82NqwF91A9ZjmlQgLIJpgd9vW5alLgdR6Bn9caIouMkehREGfI0xKoW?= =?us-ascii?B?QT09?= X-Microsoft-Antispam-Message-Info: KRzqvFKBtkBo/WRQMUWVxy9e29IYj3mffRVCpMuThUkOQDJkhpG/RDJcoaVWKnWfutUDma7oGKrbzv2MWtyLIN/Us8WmNZLy6nEuQcZ2AcHR7qN79kfhGEqp0+K4uCUdAVPoo9uqIS657EbmoRu5KjgZSbqDQQm0SjP8KxTmzgFL5axZUdU2tW8xIG4ISKkd3iDGJP3eN85IpA2UbBVvAyTMLiAOyzCyqCtbVyM0LQdzpvTpip2eAIBfo5oMGp9/wmw9e56sFAl+0MLcRwmIozDc8KWlcE+mqBw9kRharLa0JuPqA7wPI444XDiJKMA8BqmblvpRt++zAj5kvWeE/IlyGEBEjSeJguf0lRPCzKk= X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4905; 6:FG3/amtFegluRb2gIP9Rc04Dnixy2CHypekY8IXFh2LN+aoXnUvyxiXDnAHQ94EW7cOHj9fFE64z1cUpDRmW+6dgjJ4vmyAMxn/a726LoqBWWO3vRWV34dS2bL156Zvxpva50nyYQlLSZH9QFKguXBjixggg3PvuSYZTOl7D8cVonwbM5AlfFtckDCeCF9zgHL9duqbIJ5L+mLjmxjD7mRHzzWhRBhuiogCm++ZtBIQoJBlJC6O1s5pvaQSbRHNZ3UMYJuJB3mRdvMYOvTNCsukB1w0SkF15SKrFmHUTS9uOyqzuBjJv0dQXHob7qYJb2XDVxqY4JTGKMvEKNzhjZLYfm4E877oTzqUbISC9oRCJlWBKK7R5RLDD0UO5VpeE/rj2OXg7kCo1puauzsjWAmbjcrSynnJ8J79WY+bdgrSsVJVYwWag+fnTvt8BO0hgYeK3RM+/oLBKUSdsks4yfA==; 5:v/IhwvoLv50TqliJ9VC1ou8un/1MBpt9ex5bf/zqAwba6k+2H2B28r100O+39FJ8t9kknKdgPZb9wamFI3n7XT4AnfxurqHT7qwR94fuU6AmfEmp2fWaC9UjnI1N0CQwOMi1JDWK21Wo9sg3uZa7PtESlEJ7MuE5Tx2wo4ce5X4=; 24:TokeAPK+CvOr/+ZF9q0khNYjkE8ee3l8wFJiwatPNq9Enam6NLeuWb2GBhaodigj1f5/Al2KPyJ26MhREcygRRbL2TRkTrnmg71ab9Zz8wE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4905; 7:ps0w+AytAgSidowFJKLiavOYlWXPH/EAS1oIPX39Fi74zYU+CLn9MVje4swu3bgfovVBwymyD38RvLx+0ZnIx7vxRXR1ne5qgehfQR3TDHLYMXVv09+ungALD2Sgtmxz7UdY5H1jWbY02DDZuIEhNYZDkv3v7aew7TSRDKvnLxfsKHf5OIakqcnKZzp9bNFTkpbMa1y188aA6RnehHMrEOxAWMdDDK7LIVzPxOxhsu07OsVjzVAiFQH10ptRSoqe X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2018 14:43:25.9129 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a732149a-cec9-4a80-c39f-08d5e6737ffc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB4905 Subject: [dpdk-dev] [PATCH v2 3/4] test/crypto: skip validation of head/tailroom used by PMD 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: Tue, 10 Jul 2018 14:44:48 -0000 Crypto PMDs would specify the head/tailroom it would use while processing the crypto requests. This need to be considered while verifying buffers processed by crypto PMDs. Signed-off-by: Anoob Joseph --- v2: * No change v1: * Added patch test/test/test_cryptodev_blockcipher.c | 60 ++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c index 256a7da..c64b0c1 100644 --- a/test/test/test_cryptodev_blockcipher.c +++ b/test/test/test_cryptodev_blockcipher.c @@ -75,8 +75,9 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, int nb_segs = 1; + rte_cryptodev_info_get(dev_id, &dev_info); + if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) { - rte_cryptodev_info_get(dev_id, &dev_info); if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) { printf("Device doesn't support scatter-gather. " @@ -438,11 +439,34 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, uint8_t value; uint32_t head_unchanged_len, changed_len = 0; uint32_t i; + uint32_t hdroom_used = 0, tlroom_used = 0; + uint32_t hdroom = 0; mbuf = sym_op->m_src; + /* + * Crypto PMDs specify the headroom & tailroom it would use + * when processing the crypto operation. PMD is free to modify + * this space, and so the verification check should skip that + * block. + */ + hdroom_used = dev_info.min_mbuf_headroom_req; + tlroom_used = dev_info.min_mbuf_tailroom_req; + + /* Get headroom */ + hdroom = rte_pktmbuf_headroom(mbuf); + head_unchanged_len = mbuf->buf_len; for (i = 0; i < mbuf->buf_len; i++) { + + /* Skip headroom used by PMD */ + if (i == hdroom - hdroom_used) + i += hdroom_used; + + /* Skip tailroom used by PMD */ + if (i == (hdroom + mbuf->data_len)) + i += tlroom_used; + value = *((uint8_t *)(mbuf->buf_addr)+i); if (value != tmp_src_buf[i]) { snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, @@ -455,14 +479,13 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, mbuf = sym_op->m_dst; if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) { - head_unchanged_len = rte_pktmbuf_headroom(mbuf) + - sym_op->auth.data.offset; + head_unchanged_len = hdroom + sym_op->auth.data.offset; changed_len = sym_op->auth.data.length; if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) changed_len += digest_len; } else { /* cipher-only */ - head_unchanged_len = rte_pktmbuf_headroom(mbuf) + + head_unchanged_len = hdroom + sym_op->cipher.data.offset; changed_len = sym_op->cipher.data.length; } @@ -486,15 +509,30 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, uint8_t value; uint32_t head_unchanged_len = 0, changed_len = 0; uint32_t i; + uint32_t hdroom_used = 0, tlroom_used = 0; + uint32_t hdroom = 0; + + /* + * Crypto PMDs specify the headroom & tailroom it would use + * when processing the crypto operation. PMD is free to modify + * this space, and so the verification check should skip that + * block. + */ + hdroom_used = dev_info.min_mbuf_headroom_req; + tlroom_used = dev_info.min_mbuf_tailroom_req; mbuf = sym_op->m_src; + + /* Get headroom */ + hdroom = rte_pktmbuf_headroom(mbuf); + if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) { - head_unchanged_len = rte_pktmbuf_headroom(mbuf) + + head_unchanged_len = hdroom + sym_op->cipher.data.offset; changed_len = sym_op->cipher.data.length; } else { /* auth-only */ - head_unchanged_len = rte_pktmbuf_headroom(mbuf) + + head_unchanged_len = hdroom + sym_op->auth.data.offset + sym_op->auth.data.length; changed_len = 0; @@ -504,8 +542,18 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, changed_len += digest_len; for (i = 0; i < mbuf->buf_len; i++) { + + /* Skip headroom used by PMD */ + if (i == hdroom - hdroom_used) + i += hdroom_used; + if (i == head_unchanged_len) i += changed_len; + + /* Skip tailroom used by PMD */ + if (i == (hdroom + mbuf->data_len)) + i += tlroom_used; + value = *((uint8_t *)(mbuf->buf_addr)+i); if (value != tmp_src_buf[i]) { snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, -- 2.7.4