From patchwork Sun Sep 12 12:15:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipun Gupta X-Patchwork-Id: 509491 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp2955423jai; Sun, 12 Sep 2021 05:16:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySOV73RjHISXCjJ5q23P0VOc5Bu1xZmZtT4opmR6EAR0L7Cse073hCId3aAaKixQgOzFz4 X-Received: by 2002:aa7:c81a:: with SMTP id a26mr7712611edt.323.1631448995076; Sun, 12 Sep 2021 05:16:35 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id de41si4037139ejc.244.2021.09.12.05.16.34; Sun, 12 Sep 2021 05:16:35 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector2 header.b=fA4ngDpS; arc=fail (signature failed); spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 777D14113D; Sun, 12 Sep 2021 14:15:55 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70053.outbound.protection.outlook.com [40.107.7.53]) by mails.dpdk.org (Postfix) with ESMTP id D4C1741125 for ; Sun, 12 Sep 2021 14:15:53 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EWrMg83WO8qRZibVWo3C74iVooeBn2AnUuEiRLDaGUXEkoYzutQFOVIOAj/67jweLuwDzvqBfFUe+B5ofNaA+g5SwouL/TZd4mmCAdEbdpTFTfAYDc8DcNCSjzlawgo61nKoGwoVqv9oMUZQxGw8+KHqpKrLfdwloVlwS+IuGWmJwY9JY5EJvozP+hOaIGpUpgJbtNoEVlSZyyzx6IRtNmZHFxfvtXBPRH+edoEpLAuLglzZyUKfxR7GJ4BsBtaVY4QbTcQ6mOH7ygAQ6jNvFE1dyTJXDHNveHig/uAr7nQee30WX3pM4FDiNzPMvCzydI2qwLdrWMLeZuBH4FVKUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hXBhgOSdoSpvoyWlG7QuY3kZIY4yKaLaxfPcm1FYNbE=; b=A535Yqt5+XieJb/zlq5d2wdBuu6DiIzNEBsigS+saS3X4iDK/oGkU6Gas0fXwLPXa2LGxjlYfsci8C+lVff/6BG1q14oJNHyvEPV4rcdqae3y27moVCVfloUcrvPJhLn/nrf7YFSJtN+egyfiMWEgMtv4KIR/Vlg5lFtgWpjWcJwA3p3ucXDac9aOT/goWSnrDQsR60zReYEcBvIsqVeMitjqiVxXaSRWqyKU7CZMY+Q848WhRj+y9V+YHxF4TZjSHmg+X0DDGXsFIuyJvuEUuQcO7FUwvKjiV1cwwRRA1EudZsgByB4huyM0wrjAZ61gQjbmlTCPqbEBu3NWFhfZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hXBhgOSdoSpvoyWlG7QuY3kZIY4yKaLaxfPcm1FYNbE=; b=fA4ngDpSh7Yda3W1I3ecrcdSsC6lbHYT1axJ8ufmpznDQzlcI/hFe9hym9kYG4EStbdLIssFDblSEiGhkLQVKNdhu0LXMY5Uu/Np8+pX6Ejg2H68V1ihLuqqIlqBj0lPHfE9ULcT/0MmcE40v/NvfGTXk7Q/D8lMcsuVXLPQo+k= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:24e::23) by DB9PR04MB8202.eurprd04.prod.outlook.com (2603:10a6:10:24f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Sun, 12 Sep 2021 12:15:53 +0000 Received: from DB9PR04MB8429.eurprd04.prod.outlook.com ([fe80::dcda:93c2:47e7:19b4]) by DB9PR04MB8429.eurprd04.prod.outlook.com ([fe80::dcda:93c2:47e7:19b4%9]) with mapi id 15.20.4500.018; Sun, 12 Sep 2021 12:15:53 +0000 From: Nipun Gupta To: dev@dpdk.org, gakhil@marvell.com, nicolas.chautru@intel.com Cc: david.marchand@redhat.com, hemant.agrawal@nxp.com, Nipun Gupta Date: Sun, 12 Sep 2021 17:45:09 +0530 Message-Id: <20210912121510.22699-9-nipun.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210912121510.22699-1-nipun.gupta@nxp.com> References: <20210318063421.14895-1-hemant.agrawal@nxp.com> <20210912121510.22699-1-nipun.gupta@nxp.com> X-ClientProxiedBy: SG2PR0601CA0003.apcprd06.prod.outlook.com (2603:1096:3::13) To DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:24e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03274.swis.in-blr01.nxp.com (14.142.151.118) by SG2PR0601CA0003.apcprd06.prod.outlook.com (2603:1096:3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Sun, 12 Sep 2021 12:15:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a1425a98-f164-4cc9-b4ce-08d975e710d4 X-MS-TrafficTypeDiagnostic: DB9PR04MB8202: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aJrfdMy90pTi4EoFg1Cvwa85uWuVXri+fkz8QlkU/DH+BR1vRnnLckrS3Au0qZG3e1HsnIXzQZCX57uPIOyq82GlHb7NF7OlDdU+67HaSKdlEd1sOY6Lmj3dgtWyo6sPdAAMu8IiRGcLPK67HTJcCxWNzqJYfNRhBVP/ji2/TW3Phd6LssLfNAEwBWLKsNOuC+mdNjYaz3Oso6f6uvmH91m3g091HwXcDfAARbTsaEFTRaCjgaTBWEKLQ4OFviQpnqWU1ucfsvj6DTXk4WkQUj2PCmfXJLJ3nokL7SvuAakZH7emwaRBGyYitETBzbcRikaPkPjkyPaoISo/BbTtjvl4LwFFpRIhEtatcwHj+ddTR1kB5mInCIgrVXfC4aYdueRkLLg0QEX9RonaC1VNo5ubdrW/DPUJetBZi95BC62q7x6U0pR4sc543WkkwJjDwWBIwMLXkvYectMNeUKyiYDIvEoK/q3ZEPso4+e1O27awf1/eqiUEBEIO/Q1Gq6sReSl56mwsnakq7o1ln3MV0a5jQ1EM44npK7AazFtk0b7o7VieZ5RrPYDg7uoKJ6poI1a0sStn5BF79zZp/FlYgC7bk7VEafFuofK9HzGag/l9H+jYL69sA3w+IKyttrwHFSzzR7tc7caXW6pqq5panK6p7Vdfn2Hxi8vrUXZCXKtS7UpFYDQtAjIPDa3yKKld6+eOwQdN16u56w2sUOMs3B6DBTJgo0O4bS1EMy9Bh4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR04MB8429.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(346002)(366004)(396003)(376002)(39860400002)(4326008)(1006002)(2616005)(956004)(6666004)(66946007)(5660300002)(83380400001)(36756003)(38100700002)(38350700002)(8936002)(186003)(26005)(2906002)(478600001)(44832011)(55236004)(86362001)(6486002)(1076003)(52116002)(7696005)(8676002)(316002)(66556008)(66476007)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GMswOrn14jRjTct1Q4v9HZTki4sNrLrVq3hRV588qdJx15e1yBzwaaXTfkhuCgGOlf9S3VOW+A5mV79QThIWJXLDGm8odEbS+w3wZyBu+5ulT347FAwrgK/D2rsx7XdS6052OMe9sun5bfHO3as9g5jABDH8KRxrQ66aFeRSgjLbHOldAv9cZizxwZ/djZyKohz1y+RSaHhx2dtqGEU+2uu4R6WAbB+Q2QhME4noeGe+uAVrESycgZZSY1lpBkEFujfnRRlavfvndBv4Ve1KF6flvZUC4kl9aNCDKKDHcWWWd03W4lQ0vhHsnXoaDoEz0BOTHsTpaNzVM0NvXA4vJp925FxYd7x7YKuPAr8t0/MEw8aZGPhNrErkfVIMqoeC9dZRuaOFTcNZiPHzv5OfgI9yiw6PKhDNlmavt0x/jKFXG69ZuXO9nS7Vyc2FExnEeH3st+tmPqYXPIgR/y60MYi4BTUKXjG10XC+ZX9FttCRaY2IDgy1oZmfWgOzPX55Rjct5/w0smtR4I/ukfPsh9WfnENyKDkOpX4j33UEN/gs6omM0ixrPMs6V/hTQGvSLVrS9Wczl95FeiiiyuzrJNtoxssaBVm4Dc3ck3438dkpmNEfX9X+OP4juC4OrmHhjvdEfLt3NGGjw0Tv8Wh6isptQNDgFu14jJEhJutwaI2sfSMv+ZljLgFOHN5/61iNthD53jS7+J/rq26ij7exRcTR42wRVAcKfJ1lVCu6kL+6Y4XNQdme4gEdi8cxKB5smwWYvvFbFun4hkAJ1VWeE/NYHVQ6VYWpG6ZxL0nPUMKgtJnysqQ6f31YmH8x3957Vlhi/3slyN2tcWk3jmrdf9m6nFFzwiFm0tV5NzPqwHlEPNa7bZX1QYHihBbydeWOM2UllpDzge4pOm8nUw6gIOU6HqPN9BbfJWfL6f1zVrF2fWkHVT6Gnr1hMsBndgOEa7VSan/IVH09kZ/ykhpl6vXQs0qqf6X30BonTyjeowmWbdb59W+iMixUt5qIxLD6sSDL/4rdklyaNEoWbexi1LyosRwVVLbjRbEYqg06bCBuRRbKkn5joatZz2Liq/oVXhSPJ50zKUp6JvNIDD/p3EClFatX38YDwrVvZpavkOUOSg5G4eRdS3G6Xdv4CVrP3mQMRlPAosooQSIJPE5vzuSEwKMwoXRCvSYmuB+n99FFJIo9F8LZJYE/1K13KJFuuWvz+bVc0IRERsdBvGXnoaIeiZuOcyEXWvIJzMsxic0HC/gsNzYhjAiIpK7XGGVrU5x7XK6lVAsZu2XlDFsbQEdmPGLzOni+at2Woyr0wzCHcRJdOszWu/FTMV08r2lx X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1425a98-f164-4cc9-b4ce-08d975e710d4 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8429.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2021 12:15:53.1345 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Zdd4j8LNcpMWReLy35egQVgDMUJR+l2BrxPt754h69ALOk1d4q0dQcut/AVIbB60GESoN2BskgKsBOCsTibOhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8202 Subject: [dpdk-dev] [PATCH v5 8/9] app/bbdev: handle endianness of test data 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 Sender: "dev" With data input, output and harq also supported in big endian format, this patch updates the testbbdev application to handle the endianness conversion as directed by the test vector and the driver being used. For instance, if the driver supports big endian data processing, but the test vector does not mention the data as a big endian format, conversion from little endian to big will be handled by the testbbdev application. Signed-off-by: Nipun Gupta --- app/test-bbdev/test_bbdev_perf.c | 84 ++++++++++++++++++++++++++++++ app/test-bbdev/test_bbdev_vector.c | 4 ++ 2 files changed, 88 insertions(+) -- 2.17.1 diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c index 469597b8b3..836e07d747 100644 --- a/app/test-bbdev/test_bbdev_perf.c +++ b/app/test-bbdev/test_bbdev_perf.c @@ -227,6 +227,71 @@ clear_soft_out_cap(uint32_t *op_flags) *op_flags &= ~RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT; } +static void +clear_ldpc_endianness_flag(uint32_t *op_flags) +{ + *op_flags &= ~RTE_BBDEV_LDPC_ENC_BIG_ENDIAN; + *op_flags &= ~RTE_BBDEV_LDPC_DEC_BIG_ENDIAN; +} + +static inline void +reverse_op(struct op_data_entries *op) +{ + uint8_t nb_segs = op->nb_segments; + uint32_t *data, len; + int complete, rem, i, j; + uint8_t *rem_data, temp; + + /* Validate each mbuf segment length */ + for (i = 0; i < nb_segs; ++i) { + len = op->segments[i].length; + data = op->segments[i].addr; + + /* Swap complete u32 bytes */ + complete = len / 4; + for (j = 0; j < complete; j++) + data[j] = rte_bswap32(data[j]); + + /* Swap any remaining data for last seg */ + if (i == (nb_segs - 1)) { + rem = len % 4; + rem_data = (uint8_t *)&data[j]; + for (j = 0; j < rem/2; j++) { + temp = rem_data[j]; + rem_data[j] = rem_data[rem - j - 1]; + rem_data[rem - j - 1] = temp; + } + } + } +} + +static inline void +reverse_all_ops(void) +{ + unsigned int nb_inputs, nb_soft_outputs, nb_hard_outputs, + nb_harq_inputs, nb_harq_outputs; + + nb_inputs = test_vector.entries[DATA_INPUT].nb_segments; + if (nb_inputs) + reverse_op(&test_vector.entries[DATA_INPUT]); + + nb_soft_outputs = test_vector.entries[DATA_SOFT_OUTPUT].nb_segments; + if (nb_soft_outputs) + reverse_op(&test_vector.entries[DATA_SOFT_OUTPUT]); + + nb_hard_outputs = test_vector.entries[DATA_HARD_OUTPUT].nb_segments; + if (nb_hard_outputs) + reverse_op(&test_vector.entries[DATA_HARD_OUTPUT]); + + nb_harq_inputs = test_vector.entries[DATA_HARQ_INPUT].nb_segments; + if (nb_harq_inputs) + reverse_op(&test_vector.entries[DATA_HARQ_INPUT]); + + nb_harq_outputs = test_vector.entries[DATA_HARQ_OUTPUT].nb_segments; + if (nb_harq_outputs) + reverse_op(&test_vector.entries[DATA_HARQ_OUTPUT]); +} + static int check_dev_cap(const struct rte_bbdev_info *dev_info) { @@ -324,6 +389,16 @@ check_dev_cap(const struct rte_bbdev_info *dev_info) const struct rte_bbdev_op_cap_ldpc_enc *cap = &op_cap->cap.ldpc_enc; + if ((test_vector.ldpc_enc.op_flags & + RTE_BBDEV_LDPC_ENC_BIG_ENDIAN) != + (cap->capability_flags & + RTE_BBDEV_LDPC_ENC_BIG_ENDIAN)) { + reverse_all_ops(); + clear_ldpc_endianness_flag( + &test_vector.ldpc_enc.op_flags); + + } + if (!flags_match(test_vector.ldpc_enc.op_flags, cap->capability_flags)){ printf("Flag Mismatch\n"); @@ -352,6 +427,15 @@ check_dev_cap(const struct rte_bbdev_info *dev_info) const struct rte_bbdev_op_cap_ldpc_dec *cap = &op_cap->cap.ldpc_dec; + if ((test_vector.ldpc_dec.op_flags & + RTE_BBDEV_LDPC_DEC_BIG_ENDIAN) != + (cap->capability_flags & + RTE_BBDEV_LDPC_DEC_BIG_ENDIAN)) { + reverse_all_ops(); + clear_ldpc_endianness_flag( + &test_vector.ldpc_dec.op_flags); + } + if (!flags_match(test_vector.ldpc_dec.op_flags, cap->capability_flags)){ printf("Flag Mismatch\n"); diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c index 614dbd1a6d..b2e7a9008d 100644 --- a/app/test-bbdev/test_bbdev_vector.c +++ b/app/test-bbdev/test_bbdev_vector.c @@ -191,6 +191,8 @@ op_ldpc_decoder_flag_strtoul(char *token, uint32_t *op_flag_value) *op_flag_value = RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION; else if (!strcmp(token, "RTE_BBDEV_LDPC_LLR_COMPRESSION")) *op_flag_value = RTE_BBDEV_LDPC_LLR_COMPRESSION; + else if (!strcmp(token, "RTE_BBDEV_LDPC_DEC_BIG_ENDIAN")) + *op_flag_value = RTE_BBDEV_LDPC_DEC_BIG_ENDIAN; else if (!strcmp(token, "RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE")) *op_flag_value = RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE; @@ -248,6 +250,8 @@ op_ldpc_encoder_flag_strtoul(char *token, uint32_t *op_flag_value) *op_flag_value = RTE_BBDEV_LDPC_ENC_INTERRUPTS; else if (!strcmp(token, "RTE_BBDEV_LDPC_ENC_SCATTER_GATHER")) *op_flag_value = RTE_BBDEV_LDPC_ENC_SCATTER_GATHER; + else if (!strcmp(token, "RTE_BBDEV_LDPC_ENC_BIG_ENDIAN")) + *op_flag_value = RTE_BBDEV_LDPC_ENC_BIG_ENDIAN; else { printf("The given value is not a turbo encoder flag\n"); return -1;