[v1] bbdev: add device status info

Message ID 1654555808-218770-2-git-send-email-nicolas.chautru@intel.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series [v1] bbdev: add device status info |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/github-robot: build fail github build: failed
ci/intel-Testing success Testing PASS

Commit Message

Chautru, Nicolas June 6, 2022, 10:50 p.m. UTC
  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

Stephen Hemminger June 7, 2022, 12:09 a.m. UTC | #1
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.
  
Maxime Coquelin June 7, 2022, 12:42 p.m. UTC | #2
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
  
Chautru, Nicolas June 7, 2022, 3:44 p.m. UTC | #3
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
  
Maxime Coquelin June 7, 2022, 4:20 p.m. UTC | #4
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
>
  
Stephen Hemminger June 7, 2022, 4:42 p.m. UTC | #5
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.
  
Chautru, Nicolas June 8, 2022, 10:44 p.m. UTC | #6
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
  

Patch

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;
+};