Skip to contentSkip to conversation

bbdev: add device status info

PATCH New Nicolas Chautru 3 participants 8 messages Jun 6, 2022 – Jun 8, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bbdev: add device status info

This is a bbdev update targeted for 22.11. The updated structure will allow PMDs to expose through info_get what be may the status of the underlying accelerator, notably in case an HW error event having happened.

Nicolas Chautru (1):
bbdev: add device status info

 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(+)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 bbdev: add device status info

Added device status information, so that the PMD can
expose information related to the underlying accelerator device status.

---
 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(+)
drivers/baseband/acc100/rte_acc100_pmd.c +1 -0
index de7e4bc..c4a164e 100644
@@ -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
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +1 -0
index 15d23d6..f35a9f6 100644
@@ -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;
drivers/baseband/fpga_lte_fec/fpga_lte_fec.c +1 -0
index 21d3529..92c0624 100644
@@ -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;
drivers/baseband/la12xx/bbdev_la12xx.c +1 -0
index 4d1bd16..310a1c4 100644
@@ -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);
 }
drivers/baseband/null/bbdev_null.c +1 -0
index 248e129..bcdf269 100644
@@ -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);
 }
drivers/baseband/turbo_sw/bbdev_turbo_software.c +1 -0
index af7bc41..00d108a 100644
@@ -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);
 }
lib/bbdev/rte_bbdev.c +21 -0
index aaee7b7..807bafe 100644
@@ -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;
+}
lib/bbdev/rte_bbdev.h +31 -0
index b88c881..9e377c9 100644
@@ -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
lib/bbdev/version.map +6 -0
index cce3f3c..9ac3643 100644
@@ -39,3 +39,9 @@ DPDK_22 {
 
 	local: *;
 };
+
+EXPERIMENTAL {
+	global:
+
+	rte_bbdev_device_status_str;
+};
Signature · 1 line
1.8.3.1
#2 lore raw

lib/bbdev/rte_bbdev.h struct rte_bbdev_driver_info { · line 319

Quoted 8 lines · On Mon, 6 Jun 2022 15:50:08 -0700 Nicolas Chautru <[email protected]>…
lib/bbdev/rte_bbdev.h +2 -0
@@ -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.

#3 lore raw

Hi Stephen,

Quoted 15 lines · Stephen Hemminger

lib/bbdev/rte_bbdev.h struct rte_bbdev_driver_info { · line 319

Quoted 8 lines · On Mon, 6 Jun 2022 15:50:08 -0700 Nicolas Chautru <[email protected]>…
lib/bbdev/rte_bbdev.h +2 -0
@@ -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

#4 lore raw

Hi Maxime,

Quoted 28 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, June 7, 2022 5:43 AM
To: Stephen Hemminger <[email protected]>; Chautru, Nicolas <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Vargas, Hernan <[email protected]>
Subject: Re: [PATCH v1] bbdev: add device status info

Hi Stephen,

Quoted 15 lines · Stephen Hemminger

lib/bbdev/rte_bbdev.h struct rte_bbdev_driver_info { · line 319

Quoted 8 lines · On Mon, 6 Jun 2022 15:50:08 -0700 Nicolas Chautru <[email protected]>…
lib/bbdev/rte_bbdev.h +2 -0
@@ -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.

Quoted 5 lines

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/[email protected]/
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

Quoted 2 lines

Maxime

#5 lore raw

Hi Nicolas,

Quoted 33 lines · Nicolas

Hi Maxime,

Quoted 31 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, June 7, 2022 5:43 AM
To: Stephen Hemminger <[email protected]>; Chautru, Nicolas <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Vargas, Hernan <[email protected]>
Subject: Re: [PATCH v1] bbdev: add device status info

Hi Stephen,

Quoted 15 lines · Stephen Hemminger

lib/bbdev/rte_bbdev.h struct rte_bbdev_driver_info { · line 319

Quoted 8 lines · On Mon, 6 Jun 2022 15:50:08 -0700 Nicolas Chautru <[email protected]>…
lib/bbdev/rte_bbdev.h +2 -0
@@ -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.

Quoted 6 lines
Quoted 2 lines

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/[email protected]/
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

Quoted 4 lines
Quoted 3 lines

Maxime

#6 lore raw
Quoted 43 lines · On Tue, 7 Jun 2022 18:20:38 +0200 Maxime Coquelin <[email protected]>…

Hi Nicolas,

Quoted 33 lines · Nicolas

Hi Maxime,

Quoted 31 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, June 7, 2022 5:43 AM
To: Stephen Hemminger <[email protected]>; Chautru, Nicolas <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Vargas, Hernan <[email protected]>
Subject: Re: [PATCH v1] bbdev: add device status info

Hi Stephen,

Quoted 15 lines · Stephen Hemminger

lib/bbdev/rte_bbdev.h struct rte_bbdev_driver_info { · line 319

Quoted 8 lines · On Mon, 6 Jun 2022 15:50:08 -0700 Nicolas Chautru <[email protected]>…
lib/bbdev/rte_bbdev.h +2 -0
@@ -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.

Quoted 6 lines
Quoted 2 lines

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/[email protected]/
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

Quoted 5 lines

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.

#7 lore raw

Hi Stephen,

Quoted 59 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, June 7, 2022 9:43 AM
To: Maxime Coquelin <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Vargas, Hernan <[email protected]>
Subject: Re: [PATCH v1] bbdev: add device status info

Quoted 12 lines · On Tue, 7 Jun 2022 18:20:38 +0200 Maxime Coquelin <[email protected]>…

Hi Nicolas,

Quoted 9 lines · Nicolas

Hi Maxime,

Quoted 7 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, June 7, 2022 5:43 AM
To: Stephen Hemminger <[email protected]>; Chautru, Nicolas <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Vargas, Hernan

<[email protected]>

Quoted 34 lines
Quoted 33 lines
Quoted 21 lines

Subject: Re: [PATCH v1] bbdev: add device status info

Hi Stephen,

Quoted 15 lines · Stephen Hemminger

lib/bbdev/rte_bbdev.h struct rte_bbdev_driver_info { · line 319

Quoted 8 lines · On Mon, 6 Jun 2022 15:50:08 -0700 Nicolas Chautru <[email protected]>…
lib/bbdev/rte_bbdev.h +2 -0
@@ -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.

Quoted 5 lines

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
[email protected]/
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

Quoted 9 lines
Quoted 5 lines

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