[v1] bbdev: add device status info
Checks
Commit Message
Added device status information, so that the PMD can
expose information related to the underlying accelerator device status.
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
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(+)
Comments
On Mon, 6 Jun 2022 15:50:08 -0700
Nicolas Chautru <nicolas.chautru@intel.com> wrote:
> @@ -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;
> };
>
This ends up being an ABI breakage, can't change a struct like that
until 22.11 release.
Hi Stephen,
On 6/7/22 02:09, Stephen Hemminger wrote:
> On Mon, 6 Jun 2022 15:50:08 -0700
> Nicolas Chautru <nicolas.chautru@intel.com> wrote:
>
>> @@ -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;
>> };
>>
>
> This ends up being an ABI breakage, can't change a struct like that
> until 22.11 release.
>
Indeed, but Nicolas mentioned in the cover-letter that the patch targets
v22.11; not this release.
However, a deprecation notice should be sent for v22.07 if it hasn't
been done yet.
Maxime
Hi Maxime,
> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Tuesday, June 7, 2022 5:43 AM
> To: Stephen Hemminger <stephen@networkplumber.org>; Chautru, Nicolas
> <nicolas.chautru@intel.com>
> Cc: dev@dpdk.org; gakhil@marvell.com; trix@redhat.com;
> hemant.agrawal@nxp.com; Vargas, Hernan <hernan.vargas@intel.com>
> Subject: Re: [PATCH v1] bbdev: add device status info
>
> Hi Stephen,
>
> On 6/7/22 02:09, Stephen Hemminger wrote:
> > On Mon, 6 Jun 2022 15:50:08 -0700
> > Nicolas Chautru <nicolas.chautru@intel.com> wrote:
> >
> >> @@ -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;
> >> };
> >>
> >
> > This ends up being an ABI breakage, can't change a struct like that
> > until 22.11 release.
> >
>
> Indeed, but Nicolas mentioned in the cover-letter that the patch targets
> v22.11; not this release.
>
> However, a deprecation notice should be sent for v22.07 if it hasn't been
> done yet.
I have sent this deprecation Maxime:
https://patches.dpdk.org/project/dpdk/patch/1647542252-35727-2-git-send-email-nicolas.chautru@intel.com/
Do you believe this needs to be extended to cover more details the change and including this device status info explicitly? I can update the verbiage in more details if required
>
> Maxime
Hi Nicolas,
On 6/7/22 17:44, Chautru, Nicolas wrote:
> Hi Maxime,
>
>> -----Original Message-----
>> From: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Sent: Tuesday, June 7, 2022 5:43 AM
>> To: Stephen Hemminger <stephen@networkplumber.org>; Chautru, Nicolas
>> <nicolas.chautru@intel.com>
>> Cc: dev@dpdk.org; gakhil@marvell.com; trix@redhat.com;
>> hemant.agrawal@nxp.com; Vargas, Hernan <hernan.vargas@intel.com>
>> Subject: Re: [PATCH v1] bbdev: add device status info
>>
>> Hi Stephen,
>>
>> On 6/7/22 02:09, Stephen Hemminger wrote:
>>> On Mon, 6 Jun 2022 15:50:08 -0700
>>> Nicolas Chautru <nicolas.chautru@intel.com> wrote:
>>>
>>>> @@ -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;
>>>> };
>>>>
>>>
>>> This ends up being an ABI breakage, can't change a struct like that
>>> until 22.11 release.
>>>
>>
>> Indeed, but Nicolas mentioned in the cover-letter that the patch targets
>> v22.11; not this release.
>>
>> However, a deprecation notice should be sent for v22.07 if it hasn't been
>> done yet.
>
> I have sent this deprecation Maxime:
> https://patches.dpdk.org/project/dpdk/patch/1647542252-35727-2-git-send-email-nicolas.chautru@intel.com/
> Do you believe this needs to be extended to cover more details the change and including this device status info explicitly? I can update the verbiage in more details if required
Thanks for the pointer, I missed it.
Reading the deprecation notice, it is not clear to me it is about the
device status info enum.
Maybe rewording it a bit to be more specific would help.
Thanks,
Maxime
>
>>
>> Maxime
>
On Tue, 7 Jun 2022 18:20:38 +0200
Maxime Coquelin <maxime.coquelin@redhat.com> wrote:
> Hi Nicolas,
>
> On 6/7/22 17:44, Chautru, Nicolas wrote:
> > Hi Maxime,
> >
> >> -----Original Message-----
> >> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> >> Sent: Tuesday, June 7, 2022 5:43 AM
> >> To: Stephen Hemminger <stephen@networkplumber.org>; Chautru, Nicolas
> >> <nicolas.chautru@intel.com>
> >> Cc: dev@dpdk.org; gakhil@marvell.com; trix@redhat.com;
> >> hemant.agrawal@nxp.com; Vargas, Hernan <hernan.vargas@intel.com>
> >> Subject: Re: [PATCH v1] bbdev: add device status info
> >>
> >> Hi Stephen,
> >>
> >> On 6/7/22 02:09, Stephen Hemminger wrote:
> >>> On Mon, 6 Jun 2022 15:50:08 -0700
> >>> Nicolas Chautru <nicolas.chautru@intel.com> wrote:
> >>>
> >>>> @@ -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;
> >>>> };
> >>>>
> >>>
> >>> This ends up being an ABI breakage, can't change a struct like that
> >>> until 22.11 release.
> >>>
> >>
> >> Indeed, but Nicolas mentioned in the cover-letter that the patch targets
> >> v22.11; not this release.
> >>
> >> However, a deprecation notice should be sent for v22.07 if it hasn't been
> >> done yet.
> >
> > I have sent this deprecation Maxime:
> > https://patches.dpdk.org/project/dpdk/patch/1647542252-35727-2-git-send-email-nicolas.chautru@intel.com/
> > Do you believe this needs to be extended to cover more details the change and including this device status info explicitly? I can update the verbiage in more details if required
>
> Thanks for the pointer, I missed it.
> Reading the deprecation notice, it is not clear to me it is about the
> device status info enum.
>
> Maybe rewording it a bit to be more specific would help.
You might want to use one the existing empty padding slots (holes) in
that structure. It appears to have been laid out haphazardly.
Hi Stephen,
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Tuesday, June 7, 2022 9:43 AM
> To: Maxime Coquelin <maxime.coquelin@redhat.com>
> Cc: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org;
> gakhil@marvell.com; trix@redhat.com; hemant.agrawal@nxp.com; Vargas,
> Hernan <hernan.vargas@intel.com>
> Subject: Re: [PATCH v1] bbdev: add device status info
>
> On Tue, 7 Jun 2022 18:20:38 +0200
> Maxime Coquelin <maxime.coquelin@redhat.com> wrote:
>
> > Hi Nicolas,
> >
> > On 6/7/22 17:44, Chautru, Nicolas wrote:
> > > Hi Maxime,
> > >
> > >> -----Original Message-----
> > >> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> > >> Sent: Tuesday, June 7, 2022 5:43 AM
> > >> To: Stephen Hemminger <stephen@networkplumber.org>; Chautru,
> > >> Nicolas <nicolas.chautru@intel.com>
> > >> Cc: dev@dpdk.org; gakhil@marvell.com; trix@redhat.com;
> > >> hemant.agrawal@nxp.com; Vargas, Hernan
> <hernan.vargas@intel.com>
> > >> Subject: Re: [PATCH v1] bbdev: add device status info
> > >>
> > >> Hi Stephen,
> > >>
> > >> On 6/7/22 02:09, Stephen Hemminger wrote:
> > >>> On Mon, 6 Jun 2022 15:50:08 -0700 Nicolas Chautru
> > >>> <nicolas.chautru@intel.com> wrote:
> > >>>
> > >>>> @@ -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;
> > >>>> };
> > >>>>
> > >>>
> > >>> This ends up being an ABI breakage, can't change a struct like
> > >>> that until 22.11 release.
> > >>>
> > >>
> > >> Indeed, but Nicolas mentioned in the cover-letter that the patch
> > >> targets v22.11; not this release.
> > >>
> > >> However, a deprecation notice should be sent for v22.07 if it
> > >> hasn't been done yet.
> > >
> > > I have sent this deprecation Maxime:
> > > https://patches.dpdk.org/project/dpdk/patch/1647542252-35727-2-git-s
> > > end-email-nicolas.chautru@intel.com/
> > > Do you believe this needs to be extended to cover more details the
> > > change and including this device status info explicitly? I can
> > > update the verbiage in more details if required
> >
> > Thanks for the pointer, I missed it.
> > Reading the deprecation notice, it is not clear to me it is about the
> > device status info enum.
> >
> > Maybe rewording it a bit to be more specific would help.
>
> You might want to use one the existing empty padding slots (holes) in that
> structure. It appears to have been laid out haphazardly.
>
I don't see such one single hole to fill that enum but I can shuffle a bit that structure. In that case total size would no longer change but a few offsets would differ and padding would be reduced.
Thanks
Nic
@@ -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
@@ -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;
@@ -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;
@@ -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);
}
@@ -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);
}
@@ -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);
}
@@ -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;
+}
@@ -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
@@ -39,3 +39,9 @@ DPDK_22 {
local: *;
};
+
+EXPERIMENTAL {
+ global:
+
+ rte_bbdev_device_status_str;
+};