From patchwork Mon Oct 3 18:00:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chautru, Nicolas" X-Patchwork-Id: 117275 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A2A0CA04FD; Mon, 3 Oct 2022 20:34:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE99642B76; Mon, 3 Oct 2022 20:33:43 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 0C21E427F4 for ; Mon, 3 Oct 2022 20:33:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664822020; x=1696358020; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Bpvvvsd1JLScB5AY3WyZm+HEwkpZsDLnLY5H6cLx7rk=; b=oFlRCfIywVeJlIvN8X2kCHT/p/iD1fjWKhfOf1tZUKmEdDXYWl5rNgLV gOP2NvclW9wK2yNowJ1Sw14aRMOMjYI+uVQGqSk3fAAsRCtqxOF3xG3ZH utR+An/VUuyQv42/AaZqgqOY6HMo9sxlqIKKTFc26bRAajkWjchykxAe8 i0u0+JW6ZnRyHL3gA28IQ+OlA3T/taA1KXe8t7H2gBt/LFW2uWaPI+WIZ AusYIiAloNeJeTr9XOzR+W9u9e/+BMK6o2CklQiInCzecuIyE5hlhxcQ/ c6hFSYie7IRSYa+4xBhhsYlh9GiVpBfh2n3fEW4m4g4wpvHZ4RP+WF/In Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="285907055" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="285907055" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2022 11:00:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="618829413" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="618829413" Received: from unknown (HELO icx-npg-scs1-cp1.localdomain) ([10.233.180.245]) by orsmga007.jf.intel.com with ESMTP; 03 Oct 2022 11:00:39 -0700 From: Nicolas Chautru To: dev@dpdk.org, thomas@monjalon.net, gakhil@marvell.com Cc: maxime.coquelin@redhat.com, trix@redhat.com, mdr@ashroe.eu, bruce.richardson@intel.com, david.marchand@redhat.com, stephen@networkplumber.org, mingshan.zhang@intel.com, hemant.agrawal@nxp.com, Nicolas Chautru Subject: [PATCH v11 6/7] bbdev: add queue related warning and status information Date: Mon, 3 Oct 2022 11:00:22 -0700 Message-Id: <20221003180023.13362-7-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221003180023.13362-1-nicolas.chautru@intel.com> References: <1655491040-183649-6-git-send-email-nicolas.chautru@intel.com> <20221003180023.13362-1-nicolas.chautru@intel.com> MIME-Version: 1.0 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 allows to expose more information with regards to any queue related failure and warning which cannot be supported in existing API. Signed-off-by: Nicolas Chautru Acked-by: Maxime Coquelin --- app/test-bbdev/test_bbdev_perf.c | 2 ++ doc/guides/rel_notes/release_22_11.rst | 3 ++ lib/bbdev/rte_bbdev.c | 19 ++++++++++++ lib/bbdev/rte_bbdev.h | 43 ++++++++++++++++++++++++++ lib/bbdev/version.map | 1 + 5 files changed, 68 insertions(+) diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c index f5eeb735b2..75f1ca4f14 100644 --- a/app/test-bbdev/test_bbdev_perf.c +++ b/app/test-bbdev/test_bbdev_perf.c @@ -4361,6 +4361,8 @@ get_bbdev_queue_stats(uint16_t dev_id, uint16_t queue_id, stats->dequeued_count = q_stats->dequeued_count; stats->enqueue_err_count = q_stats->enqueue_err_count; stats->dequeue_err_count = q_stats->dequeue_err_count; + stats->enqueue_warning_count = q_stats->enqueue_warning_count; + stats->dequeue_warning_count = q_stats->dequeue_warning_count; stats->acc_offload_cycles = q_stats->acc_offload_cycles; return 0; diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index edc50e5647..c55fb2a861 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -329,6 +329,9 @@ ABI Changes * bbdev: Structure ``rte_bbdev_driver_info`` was updated to add new parameters for queue topology, device status using ``rte_bbdev_device_status``. +* bbdev: Structure ``rte_bbdev_queue_data`` was updated to add new parameter + for enqueue status using ``rte_bbdev_enqueue_status``. + Known Issues ------------ diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c index 9d65ba8cd3..bdd7c2f00d 100644 --- a/lib/bbdev/rte_bbdev.c +++ b/lib/bbdev/rte_bbdev.c @@ -721,6 +721,8 @@ get_stats_from_queues(struct rte_bbdev *dev, struct rte_bbdev_stats *stats) stats->dequeued_count += q_stats->dequeued_count; stats->enqueue_err_count += q_stats->enqueue_err_count; stats->dequeue_err_count += q_stats->dequeue_err_count; + stats->enqueue_warn_count += q_stats->enqueue_warn_count; + stats->dequeue_warn_count += q_stats->dequeue_warn_count; } rte_bbdev_log_debug("Got stats on %u", dev->data->dev_id); } @@ -1163,3 +1165,20 @@ rte_bbdev_device_status_str(enum rte_bbdev_device_status status) rte_bbdev_log(ERR, "Invalid device status"); return NULL; } + +const char * +rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status) +{ + static const char * const enq_sta_string[] = { + "RTE_BBDEV_ENQ_STATUS_NONE", + "RTE_BBDEV_ENQ_STATUS_QUEUE_FULL", + "RTE_BBDEV_ENQ_STATUS_RING_FULL", + "RTE_BBDEV_ENQ_STATUS_INVALID_OP", + }; + + if (status < sizeof(enq_sta_string) / sizeof(char *)) + return enq_sta_string[status]; + + rte_bbdev_log(ERR, "Invalid enqueue status"); + return NULL; +} diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index 2a9d9de79f..ed0d72d02a 100644 --- a/lib/bbdev/rte_bbdev.h +++ b/lib/bbdev/rte_bbdev.h @@ -35,6 +35,13 @@ extern "C" { #define RTE_BBDEV_MAX_DEVS 128 /**< Max number of devices */ #endif +/* + * Maximum size to be used to manage the enum rte_bbdev_enqueue_status + * including padding for future enum insertion. + * The enum values must be explicitly kept smaller or equal to this padded maximum size. + */ +#define RTE_BBDEV_ENQ_STATUS_SIZE_MAX 6 + /** Flags indicate current state of BBDEV device */ enum rte_bbdev_state { RTE_BBDEV_UNUSED, @@ -223,6 +230,21 @@ rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id); int rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id); +/** + * Flags indicate the reason why a previous enqueue may not have + * consumed all requested operations. + * In case of multiple reasons the latter supersedes a previous one. + * The related macro RTE_BBDEV_ENQ_STATUS_SIZE_MAX can be used as an absolute maximum for + * notably sizing array while allowing for future enumeration insertion. + */ +enum rte_bbdev_enqueue_status { + RTE_BBDEV_ENQ_STATUS_NONE, /**< Nothing to report */ + RTE_BBDEV_ENQ_STATUS_QUEUE_FULL, /**< Not enough room in queue */ + RTE_BBDEV_ENQ_STATUS_RING_FULL, /**< Not enough room in ring */ + RTE_BBDEV_ENQ_STATUS_INVALID_OP, /**< Operation was rejected as invalid */ + /* Note: RTE_BBDEV_ENQ_STATUS_SIZE_MAX must be larger or equal to maximum enum value */ +}; + /** * Flags indicate the status of the device */ @@ -246,6 +268,12 @@ struct rte_bbdev_stats { uint64_t enqueue_err_count; /** Total error count on operations dequeued */ uint64_t dequeue_err_count; + /** Total warning count on operations enqueued */ + uint64_t enqueue_warn_count; + /** Total warning count on operations dequeued */ + uint64_t dequeue_warn_count; + /** Total enqueue status count based on rte_bbdev_enqueue_status enum */ + uint64_t enqueue_status_count[RTE_BBDEV_ENQ_STATUS_SIZE_MAX]; /** CPU cycles consumed by the (HW/SW) accelerator device to offload * the enqueue request to its internal queues. * - For a HW device this is the cycles consumed in MMIO write @@ -386,6 +414,7 @@ struct rte_bbdev_queue_data { void *queue_private; /**< Driver-specific per-queue data */ struct rte_bbdev_queue_conf conf; /**< Current configuration */ struct rte_bbdev_stats queue_stats; /**< Queue statistics */ + enum rte_bbdev_enqueue_status enqueue_status; /**< Enqueue status when op is rejected */ bool started; /**< Queue state */ }; @@ -938,6 +967,20 @@ __rte_experimental const char* rte_bbdev_device_status_str(enum rte_bbdev_device_status status); +/** + * Convert queue status from enum to string. + * + * @param status + * Queue status as enum. + * + * @returns + * Queue status as string or NULL if op_type is invalid. + * + */ +__rte_experimental +const char* +rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status); + #ifdef __cplusplus } #endif diff --git a/lib/bbdev/version.map b/lib/bbdev/version.map index db178917e2..d0bb835255 100644 --- a/lib/bbdev/version.map +++ b/lib/bbdev/version.map @@ -47,6 +47,7 @@ EXPERIMENTAL { rte_bbdev_dequeue_fft_ops; rte_bbdev_device_status_str; rte_bbdev_enqueue_fft_ops; + rte_bbdev_enqueue_status_str; rte_bbdev_fft_op_alloc_bulk; rte_bbdev_fft_op_free_bulk; };