dma/dpaa2: support DMA operations

This patch support copy, submit, completed and
completed status functionality of DMA driver.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This commit is contained in:
Nipun Gupta 2022-05-05 14:35:21 +05:30 committed by Thomas Monjalon
parent 97f9032f5a
commit 9e2f8ca6c2
5 changed files with 1268 additions and 65 deletions

View File

@ -12,6 +12,16 @@ via using the DPDMAI device exposed by MC.
More information can be found at `NXP Official Website
<http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/qoriq-arm-processors:QORIQ-ARM>`_.
Features
--------
The DPAA2 QDMA implements following features in the dmadev API;
- Supports issuing DMA of data within memory without hogging CPU while
performing DMA operation.
- Supports configuring to optionally get status of the DMA translation on
per DMA operation basis.
Supported DPAA2 SoCs
--------------------

File diff suppressed because it is too large Load Diff

View File

@ -80,65 +80,6 @@
#define QDMA_RBP_UPPER_ADDRESS_MASK (0xfff0000000000)
/** Determines a QDMA job */
struct dpaa2_qdma_job {
/** Source Address from where DMA is (to be) performed */
uint64_t src;
/** Destination Address where DMA is (to be) done */
uint64_t dest;
/** Length of the DMA operation in bytes. */
uint32_t len;
/** See RTE_QDMA_JOB_ flags */
uint32_t flags;
/**
* Status of the transaction.
* This is filled in the dequeue operation by the driver.
* upper 8bits acc_err for route by port.
* lower 8bits fd error
*/
uint16_t status;
uint16_t vq_id;
/**
* FLE pool element maintained by user, in case no qDMA response.
* Note: the address must be allocated from DPDK memory pool.
*/
void *usr_elem;
};
struct dpaa2_qdma_rbp {
uint32_t use_ultrashort:1;
uint32_t enable:1;
/**
* dportid:
* 0000 PCI-Express 1
* 0001 PCI-Express 2
* 0010 PCI-Express 3
* 0011 PCI-Express 4
* 0100 PCI-Express 5
* 0101 PCI-Express 6
*/
uint32_t dportid:4;
uint32_t dpfid:2;
uint32_t dvfid:6;
/*using route by port for destination */
uint32_t drbp:1;
/**
* sportid:
* 0000 PCI-Express 1
* 0001 PCI-Express 2
* 0010 PCI-Express 3
* 0011 PCI-Express 4
* 0100 PCI-Express 5
* 0101 PCI-Express 6
*/
uint32_t sportid:4;
uint32_t spfid:2;
uint32_t svfid:6;
/* using route by port for source */
uint32_t srbp:1;
uint32_t rsv:4;
};
/** Source/Destination Descriptor */
struct qdma_sdd {
uint32_t rsv;
@ -248,22 +189,22 @@ struct qdma_virt_queue;
typedef uint16_t (qdma_get_job_t)(struct qdma_virt_queue *qdma_vq,
const struct qbman_fd *fd,
struct dpaa2_qdma_job **job,
struct rte_dpaa2_qdma_job **job,
uint16_t *nb_jobs);
typedef int (qdma_set_fd_t)(struct qdma_virt_queue *qdma_vq,
struct qbman_fd *fd,
struct dpaa2_qdma_job **job,
struct rte_dpaa2_qdma_job **job,
uint16_t nb_jobs);
typedef int (qdma_dequeue_multijob_t)(
struct qdma_virt_queue *qdma_vq,
uint16_t *vq_id,
struct dpaa2_qdma_job **job,
struct rte_dpaa2_qdma_job **job,
uint16_t nb_jobs);
typedef int (qdma_enqueue_multijob_t)(
struct qdma_virt_queue *qdma_vq,
struct dpaa2_qdma_job **job,
struct rte_dpaa2_qdma_job **job,
uint16_t nb_jobs);
/** Represents a QDMA virtual queue */
@ -275,7 +216,7 @@ struct qdma_virt_queue {
/** FLE pool for the queue */
struct rte_mempool *fle_pool;
/** Route by port */
struct dpaa2_qdma_rbp rbp;
struct rte_dpaa2_qdma_rbp rbp;
/** States if this vq is in use or not */
uint8_t in_use;
/** States if this vq has exclusively associated hw queue */
@ -290,7 +231,7 @@ struct qdma_virt_queue {
uint16_t vq_id;
uint32_t flags;
struct dpaa2_qdma_job *job_list[DPAA2_QDMA_MAX_DESC];
struct rte_dpaa2_qdma_job *job_list[DPAA2_QDMA_MAX_DESC];
struct rte_mempool *job_pool;
int num_valid_jobs;

View File

@ -45,6 +45,31 @@ struct rte_dpaa2_qdma_rbp {
uint32_t rsv:4;
};
/** Determines a QDMA job */
struct rte_dpaa2_qdma_job {
/** Source Address from where DMA is (to be) performed */
uint64_t src;
/** Destination Address where DMA is (to be) done */
uint64_t dest;
/** Length of the DMA operation in bytes. */
uint32_t len;
/** See RTE_QDMA_JOB_ flags */
uint32_t flags;
/**
* Status of the transaction.
* This is filled in the dequeue operation by the driver.
* upper 8bits acc_err for route by port.
* lower 8bits fd error
*/
uint16_t status;
uint16_t vq_id;
/**
* FLE pool element maintained by user, in case no qDMA response.
* Note: the address must be allocated from DPDK memory pool.
*/
void *usr_elem;
};
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
@ -93,4 +118,56 @@ __rte_experimental
void rte_dpaa2_qdma_vchan_rbp_enable(int16_t dev_id, uint16_t vchan,
struct rte_dpaa2_qdma_rbp *rbp_config);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
* Enqueue a copy operation onto the virtual DMA channel for silent mode,
* when dequeue is not required.
*
* This queues up a copy operation to be performed by hardware, if the 'flags'
* parameter contains RTE_DMA_OP_FLAG_SUBMIT then trigger doorbell to begin
* this operation, otherwise do not trigger doorbell.
*
* @param dev_id
* The identifier of the device.
* @param vchan
* The identifier of virtual DMA channel.
* @param jobs
* Jobs to be submitted to QDMA.
* @param nb_cpls
* Number of DMA jobs.
*
* @return
* - >= 0..Number of enqueued job.
* - -ENOSPC: if no space left to enqueue.
* - other values < 0 on failure.
*/
__rte_experimental
int rte_dpaa2_qdma_copy_multi(int16_t dev_id, uint16_t vchan,
struct rte_dpaa2_qdma_job **jobs, uint16_t nb_cpls);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
* Return the number of operations that have been successfully completed.
*
* @param dev_id
* The identifier of the device.
* @param vchan
* The identifier of virtual DMA channel.
* @param jobs
* Jobs completed by QDMA.
* @param nb_cpls
* Number of completed DMA jobs.
*
* @return
* The number of operations that successfully completed. This return value
* must be less than or equal to the value of nb_cpls.
*/
__rte_experimental
uint16_t rte_dpaa2_qdma_completed_multi(int16_t dev_id, uint16_t vchan,
struct rte_dpaa2_qdma_job **jobs, uint16_t nb_cpls);
#endif /* _RTE_PMD_DPAA2_QDMA_H_ */

View File

@ -3,6 +3,8 @@ DPDK_22 {
};
EXPERIMENTAL {
rte_dpaa2_qdma_completed_multi;
rte_dpaa2_qdma_copy_multi;
rte_dpaa2_qdma_vchan_fd_us_enable;
rte_dpaa2_qdma_vchan_internal_sg_enable;
rte_dpaa2_qdma_vchan_rbp_enable;