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 1077B46108; Fri, 24 Jan 2025 00:07:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 96C6740E15; Fri, 24 Jan 2025 00:07:09 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by mails.dpdk.org (Postfix) with ESMTP id 49B2040267 for ; Fri, 24 Jan 2025 00:07:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737673627; x=1769209627; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lMN86Vo9hFJyaPv0QLEAOF/qAyk6xKYITul1LzKj2Kg=; b=hqr5mjDxzv1KA9RPwmFvHEgAfCMUBYsjObA6hUW5IBPjrtBGM3pFQfbA DiVRClroA5SvooUHpk+FgMf4RXIcdq9gjdl6l/4mNnoFHZEYmNYIwIrTt JpiZanEXQV/ZT9mIDdCG6EtjOWBnqpjZdN+EoNisPtKsA6HgBgPuCgKR0 Tr8Jf7Ica4BQNxirNQi7FT83WvjU0kLaeFw6uifL9lNj3kPjnNoi0uMOu bn/mUNjKN6Gv99GOQIR7Ffo6Svq/8EmG0j5fl/gmToUQ+TECjRzGTkB1+ vB7xhWHfgE0+RzKH2qtH+kBmDa3Fkc6rQXx27nwUzZITPxJVC2m6gwIKn w==; X-CSE-ConnectionGUID: dnOYDbcYQSGzXZGzMZIxJA== X-CSE-MsgGUID: 8ZSFrLbmTiijbFMl+vbd4Q== X-IronPort-AV: E=McAfee;i="6700,10204,11324"; a="38368600" X-IronPort-AV: E=Sophos;i="6.13,229,1732608000"; d="scan'208";a="38368600" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jan 2025 15:07:05 -0800 X-CSE-ConnectionGUID: T0BoqK8TRlaz7PzlIMuxwA== X-CSE-MsgGUID: EmNZSJ21RMSbkZxQvUsmmQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,229,1732608000"; d="scan'208";a="112599681" Received: from spr-npg-bds1-eec2.sn.intel.com (HELO spr-npg-bds1-eec2..) ([10.233.181.123]) by fmviesa004.fm.intel.com with ESMTP; 23 Jan 2025 15:07:04 -0800 From: Nicolas Chautru To: dev@dpdk.org, maxime.coquelin@redhat.com Cc: hemant.agrawal@nxp.com, hernan.vargas@intel.com, Nicolas Chautru Subject: [PATCH v2 3/3] baseband/acc: add internal logging Date: Thu, 23 Jan 2025 14:55:19 -0800 Message-Id: <20250123225519.2469167-4-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250123225519.2469167-1-nicolas.chautru@intel.com> References: <20250123225519.2469167-1-nicolas.chautru@intel.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 Adds internal buffer for more flexible logging. Signed-off-by: Nicolas Chautru --- drivers/baseband/acc/acc_common.h | 22 +++++++++++++++++++--- drivers/baseband/acc/rte_vrb_pmd.c | 18 +++++++++++++++++- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/drivers/baseband/acc/acc_common.h b/drivers/baseband/acc/acc_common.h index 4880444450..06255ff5f1 100644 --- a/drivers/baseband/acc/acc_common.h +++ b/drivers/baseband/acc/acc_common.h @@ -152,6 +152,8 @@ #define ACC_MAX_FFT_WIN 16 #define ACC_MAX_RING_BUFFER 64 #define VRB2_MAX_Q_PER_OP 256 +#define ACC_MAX_LOGLEN 256 +#define ACC_MAX_BUFFERLEN 256 extern int acc_common_logtype; #define RTE_LOGTYPE_ACC_COMMON acc_common_logtype @@ -652,6 +654,9 @@ struct __rte_cache_aligned acc_queue { rte_iova_t fcw_ring_addr_iova; int8_t *derm_buffer; /* interim buffer for de-rm in SDK */ struct acc_device *d; + char error_bufs[ACC_MAX_BUFFERLEN][ACC_MAX_LOGLEN]; /**< Buffer for error log. */ + uint16_t error_head; /**< Head - Buffer for error log. */ + uint16_t error_wrap; /**< Wrap Counter - Buffer for error log. */ }; /* These strings for rte_trace must be limited to RTE_TRACE_EMIT_STRING_LEN_MAX. */ @@ -690,11 +695,21 @@ __rte_format_printf(4, 5) static inline void acc_error_log(struct acc_queue *q, void *op, uint8_t acc_error_idx, const char *fmt, ...) { - va_list args; - RTE_SET_USED(op); + va_list args, args2; + static char str[1024]; + va_start(args, fmt); + va_copy(args2, args); rte_vlog(RTE_LOG_ERR, acc_common_logtype, fmt, args); - + vsnprintf(q->error_bufs[q->error_head], ACC_MAX_LOGLEN, fmt, args2); + q->error_head++; + snprintf(q->error_bufs[q->error_head], ACC_MAX_LOGLEN, + "%s", rte_bbdev_ops_param_string(op, q->op_type, str, sizeof(str))); + q->error_head++; + if (q->error_head == ACC_MAX_LOGLEN) { + q->error_head = 0; + q->error_wrap++; + } if (acc_error_idx > ACC_ERR_MAX) acc_error_idx = ACC_ERR_MAX; @@ -702,6 +717,7 @@ acc_error_log(struct acc_queue *q, void *op, uint8_t acc_error_idx, const char * acc_error_string[acc_error_idx]); va_end(args); + va_end(args2); } /* Write to MMIO register address */ diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c index 27620ccc10..d81c5d460c 100644 --- a/drivers/baseband/acc/rte_vrb_pmd.c +++ b/drivers/baseband/acc/rte_vrb_pmd.c @@ -1135,6 +1135,10 @@ vrb_queue_setup(struct rte_bbdev *dev, uint16_t queue_id, q->mmio_reg_enqueue = RTE_PTR_ADD(d->mmio_base, d->queue_offset(d->pf_device, q->vf_id, q->qgrp_id, q->aq_id)); + /** initialize the error buffer. */ + q->error_head = 0; + q->error_wrap = 0; + rte_bbdev_log_debug( "Setup dev%u q%u: qgrp_id=%u, vf_id=%u, aq_id=%u, aq_depth=%u, mmio_reg_enqueue=%p base %p", dev->data->dev_id, queue_id, q->qgrp_id, q->vf_id, @@ -1516,7 +1520,7 @@ vrb_queue_ops_dump(struct rte_bbdev *dev, uint16_t queue_id, FILE *f) { struct acc_queue *q = dev->data->queues[queue_id].queue_private; struct rte_bbdev_dec_op *op; - uint16_t i, int_nb; + uint16_t start_err, end_err, i, int_nb; volatile union acc_info_ring_data *ring_data; uint16_t info_ring_head = q->d->info_ring_head; static char str[1024]; @@ -1533,6 +1537,18 @@ vrb_queue_ops_dump(struct rte_bbdev *dev, uint16_t queue_id, FILE *f) q->aq_enqueued, q->aq_dequeued, q->aq_depth, acc_ring_avail_enq(q), acc_ring_avail_deq(q)); + /** Print information captured in the error buffer. */ + if (q->error_wrap == 0) { + start_err = 0; + end_err = q->error_head; + } else { + start_err = q->error_head; + end_err = q->error_head + ACC_MAX_BUFFERLEN; + } + fprintf(f, "Error Buffer - Head %d Wrap %d\n", q->error_head, q->error_wrap); + for (i = start_err; i < end_err; ++i) + fprintf(f, " %d\t%s", i, q->error_bufs[i % ACC_MAX_BUFFERLEN]); + /** Print information captured in the info ring. */ if (q->d->info_ring != NULL) { fprintf(f, "Info Ring Buffer - Head %d\n", q->d->info_ring_head); -- 2.34.1