Skip to contentSkip to conversation

bbdev: add raw operation support for additional offloads

RFC PATCH In review Hemant Agrawal 2 participants 2 messages Apr 13, 2021 – Apr 14, 2021

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 bbdev: add raw operation support for additional offloads

The exisiting bbdev APIs are limited for the lookaside FEC offload only.

The modem/FPGA can do much more than just the FEC offload. This patch extend the operation to userdefined raw parameters, where they can offload more than just the FEC offload processing. e.g. some of the devices are capable of offloading large part of ORAN High-phy processing as well.

---
 lib/librte_bbdev/rte_bbdev.c    |  1 +
 lib/librte_bbdev/rte_bbdev.h    | 64 +++++++++++++++++++++
 lib/librte_bbdev/rte_bbdev_op.h | 98 +++++++++++++++++++++++----------
 3 files changed, 134 insertions(+), 29 deletions(-)
lib/librte_bbdev/rte_bbdev.c +1 -0
index 5ba891c232..9679048ce7 100644
@@ -1126,6 +1126,7 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
 		"RTE_BBDEV_OP_TURBO_ENC",
 		"RTE_BBDEV_OP_LDPC_DEC",
 		"RTE_BBDEV_OP_LDPC_ENC",
+		"RTE_BBDEV_OP_RAW",
 	};
 
 	if (op_type < RTE_BBDEV_OP_TYPE_COUNT)
lib/librte_bbdev/rte_bbdev.h +64 -0

93 lines not on this page · raw message

lib/librte_bbdev/rte_bbdev_op.h +69 -29

122 lines not on this page · raw message

Signature · 1 line
2.17.1
#1 lore raw

Initial question from a quick look, If you need a raw driver, cannot this be done by existing rawdev driver? Why should that fall under bbdev then?

Quoted 309 lines

-----Original Message-----
From: Hemant Agrawal <[email protected]>
Sent: Monday, April 12, 2021 10:00 PM
To: [email protected]; [email protected]; Chautru, Nicolas <[email protected]>
Cc: Hemant Agrawal <[email protected]>; Nipun Gupta <[email protected]>
Subject: [RFC][PATCH] bbdev: add raw operation support for additional offloads

The exisiting bbdev APIs are limited for the lookaside FEC offload only.

The modem/FPGA can do much more than just the FEC offload. This patch extend the operation to userdefined raw parameters, where they can offload more than just the FEC offload processing. e.g. some of the devices are capable of offloading large part of ORAN High-phy processing as well.

---
 lib/librte_bbdev/rte_bbdev.c    |  1 +
 lib/librte_bbdev/rte_bbdev.h    | 64 +++++++++++++++++++++
 lib/librte_bbdev/rte_bbdev_op.h | 98 +++++++++++++++++++++++----------
 3 files changed, 134 insertions(+), 29 deletions(-)
lib/librte_bbdev/rte_bbdev.c +1 -0
index 5ba891c232..9679048ce7 100644
@@ -1126,6 +1126,7 @@ rte_bbdev_op_type_str(enum
 rte_bbdev_op_type op_type)
 		"RTE_BBDEV_OP_TURBO_ENC",
 		"RTE_BBDEV_OP_LDPC_DEC",
 		"RTE_BBDEV_OP_LDPC_ENC",
+		"RTE_BBDEV_OP_RAW",
 	};
 

if (op_type < RTE_BBDEV_OP_TYPE_COUNT) diff --git
a/lib/librte_bbdev/rte_bbdev.h b/lib/librte_bbdev/rte_bbdev.h index 7017124414..fe028524c8 100644

lib/librte_bbdev/rte_bbdev.h +10 -0
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2017 Intel Corporation
+ * Copyright 2021 NXP
  */
 
 #ifndef _RTE_BBDEV_H_
@@ -387,6 +388,15 @@ struct rte_bbdev_queue_data {
 	bool started;  /**< Queue state */
 };
 
+/** @internal Enqueue encode operations for processing on queue of a
+device. */ typedef uint16_t (*rte_bbdev_enqueue_raw_op_t)(
+		struct rte_bbdev_queue_data *q_data,
+		struct rte_bbdev_raw_op *op);
+
+/** @internal Enqueue decode operations for processing on queue of a
+device. */ typedef struct rte_bbdev_raw_op
 *(*rte_bbdev_dequeue_raw_op_t)(
+		struct rte_bbdev_queue_data *q_data);
+
 /** @internal Enqueue encode operations for processing on queue of a

device. */ typedef uint16_t (*rte_bbdev_enqueue_enc_ops_t)(

lib/librte_bbdev/rte_bbdev.h +4 -0
 		struct rte_bbdev_queue_data *q_data,
@@ -441,6 +451,10 @@ TAILQ_HEAD(rte_bbdev_cb_list,
 rte_bbdev_callback);
  * these fields, but should only write to the *_ops fields.
  */
 struct __rte_cache_aligned rte_bbdev {
+	/** Enqueue raw op function */
+	rte_bbdev_enqueue_raw_op_t enqueue_raw_op;
+	/** Dequeue raw op function */
+	rte_bbdev_dequeue_raw_op_t dequeue_raw_op;
 	/** Enqueue encode function */
 	rte_bbdev_enqueue_enc_ops_t enqueue_enc_ops;
lib/librte_bbdev/rte_bbdev.h +5 -0
 	/** Enqueue decode function */
@@ -469,6 +483,33 @@ struct __rte_cache_aligned rte_bbdev {
 /** @internal array of all devices */
 extern struct rte_bbdev rte_bbdev_devices[];
 
+/**
+ * Enqueue a RAW operation to a queue of the device.
+ * If confirmation is required then the memory for the "op" structure
+should
+ * be allocated from heap/mempool and should be freed only after

confirmation.
+ * Otherwise, it shall be on stack or if on heap, should be freed after

lib/librte_bbdev/rte_bbdev.h +20 -0
+enqueue
+ * operation.
+ *
+ * @param dev_id
+ *   The identifier of the device.
+ * @param queue_id
+ *   The index of the queue.
+ * @param op
+ *   Pointer containing operation to be enqueued.
+ *
+ * @return
+ *    Status of the enqueue operation.
+ */
+__rte_experimental
+static inline uint16_t
+rte_bbdev_enqueue_raw_op(uint16_t dev_id, uint16_t queue_id,
+		struct rte_bbdev_raw_op *op)
+{
+	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
+	struct rte_bbdev_queue_data *q_data = &dev->data-
Quoted 1 line

queues[queue_id];

lib/librte_bbdev/rte_bbdev.h +2 -0
+	return dev->enqueue_raw_op(q_data, op); }
+
 /**
  * Enqueue a burst of processed encode operations to a queue of the

device.
* This functions only enqueues as many operations as currently possible
and @@ -593,6 +634,29 @@ rte_bbdev_enqueue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,

lib/librte_bbdev/rte_bbdev.h +5 -0
 	return dev->enqueue_ldpc_dec_ops(q_data, ops, num_ops);  }
 
+/**
+ * Dequeue a raw operation.
+ * For HOST->MODEM queues, this would provide RAW op which had
+ * "conf_enable" configured at queue initialization.
+ * For MODEM->HOST queues, this would provide RAW op which are sent

from MODEM.
+ * "op" memory would be internally allocated
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @param queue_id
+ * The index of the queue.
+ *
+ * @return
+ * Pointer containing dequeued operation.
+ */

lib/librte_bbdev/rte_bbdev.h +5 -0
+__rte_experimental
+static inline struct rte_bbdev_raw_op *
+rte_bbdev_dequeue_raw_op(uint16_t dev_id, uint16_t queue_id) {
+	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
+	struct rte_bbdev_queue_data *q_data = &dev->data-
Quoted 1 line

queues[queue_id];

lib/librte_bbdev/rte_bbdev.h +2 -0
+	return dev->dequeue_raw_op(q_data);
+}
 
 /**
  * Dequeue a burst of processed encode operations from a queue of the

device.

(quoted diff) +0 -0

b/lib/librte_bbdev/rte_bbdev_op.h index f726d7302e..fa993c6222 100644

lib/librte_bbdev/rte_bbdev_op.h +1 -1
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2017 Intel Corporation
+ * Copyright 2021 NXP
  */
 
 #ifndef _RTE_BBDEV_OP_H_
@@ -211,36 +212,57 @@ enum rte_bbdev_op_ldpcenc_flag_bitmasks {
 
 /** Data input and output buffer for BBDEV operations */  struct
 rte_bbdev_op_data {
-	/** The mbuf data structure representing the data for BBDEV

operation.

lib/librte_bbdev/rte_bbdev_op.h +0 -5
-	 *
-	 * This mbuf pointer can point to one Code Block (CB) data buffer or
-	 * multiple CBs contiguously located next to each other.
-	 * A Transport Block (TB) represents a whole piece of data that is
-	 * divided into one or more CBs. Maximum number of CBs can be

contained

lib/librte_bbdev/rte_bbdev_op.h +0 -1
-	 * in one TB is defined by

RTE_BBDEV_(TURBO/LDPC)_MAX_CODE_BLOCKS.

lib/librte_bbdev/rte_bbdev_op.h +0 -3
-	 *
-	 * An mbuf data structure cannot represent more than one TB. The
-	 * smallest piece of data that can be contained in one mbuf is one

CB.

lib/librte_bbdev/rte_bbdev_op.h +0 -1
-	 * An mbuf can include one contiguous CB, subset of contiguous CBs

that

lib/librte_bbdev/rte_bbdev_op.h +0 -1
-	 * are belonging to one TB, or all contiguous CBs that are belonging

to

lib/librte_bbdev/rte_bbdev_op.h +0 -12
-	 * one TB.
-	 *
-	 * If a BBDEV PMD supports the extended capability "Scatter-Gather",
-	 * then it is capable of collecting (gathering) non-contiguous
-	 * (scattered) data from multiple locations in the memory.
-	 * This capability is reported by the capability flags:
-	 * - RTE_BBDEV_(TURBO/LDPC)_ENC_SCATTER_GATHER and
-	 * - RTE_BBDEV_(TURBO/LDPC)_DEC_SCATTER_GATHER.
-	 * Only if a BBDEV PMD supports this feature, chained mbuf data
-	 * structures are accepted. A chained mbuf can represent one
-	 * non-contiguous CB or multiple non-contiguous CBs.
-	 * If BBDEV PMD does not support this feature, it will assume

inbound

lib/librte_bbdev/rte_bbdev_op.h +0 -3
-	 * mbuf data contains one segment.
-	 *
-	 * The output mbuf data though is always one segment, even if the

input

lib/librte_bbdev/rte_bbdev_op.h +6 -2
-	 * was a chained mbuf.
+	/** If set, this indicates that the memory pointer provided in
+	 * data or mem is a mempory pointer which is a contiguous memory
+	 * having the data (and is not a mbuf)
 	 */
-	struct rte_mbuf *data;
+	uint32_t is_direct_mem;
+	union {
+		/** The mbuf data structure representing the data for BBDEV

operation.

lib/librte_bbdev/rte_bbdev_op.h +2 -0
+		 *
+		 * This mbuf pointer can point to one Code Block (CB) data

buffer or

lib/librte_bbdev/rte_bbdev_op.h +2 -0
+		 * multiple CBs contiguously located next to each other.
+		 * A Transport Block (TB) represents a whole piece of data

that is

lib/librte_bbdev/rte_bbdev_op.h +1 -0
+		 * divided into one or more CBs. Maximum number of CBs

can be contained

lib/librte_bbdev/rte_bbdev_op.h +1 -0
+		 * in one TB is defined by

RTE_BBDEV_(TURBO/LDPC)_MAX_CODE_BLOCKS.

lib/librte_bbdev/rte_bbdev_op.h +2 -0
+		 *
+		 * An mbuf data structure cannot represent more than one

TB. The

lib/librte_bbdev/rte_bbdev_op.h +1 -0
+		 * smallest piece of data that can be contained in one mbuf is

one CB.

lib/librte_bbdev/rte_bbdev_op.h +1 -0
+		 * An mbuf can include one contiguous CB, subset of

contiguous CBs that

lib/librte_bbdev/rte_bbdev_op.h +1 -0
+		 * are belonging to one TB, or all contiguous CBs that are

belonging to

lib/librte_bbdev/rte_bbdev_op.h +3 -0
+		 * one TB.
+		 *
+		 * If a BBDEV PMD supports the extended capability "Scatter-

Gather",

lib/librte_bbdev/rte_bbdev_op.h +6 -0
+		 * then it is capable of collecting (gathering) non-contiguous
+		 * (scattered) data from multiple locations in the memory.
+		 * This capability is reported by the capability flags:
+		 * - RTE_BBDEV_(TURBO/LDPC)_ENC_SCATTER_GATHER and
+		 * - RTE_BBDEV_(TURBO/LDPC)_DEC_SCATTER_GATHER.
+		 * Only if a BBDEV PMD supports this feature, chained mbuf

data

lib/librte_bbdev/rte_bbdev_op.h +1 -0
+		 * structures are accepted. A chained mbuf can represent

one

lib/librte_bbdev/rte_bbdev_op.h +2 -0
+		 * non-contiguous CB or multiple non-contiguous CBs.
+		 * If BBDEV PMD does not support this feature, it will assume

inbound

lib/librte_bbdev/rte_bbdev_op.h +3 -0
+		 * mbuf data contains one segment.
+		 *
+		 * The output mbuf data though is always one segment, even

if the input

lib/librte_bbdev/rte_bbdev_op.h +6 -0
+		 * was a chained mbuf.
+		 */
+		struct rte_mbuf *data;
+
+		/** bbuf representing the data for BBDEV operation.
+		 * This is a non scatter-gather buffer which uses length and

offset

lib/librte_bbdev/rte_bbdev_op.h +1 -0
+		 * parameters from rte_bbdev_op_data structure to evaluate

the

lib/librte_bbdev/rte_bbdev_op.h +1 -0
+		 * length of the buffer and offset of the starting data

respectively.

lib/librte_bbdev/rte_bbdev_op.h +4 -0
+		 */
+		void *bdata;
+
+		/** memory pointer representing the data for BBDEV

operation.

lib/librte_bbdev/rte_bbdev_op.h +2 -0
+		 * This is a contiguous memory which uses length and offset
+		 * parameters from rte_bbdev_op_data structure to evaluate

the

lib/librte_bbdev/rte_bbdev_op.h +1 -0
+		 * length of the buffer and offset of the starting data

respectively.

lib/librte_bbdev/rte_bbdev_op.h +7 -0
+		 */
+		void *mem;
+	};
 	/** The starting point of the BBDEV (encode/decode) operation,
 	 * in bytes.
 	 *
@@ -738,6 +760,7 @@ enum rte_bbdev_op_type {
 	RTE_BBDEV_OP_TURBO_ENC,  /**< Turbo encode */
 	RTE_BBDEV_OP_LDPC_DEC,  /**< LDPC decode */
 	RTE_BBDEV_OP_LDPC_ENC,  /**< LDPC encode */
+	RTE_BBDEV_OP_RAW, /**< RAW operation */
 	RTE_BBDEV_OP_TYPE_COUNT,  /**< Count of different op types */
 };
 
@@ -749,6 +772,23 @@ enum {
 	RTE_BBDEV_SYNDROME_ERROR
 };
 
+/** Structure specifying a single raw operation */ struct
+rte_bbdev_raw_op {
+	/** RAW operation flags. BBDEV_RAW_OP_IN_VALID /

BBDEV_RAW_OP_OUT_VALID

lib/librte_bbdev/rte_bbdev_op.h +14 -0
+	 */
+	uint32_t raw_op_flags;
+	/** Status of the operation */
+	uint32_t status;
+	/** Opaque pointer for user data in case of confirmation. Invalid for
+	 *  dequeue operation for MODEM -> HOST communication.
+	 */
+	void *opaque_data;
+	/** Input data */
+	struct rte_bbdev_op_data input;
+	/** Output data */
+	struct rte_bbdev_op_data output;
+};
+
 /** Structure specifying a single encode operation */  struct

rte_bbdev_enc_op {
/** Status of operation that was performed */
--
2.17.1