Skip to contentSkip to conversation

bbdev: add device info related to data endianness assumption

PATCH Superseded Nicolas Chautru 4 participants 10 messages Oct 6, 2021 – Oct 8, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v9 1/1 bbdev: add device info related to data endianness assumption

Suggesting this bbdev api change attached to address the requirement for the new
bbdev PMD from this serie : https://patches.dpdk.org/project/dpdk/patch/[email protected]/
Nipin, please review and you can use this one in case that is okay with you.
This is defined as an enum and default values set in existing PMDs.

Nicolas Chautru (1):
bbdev: add device info related to data endianness assumption

 doc/guides/rel_notes/release_21_11.rst             | 1 +
 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/turbo_sw/bbdev_turbo_software.c   | 1 +
 lib/bbdev/rte_bbdev.h                              | 8 ++++++++
 6 files changed, 13 insertions(+)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v9 1/1 bbdev: add device info related to data endianness assumption

Adding device information to capture explicitly the assumption of the input/output data byte endianness being processed.

---
 doc/guides/rel_notes/release_21_11.rst             | 1 +
 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/turbo_sw/bbdev_turbo_software.c   | 1 +
 lib/bbdev/rte_bbdev.h                              | 8 ++++++++
 6 files changed, 13 insertions(+)
doc/guides/rel_notes/release_21_11.rst +1 -0
index a8900a3..f0b3006 100644
@@ -191,6 +191,7 @@ API Changes
 
 * bbdev: Added capability related to more comprehensive CRC options.
 
+* bbdev: Added device info related to data byte endianness processing assumption.
 
 ABI Changes
 -----------
drivers/baseband/acc100/rte_acc100_pmd.c +1 -0
index 4e2feef..eb2c6c1 100644
@@ -1089,6 +1089,7 @@
 #else
 	dev_info->harq_buffer_size = 0;
 #endif
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 	acc100_check_ir(d);
 }
 
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +1 -0
index 6485cc8..c7f15c0 100644
@@ -372,6 +372,7 @@
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* 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 350c424..72e213e 100644
@@ -644,6 +644,7 @@ struct __rte_cache_aligned fpga_queue {
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* Calculates number of queues assigned to device */
 	dev_info->max_num_queues = 0;
drivers/baseband/turbo_sw/bbdev_turbo_software.c +1 -0
index e1db2bf..0cab91a 100644
@@ -253,6 +253,7 @@ struct turbo_sw_queue {
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->min_alignment = 64;
 	dev_info->harq_buffer_size = 0;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	rte_bbdev_log_debug("got device info from %u\n", dev->data->dev_id);
 }
lib/bbdev/rte_bbdev.h +8 -0
index 3ebf62e..b3f3000 100644
@@ -49,6 +49,12 @@ enum rte_bbdev_state {
 	RTE_BBDEV_INITIALIZED
 };
 
+/** Definitions of device data byte endianness types */
+enum rte_bbdev_endianness {
+	RTE_BBDEV_BIG_ENDIAN,    /**< Data with byte-endianness BE */
+	RTE_BBDEV_LITTLE_ENDIAN, /**< Data with byte-endianness LE */
+};
+
 /**
  * Get the total number of devices that have been successfully initialised.
  *
@@ -309,6 +315,8 @@ struct rte_bbdev_driver_info {
 	uint16_t min_alignment;
 	/** HARQ memory available in kB */
 	uint32_t harq_buffer_size;
+	/** Byte endianness assumption for input/output data */
+	enum rte_bbdev_endianness data_endianness;
 	/** Default queue configuration used if none is supplied  */
 	struct rte_bbdev_queue_conf default_queue_conf;
 	/** Device operation capabilities */
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 9 lines · Nicolas Chautru

Adding device information to capture explicitly the assumption of the input/output data byte endianness being processed.

---
  doc/guides/rel_notes/release_21_11.rst             | 1 +
  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 +

Missed bbdev_null.c

If this was intentional data_endianness is uninitialized or implicitly big endian.

It would be better to say it is unknown. which may mean another enum is needed.

Quoted 69 lines
  drivers/baseband/turbo_sw/bbdev_turbo_software.c   | 1 +
  lib/bbdev/rte_bbdev.h                              | 8 ++++++++
  6 files changed, 13 insertions(+)
doc/guides/rel_notes/release_21_11.rst +1 -0
index a8900a3..f0b3006 100644
@@ -191,6 +191,7 @@ API Changes
 
  * bbdev: Added capability related to more comprehensive CRC options.
 
+* bbdev: Added device info related to data byte endianness processing assumption.
 
  ABI Changes
  -----------
drivers/baseband/acc100/rte_acc100_pmd.c +1 -0
index 4e2feef..eb2c6c1 100644
@@ -1089,6 +1089,7 @@
  #else
  	dev_info->harq_buffer_size = 0;
  #endif
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
  	acc100_check_ir(d);
  }
 
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +1 -0
index 6485cc8..c7f15c0 100644
@@ -372,6 +372,7 @@
  	dev_info->default_queue_conf = default_queue_conf;
  	dev_info->capabilities = bbdev_capabilities;
  	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
  	/* 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 350c424..72e213e 100644
@@ -644,6 +644,7 @@ struct __rte_cache_aligned fpga_queue {
  	dev_info->default_queue_conf = default_queue_conf;
  	dev_info->capabilities = bbdev_capabilities;
  	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
  	/* Calculates number of queues assigned to device */
  	dev_info->max_num_queues = 0;
drivers/baseband/turbo_sw/bbdev_turbo_software.c +1 -0
index e1db2bf..0cab91a 100644
@@ -253,6 +253,7 @@ struct turbo_sw_queue {
  	dev_info->capabilities = bbdev_capabilities;
  	dev_info->min_alignment = 64;
  	dev_info->harq_buffer_size = 0;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
  	rte_bbdev_log_debug("got device info from %u\n", dev->data->dev_id);
  }
lib/bbdev/rte_bbdev.h +0 -0
index 3ebf62e..b3f3000 100644

lib/bbdev/rte_bbdev.h enum rte_bbdev_state { · line 56

Quoted 8 lines
lib/bbdev/rte_bbdev.h +5 -0
@@ -49,6 +49,12 @@ enum rte_bbdev_state {
  	RTE_BBDEV_INITIALIZED
  };
 
+/** Definitions of device data byte endianness types */
+enum rte_bbdev_endianness {
+	RTE_BBDEV_BIG_ENDIAN,    /**< Data with byte-endianness BE */
+	RTE_BBDEV_LITTLE_ENDIAN, /**< Data with byte-endianness LE */
+};

Could RTE_BIG|LITTLE_ENDIAN be reused ?

Tom

Quoted 13 lines
lib/bbdev/rte_bbdev.h +3 -0
+
  /**
   * Get the total number of devices that have been successfully initialised.
   *
@@ -309,6 +315,8 @@ struct rte_bbdev_driver_info {
  	uint16_t min_alignment;
  	/** HARQ memory available in kB */
  	uint32_t harq_buffer_size;
+	/** Byte endianness assumption for input/output data */
+	enum rte_bbdev_endianness data_endianness;
  	/** Default queue configuration used if none is supplied  */
  	struct rte_bbdev_queue_conf default_queue_conf;
  	/** Device operation capabilities */
#3 lore raw

Hi Tom,

Quoted 23 lines

-----Original Message-----
From: Tom Rix <[email protected]>
Sent: Thursday, October 7, 2021 5:01 AM
To: Chautru, Nicolas <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Zhang, Mingshan <[email protected]>; Joshi, Arun <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH v9] bbdev: add device info related to data endianness assumption

Quoted 9 lines · Nicolas Chautru

Adding device information to capture explicitly the assumption of the input/output data byte endianness being processed.

---
  doc/guides/rel_notes/release_21_11.rst             | 1 +
  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 +
Quoted 6 lines

Missed bbdev_null.c

If this was intentional data_endianness is uninitialized or implicitly big endian.

It would be better to say it is unknown. which may mean another enum is needed.

I considered this but null driver doesn't touch data, so not relevant.
Still if preferred, Nipin feel free to set it in null_driver as well in your serie (with a comment that it is not relevant).

Quoted 80 lines
Quoted 11 lines
  drivers/baseband/turbo_sw/bbdev_turbo_software.c   | 1 +
  lib/bbdev/rte_bbdev.h                              | 8 ++++++++
  6 files changed, 13 insertions(+)
doc/guides/rel_notes/release_21_11.rst +0 -0
index a8900a3..f0b3006 100644

doc/guides/rel_notes/release_21_11.rst API Changes · line 194

Quoted 4 lines
doc/guides/rel_notes/release_21_11.rst +1 -0
@@ -191,6 +191,7 @@ API Changes
 
  * bbdev: Added capability related to more comprehensive CRC options.
 
+* bbdev: Added device info related to data byte endianness processing

assumption.

Quoted 64 lines
doc/guides/rel_notes/release_21_11.rst +0 -0
  ABI Changes
  -----------
drivers/baseband/acc100/rte_acc100_pmd.c +1 -0
index 4e2feef..eb2c6c1 100644
@@ -1089,6 +1089,7 @@
  #else
  	dev_info->harq_buffer_size = 0;
  #endif
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
  	acc100_check_ir(d);
  }
 
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +1 -0
index 6485cc8..c7f15c0 100644
@@ -372,6 +372,7 @@
  	dev_info->default_queue_conf = default_queue_conf;
  	dev_info->capabilities = bbdev_capabilities;
  	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
  	/* 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 350c424..72e213e 100644
@@ -644,6 +644,7 @@ struct __rte_cache_aligned fpga_queue {
  	dev_info->default_queue_conf = default_queue_conf;
  	dev_info->capabilities = bbdev_capabilities;
  	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
  	/* Calculates number of queues assigned to device */
  	dev_info->max_num_queues = 0;
drivers/baseband/turbo_sw/bbdev_turbo_software.c +1 -0
index e1db2bf..0cab91a 100644
@@ -253,6 +253,7 @@ struct turbo_sw_queue {
  	dev_info->capabilities = bbdev_capabilities;
  	dev_info->min_alignment = 64;
  	dev_info->harq_buffer_size = 0;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
  	rte_bbdev_log_debug("got device info from %u\n", dev->data-
 dev_id);
  }
lib/bbdev/rte_bbdev.h index renamed from lib/bbdev/rte_bbdev.h +0 -0

3ebf62e..b3f3000 100644

lib/bbdev/rte_bbdev.h +0 -0
@@ -49,6 +49,12 @@ enum rte_bbdev_state {
  	RTE_BBDEV_INITIALIZED
  };
 
Quoted 6 lines

lib/bbdev/rte_bbdev.h enum rte_bbdev_state { · line 55

Quoted 4 lines
lib/bbdev/rte_bbdev.h +4 -0
+/** Definitions of device data byte endianness types */ enum
+rte_bbdev_endianness {
+	RTE_BBDEV_BIG_ENDIAN,    /**< Data with byte-endianness BE */
+	RTE_BBDEV_LITTLE_ENDIAN, /**< Data with byte-endianness LE */ };

Could RTE_BIG|LITTLE_ENDIAN be reused ?

I considered this but the usage is different, these are build time #define, and really would bring confusion here. Note that there are not really the endianness of the system itself but specific to the bbdev data output going through signal processing. I thought it was more explicit and less confusing this way, feel free to comment back.

Thanks for the comments.

Quoted 16 lines

Tom

Quoted 13 lines
lib/bbdev/rte_bbdev.h +3 -0
+
  /**
   * Get the total number of devices that have been successfully initialised.
   *
@@ -309,6 +315,8 @@ struct rte_bbdev_driver_info {
  	uint16_t min_alignment;
  	/** HARQ memory available in kB */
  	uint32_t harq_buffer_size;
+	/** Byte endianness assumption for input/output data */
+	enum rte_bbdev_endianness data_endianness;
  	/** Default queue configuration used if none is supplied  */
  	struct rte_bbdev_queue_conf default_queue_conf;
  	/** Device operation capabilities */
#4 lore raw
In reply to Nicolas Chautru
Quoted 3 lines

Subject: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Title is too long.
bbdev: add dev info for data endianness

Quoted 23 lines

Adding device information to capture explicitly the assumption of the input/output data byte endianness being processed.

---
 doc/guides/rel_notes/release_21_11.rst             | 1 +
 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/turbo_sw/bbdev_turbo_software.c   | 1 +
 lib/bbdev/rte_bbdev.h                              | 8 ++++++++
 6 files changed, 13 insertions(+)
doc/guides/rel_notes/release_21_11.rst +1 -0
index a8900a3..f0b3006 100644
@@ -191,6 +191,7 @@ API Changes
 
 * bbdev: Added capability related to more comprehensive CRC options.
 
+* bbdev: Added device info related to data byte endianness processing
Quoted 1 line

assumption.

It is not clear from the description or the release notes, what the application is supposed to do based on the new dev_info field set and how the driver determine what value to set?
Isn't there a standard from the application stand point that the input/output data Should be in BE or in LE like in case of IP packets which are always in BE? I mean why is it dependent on the PMD which is processing it? Whatever application understands, PMD should comply with that and do internal Swapping if it does not support it.
Am I missing something?

Quoted 61 lines

ABI Changes
-----------

drivers/baseband/acc100/rte_acc100_pmd.c +1 -0
index 4e2feef..eb2c6c1 100644
@@ -1089,6 +1089,7 @@
 #else
 	dev_info->harq_buffer_size = 0;
 #endif
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 	acc100_check_ir(d);
 }
 
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +1 -0
index 6485cc8..c7f15c0 100644
@@ -372,6 +372,7 @@
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* 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 350c424..72e213e 100644
@@ -644,6 +644,7 @@ struct __rte_cache_aligned fpga_queue {
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* Calculates number of queues assigned to device */
 	dev_info->max_num_queues = 0;
drivers/baseband/turbo_sw/bbdev_turbo_software.c +1 -0
index e1db2bf..0cab91a 100644
@@ -253,6 +253,7 @@ struct turbo_sw_queue {
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->min_alignment = 64;
 	dev_info->harq_buffer_size = 0;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	rte_bbdev_log_debug("got device info from %u\n", dev->data-
 >dev_id);

}

lib/bbdev/rte_bbdev.h +0 -0
index 3ebf62e..b3f3000 100644

lib/bbdev/rte_bbdev.h enum rte_bbdev_state { · line 56

Quoted 8 lines
lib/bbdev/rte_bbdev.h +5 -0
@@ -49,6 +49,12 @@ enum rte_bbdev_state {
 	RTE_BBDEV_INITIALIZED
 };
 
+/** Definitions of device data byte endianness types */
+enum rte_bbdev_endianness {
+	RTE_BBDEV_BIG_ENDIAN,    /**< Data with byte-endianness BE */
+	RTE_BBDEV_LITTLE_ENDIAN, /**< Data with byte-endianness LE */
+};

If at all be need this dev_info field,
as Tom suggested we should use RTE_BIG/LITTLE_ENDIAN.

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

Quoted 10 lines
lib/bbdev/rte_bbdev.h +3 -0
+
 /**
  * Get the total number of devices that have been successfully initialised.
  *
@@ -309,6 +315,8 @@ struct rte_bbdev_driver_info {
 	uint16_t min_alignment;
 	/** HARQ memory available in kB */
 	uint32_t harq_buffer_size;
+	/** Byte endianness assumption for input/output data */
+	enum rte_bbdev_endianness data_endianness;

We should define how the input and output data are expected from the app. If need be, we can define a simple ``bool swap`` instead of an enum.

Quoted 5 lines
lib/bbdev/rte_bbdev.h +0 -1
 	/** Default queue configuration used if none is supplied  */
 	struct rte_bbdev_queue_conf default_queue_conf;
 	/** Device operation capabilities */
--

1.8.3.1

#5 lore raw

Hi Akhil,

Quoted 11 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Thursday, October 7, 2021 6:14 AM
To: Chautru, Nicolas <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Zhang, Mingshan <[email protected]>; Joshi, Arun <[email protected]>; [email protected]; [email protected]
Subject: RE: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Quoted 5 lines
Quoted 3 lines

Subject: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Title is too long.
bbdev: add dev info for data endianness

OK

Quoted 23 lines
Quoted 23 lines

Adding device information to capture explicitly the assumption of the input/output data byte endianness being processed.

---
 doc/guides/rel_notes/release_21_11.rst             | 1 +
 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/turbo_sw/bbdev_turbo_software.c   | 1 +
 lib/bbdev/rte_bbdev.h                              | 8 ++++++++
 6 files changed, 13 insertions(+)
doc/guides/rel_notes/release_21_11.rst +0 -0
index a8900a3..f0b3006 100644
@@ -191,6 +191,7 @@ API Changes
 
 * bbdev: Added capability related to more comprehensive CRC options.
 
Quoted 12 lines
Quoted 2 lines
doc/guides/rel_notes/release_21_11.rst +1 -0
+* bbdev: Added device info related to data byte endianness processing

assumption.

It is not clear from the description or the release notes, what the application is supposed to do based on the new dev_info field set and how the driver determine what value to set?
Isn't there a standard from the application stand point that the input/output data Should be in BE or in LE like in case of IP packets which are always in BE? I mean why is it dependent on the PMD which is processing it? Whatever application understands, PMD should comply with that and do internal Swapping if it does not support it.
Am I missing something?

This is really to allow Nipin to add his own NXP la12xx PMD, which appears to have different assumption on endianness.
All existing processing is done in LE by default by the existing PMDs and the existing ecosystem.
I cannot comment on why they would want to do that for the la12xx specifically, I could only speculate but here trying to help to find the best way for the new PMD to be supported.
So here this suggested change is purely about exposing different assumption for the PMDs, so that this new PMD can still be supported under this API even though this is in effect incompatible with existing ecosystem. In case the application has different assumption that what the PMD does, then byte swapping would have to be done in the application, more likely I assume that la12xx has its own ecosystem with different endianness required for other reasons. The option you are suggesting would be to put the burden on the PMD but I doubt there is an actual usecase for that. I assume they assume different endianness for other specific reason, not necessary to be compatible with existing ecosystem. Niping, Hemant, feel free to comment back, from previous discussion I believe this is what you wanted to do. Unsure of the reason, feel free to share more details or not.

Quoted 65 lines
Quoted 65 lines

ABI Changes
-----------

drivers/baseband/acc100/rte_acc100_pmd.c +1 -0
index 4e2feef..eb2c6c1 100644
@@ -1089,6 +1089,7 @@
 #else
 	dev_info->harq_buffer_size = 0;
 #endif
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 	acc100_check_ir(d);
 }
 
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +1 -0
index 6485cc8..c7f15c0 100644
@@ -372,6 +372,7 @@
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* 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 350c424..72e213e 100644
@@ -644,6 +644,7 @@ struct __rte_cache_aligned fpga_queue {
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* Calculates number of queues assigned to device */
 	dev_info->max_num_queues = 0;
drivers/baseband/turbo_sw/bbdev_turbo_software.c +1 -0
index e1db2bf..0cab91a 100644
@@ -253,6 +253,7 @@ struct turbo_sw_queue {
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->min_alignment = 64;
 	dev_info->harq_buffer_size = 0;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	rte_bbdev_log_debug("got device info from %u\n", dev->data-
 >dev_id);

}

lib/bbdev/rte_bbdev.h index renamed from lib/bbdev/rte_bbdev.h +0 -0

3ebf62e..b3f3000 100644

lib/bbdev/rte_bbdev.h +0 -0
@@ -49,6 +49,12 @@ enum rte_bbdev_state {
 	RTE_BBDEV_INITIALIZED
 };
 
Quoted 6 lines

lib/bbdev/rte_bbdev.h enum rte_bbdev_state { · line 55

Quoted 4 lines
lib/bbdev/rte_bbdev.h +4 -0
+/** Definitions of device data byte endianness types */ enum
+rte_bbdev_endianness {
+	RTE_BBDEV_BIG_ENDIAN,    /**< Data with byte-endianness BE */
+	RTE_BBDEV_LITTLE_ENDIAN, /**< Data with byte-endianness LE */ };

If at all be need this dev_info field,
as Tom suggested we should use RTE_BIG/LITTLE_ENDIAN.

See separate comment on my reply to Tom:
I considered this but the usage is different, these are build time #define, and really would bring confusion here. Note that there are not really the endianness of the system itself but specific to the bbdev data output going through signal processing. I thought it was more explicit and less confusing this way, feel free to comment back.
NXP would know best why a different endianness would be required in the PMD.

Quoted 14 lines

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

Quoted 11 lines
lib/bbdev/rte_bbdev.h +3 -0
+
 /**
  * Get the total number of devices that have been successfully initialised.
  *
@@ -309,6 +315,8 @@ struct rte_bbdev_driver_info {
 	uint16_t min_alignment;
 	/** HARQ memory available in kB */
 	uint32_t harq_buffer_size;
+	/** Byte endianness assumption for input/output data */
+	enum rte_bbdev_endianness data_endianness;

We should define how the input and output data are expected from the app. If need be, we can define a simple ``bool swap`` instead of an enum.

This could be done as well. Default no swap, and swap required for the new PMD. I will let Nipin/Hemant comment back.

Quoted 6 lines
Quoted 6 lines
lib/bbdev/rte_bbdev.h +0 -1
 	/** Default queue configuration used if none is supplied  */
 	struct rte_bbdev_queue_conf default_queue_conf;
 	/** Device operation capabilities */
--

1.8.3.1

#6 lore raw
Quoted 84 lines

-----Original Message-----
From: Chautru, Nicolas <[email protected]>
Sent: Thursday, October 7, 2021 9:12 PM
To: Akhil Goyal <[email protected]>; [email protected]; Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; Zhang, Mingshan <[email protected]>; Joshi, Arun <[email protected]>; Hemant Agrawal <[email protected]>; [email protected]
Subject: RE: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Hi Akhil,

Quoted 11 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Thursday, October 7, 2021 6:14 AM
To: Chautru, Nicolas <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Zhang, Mingshan <[email protected]>; Joshi, Arun <[email protected]>; [email protected]; [email protected]
Subject: RE: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Quoted 5 lines
Quoted 3 lines

Subject: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Title is too long.
bbdev: add dev info for data endianness

OK

Quoted 23 lines
Quoted 23 lines

Adding device information to capture explicitly the assumption of the input/output data byte endianness being processed.

---
 doc/guides/rel_notes/release_21_11.rst             | 1 +
 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/turbo_sw/bbdev_turbo_software.c   | 1 +
 lib/bbdev/rte_bbdev.h                              | 8 ++++++++
 6 files changed, 13 insertions(+)
doc/guides/rel_notes/release_21_11.rst +0 -0
index a8900a3..f0b3006 100644
@@ -191,6 +191,7 @@ API Changes
 
 * bbdev: Added capability related to more comprehensive CRC options.
 
Quoted 12 lines
Quoted 2 lines
doc/guides/rel_notes/release_21_11.rst +1 -0
+* bbdev: Added device info related to data byte endianness processing

assumption.

It is not clear from the description or the release notes, what the application is supposed to do based on the new dev_info field set and how the driver determine what value to set?
Isn't there a standard from the application stand point that the input/output data Should be in BE or in LE like in case of IP packets which are always in BE? I mean why is it dependent on the PMD which is processing it? Whatever application understands, PMD should comply with that and do internal Swapping if it does not support it.
Am I missing something?

This is really to allow Nipin to add his own NXP la12xx PMD, which appears to have different assumption on endianness.
All existing processing is done in LE by default by the existing PMDs and the existing ecosystem.
I cannot comment on why they would want to do that for the la12xx specifically, I could only speculate but here trying to help to find the best way for the new PMD to be supported.
So here this suggested change is purely about exposing different assumption for the PMDs, so that this new PMD can still be supported under this API even though this is in effect incompatible with existing ecosystem.
In case the application has different assumption that what the PMD does, then byte swapping would have to be done in the application, more likely I assume that la12xx has its own ecosystem with different endianness required for other

Quoted 8 lines

reasons.
The option you are suggesting would be to put the burden on the PMD but I doubt there is an actual usecase for that. I assume they assume different endianness for other specific reason, not necessary to be compatible with existing ecosystem.
Niping, Hemant, feel free to comment back, from previous discussion I believe this is what you wanted to do. Unsure of the reason, feel free to share more details or not.

Akhil/Nicolas,

As Hemant mentioned on v4 (previously asked by Dave)

"---
If we go back to the data providing source i.e. FAPI interface, it is implementation specific, as per SCF222.

Our customers do use BE data in network and at FAPI interface.

In LA12xx, at present, we use u8 Big-endian data for processing to FECA engine. We do see that other drivers in DPDK are using Little Endian *(with u32 data)* but standards is open for both.
"---

Standard is not specific to endianness and is open for implementation. So it does not makes a reason to have one endianness as default and other managed in the PMD, and the current change seems right.

Yes endianness assumption is taken in the test vector input/output data, but this should be acceptable as it does not impact the PMD's and end user applications in general.

BTW Nicolos, my name is Nipun :)

Quoted 74 lines
Quoted 67 lines
Quoted 67 lines

ABI Changes
-----------

drivers/baseband/acc100/rte_acc100_pmd.c +1 -0
index 4e2feef..eb2c6c1 100644
@@ -1089,6 +1089,7 @@
 #else
 	dev_info->harq_buffer_size = 0;
 #endif
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 	acc100_check_ir(d);
 }
 
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +1 -0
index 6485cc8..c7f15c0 100644
@@ -372,6 +372,7 @@
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* 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 350c424..72e213e 100644
@@ -644,6 +644,7 @@ struct __rte_cache_aligned fpga_queue {
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* Calculates number of queues assigned to device */
 	dev_info->max_num_queues = 0;
drivers/baseband/turbo_sw/bbdev_turbo_software.c +1 -0
index e1db2bf..0cab91a 100644
@@ -253,6 +253,7 @@ struct turbo_sw_queue {
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->min_alignment = 64;
 	dev_info->harq_buffer_size = 0;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	rte_bbdev_log_debug("got device info from %u\n", dev->data-
 >dev_id);

}

lib/bbdev/rte_bbdev.h index renamed from lib/bbdev/rte_bbdev.h +0 -0

3ebf62e..b3f3000 100644

lib/bbdev/rte_bbdev.h +0 -0
@@ -49,6 +49,12 @@ enum rte_bbdev_state {
 	RTE_BBDEV_INITIALIZED
 };
 
Quoted 6 lines

lib/bbdev/rte_bbdev.h enum rte_bbdev_state { · line 55

Quoted 4 lines
lib/bbdev/rte_bbdev.h +4 -0
+/** Definitions of device data byte endianness types */ enum
+rte_bbdev_endianness {
+	RTE_BBDEV_BIG_ENDIAN,    /**< Data with byte-endianness BE */
+	RTE_BBDEV_LITTLE_ENDIAN, /**< Data with byte-endianness LE */ };

If at all be need this dev_info field,
as Tom suggested we should use RTE_BIG/LITTLE_ENDIAN.

Quoted 8 lines

See separate comment on my reply to Tom:
I considered this but the usage is different, these are build time #define, and really would bring confusion here.
Note that there are not really the endianness of the system itself but specific to the bbdev data output going through signal processing.
I thought it was more explicit and less confusing this way, feel free to comment back.
NXP would know best why a different endianness would be required in the PMD.

Please see previous comment for endianness support.
I agree with the RTE_ prefix we can add it as it is for the application interface.

Quoted 16 lines
Quoted 15 lines

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

Quoted 12 lines
lib/bbdev/rte_bbdev.h +3 -0
+
 /**
  * Get the total number of devices that have been successfully initialised.
  *
@@ -309,6 +315,8 @@ struct rte_bbdev_driver_info {
 	uint16_t min_alignment;
 	/** HARQ memory available in kB */
 	uint32_t harq_buffer_size;
+	/** Byte endianness assumption for input/output data */
+	enum rte_bbdev_endianness data_endianness;

We should define how the input and output data are expected from the app. If need be, we can define a simple ``bool swap`` instead of an enum.

Quoted 3 lines

This could be done as well. Default no swap, and swap required for the new PMD.
I will let Nipin/Hemant comment back.

Again endianness is implementation specific and not standard for 5G processing, unlike it is for network packet.

Regards,
Nipun

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
lib/bbdev/rte_bbdev.h +0 -1
 	/** Default queue configuration used if none is supplied  */
 	struct rte_bbdev_queue_conf default_queue_conf;
 	/** Device operation capabilities */
--

1.8.3.1

#7 lore raw

Hi Nipun,

Quoted 125 lines

-----Original Message-----
From: Nipun Gupta <[email protected]>
Sent: Thursday, October 7, 2021 9:49 AM
To: Chautru, Nicolas <[email protected]>; Akhil Goyal <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; Zhang, Mingshan <[email protected]>; Joshi, Arun <[email protected]>; Hemant Agrawal <[email protected]>; [email protected]
Subject: RE: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Quoted 6 lines

-----Original Message-----
From: Chautru, Nicolas <[email protected]>
Sent: Thursday, October 7, 2021 9:12 PM
To: Akhil Goyal <[email protected]>; [email protected]; Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; Zhang, Mingshan

<[email protected]>;

Quoted 5 lines

Joshi, Arun <[email protected]>; Hemant Agrawal <[email protected]>; [email protected]
Subject: RE: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Quoted 9 lines

Hi Akhil,

Quoted 6 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Thursday, October 7, 2021 6:14 AM
To: Chautru, Nicolas <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Zhang, Mingshan

<[email protected]>;

Quoted 27 lines
Quoted 10 lines

Joshi, Arun <[email protected]>; [email protected]; [email protected]
Subject: RE: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Quoted 3 lines

Subject: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Title is too long.
bbdev: add dev info for data endianness

OK

Quoted 14 lines
Quoted 14 lines

Adding device information to capture explicitly the assumption of the input/output data byte endianness being processed.

---
 doc/guides/rel_notes/release_21_11.rst             | 1 +
 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/turbo_sw/bbdev_turbo_software.c   | 1 +
 lib/bbdev/rte_bbdev.h                              | 8 ++++++++
 6 files changed, 13 insertions(+)
Quoted 8 lines
Quoted 8 lines

doc/guides/rel_notes/release_21_11.rst API Changes · line 192

Quoted 8 lines
doc/guides/rel_notes/release_21_11.rst +0 -0
index a8900a3..f0b3006 100644
@@ -191,6 +191,7 @@ API Changes
 
 * bbdev: Added capability related to more comprehensive CRC

options.

Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
doc/guides/rel_notes/release_21_11.rst +2 -0
+* bbdev: Added device info related to data byte endianness
+processing

assumption.

It is not clear from the description or the release notes, what the application is supposed to do based on the new dev_info field set and how the driver determine what value to set?
Isn't there a standard from the application stand point that the input/output data Should be in BE or in LE like in case of IP packets which

are always in BE?

Quoted 5 lines
Quoted 4 lines

I mean why is it dependent on the PMD which is processing it? Whatever application understands, PMD should comply with that and do internal Swapping if it does not support it.
Am I missing something?

Quoted 10 lines

This is really to allow Nipin to add his own NXP la12xx PMD, which appears to have different assumption on endianness.
All existing processing is done in LE by default by the existing PMDs and the existing ecosystem.
I cannot comment on why they would want to do that for the la12xx specifically, I could only speculate but here trying to help to find the best way for the new PMD to be supported.
So here this suggested change is purely about exposing different assumption for the PMDs, so that this new PMD can still be supported under this API even though this is in effect incompatible with existing

ecosystem.

Quoted 11 lines

In case the application has different assumption that what the PMD does, then byte swapping would have to be done in the application, more likely I assume that la12xx has its own ecosystem with different endianness required for other reasons.
The option you are suggesting would be to put the burden on the PMD but I doubt there is an actual usecase for that. I assume they assume different endianness for other specific reason, not necessary to be compatible with existing ecosystem.
Niping, Hemant, feel free to comment back, from previous discussion I believe this is what you wanted to do. Unsure of the reason, feel free to share more details or not.

Akhil/Nicolas,

As Hemant mentioned on v4 (previously asked by Dave)

"---
If we go back to the data providing source i.e. FAPI interface, it is implementation specific, as per SCF222.

Our customers do use BE data in network and at FAPI interface.

In LA12xx, at present, we use u8 Big-endian data for processing to FECA engine. We do see that other drivers in DPDK are using Little Endian *(with u32 data)* but standards is open for both.
"---

Quoted 7 lines

Standard is not specific to endianness and is open for implementation. So it does not makes a reason to have one endianness as default and other managed in the PMD, and the current change seems right.

Yes endianness assumption is taken in the test vector input/output data, but this should be acceptable as it does not impact the PMD's and end user applications in general.

I want clarify that this would impact the application in case user wanted to switch between 2 such hw accelator.
Ie. you cannot switch the 2 solutions, they are incompatible except if you explicitly do the byteswap in the application (as is done in bbdev-test).
Not necessarily a problem in case they address 2 different ecosystems but capturing the implication to be explicit. Ie each device expose the assumptions expected by the application and it is up to the application the bbdev api to satisfy the relared assumptions.

Quoted 2 lines

BTW Nicolos, my name is Nipun :)

My bad!

I am marking this patch as obsolete since you have included it in your serie.

Quoted 123 lines
Quoted 75 lines
Quoted 68 lines
Quoted 68 lines

ABI Changes
-----------

drivers/baseband/acc100/rte_acc100_pmd.c +1 -0
index 4e2feef..eb2c6c1 100644
@@ -1089,6 +1089,7 @@
 #else
 	dev_info->harq_buffer_size = 0;
 #endif
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 	acc100_check_ir(d);
 }
 
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +1 -0
index 6485cc8..c7f15c0 100644
@@ -372,6 +372,7 @@
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* 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 350c424..72e213e 100644
@@ -644,6 +644,7 @@ struct __rte_cache_aligned fpga_queue {
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* Calculates number of queues assigned to device */
 	dev_info->max_num_queues = 0;
drivers/baseband/turbo_sw/bbdev_turbo_software.c +1 -0
index e1db2bf..0cab91a 100644
@@ -253,6 +253,7 @@ struct turbo_sw_queue {
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->min_alignment = 64;
 	dev_info->harq_buffer_size = 0;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	rte_bbdev_log_debug("got device info from %u\n", dev->data-
 >dev_id);

}

lib/bbdev/rte_bbdev.h index renamed from lib/bbdev/rte_bbdev.h +0 -0

3ebf62e..b3f3000 100644

lib/bbdev/rte_bbdev.h +0 -0
@@ -49,6 +49,12 @@ enum rte_bbdev_state {
 	RTE_BBDEV_INITIALIZED
 };
 
Quoted 6 lines

lib/bbdev/rte_bbdev.h enum rte_bbdev_state { · line 55

Quoted 4 lines
lib/bbdev/rte_bbdev.h +4 -0
+/** Definitions of device data byte endianness types */ enum
+rte_bbdev_endianness {
+	RTE_BBDEV_BIG_ENDIAN,    /**< Data with byte-endianness BE */
+	RTE_BBDEV_LITTLE_ENDIAN, /**< Data with byte-endianness LE */ };

If at all be need this dev_info field, as Tom suggested we should use RTE_BIG/LITTLE_ENDIAN.

Quoted 8 lines

See separate comment on my reply to Tom:
I considered this but the usage is different, these are build time #define, and really would bring confusion here.
Note that there are not really the endianness of the system itself but specific to the bbdev data output going through signal processing. I thought it was more explicit and less confusing this way, feel free to comment back.
NXP would know best why a different endianness would be required in the

PMD.

Please see previous comment for endianness support.
I agree with the RTE_ prefix we can add it as it is for the application interface.

Quoted 5 lines
Quoted 5 lines

lib/bbdev/rte_bbdev.h enum rte_bbdev_state {

Quoted 5 lines
lib/bbdev/rte_bbdev.h +1 -0
+
 /**
  * Get the total number of devices that have been successfully

initialised.

Quoted 9 lines
Quoted 9 lines

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

Quoted 7 lines
lib/bbdev/rte_bbdev.h +2 -0
  *
@@ -309,6 +315,8 @@ struct rte_bbdev_driver_info {
 	uint16_t min_alignment;
 	/** HARQ memory available in kB */
 	uint32_t harq_buffer_size;
+	/** Byte endianness assumption for input/output data */
+	enum rte_bbdev_endianness data_endianness;

We should define how the input and output data are expected from the

app.

Quoted 5 lines
Quoted 1 line

If need be, we can define a simple ``bool swap`` instead of an enum.

This could be done as well. Default no swap, and swap required for the new PMD.
I will let Nipin/Hemant comment back.

Again endianness is implementation specific and not standard for 5G processing, unlike it is for network packet.

Regards,
Nipun

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
lib/bbdev/rte_bbdev.h +0 -1
 	/** Default queue configuration used if none is supplied  */
 	struct rte_bbdev_queue_conf default_queue_conf;
 	/** Device operation capabilities */
--

1.8.3.1

#8 lore raw
Quoted 148 lines

-----Original Message-----
From: Chautru, Nicolas <[email protected]>
Sent: Friday, October 8, 2021 12:29 AM
To: Nipun Gupta <[email protected]>; Akhil Goyal <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; Zhang, Mingshan <[email protected]>; Joshi, Arun <[email protected]>; Hemant Agrawal <[email protected]>; [email protected]
Subject: RE: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Hi Nipun,

Quoted 125 lines

-----Original Message-----
From: Nipun Gupta <[email protected]>
Sent: Thursday, October 7, 2021 9:49 AM
To: Chautru, Nicolas <[email protected]>; Akhil Goyal <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; Zhang, Mingshan <[email protected]>; Joshi, Arun <[email protected]>; Hemant Agrawal <[email protected]>; [email protected]
Subject: RE: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Quoted 6 lines

-----Original Message-----
From: Chautru, Nicolas <[email protected]>
Sent: Thursday, October 7, 2021 9:12 PM
To: Akhil Goyal <[email protected]>; [email protected]; Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; Zhang, Mingshan

<[email protected]>;

Quoted 5 lines

Joshi, Arun <[email protected]>; Hemant Agrawal <[email protected]>; [email protected]
Subject: RE: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Quoted 9 lines

Hi Akhil,

Quoted 6 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Thursday, October 7, 2021 6:14 AM
To: Chautru, Nicolas <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Zhang, Mingshan

<[email protected]>;

Quoted 27 lines
Quoted 10 lines

Joshi, Arun <[email protected]>; [email protected]; [email protected]
Subject: RE: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Quoted 3 lines

Subject: [EXT] [PATCH v9] bbdev: add device info related to data endianness assumption

Title is too long.
bbdev: add dev info for data endianness

OK

Quoted 14 lines
Quoted 14 lines

Adding device information to capture explicitly the assumption of the input/output data byte endianness being processed.

---
 doc/guides/rel_notes/release_21_11.rst             | 1 +
 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/turbo_sw/bbdev_turbo_software.c   | 1 +
 lib/bbdev/rte_bbdev.h                              | 8 ++++++++
 6 files changed, 13 insertions(+)
Quoted 8 lines
Quoted 8 lines

doc/guides/rel_notes/release_21_11.rst API Changes · line 192

Quoted 8 lines
doc/guides/rel_notes/release_21_11.rst +0 -0
index a8900a3..f0b3006 100644
@@ -191,6 +191,7 @@ API Changes
 
 * bbdev: Added capability related to more comprehensive CRC

options.

Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
doc/guides/rel_notes/release_21_11.rst +2 -0
+* bbdev: Added device info related to data byte endianness
+processing

assumption.

It is not clear from the description or the release notes, what the application is supposed to do based on the new dev_info field set and how the driver determine what value to set?
Isn't there a standard from the application stand point that the input/output data Should be in BE or in LE like in case of IP packets which

are always in BE?

Quoted 5 lines
Quoted 4 lines

I mean why is it dependent on the PMD which is processing it? Whatever application understands, PMD should comply with that and do internal Swapping if it does not support it.
Am I missing something?

Quoted 10 lines

This is really to allow Nipin to add his own NXP la12xx PMD, which appears to have different assumption on endianness.
All existing processing is done in LE by default by the existing PMDs and the existing ecosystem.
I cannot comment on why they would want to do that for the la12xx specifically, I could only speculate but here trying to help to find the best way for the new PMD to be supported.
So here this suggested change is purely about exposing different assumption for the PMDs, so that this new PMD can still be supported under this API even though this is in effect incompatible with existing

ecosystem.

Quoted 11 lines

In case the application has different assumption that what the PMD does, then byte swapping would have to be done in the application, more likely I assume that la12xx has its own ecosystem with different endianness required for other reasons.
The option you are suggesting would be to put the burden on the PMD but I doubt there is an actual usecase for that. I assume they assume different endianness for other specific reason, not necessary to be compatible with existing ecosystem.
Niping, Hemant, feel free to comment back, from previous discussion I believe this is what you wanted to do. Unsure of the reason, feel free to share more details or not.

Akhil/Nicolas,

As Hemant mentioned on v4 (previously asked by Dave)

"---
If we go back to the data providing source i.e. FAPI interface, it is implementation specific, as per SCF222.

Our customers do use BE data in network and at FAPI interface.

In LA12xx, at present, we use u8 Big-endian data for processing to FECA engine. We do see that other drivers in DPDK are using Little Endian *(with u32 data)* but standards is open for both.
"---

Quoted 7 lines

Standard is not specific to endianness and is open for implementation. So it does not makes a reason to have one endianness as default and other managed in the PMD, and the current change seems right.

Yes endianness assumption is taken in the test vector input/output data, but this should be acceptable as it does not impact the PMD's and end user applications in general.

Quoted 8 lines

I want clarify that this would impact the application in case user wanted to switch between 2 such hw accelator.
Ie. you cannot switch the 2 solutions, they are incompatible except if you explicitly do the byteswap in the application (as is done in bbdev-test). Not necessarily a problem in case they address 2 different ecosystems but capturing the implication to be explicit. Ie each device expose the assumptions expected by the application and it is up to the application the bbdev api to satisfy the relared assumptions.

Hi Nicolas,

Bbdev-test is one of a test application and it is using test vectors. Consider bbdev example application, the packets are in the network order (i.e. big-endian) and no swapping is being done in this application. It is probably assumed that the packets which are arriving/going out at the network are in the endianness order which are to be processed by the device.

Similarly in the real world usage/applications, the endianness handling would be done on the other end (the originator/consumer of the data), which again could be done in hw accelerators without impacting the real world applications.

Also, as standard is open for both, the current change makes sense and swapping in any of the PMD does not seems suitable.

Regards,
Nipun

Quoted 134 lines
Quoted 3 lines

BTW Nicolos, my name is Nipun :)

My bad!

I am marking this patch as obsolete since you have included it in your serie.

Quoted 68 lines
Quoted 68 lines
Quoted 68 lines
Quoted 68 lines

ABI Changes
-----------

drivers/baseband/acc100/rte_acc100_pmd.c +1 -0
index 4e2feef..eb2c6c1 100644
@@ -1089,6 +1089,7 @@
 #else
 	dev_info->harq_buffer_size = 0;
 #endif
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 	acc100_check_ir(d);
 }
 
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +1 -0
index 6485cc8..c7f15c0 100644
@@ -372,6 +372,7 @@
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* 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 350c424..72e213e 100644
@@ -644,6 +644,7 @@ struct __rte_cache_aligned fpga_queue {
 	dev_info->default_queue_conf = default_queue_conf;
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->cpu_flag_reqs = NULL;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	/* Calculates number of queues assigned to device */
 	dev_info->max_num_queues = 0;
drivers/baseband/turbo_sw/bbdev_turbo_software.c +1 -0
index e1db2bf..0cab91a 100644
@@ -253,6 +253,7 @@ struct turbo_sw_queue {
 	dev_info->capabilities = bbdev_capabilities;
 	dev_info->min_alignment = 64;
 	dev_info->harq_buffer_size = 0;
+	dev_info->data_endianness = RTE_BBDEV_LITTLE_ENDIAN;
 
 	rte_bbdev_log_debug("got device info from %u\n", dev->data-
 >dev_id);

}

lib/bbdev/rte_bbdev.h index renamed from lib/bbdev/rte_bbdev.h +0 -0

3ebf62e..b3f3000 100644

lib/bbdev/rte_bbdev.h +0 -0
@@ -49,6 +49,12 @@ enum rte_bbdev_state {
 	RTE_BBDEV_INITIALIZED
 };
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

lib/bbdev/rte_bbdev.h enum rte_bbdev_state { · line 54

Quoted 3 lines
lib/bbdev/rte_bbdev.h +3 -0
+/** Definitions of device data byte endianness types */ enum
+rte_bbdev_endianness {
+	RTE_BBDEV_BIG_ENDIAN,    /**< Data with byte-endianness BE

*/

Quoted 1 line
Quoted 1 line
Quoted 1 line

lib/bbdev/rte_bbdev.h enum rte_bbdev_state { · line 55

Quoted 1 line
lib/bbdev/rte_bbdev.h +1 -0
+	RTE_BBDEV_LITTLE_ENDIAN, /**< Data with byte-endianness

LE */ };

Quoted 51 lines
Quoted 11 lines
Quoted 2 lines

If at all be need this dev_info field, as Tom suggested we should use RTE_BIG/LITTLE_ENDIAN.

See separate comment on my reply to Tom:
I considered this but the usage is different, these are build time #define, and really would bring confusion here.
Note that there are not really the endianness of the system itself but specific to the bbdev data output going through signal processing. I thought it was more explicit and less confusing this way, feel free to comment back.
NXP would know best why a different endianness would be required in the

PMD.

Please see previous comment for endianness support.
I agree with the RTE_ prefix we can add it as it is for the application interface.

Quoted 5 lines
Quoted 5 lines

lib/bbdev/rte_bbdev.h enum rte_bbdev_state {

Quoted 5 lines
lib/bbdev/rte_bbdev.h +1 -0
+
 /**
  * Get the total number of devices that have been successfully

initialised.

Quoted 9 lines
Quoted 9 lines

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

Quoted 7 lines
lib/bbdev/rte_bbdev.h +2 -0
  *
@@ -309,6 +315,8 @@ struct rte_bbdev_driver_info {
 	uint16_t min_alignment;
 	/** HARQ memory available in kB */
 	uint32_t harq_buffer_size;
+	/** Byte endianness assumption for input/output data */
+	enum rte_bbdev_endianness data_endianness;

We should define how the input and output data are expected from the

app.

Quoted 5 lines
Quoted 1 line

If need be, we can define a simple ``bool swap`` instead of an enum.

This could be done as well. Default no swap, and swap required for the new PMD.
I will let Nipin/Hemant comment back.

Again endianness is implementation specific and not standard for 5G processing, unlike it is for network packet.

Regards,
Nipun

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
lib/bbdev/rte_bbdev.h +0 -1
 	/** Default queue configuration used if none is supplied  */
 	struct rte_bbdev_queue_conf default_queue_conf;
 	/** Device operation capabilities */
--

1.8.3.1

#9 lore raw
In reply to Nicolas Chautru

Sure Nicolas, this seems fine.
I'll use this change instead of existing patch 1/10 and send a re-spin.

Thanks,
Nipun

Quoted 38 lines

-----Original Message-----
From: Nicolas Chautru <[email protected]>
Sent: Thursday, October 7, 2021 2:29 AM
To: [email protected]; [email protected]; Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; [email protected]; Nicolas Chautru <[email protected]>
Subject: [PATCH v9] bbdev: add device info related to data endianness assumption

Suggesting this bbdev api change attached to address the requirement for the new
bbdev PMD from this serie :
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatches.
dpdk.org%2Fproject%2Fdpdk%2Fpatch%2F20211006113112.11163-2- nipun.gupta%40nxp.com%2F&amp;data=04%7C01%7Cnipun.gupta%40nxp.com %7Cd99e521071fc4162dfa508d9890c1b8a%7C686ea1d3bc2b4c6fa92cd99c5c30 1635%7C0%7C0%7C637691507373998592%7CUnknown%7CTWFpbGZsb3d8eyJ WIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C 1000&amp;sdata=ogEvbxTKLnCAPs1cuIN76bXb1Mjty0crd3wotOmw%2Fcg%3D &amp;reserved=0
Nipin, please review and you can use this one in case that is okay with you. This is defined as an enum and default values set in existing PMDs.

Nicolas Chautru (1):
bbdev: add device info related to data endianness assumption

 doc/guides/rel_notes/release_21_11.rst             | 1 +
 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/turbo_sw/bbdev_turbo_software.c   | 1 +
 lib/bbdev/rte_bbdev.h                              | 8 ++++++++
 6 files changed, 13 insertions(+)

--
1.8.3.1