src/dpdk/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c
static int
otx2_dpi_rawdev_enqueue_bufs(struct rte_rawdev *dev,
			     struct rte_rawdev_buf **buffers,
			     unsigned int count, rte_rawdev_obj_t context)
{
	struct dpi_dma_queue_ctx_s *ctx = (struct dpi_dma_queue_ctx_s *)context;
	struct dpi_dma_buf_ptr_s *cmd;
	uint32_t c = 0;

	for (c = 0; c < count; c++) {
		uint64_t dpi_cmd[DPI_DMA_CMD_SIZE] = {0};
		union dpi_dma_instr_hdr_u *hdr;
		uint16_t index = 0, i;

		hdr = (union dpi_dma_instr_hdr_u *)&dpi_cmd[0];
		cmd = (struct dpi_dma_buf_ptr_s *)buffers[c]->buf_addr;

		hdr->s.xtype = ctx->xtype & DPI_XTYPE_MASK;
		hdr->s.pt = ctx->pt & DPI_HDR_PT_MASK;
		/* Request initiated with byte write completion, but completion
		 * pointer not provided
		 */
		if ((hdr->s.pt == DPI_HDR_PT_ZBW_CA ||
		     hdr->s.pt == DPI_HDR_PT_ZBW_NC) && cmd->comp_ptr == NULL)
			return c;

		cmd->comp_ptr->cdata = DPI_REQ_CDATA;
		hdr->s.ptr = (uint64_t)cmd->comp_ptr;
		hdr->s.deallocv = ctx->deallocv;
		hdr->s.tt = ctx->tt & DPI_W0_TT_MASK;
		hdr->s.grp = ctx->grp & DPI_W0_GRP_MASK;

		/* If caller provides completion ring details, then only queue
		 * completion address for later polling.
		 */
		if (ctx->c_ring) {
			ctx->c_ring->compl_data[ctx->c_ring->tail] =
								 cmd->comp_ptr;
			STRM_INC(ctx->c_ring);
		}

		if (hdr->s.deallocv)
			hdr->s.pvfe = 1;

		if (hdr->s.pt == DPI_HDR_PT_WQP)
			hdr->s.ptr = hdr->s.ptr | DPI_HDR_PT_WQP_STATUSNC;

		index += 4;
		hdr->s.fport = 0;
		hdr->s.lport = 0;
		if (ctx->xtype !=  DPI_XTYPE_INTERNAL_ONLY)
			hdr->s.lport = ctx->pem_id;

		/* For inbound case, src pointers are last pointers.
		 * For all other cases, src pointers are first pointers.
		 */
		if (ctx->xtype ==  DPI_XTYPE_INBOUND) {
			hdr->s.nfst = cmd->wptr_cnt & DPI_MAX_POINTER;
			hdr->s.nlst = cmd->rptr_cnt & DPI_MAX_POINTER;
			for (i = 0; i < hdr->s.nfst; i++) {
				dpi_cmd[index++] = cmd->wptr[i]->u[0];
				dpi_cmd[index++] = cmd->wptr[i]->u[1];
			}
			for (i = 0; i < hdr->s.nlst; i++) {
				dpi_cmd[index++] = cmd->rptr[i]->u[0];
				dpi_cmd[index++] = cmd->rptr[i]->u[1];
			}
		} else {
			hdr->s.nfst = cmd->rptr_cnt & DPI_MAX_POINTER;
			hdr->s.nlst = cmd->wptr_cnt & DPI_MAX_POINTER;
			for (i = 0; i < hdr->s.nfst; i++) {
				dpi_cmd[index++] = cmd->rptr[i]->u[0];
				dpi_cmd[index++] = cmd->rptr[i]->u[1];
			}
			for (i = 0; i < hdr->s.nlst; i++) {
				dpi_cmd[index++] = cmd->wptr[i]->u[0];
				dpi_cmd[index++] = cmd->wptr[i]->u[1];
			}
		}
		if (dma_queue_submit(dev, index, dpi_cmd))
			return c;
	}
	return c;
}
/* Enqueue buffers to DMA queue
 * returns number of buffers enqueued successfully
 */
Enqueue buffers to DMA queue
returns number of buffers enqueued successfully
Enqueue buffers to DMA queue returns number of buffers enqueued successfully
static int
otx2_dpi_rawdev_enqueue_bufs(struct rte_rawdev *dev,
			     struct rte_rawdev_buf **buffers,
			     unsigned int count, rte_rawdev_obj_t context)
{
	struct dpi_dma_queue_ctx_s *ctx = (struct dpi_dma_queue_ctx_s *)context;
	struct dpi_dma_buf_ptr_s *cmd;
	uint32_t c = 0;
	for (c = 0; c < count; c++) {
		uint64_t dpi_cmd[DPI_DMA_CMD_SIZE] = {0};
		union dpi_dma_instr_hdr_u *hdr;
		uint16_t index = 0, i;
		hdr = (union dpi_dma_instr_hdr_u *)&dpi_cmd[0];
		cmd = (struct dpi_dma_buf_ptr_s *)buffers[c]->buf_addr;
		hdr->s.xtype = ctx->xtype & DPI_XTYPE_MASK;
		hdr->s.pt = ctx->pt & DPI_HDR_PT_MASK;
		if ((hdr->s.pt == DPI_HDR_PT_ZBW_CA ||
		     hdr->s.pt == DPI_HDR_PT_ZBW_NC) && cmd->comp_ptr == NULL)
			return c;
		cmd->comp_ptr->cdata = DPI_REQ_CDATA;
		hdr->s.ptr = (uint64_t)cmd->comp_ptr;
		hdr->s.deallocv = ctx->deallocv;
		hdr->s.tt = ctx->tt & DPI_W0_TT_MASK;
		hdr->s.grp = ctx->grp & DPI_W0_GRP_MASK;
		if (ctx->c_ring) {
			ctx->c_ring->compl_data[ctx->c_ring->tail] =
								 cmd->comp_ptr;
			STRM_INC(ctx->c_ring);
		}
		if (hdr->s.deallocv)
			hdr->s.pvfe = 1;
		if (hdr->s.pt == DPI_HDR_PT_WQP)
			hdr->s.ptr = hdr->s.ptr | DPI_HDR_PT_WQP_STATUSNC;
		index += 4;
		hdr->s.fport = 0;
		hdr->s.lport = 0;
		if (ctx->xtype !=  DPI_XTYPE_INTERNAL_ONLY)
			hdr->s.lport = ctx->pem_id;
		if (ctx->xtype ==  DPI_XTYPE_INBOUND) {
			hdr->s.nfst = cmd->wptr_cnt & DPI_MAX_POINTER;
			hdr->s.nlst = cmd->rptr_cnt & DPI_MAX_POINTER;
			for (i = 0; i < hdr->s.nfst; i++) {
				dpi_cmd[index++] = cmd->wptr[i]->u[0];
				dpi_cmd[index++] = cmd->wptr[i]->u[1];
			}
			for (i = 0; i < hdr->s.nlst; i++) {
				dpi_cmd[index++] = cmd->rptr[i]->u[0];
				dpi_cmd[index++] = cmd->rptr[i]->u[1];
			}
		} else {
			hdr->s.nfst = cmd->rptr_cnt & DPI_MAX_POINTER;
			hdr->s.nlst = cmd->wptr_cnt & DPI_MAX_POINTER;
			for (i = 0; i < hdr->s.nfst; i++) {
				dpi_cmd[index++] = cmd->rptr[i]->u[0];
				dpi_cmd[index++] = cmd->rptr[i]->u[1];
			}
			for (i = 0; i < hdr->s.nlst; i++) {
				dpi_cmd[index++] = cmd->wptr[i]->u[0];
				dpi_cmd[index++] = cmd->wptr[i]->u[1];
			}
		}
		if (dma_queue_submit(dev, index, dpi_cmd))
			return c;
	}
	return c;
}
static int otx2_dpi_rawdev_enqueue_bufs ( struct rte_rawdev * dev , struct rte_rawdev_buf * * buffers , unsigned int count , rte_rawdev_obj_t context ) { struct dpi_dma_queue_ctx_s * ctx = ( struct dpi_dma_queue_ctx_s * ) context ; struct dpi_dma_buf_ptr_s * cmd ; uint32_t c = 0 ; for ( c = 0 ; c < count ; c ++ ) { uint64_t dpi_cmd [ DPI_DMA_CMD_SIZE ] = { 0 } ; union dpi_dma_instr_hdr_u * hdr ; uint16_t index = 0 , i ; hdr = ( union dpi_dma_instr_hdr_u * ) & dpi_cmd [ 0 ] ; cmd = ( struct dpi_dma_buf_ptr_s * ) buffers [ c ] -> buf_addr ; hdr -> s . xtype = ctx -> xtype & DPI_XTYPE_MASK ; hdr -> s . pt = ctx -> pt & DPI_HDR_PT_MASK ; if ( ( hdr -> s . pt == DPI_HDR_PT_ZBW_CA || hdr -> s . pt == DPI_HDR_PT_ZBW_NC ) && cmd -> comp_ptr == NULL ) return c ; cmd -> comp_ptr -> cdata = DPI_REQ_CDATA ; hdr -> s . ptr = ( uint64_t ) cmd -> comp_ptr ; hdr -> s . deallocv = ctx -> deallocv ; hdr -> s . tt = ctx -> tt & DPI_W0_TT_MASK ; hdr -> s . grp = ctx -> grp & DPI_W0_GRP_MASK ; if ( ctx -> c_ring ) { ctx -> c_ring -> compl_data [ ctx -> c_ring -> tail ] = cmd -> comp_ptr ; STRM_INC ( ctx -> c_ring ) ; } if ( hdr -> s . deallocv ) hdr -> s . pvfe = 1 ; if ( hdr -> s . pt == DPI_HDR_PT_WQP ) hdr -> s . ptr = hdr -> s . ptr | DPI_HDR_PT_WQP_STATUSNC ; index += 4 ; hdr -> s . fport = 0 ; hdr -> s . lport = 0 ; if ( ctx -> xtype != DPI_XTYPE_INTERNAL_ONLY ) hdr -> s . lport = ctx -> pem_id ; if ( ctx -> xtype == DPI_XTYPE_INBOUND ) { hdr -> s . nfst = cmd -> wptr_cnt & DPI_MAX_POINTER ; hdr -> s . nlst = cmd -> rptr_cnt & DPI_MAX_POINTER ; for ( i = 0 ; i < hdr -> s . nfst ; i ++ ) { dpi_cmd [ index ++ ] = cmd -> wptr [ i ] -> u [ 0 ] ; dpi_cmd [ index ++ ] = cmd -> wptr [ i ] -> u [ 1 ] ; } for ( i = 0 ; i < hdr -> s . nlst ; i ++ ) { dpi_cmd [ index ++ ] = cmd -> rptr [ i ] -> u [ 0 ] ; dpi_cmd [ index ++ ] = cmd -> rptr [ i ] -> u [ 1 ] ; } } else { hdr -> s . nfst = cmd -> rptr_cnt & DPI_MAX_POINTER ; hdr -> s . nlst = cmd -> wptr_cnt & DPI_MAX_POINTER ; for ( i = 0 ; i < hdr -> s . nfst ; i ++ ) { dpi_cmd [ index ++ ] = cmd -> rptr [ i ] -> u [ 0 ] ; dpi_cmd [ index ++ ] = cmd -> rptr [ i ] -> u [ 1 ] ; } for ( i = 0 ; i < hdr -> s . nlst ; i ++ ) { dpi_cmd [ index ++ ] = cmd -> wptr [ i ] -> u [ 0 ] ; dpi_cmd [ index ++ ] = cmd -> wptr [ i ] -> u [ 1 ] ; } } if ( dma_queue_submit ( dev , index , dpi_cmd ) ) return c ; } return c ; }
Enqueue buffers to DMA queue
 returns number of buffers enqueued successfully
Enqueue buffers to DMA queue returns number of buffers enqueued successfully
/* Request initiated with byte write completion, but completion
		 * pointer not provided
		 */ /* If caller provides completion ring details, then only queue
		 * completion address for later polling.
		 */ /* For inbound case, src pointers are last pointers.
		 * For all other cases, src pointers are first pointers.
		 */