bbdev: add device status info

Added device status information, so that the PMD can
expose information related to the underlying accelerator device status.
Minor order change in structure to fit into padding hole.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Acked-by: Mingshan Zhang <mingshan.zhang@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
This commit is contained in:
Nicolas Chautru 2022-10-04 10:16:51 -07:00 committed by Akhil Goyal
parent e70212cc24
commit 1be86f2e94
11 changed files with 71 additions and 5 deletions

View File

@ -99,9 +99,6 @@ Deprecation Notices
New members will be added in ``rte_bbdev_driver_info`` to expose
PMD queue topology inspired by
this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=22076>`__.
New member will be added in ``rte_bbdev_driver_info`` to expose
the device status as per
this `RFC <https://patches.dpdk.org/project/dpdk/list/?series=23367>`__.
This should be updated in DPDK 22.11.
* cryptodev: The function ``rte_cryptodev_cb_fn`` will be updated

View File

@ -432,6 +432,9 @@ ABI Changes
and to allow for futureproof enum insertion a padded ``RTE_BBDEV_OP_TYPE_SIZE_MAX``
macro is added.
* bbdev: Structure ``rte_bbdev_driver_info`` was updated to add new parameters
for device status using ``rte_bbdev_device_status``.
* eventdev: Added ``evtim_drop_count`` field
to ``rte_event_timer_adapter_stats`` structure.

View File

@ -1061,6 +1061,7 @@ acc100_dev_info_get(struct rte_bbdev *dev,
/* Read and save the populated config from ACC100 registers */
fetch_acc100_config(dev);
dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
/* 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

View File

@ -369,6 +369,7 @@ fpga_dev_info_get(struct rte_bbdev *dev,
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_NOT_SUPPORTED;
/* Calculates number of queues assigned to device */
dev_info->max_num_queues = 0;

View File

@ -645,6 +645,7 @@ fpga_dev_info_get(struct rte_bbdev *dev,
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_NOT_SUPPORTED;
/* Calculates number of queues assigned to device */
dev_info->max_num_queues = 0;

View File

@ -101,6 +101,7 @@ la12xx_info_get(struct rte_bbdev *dev __rte_unused,
dev_info->capabilities = bbdev_capabilities;
dev_info->cpu_flag_reqs = NULL;
dev_info->min_alignment = 64;
dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
}

View File

@ -83,6 +83,7 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
* here for code completeness.
*/
dev_info->data_endianness = RTE_LITTLE_ENDIAN;
dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED;
rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
}

View File

@ -255,6 +255,7 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
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_NOT_SUPPORTED;
rte_bbdev_log_debug("got device info from %u\n", dev->data->dev_id);
}

View File

@ -1133,3 +1133,25 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
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_NOT_SUPPORTED",
"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 < sizeof(dev_sta_string) / sizeof(char *))
return dev_sta_string[status];
rte_bbdev_log(ERR, "Invalid device status");
return NULL;
}

View File

@ -223,6 +223,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 to indicate the status of the device.
*/
enum rte_bbdev_device_status {
RTE_BBDEV_DEV_NOSTATUS, /**< Nothing being reported. */
RTE_BBDEV_DEV_NOT_SUPPORTED, /**< Device status is not supported on the PMD. */
RTE_BBDEV_DEV_RESET, /**< Device in reset and un-configured 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 reconfigure queues. */
RTE_BBDEV_DEV_CORRECT_ERR, /**< Warning of a correctable error event happened. */
};
/** Device statistics. */
struct rte_bbdev_stats {
uint64_t enqueued_count; /**< Count of all operations enqueued */
@ -284,10 +299,12 @@ struct rte_bbdev_driver_info {
uint8_t max_ul_queue_priority;
/** Set if device supports per-queue interrupts */
bool queue_intr_supported;
/** Minimum alignment of buffers, in bytes */
uint16_t min_alignment;
/** Device Status */
enum rte_bbdev_device_status device_status;
/** HARQ memory available in kB */
uint32_t harq_buffer_size;
/** Minimum alignment of buffers, in bytes */
uint16_t min_alignment;
/** Byte endianness (RTE_BIG_ENDIAN/RTE_LITTLE_ENDIAN) supported
* for input/output data
*/
@ -827,6 +844,20 @@ int
rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
void *data);
/**
* Convert device status from enum to string.
*
* @param status
* Device status as enum.
*
* @returns
* Device status as string or NULL if invalid.
*
*/
__rte_experimental
const char*
rte_bbdev_device_status_str(enum rte_bbdev_device_status status);
#ifdef __cplusplus
}
#endif

View File

@ -39,3 +39,10 @@ DPDK_23 {
local: *;
};
EXPERIMENTAL {
global:
# added in 22.11
rte_bbdev_device_status_str;
};