From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0058.outbound.protection.outlook.com [104.47.33.58]) by dpdk.org (Postfix) with ESMTP id AF77A1BEFC for ; Wed, 4 Jul 2018 15:56:31 +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=RWq0MjC5DPJClmODy74VerCFXpvGMsUaMJg9tZaDRl8=; b=CPmz/xol/QJUco2dqpS6WFgvIBeTewtPk4X8RTg42z78q2NT1PgkN7Y/9ZdRMy2QV7LEJSi7u9G1wYOIHQ9rh57gArL6s2+UL7nSu8Ke0DVR86zAK6K+6t8ADl87ipOJqxUYw2MeMmAqcEtwU1WU7buakGuuQiTSVR830oQLl10= 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 BN7PR07MB4897.namprd07.prod.outlook.com (2603:10b6:406:ef::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.26; Wed, 4 Jul 2018 13:56:27 +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: Wed, 4 Jul 2018 19:25:50 +0530 Message-Id: <1530712550-18099-4-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530712550-18099-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1529389574-6643-1-git-send-email-anoob.joseph@caviumnetworks.com> <1530712550-18099-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: BM1PR0101CA0041.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::27) To BN7PR07MB4897.namprd07.prod.outlook.com (2603:10b6:406:ef::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c34787a2-869a-432e-4d64-08d5e1b5f168 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:BN7PR07MB4897; X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4897; 3:3RI207ZDwtgpddhW47vNRobB4XgJFSJx/BDjCxC7D7G/tb9Y9YlEeBTTKDS7sAUObMqPw6MWqXyHgU3fKZAU7zmPir9C5jWhcdivPHmSUebDbaT9C0DyUEqVPkCYUiHFFoqDZYSqA4ZSJpVzh/CBB6f1y+kxj0AfoT4D+GrqGL7GhWkeNFAsbstQkP32dpiB9NmLtNO0/TC+BAY6djIk9FTpsOFOzxmrHvzv/iBaimx/e30BsfGhhif2q8dbGyZ7; 25:Gesmz3Icq0KZTgqId+AzcHnVctviKPeE1DFiJpXCijHM6c9SfvnotStHbEoZKXxsmgNl/c7ebH9+Q6k/MMDRFyx68BzAcgwaNMsLO5kMTAuZmI5L7/I4zE0bTE9qRQUI6Z44gRzN2wU+PaptytqCwM1vJ5hb55+dW5IgxCTaRqQloGKSAqj/DNWQM1piyg9Scv8ocnEzOfNWap1KD5xIXMEybPvsegqtU2Gyabbqo0T1V0mqGaSMImybAEVaCHf8CidM68YekwjB+cyNNF6zHMTHpvZXeRD3nvbptq3duT6eTDne+KYawEVkKtW2J5LCdnDBp9J71Jh+p7BVS/AIrg==; 31:0rQXe2k406f/YKWSJfRVMsypUR2hzCGWAZu/cXwEo4a+c9NqBbHq4eF1wuIyWYlvp8jT4bhiaQpBNfCFObAsKKw0BpZeuKyuugg290nspwMU868lzB5F/mNXTVxLZK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pTJhckUulapmo1KihcIWWpg== X-Microsoft-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)(3002001)(93006095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:BN7PR07MB4897; BCL:0; PCL:0; RULEID:; SRVR:BN7PR07MB4897; X-Forefront-PRVS: 0723A02764 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(396003)(39850400004)(366004)(136003)(199004)(189003)(316002)(6512007)(11346002)(110136005)(16526019)(54906003)(478600001)(6116002)(2616005)(4326008)(956004)(53936002)(72206003)(186003)(3846002)(486006)(47776003)(25786009)(446003)(26005)(66066001)(16586007)(105586002)(44832011)(476003)(106356001)(2906002)(50226002)(55236004)(42882007)(8936002)(52116002)(51416003)(6486002)(575784001)(76176011)(97736004)(48376002)(50466002)(68736007)(5660300001)(7736002)(386003)(8676002)(6666003)(81156014)(81166006)(6506007)(36756003)(14444005)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR07MB4897; 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; BN7PR07MB4897; 23:yEd+Y0gamk6HvoPGNBXwGVplqmwd+1GkXlvhGWcBj?= =?us-ascii?Q?IGtui6e7rsH4qYZm4lZIl62yR2T+lRZ+FH9utdzTEofOHXcatz/pgpddsXIn?= =?us-ascii?Q?VSAUgOlJHSk2Xv9VrrtI86XS2b9QiQcxziooirXuFGZCiqtpD4N08xjWdy0g?= =?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SzrWfKsEaYDEuVUYPNNOtLuj?= =?us-ascii?Q?RfBMuifNKSL+kgllNPT9fiKbqaBNa/qDnX9BRcLsnRRfWQwQ7dSVG5PZM7Wz?= =?us-ascii?Q?0gxLmB/tLNVU0KOxq3aGeV6f1UmSTmu/LMCVdvWPj020du0sdLlp6kzYSo5J?= =?us-ascii?Q?DGyBiuAwSBZtCj3aFKlCwSWAjK9SODm6or8waj2ylBUKUWxNy8S9mw3UHy4p?= =?us-ascii?Q?eeNfVkECBAh7/n8W3YQz0dtErOQQwxVdzHtiDeQ9RYj3cssKIWYSOBKNVs+x?= =?us-ascii?B?QT09?= X-Microsoft-Antispam-Message-Info: 6+BBcyn6aa2PUzOM8udrGQAebF54z2dolt3DeAtdGcHpC1nz29s0OtmyUjB21PmrxMgvlkSpxyso4vj5q+4evlokMp9EjMD2BsXldPYVeF4yUKjXb6bTHQ/jfjTGHkunCL66z8pOkEsSN96H1Bkqd1TB9XcGrpA6t2iNkOal2JFv1HJtObDencHMGR1wUZzfTGgifgGMe2r5uqS9Bh5h/QvnQq8pOftffQ6putWptuij7O217fDF6dwdRoKdRSnXtYNs6iDUP7COGkqw+Yh1TcpArW8gKIGmagSxQVWWBmcr/nBxyDXld4m8sKPUxcwyWh8fmJGDTGVN5leO2x8imabvESfpMwAAdxz02WdP4UA= X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4897; 6:/mK5trsjRzIZKQUsqouXfyiVOIZc8INmyckW6iPmK/mu4BAxBOR782PvMe1YfqCWIkPOF22Z2Aenr3qLmwRD050DyN++npeP6PECGtM4/AF2lvboGHhPxYAfDPdu1FzWcugbfyuoMckr2M37geu9HnmfZwjkiNTXrET2D8Pe9Co3hPDPOlk+1AQGQTz23Wmz3ZDlC9JEpyWuQiFO1BE135MnaYMngGW6P6BGw+acreeW2FOTU13M0gYvBXEIpAItpBLgQqMAorblT1E6eApQsldD+/8iTD4f7o1uzDm+K4Gjxw48Q7FuaNmHDr+D1QSYQ7x/vwqREh9oAqKzha8NqLMU34sVk1jXREY7mOOR5hC1OzxcaK/L5dDGw6RQ3NKljhxAExN7z17xxm1CgyX2KOajOc6qzOxm7kB3NdJM8QeoNg091Uzuhqfv8sCBt07WajtCE+cab2I2TW4PtBXVjg==; 5:WLRdCcufNJGOv3W6KMnCCPyhScdTiHTq9Y+uBFd+p3eo2CaOxBuEbMvDr+jYFx268MQKe2DAxzmJTkoGy3LwJdlUOHybnNRDZsz0zV9UaVGfwSqUDsyCZeQR9OiyWO55V+3oBSKbeZQvDTP/ABBHQ59jFsYo2zr0/oY2X+mTix8=; 24:SVklfDq0h9IyRDhN4xgVKs9TekJsvYK71EwahwPT7IzocD58iTIO7gEELHfz4CgAI4/wIsp0ljBbsZm1I0Sb8xgLQlF45RH2Amq5fgrhjEE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4897; 7:vw/HIjmBSB8B+Z4Pp049m+NROUn5t9Z0fLAZbpvvpB78FU/0+uPbzddQRT4V/uFuUvwbFuKxt7rHFbiAHyUVNHMovc9I9oaKaWjV0ayB45vx9+xjYyAtmRMYkHiv+74DS2ALRFriPFuQV8rXZMPsYL4RbbJsJk9fvF2nvsFEcAzu2+twljRlXnoZBUDpHhkquR3Sce2+XXJ7Sb6BmlfSsUF2oudxl0Y69nL/Xc/8MvyF4p9+cFH8cBUocEi2mZ8u X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2018 13:56:27.7293 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c34787a2-869a-432e-4d64-08d5e1b5f168 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4897 Subject: [dpdk-dev] [PATCH v1 3/3] 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: Wed, 04 Jul 2018 13:56:32 -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 --- 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