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 E6F53A04FD; Wed, 26 Oct 2022 21:47:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D2E542BBB; Wed, 26 Oct 2022 21:46:49 +0200 (CEST) Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by mails.dpdk.org (Postfix) with ESMTP id 3487A42B9D for ; Wed, 26 Oct 2022 21:46:43 +0200 (CEST) Received: by mail-io1-f52.google.com with SMTP id e15so14499388iof.2 for ; Wed, 26 Oct 2022 12:46:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atomicrules-com.20210112.gappssmtp.com; s=20210112; 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=CinhMuL/+oVOKbH719JxYAXoO3S0sENKA2k9CkFlx60=; b=kcQT5OWItNM9nqLu5gqPaJ65TMaLD0VctmUD2EWHT5r4csVz5m0gRFI3ezbiBpCXAC Qu3WHGbfYirph8kt5XEl1AM8cCYouKyiuEO9qwdceih0FpzHI21+2fPaeGqKapqwKiMd FbcJyOUu69aNtMHtpPWYECpop8bLFaRNSxiDRVC6CMNkcTwjjwAvRJwX51d2mPPAMnGc s29bZZ6HGYDiIYDaz0BwsZrGBivg27oMF4B9KdlNsoN872rcC8OksMxgItR0+GF2E92o No8EXgDk08bwv/ayc8TpqilVTlqV/bnXRCPvv+UvdboOWcd6Tr2Wi0OuqlfWx2ol3ZTn ohJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=CinhMuL/+oVOKbH719JxYAXoO3S0sENKA2k9CkFlx60=; b=sUSUB2AgMj7jP23RWGMkfXPXmOi00EqSB5OhbR38aDHhJcxsDg9gqVADYr9coYzAju b1XhkpjpY88twH2tH+Cso8uLQijTryZm4ZHz2YIgBnjK0omytWHWFVfqQPGoB5l4PsAj yYWMN1YpWkh/uPmv0I+m23Aiu2eKqqFb/fc+w3TNbHPDt2PIrDc3/4WSCcBejBn7LCBR faZYl0ubpZEaZU4RhW0y3e/0Gm9hT0SdcQa7uSS9w6T24zp9vcIPK5N4CJjBkesEEWfw ywBtK8m0tclvcNIR/gFRT/+NoHHM4j6CGfg6z5/qi+ANMLXWC2SL62frJdp2WwhE0IoP pV9g== X-Gm-Message-State: ACrzQf1S2V1AmqXEkxvjULmhjHeUDpKs6XYdNfXIoh8ImdaH7I6dtvTH TwEtsN1CqWnUSL1sZ1+2jXzE1w2bcT0nZA== X-Google-Smtp-Source: AMsMyM6W2hvYdPYItyeNWr33vF++yvoa+k5GjTk5ljarWsZHVz2jn1P5Y7z5p8A+dASGxMuwhgUBUA== X-Received: by 2002:a05:6638:613:b0:375:13ba:a548 with SMTP id g19-20020a056638061300b0037513baa548mr3064956jar.56.1666813602585; Wed, 26 Oct 2022 12:46:42 -0700 (PDT) Received: from john-System-Product-Name.tds (h64-35-205-155.cntcnh.broadband.dynamic.tds.net. [64.35.205.155]) by smtp.googlemail.com with ESMTPSA id m1-20020a056e020de100b002faecf63c48sm2336169ilj.79.2022.10.26.12.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 12:46:41 -0700 (PDT) From: John Miller To: nicolas.chautru@intel.com Cc: dev@dpdk.org, ed.czeck@atomicrules.com, shepard.siegel@atomicrules.com, John Miller Subject: [PATCH 11/14] baseband/ark: introduce ark baseband driver custom functions Date: Wed, 26 Oct 2022 15:46:10 -0400 Message-Id: <20221026194613.1008232-11-john.miller@atomicrules.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221026194613.1008232-1-john.miller@atomicrules.com> References: <20221026194613.1008232-1-john.miller@atomicrules.com> 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 This patch introduces the Arkville baseband device driver custom functions. Signed-off-by: John Miller --- drivers/baseband/ark/ark_bbdev_custom.c | 201 ++++++++++++++++++++++++ drivers/baseband/ark/ark_bbdev_custom.h | 30 ++++ 2 files changed, 231 insertions(+) create mode 100644 drivers/baseband/ark/ark_bbdev_custom.c create mode 100644 drivers/baseband/ark/ark_bbdev_custom.h diff --git a/drivers/baseband/ark/ark_bbdev_custom.c b/drivers/baseband/ark/ark_bbdev_custom.c new file mode 100644 index 0000000000..6b1553abe1 --- /dev/null +++ b/drivers/baseband/ark/ark_bbdev_custom.c @@ -0,0 +1,201 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2021 Atomic Rules LLC + */ + +#include +#include + +#include +#include /* For debug */ + + +#include "ark_bbdev_common.h" +#include "ark_bbdev_custom.h" + +/* It is expected that functions in this file will be modified based on + * specifics of the FPGA hardware beyond the core Arkville + * components. + */ + +/* bytyes must be range of 0 to 20 */ +static inline +uint8_t ark_bb_cvt_bytes_meta_cnt(size_t bytes) +{ + return (bytes + 3) / 8; +} + +void +ark_bbdev_info_get(struct rte_bbdev *dev, + struct rte_bbdev_driver_info *dev_info) +{ + struct ark_bbdevice *ark_bb = dev->data->dev_private; + + static const struct rte_bbdev_op_cap bbdev_capabilities[] = { + { + .type = RTE_BBDEV_OP_LDPC_DEC, + .cap.ldpc_dec = { + .capability_flags = + RTE_BBDEV_LDPC_CRC_24B_ATTACH | + RTE_BBDEV_LDPC_RATE_MATCH, + .num_buffers_src = + RTE_BBDEV_LDPC_MAX_CODE_BLOCKS, + .num_buffers_hard_out = + RTE_BBDEV_LDPC_MAX_CODE_BLOCKS + } + }, + { + .type = RTE_BBDEV_OP_LDPC_ENC, + .cap.ldpc_enc = { + .capability_flags = + RTE_BBDEV_LDPC_CRC_24B_ATTACH | + RTE_BBDEV_LDPC_RATE_MATCH, + .num_buffers_src = + RTE_BBDEV_LDPC_MAX_CODE_BLOCKS, + .num_buffers_dst = + RTE_BBDEV_LDPC_MAX_CODE_BLOCKS + } + }, + RTE_BBDEV_END_OF_CAPABILITIES_LIST(), + }; + + static struct rte_bbdev_queue_conf default_queue_conf = { + .queue_size = RTE_BBDEV_QUEUE_SIZE_LIMIT, + }; + + default_queue_conf.socket = dev->data->socket_id; + + dev_info->driver_name = RTE_STR(DRIVER_NAME); + dev_info->max_num_queues = ark_bb->max_nb_queues; + dev_info->queue_size_lim = RTE_BBDEV_QUEUE_SIZE_LIMIT; + dev_info->hardware_accelerated = true; + dev_info->max_dl_queue_priority = 0; + dev_info->max_ul_queue_priority = 0; + dev_info->default_queue_conf = default_queue_conf; + dev_info->capabilities = bbdev_capabilities; + dev_info->cpu_flag_reqs = NULL; + dev_info->min_alignment = 4; + +} + +/* Structure defining layout of the ldpc command struct */ +struct ark_bb_ldpc_enc_meta { + uint16_t header; + uint8_t rv_index:2, + basegraph:1, + code_block_mode:1, + rfu_71_68:4; + + uint8_t q_m; + uint32_t e_ea; + uint32_t eb; + uint8_t c; + uint8_t cab; + uint16_t n_cb; + uint16_t pad; + uint16_t trailer; +} __rte_packed; + +/* The size must be less then 20 Bytes */ +static_assert(sizeof(struct ark_bb_ldpc_enc_meta) <= 20, "struct size"); + +/* Custom operation on equeue ldpc operation */ +/* Do these function need queue number? */ +/* Maximum of 20 bytes */ +int +ark_bb_user_enqueue_ldpc_enc(struct rte_bbdev_enc_op *enc_op, + uint32_t *meta, uint8_t *meta_cnt) +{ + struct rte_bbdev_op_ldpc_enc *ldpc_enc_op = &enc_op->ldpc_enc; + struct ark_bb_ldpc_enc_meta *src = (struct ark_bb_ldpc_enc_meta *)meta; + + src->header = 0x4321; /* For testings */ + src->trailer = 0xFEDC; + + src->rv_index = ldpc_enc_op->rv_index; + src->basegraph = ldpc_enc_op->basegraph; + src->code_block_mode = ldpc_enc_op->code_block_mode; + + src->q_m = ldpc_enc_op->q_m; + src->e_ea = 0xABCD; + src->eb = ldpc_enc_op->tb_params.eb; + src->c = ldpc_enc_op->tb_params.c; + src->cab = ldpc_enc_op->tb_params.cab; + + src->n_cb = 0; + + meta[0] = 0x11111110; + meta[1] = 0x22222220; + meta[2] = 0x33333330; + meta[3] = 0x44444440; + meta[4] = 0x55555550; + + *meta_cnt = ark_bb_cvt_bytes_meta_cnt( + sizeof(struct ark_bb_ldpc_enc_meta)); + return 0; +} + +/* Custom operation on dequeue ldpc operation */ +int +ark_bb_user_dequeue_ldpc_enc(struct rte_bbdev_enc_op *enc_op, + const uint32_t *usermeta) +{ + static int dump; /* = 0 */ + /* Just compare with what was sent? */ + uint32_t meta_in[5] = {0}; + uint8_t meta_cnt; + + ark_bb_user_enqueue_ldpc_enc(enc_op, meta_in, &meta_cnt); + if (memcmp(usermeta, meta_in, 3 + (meta_cnt * 8))) { + fprintf(stderr, + "------------------------------------------\n"); + rte_hexdump(stdout, "meta difference for lpdc_enc IN", + meta_in, 20); + rte_hexdump(stdout, "meta difference for lpdc_enc OUT", + usermeta, 20); + } else if (dump) { + rte_hexdump(stdout, "DUMP lpdc_enc IN", usermeta, 20); + dump--; + } + + return 0; +} + + +/* Turbo op call backs for user meta data */ +int ark_bb_user_enqueue_ldpc_dec(struct rte_bbdev_dec_op *enc_op, + uint32_t *meta, uint8_t *meta_cnt) +{ + RTE_SET_USED(enc_op); + meta[0] = 0xF1111110; + meta[1] = 0xF2222220; + meta[2] = 0xF3333330; + meta[3] = 0xF4444440; + meta[4] = 0xF5555550; + + *meta_cnt = ark_bb_cvt_bytes_meta_cnt(20); + return 0; +} + +int ark_bb_user_dequeue_ldpc_dec(struct rte_bbdev_dec_op *enc_op, + const uint32_t *usermeta) +{ + RTE_SET_USED(enc_op); + static int dump; /* = 0 */ + /* Just compare with what was sent? */ + uint32_t meta_in[5] = {0}; + uint8_t meta_cnt; + + ark_bb_user_enqueue_ldpc_dec(enc_op, meta_in, &meta_cnt); + if (memcmp(usermeta, meta_in, 3 + (meta_cnt * 8))) { + fprintf(stderr, + "------------------------------------------\n"); + rte_hexdump(stdout, "meta difference for lpdc_enc IN", + meta_in, 20); + rte_hexdump(stdout, "meta difference for lpdc_enc OUT", + usermeta, 20); + } else if (dump) { + rte_hexdump(stdout, "DUMP lpdc_enc IN", usermeta, 20); + dump--; + } + return 0; +} diff --git a/drivers/baseband/ark/ark_bbdev_custom.h b/drivers/baseband/ark/ark_bbdev_custom.h new file mode 100644 index 0000000000..32a2ef6bb6 --- /dev/null +++ b/drivers/baseband/ark/ark_bbdev_custom.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2021 Atomic Rules LLC + */ + +#ifndef _ARK_BBDEV_CUSTOM_H_ +#define _ARK_BBDEV_CUSTOM_H_ + +#include + +/* Forward declarations */ +struct rte_bbdev; +struct rte_bbdev_driver_info; +struct rte_bbdev_enc_op; +struct rte_bbdev_dec_op; +struct rte_mbuf; + +void ark_bbdev_info_get(struct rte_bbdev *dev, + struct rte_bbdev_driver_info *dev_info); + +int ark_bb_user_enqueue_ldpc_dec(struct rte_bbdev_dec_op *enc_op, + uint32_t *meta, uint8_t *meta_cnt); +int ark_bb_user_dequeue_ldpc_dec(struct rte_bbdev_dec_op *enc_op, + const uint32_t *usermeta); + +int ark_bb_user_enqueue_ldpc_enc(struct rte_bbdev_enc_op *enc_op, + uint32_t *meta, uint8_t *meta_cnt); +int ark_bb_user_dequeue_ldpc_enc(struct rte_bbdev_enc_op *enc_op, + const uint32_t *usermeta); + +#endif -- 2.25.1