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 30CB7A0542; Tue, 7 Jun 2022 01:00:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1251B40156; Tue, 7 Jun 2022 01:00:37 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 39953400EF for ; Tue, 7 Jun 2022 01:00:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654556435; x=1686092435; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=9ReSdarqBJdTDaBMfx0yGvbywGLgcH19yY3jqusNNvE=; b=KuXKVFo4T4x5gvtohzhMLeoV2tKlzHRKxjnBePiWEl1ryrNpNn17E8co TbMYDjxMZitFMkTB7YQqjdZ8mQW2ca2MxcZwqDHfdOMt9aSKapcGzqHo4 PsNx46hbk43aKldD6BWQR93yIVW31/necZ2PL5pjXOaaBAenJ7Qygn9qP soB5aUucmNNb0EONoQFpZ/Z9Wxc+jUraTy50JS0LLuCR1IOMFv0BCm2an 1jv9M56/sxTdL1+UMPQsV58MfD31gugwJqcT9MFcF2Y/rkq2uGad8CnzV gYjQ9CqkTc0Pzz42D1Z4cP5gqFDOS4lBpTr4p+Ci1wDvmYG8yQRPPeKVj Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10370"; a="276740769" X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="276740769" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 16:00:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,280,1647327600"; d="scan'208";a="723079511" Received: from skx-5gnr-sc12-4.sc.intel.com ([172.25.69.210]) by fmsmga001.fm.intel.com with ESMTP; 06 Jun 2022 16:00:34 -0700 From: Nicolas Chautru To: dev@dpdk.org, gakhil@marvell.com, trix@redhat.com, maxime.coquelin@redhat.com, hemant.agrawal@nxp.com Cc: hernan.vargas@intel.com, Nicolas Chautru Subject: [PATCH v1] bbdev: add device status info Date: Mon, 6 Jun 2022 15:50:08 -0700 Message-Id: <1654555808-218770-2-git-send-email-nicolas.chautru@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1654555808-218770-1-git-send-email-nicolas.chautru@intel.com> References: <1654555808-218770-1-git-send-email-nicolas.chautru@intel.com> 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 Added device status information, so that the PMD can expose information related to the underlying accelerator device status. Signed-off-by: Nicolas Chautru --- drivers/baseband/acc100/rte_acc100_pmd.c | 1 + drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 1 + drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 1 + drivers/baseband/la12xx/bbdev_la12xx.c | 1 + drivers/baseband/null/bbdev_null.c | 1 + drivers/baseband/turbo_sw/bbdev_turbo_software.c | 1 + lib/bbdev/rte_bbdev.c | 21 +++++++++++++++ lib/bbdev/rte_bbdev.h | 31 ++++++++++++++++++++++ lib/bbdev/version.map | 6 +++++ 9 files changed, 64 insertions(+) diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c index de7e4bc..c4a164e 100644 --- a/drivers/baseband/acc100/rte_acc100_pmd.c +++ b/drivers/baseband/acc100/rte_acc100_pmd.c @@ -1060,6 +1060,7 @@ /* Read and save the populated config from ACC100 registers */ fetch_acc100_config(dev); + dev_info->device_status = RTE_BBDEV_DEV_NOSTATUS; /* This isn't ideal because it reports the maximum number of queues but * does not provide info on how many can be uplink/downlink or different diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c index 15d23d6..f35a9f6 100644 --- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c @@ -373,6 +373,7 @@ dev_info->capabilities = bbdev_capabilities; dev_info->cpu_flag_reqs = NULL; dev_info->data_endianness = RTE_LITTLE_ENDIAN; + dev_info->device_status = RTE_BBDEV_DEV_NOSTATUS; /* Calculates number of queues assigned to device */ dev_info->max_num_queues = 0; diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c index 21d3529..92c0624 100644 --- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c +++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c @@ -645,6 +645,7 @@ struct __rte_cache_aligned fpga_queue { dev_info->capabilities = bbdev_capabilities; dev_info->cpu_flag_reqs = NULL; dev_info->data_endianness = RTE_LITTLE_ENDIAN; + dev_info->device_status = RTE_BBDEV_DEV_NOSTATUS; /* Calculates number of queues assigned to device */ dev_info->max_num_queues = 0; diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c index 4d1bd16..310a1c4 100644 --- a/drivers/baseband/la12xx/bbdev_la12xx.c +++ b/drivers/baseband/la12xx/bbdev_la12xx.c @@ -100,6 +100,7 @@ struct bbdev_la12xx_params { dev_info->capabilities = bbdev_capabilities; dev_info->cpu_flag_reqs = NULL; dev_info->min_alignment = 64; + dev_info->device_status = RTE_BBDEV_DEV_NOSTATUS; rte_bbdev_log_debug("got device info from %u", dev->data->dev_id); } diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c index 248e129..bcdf269 100644 --- a/drivers/baseband/null/bbdev_null.c +++ b/drivers/baseband/null/bbdev_null.c @@ -82,6 +82,7 @@ struct bbdev_queue { * here for code completeness. */ dev_info->data_endianness = RTE_LITTLE_ENDIAN; + dev_info->device_status = RTE_BBDEV_DEV_NOSTATUS; rte_bbdev_log_debug("got device info from %u", dev->data->dev_id); } diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c index af7bc41..00d108a 100644 --- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c +++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c @@ -254,6 +254,7 @@ struct turbo_sw_queue { dev_info->min_alignment = 64; dev_info->harq_buffer_size = 0; dev_info->data_endianness = RTE_LITTLE_ENDIAN; + dev_info->device_status = RTE_BBDEV_DEV_NOSTATUS; rte_bbdev_log_debug("got device info from %u\n", dev->data->dev_id); } diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c index aaee7b7..807bafe 100644 --- a/lib/bbdev/rte_bbdev.c +++ b/lib/bbdev/rte_bbdev.c @@ -1131,3 +1131,24 @@ struct rte_mempool * rte_bbdev_log(ERR, "Invalid operation type"); return NULL; } + +const char * +rte_bbdev_device_status_str(enum rte_bbdev_device_status status) +{ + static const char * const dev_sta_string[] = { + "RTE_BBDEV_DEV_NOSTATUS", + "RTE_BBDEV_DEV_RESET", + "RTE_BBDEV_DEV_CONFIGURED", + "RTE_BBDEV_DEV_ACTIVE", + "RTE_BBDEV_DEV_FATAL_ERR", + "RTE_BBDEV_DEV_RESTART_REQ", + "RTE_BBDEV_DEV_RECONFIG_REQ", + "RTE_BBDEV_DEV_CORRECT_ERR", + }; + + if (status < RTE_BBDEV_DEV_COUNT) + return dev_sta_string[status]; + + rte_bbdev_log(ERR, "Invalid device status"); + return NULL; +} diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index b88c881..9e377c9 100644 --- a/lib/bbdev/rte_bbdev.h +++ b/lib/bbdev/rte_bbdev.h @@ -223,6 +223,21 @@ struct rte_bbdev_queue_conf { int rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id); +/** + * Flags indicate the status of the device + */ +enum rte_bbdev_device_status { + RTE_BBDEV_DEV_NOSTATUS, /**< Nothing to report */ + RTE_BBDEV_DEV_RESET, /**< Device in reset and unconfigure state */ + RTE_BBDEV_DEV_CONFIGURED, /**< Device is configured and ready to use */ + RTE_BBDEV_DEV_ACTIVE, /**< Device is configured and VF is being used */ + RTE_BBDEV_DEV_FATAL_ERR, /**< Device has hit a fatal uncorrectable error */ + RTE_BBDEV_DEV_RESTART_REQ, /**< Device requires application to restart */ + RTE_BBDEV_DEV_RECONFIG_REQ, /**< Device requires application to reconfig queues */ + RTE_BBDEV_DEV_CORRECT_ERR, /**< Warning of a correctable error event happened */ + RTE_BBDEV_DEV_COUNT +}; + /** Device statistics. */ struct rte_bbdev_stats { uint64_t enqueued_count; /**< Count of all operations enqueued */ @@ -298,6 +313,8 @@ struct rte_bbdev_driver_info { const struct rte_bbdev_op_cap *capabilities; /** Device cpu_flag requirements */ const enum rte_cpu_flag_t *cpu_flag_reqs; + /** Device Status */ + enum rte_bbdev_device_status device_status; }; /** Macro used at end of bbdev PMD list */ @@ -827,6 +844,20 @@ typedef void (*rte_bbdev_cb_fn)(uint16_t dev_id, rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op, void *data); +/** + * Converts device status from enum to string + * + * @param status + * Device status as enum + * + * @returns + * Operation type as string or NULL if op_type is invalid + * + */ +__rte_experimental +const char* +rte_bbdev_device_status_str(enum rte_bbdev_device_status status); + #ifdef __cplusplus } #endif diff --git a/lib/bbdev/version.map b/lib/bbdev/version.map index cce3f3c..9ac3643 100644 --- a/lib/bbdev/version.map +++ b/lib/bbdev/version.map @@ -39,3 +39,9 @@ DPDK_22 { local: *; }; + +EXPERIMENTAL { + global: + + rte_bbdev_device_status_str; +}; -- 1.8.3.1