From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7022E42A49; Fri, 5 May 2023 19:48:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9618242D44; Fri, 5 May 2023 19:48:23 +0200 (CEST) Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by mails.dpdk.org (Postfix) with ESMTP id BF23F42D3C for ; Fri, 5 May 2023 19:48:21 +0200 (CEST) Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-64115eef620so21341940b3a.1 for ; Fri, 05 May 2023 10:48:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1683308901; x=1685900901; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=L81AMxEdco4V829VZuJDkXKn++gij/EfI8CQq6w8ezE=; b=FAqdLuoCrzT8nk6UWPO+3hkmw6BM7UQKWCk8R06g/VznpsNicK2xliX6Nv6KWRTHMK kg5IpMTCp+PL5vSykgiIbyTsVfwN+Bhnm4eKfTS1SeScjZXRgNM51khm9d6m4xlsGS3K teic9/EH/S0mNZJsgGB/N9fpg4eghZTLLHMDfjhV/RZif1XcypRwwfIz4tDpGmdhcOCP XUDoSlQYnzdX83G2dh2DlJ+sLatVe+YEKknXeIC/slHPbWo8MnLqJsPmVVkA7dJkavJU tyX4PLe85gkgq3HBy3ZCQu5BJqo3Xg+jifIOI0iT9TO+SKFuWGjKBrB0GgKxaSbVZ+nY elIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683308901; x=1685900901; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L81AMxEdco4V829VZuJDkXKn++gij/EfI8CQq6w8ezE=; b=MP0GFAQIBpH7VawNrx8i35XjmihMXc5ZyCBzk+v5CZ3qlm/nI9zU7INsHYQHceAn6O MkwmiV36+5B+kUx9URpeqMIqs2ouZJEBAcxWfKAr1jLLyaxLfwd6SYbyOjewo6i+hsKn e72JhpD2VTYhgJRtXzkZ5J8Jm+fImDNLxLbZkpM8m8tSPhWenFeDf9g/FUAFULiTtVoa JiBMi+Zvf7eU/1SagUJH+H2iPUCVwvIxZtmWAsMSJBg+aAMupvZrTvYIR9olrMSWqzMC O1ac9RgO7v8uwtpvLqBbj9GEcFe4Bq/Pt5tIRtPjBDr32++FbYcriSueeLtVLt8pwY4Q JgJQ== X-Gm-Message-State: AC+VfDzrHpGBkKlOypWU4SVeu5CO4qJhRcx6U3XGJ0zKBXrh23UHOt8A 4BuNKLfUZvs9sWJh4n+3cF0QkrIuOiEr8I3K8Bu1Vw== X-Google-Smtp-Source: ACHHUZ6B0KxhUYx5yxxpbCk6GJgxm8vsGo1hxAtWHv4ww0NopvQzLLX0HZi9qz9QJiBqpQkUYyZjNg== X-Received: by 2002:a05:6a00:3698:b0:643:6fd8:ea7a with SMTP id dw24-20020a056a00369800b006436fd8ea7amr7967412pfb.16.1683308901035; Fri, 05 May 2023 10:48:21 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id a15-20020aa780cf000000b0063799398eb9sm1895707pfn.58.2023.05.05.10.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 May 2023 10:48:20 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Akhil Goyal , Fan Zhang Subject: [PATCH 04/14] test: cryptodev use rte_pktmbuf_mtod_offset Date: Fri, 5 May 2023 10:48:03 -0700 Message-Id: <20230505174813.133894-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174813.133894-1-stephen@networkplumber.org> References: <20230505174813.133894-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Automatically genertged by cocci/mtod-offset.cocci. Signed-off-by: Stephen Hemminger --- app/test/test_cryptodev.c | 66 +++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 9c670e9a3554..2eebeaac9ef4 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -3151,8 +3151,9 @@ test_snow3g_authentication(const struct snow3g_hash_test_data *tdata) ut_params->op); ut_params->obuf = ut_params->op->sym->m_src; TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf"); - ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) - + plaintext_pad_len; + ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf, + uint8_t *, + plaintext_pad_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( @@ -3243,8 +3244,9 @@ test_snow3g_authentication_verify(const struct snow3g_hash_test_data *tdata) ut_params->op); TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf"); ut_params->obuf = ut_params->op->sym->m_src; - ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) - + plaintext_pad_len; + ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf, + uint8_t *, + plaintext_pad_len); /* Validate obuf */ if (ut_params->op->status == RTE_CRYPTO_OP_STATUS_SUCCESS) @@ -3331,8 +3333,9 @@ test_kasumi_authentication(const struct kasumi_hash_test_data *tdata) ut_params->obuf = ut_params->op->sym->m_src; TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf"); - ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) - + plaintext_pad_len; + ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf, + uint8_t *, + plaintext_pad_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( @@ -3417,8 +3420,9 @@ test_kasumi_authentication_verify(const struct kasumi_hash_test_data *tdata) ut_params->op); TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf"); ut_params->obuf = ut_params->op->sym->m_src; - ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) - + plaintext_pad_len; + ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf, + uint8_t *, + plaintext_pad_len); /* Validate obuf */ if (ut_params->op->status == RTE_CRYPTO_OP_STATUS_SUCCESS) @@ -4851,8 +4855,9 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata) tdata->validDataLenInBits.len, "ZUC Ciphertext data not as expected"); - ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) - + plaintext_pad_len; + ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf, + uint8_t *, + plaintext_pad_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( @@ -4963,8 +4968,9 @@ test_snow3g_cipher_auth(const struct snow3g_test_data *tdata) tdata->validDataLenInBits.len, "SNOW 3G Ciphertext data not as expected"); - ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) - + plaintext_pad_len; + ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf, + uint8_t *, + plaintext_pad_len); /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( @@ -5129,9 +5135,9 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata, debug_hexdump(stdout, "ciphertext expected:", tdata->ciphertext.data, tdata->ciphertext.len >> 3); - ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) - + (tdata->digest.offset_bytes == 0 ? - plaintext_pad_len : tdata->digest.offset_bytes); + ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf, + uint8_t *, + (tdata->digest.offset_bytes == 0 ? plaintext_pad_len : tdata->digest.offset_bytes)); debug_hexdump(stdout, "digest:", ut_params->digest, tdata->digest.len); @@ -5537,10 +5543,9 @@ test_kasumi_auth_cipher(const struct kasumi_test_data *tdata, debug_hexdump(stdout, "ciphertext expected:", tdata->ciphertext.data, tdata->ciphertext.len >> 3); - ut_params->digest = rte_pktmbuf_mtod( - ut_params->obuf, uint8_t *) + - (tdata->digest.offset_bytes == 0 ? - plaintext_pad_len : tdata->digest.offset_bytes); + ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf, + uint8_t *, + (tdata->digest.offset_bytes == 0 ? plaintext_pad_len : tdata->digest.offset_bytes)); debug_hexdump(stdout, "digest:", ut_params->digest, tdata->digest.len); @@ -5878,8 +5883,9 @@ test_kasumi_cipher_auth(const struct kasumi_test_data *tdata) ciphertext = rte_pktmbuf_mtod_offset(ut_params->obuf, uint8_t *, tdata->validCipherOffsetInBits.len >> 3); - ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) - + plaintext_pad_len; + ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf, + uint8_t *, + plaintext_pad_len); const uint8_t *reference_ciphertext = tdata->ciphertext.data + (tdata->validCipherOffsetInBits.len >> 3); @@ -6292,8 +6298,9 @@ test_zuc_authentication(const struct wireless_test_data *tdata, ut_params->op); TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf"); ut_params->obuf = ut_params->op->sym->m_src; - ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) - + plaintext_pad_len; + ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf, + uint8_t *, + plaintext_pad_len); if (auth_op != RTE_CRYPTO_AUTH_OP_VERIFY) { /* Validate obuf */ @@ -6476,10 +6483,9 @@ test_zuc_auth_cipher(const struct wireless_test_data *tdata, debug_hexdump(stdout, "ciphertext expected:", tdata->ciphertext.data, tdata->ciphertext.len >> 3); - ut_params->digest = rte_pktmbuf_mtod( - ut_params->obuf, uint8_t *) + - (tdata->digest.offset_bytes == 0 ? - plaintext_pad_len : tdata->digest.offset_bytes); + ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf, + uint8_t *, + (tdata->digest.offset_bytes == 0 ? plaintext_pad_len : tdata->digest.offset_bytes)); debug_hexdump(stdout, "digest:", ut_params->digest, tdata->digest.len); @@ -7897,9 +7903,9 @@ test_mixed_auth_cipher(const struct mixed_cipher_auth_test_data *tdata, tdata->ciphertext.data, tdata->ciphertext.len_bits >> 3); - ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) - + (tdata->digest_enc.offset == 0 ? - plaintext_pad_len : tdata->digest_enc.offset); + ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf, + uint8_t *, + (tdata->digest_enc.offset == 0 ? plaintext_pad_len : tdata->digest_enc.offset)); debug_hexdump(stdout, "digest:", ut_params->digest, tdata->digest_enc.len); -- 2.39.2