[dpdk-dev] [PATCH v1 1/1] compress/octeontx: scatter gather mode feature support
Scatter gather mode feature support is added to compress or decompress the larger data in a single compression or decompression operation. Signed-off-by: Mahipal Challa --- drivers/compress/octeontx/otx_zip.h | 155 +--- drivers/compress/octeontx/otx_zip_pmd.c | 72 +-- 2 files changed, 200 insertions(+), 27 deletions(-) diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h index ee14deb03d..0b68f49609 100644 --- a/drivers/compress/octeontx/otx_zip.h +++ b/drivers/compress/octeontx/otx_zip.h @@ -55,10 +55,13 @@ extern int octtx_zip_logtype_driver; ZIP_MAX_NCBP_SIZE)/* ~8072ull */ #define ZIP_BUF_SIZE 256 +#define ZIP_SGBUF_SIZE (5 * 1024) #define ZIP_BURST_SIZE 64 #define ZIP_MAXSEG_SIZE 59460 #define ZIP_EXTRABUF_SIZE4096 +#define ZIP_MAX_SEGS 300 +#define ZIP_MAX_DATA_SIZE(16*1024*1024) #define ZIP_SGPTR_ALIGN16 #define ZIP_CMDQ_ALIGN 128 @@ -102,6 +105,12 @@ struct zipvf_qp; typedef int (*comp_func_t)(struct rte_comp_op *op, struct zipvf_qp *qp, struct zip_stream *zstrm, int num); +/* Scatter Gather list */ +struct zipvf_sginfo { + union zip_zptr_addr_s sg_addr; + union zip_zptr_ctl_s sg_ctl; +} __rte_aligned(16); + /** * ZIP private stream structure */ @@ -144,6 +153,11 @@ struct zipvf_qp { /* Unique Queue Pair Name */ struct zip_vf *vf; /* pointer to device, queue belongs to */ + struct zipvf_sginfo *g_info; + struct zipvf_sginfo *s_info; + /* gather and scatter SGL */ + uint64_t num_sgbuf; + uint64_t enqed; } __rte_cache_aligned; /** @@ -161,50 +175,146 @@ struct zip_vf { uint32_t max_nb_queue_pairs; /* pointer to device qps */ struct rte_mempool *zip_mp; + struct rte_mempool *sg_mp; /* pointer to pools */ } __rte_cache_aligned; -static inline void -zipvf_prepare_in_buf(union zip_inst_s *inst, struct rte_comp_op *op) +static inline int +zipvf_prepare_sgl(struct rte_mbuf *buf, int64_t offset, struct zipvf_sginfo *sg_list, + uint32_t data_len, const uint16_t max_segs, struct zipvf_qp *qp) +{ + struct zipvf_sginfo *sginfo = (struct zipvf_sginfo *)sg_list; + uint32_t tot_buf_len, sgidx; + int ret = -EINVAL; + + for (sgidx = tot_buf_len = 0; buf && sgidx < max_segs; buf = buf->next) { + if (offset >= rte_pktmbuf_data_len(buf)) { + offset -= rte_pktmbuf_data_len(buf); + continue; + } + + sginfo[sgidx].sg_ctl.s.length = (uint16_t)(rte_pktmbuf_data_len(buf) - offset); + sginfo[sgidx].sg_addr.s.addr = rte_pktmbuf_iova_offset(buf, offset); + + offset = 0; + tot_buf_len += sginfo[sgidx].sg_ctl.s.length; + + if (tot_buf_len >= data_len) { + sginfo[sgidx].sg_ctl.s.length -= tot_buf_len - data_len; + ret = 0; + break; + } + +#ifdef ZIP_DBG + ZIP_PMD_INFO("ZIP SGL buf[%d], len = %d, iova = 0x%"PRIx64"\n", +sgidx, sginfo[sgidx].sg_ctl.s.length, +sginfo[sgidx].sg_addr.s.addr); +#endif + ++sgidx; + } + + if (unlikely(ret != 0)) { + if (sgidx == max_segs) + ZIP_PMD_ERR("Exceeded max segments in ZIP SGL (%u)", max_segs); + else + ZIP_PMD_ERR("Mbuf chain is too short"); + } + qp->num_sgbuf = ++sgidx; + +#ifdef ZIP_DBG + ZIP_PMD_INFO("Tot_buf_len:%d max_segs:%d\n", tot_buf_len, qp->num_sgbuf); +#endif + return ret; +} + +static inline int +zipvf_prepare_in_buf(union zip_inst_s *inst, struct zipvf_qp *qp, struct rte_comp_op *op) { uint32_t offset, inlen; struct rte_mbuf *m_src; + int ret = 0; inlen = op->src.length; offset = op->src.offset; m_src = op->m_src; + /* Gather input */ + if (op->m_src->next != NULL && inlen > ZIP_MAXSEG_SIZE) { + inst->s.dg = 1; + + ret = zipvf_prepare_sgl(m_src, offset, qp->g_info, inlen, + op->m_src->nb_segs, qp); + + inst->s.inp_ptr_addr.s.addr = rte_mem_virt2iova(qp->g_info); + inst->s.inp_ptr_ctl.s.length = qp->num_sgbuf; + inst->s.inp_ptr_ctl.s.fw = 0; + +#ifdef ZIP_DBG + ZIP_PMD_INFO("Gather(input): len(nb_segs):%d, iova: 0x%"PRIx64"\n", +inst->s.inp_ptr_ctl.s.length, inst->s.inp_ptr_addr.s.addr); +#endif + return ret; + } + /* Prepare direct input
[dpdk-dev] [PATCH v2 1/1] compress/octeontx: support scatter gather mode
Scatter gather mode feature support is added to compress or decompress the larger data in a single compression or decompression operation. Signed-off-by: Mahipal Challa --- v2: - Checkpatch warning is resolved. - PMD debug logs are used for debug prints. - Documentation is updated. --- --- doc/guides/compressdevs/features/octeontx.ini | 3 + drivers/compress/octeontx/otx_zip.h | 143 +++--- drivers/compress/octeontx/otx_zip_pmd.c | 84 +++--- 3 files changed, 194 insertions(+), 36 deletions(-) diff --git a/doc/guides/compressdevs/features/octeontx.ini b/doc/guides/compressdevs/features/octeontx.ini index cc8b025682..8a9b2906d8 100644 --- a/doc/guides/compressdevs/features/octeontx.ini +++ b/doc/guides/compressdevs/features/octeontx.ini @@ -8,3 +8,6 @@ HW Accelerated = Y Deflate= Y Fixed = Y Dynamic= Y +OOP SGL In SGL Out = Y +OOP SGL In LB Out = Y +OOP LB In SGL Out = Y diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h index ee14deb03d..7391360925 100644 --- a/drivers/compress/octeontx/otx_zip.h +++ b/drivers/compress/octeontx/otx_zip.h @@ -55,10 +55,13 @@ extern int octtx_zip_logtype_driver; ZIP_MAX_NCBP_SIZE)/* ~8072ull */ #define ZIP_BUF_SIZE 256 +#define ZIP_SGBUF_SIZE (5 * 1024) #define ZIP_BURST_SIZE 64 #define ZIP_MAXSEG_SIZE 59460 #define ZIP_EXTRABUF_SIZE4096 +#define ZIP_MAX_SEGS 300 +#define ZIP_MAX_DATA_SIZE(16*1024*1024) #define ZIP_SGPTR_ALIGN16 #define ZIP_CMDQ_ALIGN 128 @@ -102,6 +105,12 @@ struct zipvf_qp; typedef int (*comp_func_t)(struct rte_comp_op *op, struct zipvf_qp *qp, struct zip_stream *zstrm, int num); +/* Scatter gather list */ +struct zipvf_sginfo { + union zip_zptr_addr_s sg_addr; + union zip_zptr_ctl_s sg_ctl; +} __rte_aligned(16); + /** * ZIP private stream structure */ @@ -144,6 +153,11 @@ struct zipvf_qp { /* Unique Queue Pair Name */ struct zip_vf *vf; /* pointer to device, queue belongs to */ + struct zipvf_sginfo *g_info; + struct zipvf_sginfo *s_info; + /* SGL pointers */ + uint64_t num_sgbuf; + uint64_t enqed; } __rte_cache_aligned; /** @@ -161,50 +175,134 @@ struct zip_vf { uint32_t max_nb_queue_pairs; /* pointer to device qps */ struct rte_mempool *zip_mp; + struct rte_mempool *sg_mp; /* pointer to pools */ } __rte_cache_aligned; -static inline void -zipvf_prepare_in_buf(union zip_inst_s *inst, struct rte_comp_op *op) +static inline int +zipvf_prepare_sgl(struct rte_mbuf *buf, int64_t offset, struct zipvf_sginfo *sg_list, + uint32_t data_len, const uint16_t max_segs, struct zipvf_qp *qp) +{ + struct zipvf_sginfo *sginfo = (struct zipvf_sginfo *)sg_list; + uint32_t tot_buf_len, sgidx; + int ret = -EINVAL; + + for (sgidx = tot_buf_len = 0; buf && sgidx < max_segs; buf = buf->next) { + if (offset >= rte_pktmbuf_data_len(buf)) { + offset -= rte_pktmbuf_data_len(buf); + continue; + } + + sginfo[sgidx].sg_ctl.s.length = (uint16_t)(rte_pktmbuf_data_len(buf) - offset); + sginfo[sgidx].sg_addr.s.addr = rte_pktmbuf_iova_offset(buf, offset); + + offset = 0; + tot_buf_len += sginfo[sgidx].sg_ctl.s.length; + + if (tot_buf_len >= data_len) { + sginfo[sgidx].sg_ctl.s.length -= tot_buf_len - data_len; + ret = 0; + break; + } + + ZIP_PMD_LOG(DEBUG, "ZIP SGL buf[%d], len = %d, iova = 0x%"PRIx64"\n", + sgidx, sginfo[sgidx].sg_ctl.s.length, sginfo[sgidx].sg_addr.s.addr); + ++sgidx; + } + + if (unlikely(ret != 0)) { + if (sgidx == max_segs) + ZIP_PMD_ERR("Exceeded max segments in ZIP SGL (%u)", max_segs); + else + ZIP_PMD_ERR("Mbuf chain is too short"); + } + qp->num_sgbuf = ++sgidx; + + ZIP_PMD_LOG(DEBUG, "Tot_buf_len:%d max_segs:%"PRIx64"\n", tot_buf_len, + qp->num_sgbuf); + return ret; +} + +static inline int +zipvf_prepare_in_buf(union zip_inst_s *inst, struct zipvf_qp *qp, struct rte_comp_op *op) { uint32_t offset, inlen; struct rte_mbuf *m_src; + int ret = 0; inlen = op->src.length; offset = op->src.offset; m_src = op->m_src; + /* Gather input */ + if (op->m_src->next != NULL && inlen > ZIP_MAXSEG_SIZE) { + inst->s.dg = 1; + + ret = zipvf_prepare_sgl(m_src, offset, qp->g_info, inlen, +
[dpdk-dev] [PATCH v1 1/1] compress/octeontx: mark ZIP VF driver to support disabling IOVA as PA
Enabled the flag "pmd_supports_disable_iova_as_pa" for octeontx2 compress VF driver files. Signed-off-by: Mahipal Challa --- drivers/common/octeontx/meson.build | 1 + drivers/compress/octeontx/meson.build | 1 + drivers/mempool/octeontx/meson.build | 1 + 3 files changed, 3 insertions(+) diff --git a/drivers/common/octeontx/meson.build b/drivers/common/octeontx/meson.build index dc060dfea1..599b276197 100644 --- a/drivers/common/octeontx/meson.build +++ b/drivers/common/octeontx/meson.build @@ -9,3 +9,4 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64') endif sources = files('octeontx_mbox.c') +pmd_supports_disable_iova_as_pa = true diff --git a/drivers/compress/octeontx/meson.build b/drivers/compress/octeontx/meson.build index 3a29c3e609..1be89a9e94 100644 --- a/drivers/compress/octeontx/meson.build +++ b/drivers/compress/octeontx/meson.build @@ -11,3 +11,4 @@ sources = files('otx_zip.c', 'otx_zip_pmd.c') includes += include_directories('include') deps += ['mempool_octeontx', 'bus_pci'] ext_deps += dep +pmd_supports_disable_iova_as_pa = true diff --git a/drivers/mempool/octeontx/meson.build b/drivers/mempool/octeontx/meson.build index fb05928129..17318d6360 100644 --- a/drivers/mempool/octeontx/meson.build +++ b/drivers/mempool/octeontx/meson.build @@ -13,3 +13,4 @@ sources = files( ) deps += ['mbuf', 'bus_pci', 'common_octeontx'] +pmd_supports_disable_iova_as_pa = true -- 2.25.1
[dpdk-dev] [PATCH v1 1/1] compress/octeontx: async burst mode feature support
Async burst mode feature support is added, improves the single thread compression/decompression throughput. Signed-off-by: Mahipal Challa --- drivers/compress/octeontx/include/zip_regs.h | 1 + drivers/compress/octeontx/otx_zip.h | 37 +-- drivers/compress/octeontx/otx_zip_pmd.c | 258 ++- 3 files changed, 160 insertions(+), 136 deletions(-) diff --git a/drivers/compress/octeontx/include/zip_regs.h b/drivers/compress/octeontx/include/zip_regs.h index a7f055..a07483b045 100644 --- a/drivers/compress/octeontx/include/zip_regs.h +++ b/drivers/compress/octeontx/include/zip_regs.h @@ -687,6 +687,7 @@ union zip_zptr_s { #define ZIP_COMP_E_TIMEOUT (0xc) #define ZIP_COMP_E_INSTR_ERR (0xd) #define ZIP_COMP_E_HCTX_ERR (0xe) +#define ZIP_COMP_E_PTR_ERR (0xf) #define ZIP_COMP_E_STOP (3) /** diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h index cdef8cc6cb..ee14deb03d 100644 --- a/drivers/compress/octeontx/otx_zip.h +++ b/drivers/compress/octeontx/otx_zip.h @@ -55,6 +55,10 @@ extern int octtx_zip_logtype_driver; ZIP_MAX_NCBP_SIZE)/* ~8072ull */ #define ZIP_BUF_SIZE 256 +#define ZIP_BURST_SIZE 64 + +#define ZIP_MAXSEG_SIZE 59460 +#define ZIP_EXTRABUF_SIZE4096 #define ZIP_SGPTR_ALIGN16 #define ZIP_CMDQ_ALIGN 128 @@ -67,7 +71,7 @@ extern int octtx_zip_logtype_driver; ((_align) * (((x) + (_align) - 1) / (_align))) /**< ZIP PMD device name */ -#define COMPRESSDEV_NAME_ZIP_PMD compress_octeonx +#define COMPRESSDEV_NAME_ZIP_PMD compress_octeontx #define ZIP_PMD_LOG(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, \ @@ -95,18 +99,18 @@ struct zip_stream; struct zipvf_qp; /* Algorithm handler function prototype */ -typedef int (*comp_func_t)(struct rte_comp_op *op, - struct zipvf_qp *qp, struct zip_stream *zstrm); +typedef int (*comp_func_t)(struct rte_comp_op *op, struct zipvf_qp *qp, + struct zip_stream *zstrm, int num); /** * ZIP private stream structure */ struct zip_stream { - union zip_inst_s *inst; + union zip_inst_s *inst[ZIP_BURST_SIZE]; /* zip instruction pointer */ comp_func_t func; /* function to process comp operation */ - void *bufs[MAX_BUFS_PER_STREAM]; + void *bufs[MAX_BUFS_PER_STREAM * ZIP_BURST_SIZE]; } __rte_cache_aligned; @@ -162,11 +166,10 @@ struct zip_vf { static inline void -zipvf_prepare_in_buf(struct zip_stream *zstrm, struct rte_comp_op *op) +zipvf_prepare_in_buf(union zip_inst_s *inst, struct rte_comp_op *op) { uint32_t offset, inlen; struct rte_mbuf *m_src; - union zip_inst_s *inst = zstrm->inst; inlen = op->src.length; offset = op->src.offset; @@ -180,11 +183,10 @@ zipvf_prepare_in_buf(struct zip_stream *zstrm, struct rte_comp_op *op) } static inline void -zipvf_prepare_out_buf(struct zip_stream *zstrm, struct rte_comp_op *op) +zipvf_prepare_out_buf(union zip_inst_s *inst, struct rte_comp_op *op) { uint32_t offset; struct rte_mbuf *m_dst; - union zip_inst_s *inst = zstrm->inst; offset = op->dst.offset; m_dst = op->m_dst; @@ -195,14 +197,15 @@ zipvf_prepare_out_buf(struct zip_stream *zstrm, struct rte_comp_op *op) rte_pktmbuf_iova_offset(m_dst, offset); inst->s.totaloutputlength = rte_pktmbuf_pkt_len(m_dst) - op->dst.offset; + if (inst->s.totaloutputlength == ZIP_MAXSEG_SIZE) + inst->s.totaloutputlength += ZIP_EXTRABUF_SIZE; /* DSTOP */ + inst->s.out_ptr_ctl.s.length = inst->s.totaloutputlength; } static inline void -zipvf_prepare_cmd_stateless(struct rte_comp_op *op, struct zip_stream *zstrm) +zipvf_prepare_cmd_stateless(struct rte_comp_op *op, union zip_inst_s *inst) { - union zip_inst_s *inst = zstrm->inst; - /* set flush flag to always 1*/ inst->s.ef = 1; @@ -215,8 +218,8 @@ zipvf_prepare_cmd_stateless(struct rte_comp_op *op, struct zip_stream *zstrm) inst->s.adlercrc32 = op->input_chksum; /* Prepare gather buffers */ - zipvf_prepare_in_buf(zstrm, op); - zipvf_prepare_out_buf(zstrm, op); + zipvf_prepare_in_buf(inst, op); + zipvf_prepare_out_buf(inst, op); } #ifdef ZIP_DBG @@ -224,6 +227,7 @@ static inline void zip_dump_instruction(void *inst) { union zip_inst_s *cmd83 = (union zip_inst_s *)inst; + printf("### START \n"); printf("doneint:%d totaloutputlength:%d\n", cmd83->s.doneint, cmd83->s.totaloutputlength); @@ -265,9 +269,8 @@ void zipvf_push_command(struct zipvf_qp *qp, union zip_inst_s *zcmd); int -zip_process_op(struct rte_comp_op *op, - struct zipvf_qp *q
[dpdk-dev] [PATCH v1 1/1] compress/octeontx: add octeontx2 SoC family support
The octeontx2 9xxx SoC family support is added. Signed-off-by: Mahipal Challa --- drivers/compress/octeontx/include/zip_regs.h | 12 drivers/compress/octeontx/otx_zip.c | 6 +- drivers/compress/octeontx/otx_zip.h | 1 + drivers/compress/octeontx/otx_zip_pmd.c | 6 ++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/compress/octeontx/include/zip_regs.h b/drivers/compress/octeontx/include/zip_regs.h index 94a48cde66..a7f055 100644 --- a/drivers/compress/octeontx/include/zip_regs.h +++ b/drivers/compress/octeontx/include/zip_regs.h @@ -63,6 +63,18 @@ typedef union { uint64_t reserved_49_63: 15; #endif /* Word 0 - End */ } s; + + struct zip_vqx_sbuf_addr_s9x { +#if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */ + uint64_t reserved_53_63: 11; + uint64_t ptr : 46; + uint64_t off : 7; +#else /* Word 0 - Little Endian */ + uint64_t off : 7; + uint64_t ptr : 46; + uint64_t reserved_53_63: 11; +#endif /* Word 0 - End */ + } s9x; } zip_vqx_sbuf_addr_t; /** diff --git a/drivers/compress/octeontx/otx_zip.c b/drivers/compress/octeontx/otx_zip.c index a9046ff351..11471dcbb4 100644 --- a/drivers/compress/octeontx/otx_zip.c +++ b/drivers/compress/octeontx/otx_zip.c @@ -58,7 +58,11 @@ zipvf_q_init(struct zipvf_qp *qp) cmdq->iova = iova; que_sbuf_addr.u = 0ull; - que_sbuf_addr.s.ptr = (cmdq->iova >> 7); + if (vf->pdev->id.device_id == PCI_DEVICE_ID_OCTEONTX2_ZIPVF) + que_sbuf_addr.s9x.ptr = (cmdq->iova >> 7); + else + que_sbuf_addr.s.ptr = (cmdq->iova >> 7); + zip_reg_write64(vf->vbar0, ZIP_VQ_SBUF_ADDR, que_sbuf_addr.u); zip_q_enable(qp); diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h index 118a95d738..46c80c8dc2 100644 --- a/drivers/compress/octeontx/otx_zip.h +++ b/drivers/compress/octeontx/otx_zip.h @@ -30,6 +30,7 @@ extern int octtx_zip_logtype_driver; #define PCI_VENDOR_ID_CAVIUM 0x177D /**< PCI device id of ZIP VF */ #define PCI_DEVICE_ID_OCTEONTX_ZIPVF 0xA037 +#define PCI_DEVICE_ID_OCTEONTX2_ZIPVF 0xA083 /* maximum number of zip vf devices */ #define ZIP_MAX_VFS 8 diff --git a/drivers/compress/octeontx/otx_zip_pmd.c b/drivers/compress/octeontx/otx_zip_pmd.c index f9b8f7a1ec..dff188e223 100644 --- a/drivers/compress/octeontx/otx_zip_pmd.c +++ b/drivers/compress/octeontx/otx_zip_pmd.c @@ -85,7 +85,9 @@ zip_process_op(struct rte_comp_op *op, op->status = RTE_COMP_OP_STATUS_ERROR; } +#ifdef ZIP_DBG ZIP_PMD_INFO("written %d\n", zresult->s.totalbyteswritten); +#endif /* Update op stats */ switch (op->status) { @@ -630,6 +632,10 @@ static struct rte_pci_id pci_id_octtx_zipvf_table[] = { RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVICE_ID_OCTEONTX_ZIPVF), }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, + PCI_DEVICE_ID_OCTEONTX2_ZIPVF), + }, { .device_id = 0 }, -- 2.25.1
Re: [dpdk-dev] [PATCH v1 2/6] raw/octeontx2_ep: add device configuration
Hi Gavin, Thanks for your suggestions, please see the response inline. From: Gavin Hu (Arm Technology China) Sent: Saturday, December 14, 2019 9:34 PM To: Mahipal Challa ; dev@dpdk.org Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju Athreya ; Subrahmanyam Nilla ; Venkateshwarlu Nalla ; nd Subject: [EXT] RE: [dpdk-dev] [PATCH v1 2/6] raw/octeontx2_ep: add device configuration External Email -- Hi Mahipal, > -Original Message- > From: dev On Behalf Of Mahipal Challa > Sent: Friday, December 6, 2019 2:39 PM > To: dev@dpdk.org > Cc: jer...@marvell.com; pathr...@marvell.com; sni...@marvell.com; > venk...@marvell.com > Subject: [dpdk-dev] [PATCH v1 2/6] raw/octeontx2_ep: add device > configuration > > Register "dev_configure" API to configure/initialize the SDP > VF PCIe devices. > > Signed-off-by: Mahipal Challa > --- > doc/guides/rawdevs/octeontx2_ep.rst| 29 ++ > drivers/common/octeontx2/hw/otx2_sdp.h | 184 + > drivers/common/octeontx2/otx2_common.c | 9 + > drivers/common/octeontx2/otx2_common.h | 4 + > .../octeontx2/rte_common_octeontx2_version.map | 6 + > drivers/raw/octeontx2_ep/Makefile | 3 + > drivers/raw/octeontx2_ep/meson.build | 4 +- > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 294 ++ > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 11 + > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 148 +++ > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 434 > - > drivers/raw/octeontx2_ep/otx2_ep_vf.c | 408 +++ > drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + > 13 files changed, 1542 insertions(+), 2 deletions(-) > > diff --git a/doc/guides/rawdevs/octeontx2_ep.rst > b/doc/guides/rawdevs/octeontx2_ep.rst > index 5f5ed01..2507fcf 100644 > --- a/doc/guides/rawdevs/octeontx2_ep.rst > +++ b/doc/guides/rawdevs/octeontx2_ep.rst > @@ -39,3 +39,32 @@ entry `sriov_numvfs` for the corresponding PF driver. > > Once the required VFs are enabled, to be accessible from DPDK, VFs need to > be > bound to vfio-pci driver. > + > +Device Setup > + > + > +The OCTEON TX2 SDP End Point VF devices will need to be bound to a > +user-space IO driver for use. The script ``dpdk-devbind.py`` script > +included with DPDK can be used to view the state of the devices and to bind > +them to a suitable DPDK-supported kernel driver. When querying the status > +of the devices, they will appear under the category of "Misc (rawdev) > +devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be > +used to see the state of those devices alone. > + > +Device Configuration > + > + > +Configuring SDP EP rawdev device is done using the > ``rte_rawdev_configure()`` > +API, which takes the mempool as parameter. PMD uses this pool to > send/receive > +packets to/from the HW. > + > +The following code shows how the device is configured > + > +.. code-block:: c > + > + struct sdp_rawdev_info config = {0}; > + struct rte_rawdev_info rdev_info = {.dev_private = &config}; > + config.enqdeq_mpool = (void *)rte_mempool_create(...); > + > + rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); > + > diff --git a/drivers/common/octeontx2/hw/otx2_sdp.h > b/drivers/common/octeontx2/hw/otx2_sdp.h > new file mode 100644 > index 000..7e03317 > --- /dev/null > +++ b/drivers/common/octeontx2/hw/otx2_sdp.h > @@ -0,0 +1,184 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2019 Marvell International Ltd. > + */ > + > +#ifndef __OTX2_SDP_HW_H_ > +#define __OTX2_SDP_HW_H_ > + > +/* SDP VF IOQs */ > +#define SDP_MIN_RINGS_PER_VF(1) > +#define SDP_MAX_RINGS_PER_VF(8) > + > +/* SDP VF IQ configuration */ > +#define SDP_VF_MAX_IQ_DESCRIPTORS (512) > +#define SDP_VF_MIN_IQ_DESCRIPTORS (128) > + > +#define SDP_VF_DB_MIN (1) > +#define SDP_VF_DB_TIMEOUT (1) > +#define SDP_VF_INTR_THRESHOLD (0x) > + > +#define SDP_VF_64BYTE_INSTR (64) > +#define SDP_VF_32BYTE_INSTR (32) > + > +/* SDP VF OQ configuration */ > +#define SDP_VF_MAX_OQ_DESCRIPTORS (512) > +#define SDP_VF_MIN_OQ_DESCRIPTORS (128) > +#define SDP_VF_OQ_BUF_SIZE (2048) > +#define SDP_VF_OQ_REFIL_THRESHOLD (16) > + > +#define SDP_VF_OQ_INFOPTR_MODE (1) > +#define SDP_VF_OQ_BUFPTR_MODE (0) > + > +#define SDP_VF_OQ_INTR_PKT (1) > +#d
Re: [dpdk-dev] [PATCH v1 5/6] raw/octeontx2_ep: add dequeue operation
Hi Gavin, Please see response inline. From: Gavin Hu (Arm Technology China) Sent: Saturday, December 14, 2019 9:48 PM To: Mahipal Challa ; dev@dpdk.org Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju Athreya ; Subrahmanyam Nilla ; Venkateshwarlu Nalla ; nd Subject: [EXT] RE: [dpdk-dev] [PATCH v1 5/6] raw/octeontx2_ep: add dequeue operation External Email -- Hi Mahipal, > -Original Message- > From: dev On Behalf Of Mahipal Challa > Sent: Friday, December 6, 2019 2:39 PM > To: dev@dpdk.org > Cc: jer...@marvell.com; pathr...@marvell.com; sni...@marvell.com; > venk...@marvell.com > Subject: [dpdk-dev] [PATCH v1 5/6] raw/octeontx2_ep: add dequeue > operation > > Add rawdev dequeue operation for SDP VF devices. > > Signed-off-by: Mahipal Challa > --- > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 199 > ++ > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 2 + > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 18 ++- > 4 files changed, 219 insertions(+), 1 deletion(-) > > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > index ebbacfb..451fcc0 100644 > --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > @@ -260,6 +260,7 @@ >rte_mempool_get(sdpvf->enqdeq_mpool, &buf); >if (buf == NULL) { >otx2_err("OQ buffer alloc failed"); > + droq->stats.rx_alloc_failure++; >/* sdp_droq_destroy_ring_buffers(droq);*/ >return -ENOMEM; >} > @@ -645,3 +646,201 @@ >return SDP_IQ_SEND_FAILED; > } > > +static uint32_t > +sdp_droq_refill(struct sdp_device *sdpvf, struct sdp_droq *droq) > +{ > + struct sdp_droq_desc *desc_ring; > + uint32_t desc_refilled = 0; > + void *buf = NULL; > + > + desc_ring = droq->desc_ring; > + > + while (droq->refill_count && (desc_refilled < droq->nb_desc)) { > + /* If a valid buffer exists (happens if there is no dispatch), > + * reuse the buffer, else allocate. > + */ > + if (droq->recv_buf_list[droq->refill_idx].buffer != NULL) > + break; > + > + rte_mempool_get(sdpvf->enqdeq_mpool, &buf); > + /* If a buffer could not be allocated, no point in > + * continuing > + */ > + if (buf == NULL) { > + droq->stats.rx_alloc_failure++; > + break; > + } > + > + droq->recv_buf_list[droq->refill_idx].buffer = buf; > + desc_ring[droq->refill_idx].buffer_ptr = > rte_mem_virt2iova(buf); > + > + /* Reset any previous values in the length field. */ > + droq->info_list[droq->refill_idx].length = 0; > + > + droq->refill_idx = sdp_incr_index(droq->refill_idx, 1, > + droq->nb_desc); > + > + desc_refilled++; > + droq->refill_count--; > + > + } > + > + return desc_refilled; > +} > + > +static int > +sdp_droq_read_packet(struct sdp_device *sdpvf __rte_unused, > + struct sdp_droq *droq, > + struct sdp_droq_pkt *droq_pkt) > +{ > + struct sdp_droq_info *info; > + uint32_t total_len = 0; > + uint32_t pkt_len = 0; > + > + info = &droq->info_list[droq->read_idx]; > + sdp_swap_8B_data((uint64_t *)&info->length, 1); > + if (!info->length) { > + otx2_err("OQ info_list->length[%ld]", (long)info->length); > + goto oq_read_fail; > + } > + > + /* Deduce the actual data size */ > + info->length -= SDP_RH_SIZE; > + total_len += (uint32_t)info->length; > + > + otx2_sdp_dbg("OQ: pkt_len[%ld], buffer_size %d", > + (long)info->length, droq->buffer_size); > + if (info->length > droq->buffer_size) { > + otx2_err("This mode is not supported: pkt_len > buffer_size"); > + goto oq_read_fail; > + } > + > + if (info->length <= droq->buffer_size) { > + pkt_len = (uint32_t)info->length; > + droq_pkt->data = droq->recv_buf_list[droq->read_idx].buffer; > + droq_pkt->len = pkt_len; > + > +
Re: [dpdk-dev] [PATCH v1 4/6] raw/octeontx2_ep: add enqueue operation
Hi Gavin, Please see the response inline. From: Gavin Hu (Arm Technology China) Sent: Saturday, December 14, 2019 9:54 PM To: Mahipal Challa ; dev@dpdk.org Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju Athreya ; Subrahmanyam Nilla ; Venkateshwarlu Nalla ; nd Subject: [EXT] RE: [dpdk-dev] [PATCH v1 4/6] raw/octeontx2_ep: add enqueue operation External Email -- Hi Mahipal, > -Original Message- > From: dev On Behalf Of Mahipal Challa > Sent: Friday, December 6, 2019 2:39 PM > To: dev@dpdk.org > Cc: jer...@marvell.com; pathr...@marvell.com; sni...@marvell.com; > venk...@marvell.com > Subject: [dpdk-dev] [PATCH v1 4/6] raw/octeontx2_ep: add enqueue > operation > > Add rawdev enqueue operation for SDP VF devices. > > Signed-off-by: Mahipal Challa > --- > doc/guides/rawdevs/octeontx2_ep.rst | 6 + > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 242 > ++ > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 39 + > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 20 +++ > drivers/raw/octeontx2_ep/otx2_ep_vf.c | 24 +++ > 6 files changed, 332 insertions(+) > > diff --git a/doc/guides/rawdevs/octeontx2_ep.rst > b/doc/guides/rawdevs/octeontx2_ep.rst > index 2507fcf..39a7c29 100644 > --- a/doc/guides/rawdevs/octeontx2_ep.rst > +++ b/doc/guides/rawdevs/octeontx2_ep.rst > @@ -68,3 +68,9 @@ The following code shows how the device is configured > > rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); > > +Performing Data Transfer > + > + > +To perform data transfer using SDP VF EP rawdev devices use standard > +``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` > APIs. > + > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > index 584b818..ebbacfb 100644 > --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > @@ -403,3 +403,245 @@ >return -ENOMEM; > } > > +static inline void > +sdp_iqreq_delete(struct sdp_device *sdpvf, > + struct sdp_instr_queue *iq, uint32_t idx) > +{ > + uint32_t reqtype; > + void *buf; > + > + buf = iq->req_list[idx].buf; > + reqtype = iq->req_list[idx].reqtype; > + > + switch (reqtype) { > + case SDP_REQTYPE_NORESP: > + rte_mempool_put(sdpvf->enqdeq_mpool, buf); > + otx2_sdp_dbg("IQ buffer freed at idx[%d]", idx); > + break; > + > + case SDP_REQTYPE_NORESP_GATHER: > + case SDP_REQTYPE_NONE: > + default: > + otx2_info("This iqreq mode is not supported:%d", reqtype); > + > + } > + > + /* Reset the request list at this index */ > + iq->req_list[idx].buf = NULL; > + iq->req_list[idx].reqtype = 0; > +} > + > +static inline void > +sdp_iqreq_add(struct sdp_instr_queue *iq, void *buf, > + uint32_t reqtype) > +{ > + iq->req_list[iq->host_write_index].buf = buf; > + iq->req_list[iq->host_write_index].reqtype = reqtype; > + > + otx2_sdp_dbg("IQ buffer added at idx[%d]", iq->host_write_index); > + > +} > + > +static void > +sdp_flush_iq(struct sdp_device *sdpvf, > + struct sdp_instr_queue *iq, > + uint32_t pending_thresh __rte_unused) > +{ > + uint32_t instr_processed = 0; > + > + rte_spinlock_lock(&iq->lock); > + > + iq->otx_read_index = sdpvf->fn_list.update_iq_read_idx(iq); > + while (iq->flush_index != iq->otx_read_index) { > + /* Free the IQ data buffer to the pool */ > + sdp_iqreq_delete(sdpvf, iq, iq->flush_index); > + iq->flush_index = > + sdp_incr_index(iq->flush_index, 1, iq->nb_desc); > + > + instr_processed++; > + } > + > + iq->stats.instr_processed = instr_processed; > + rte_atomic64_sub(&iq->instr_pending, instr_processed); > + > + rte_spinlock_unlock(&iq->lock); > +} > + > +static inline void > +sdp_ring_doorbell(struct sdp_device *sdpvf __rte_unused, > + struct sdp_instr_queue *iq) > +{ > + otx2_write64(iq->fill_cnt, iq->doorbell_reg); > + > + /* Make sure doorbell write goes through */ > + rte_wmb(); This is overkill, no need to wait for the completeness, is it ok to just ensure the doorbell ring is seen by the device before the new fill_cnt is seen by lcore? If
[dpdk-dev] [PATCH v2 0/6] OCTEON TX2 End Point Driver
This patchset adds support for OCTEON TX2 end point mode of operation. The driver implementation uses DPDK rawdevice sub-system. v2: * Updated memory barrior API's as per Gavin Hu suggestion. Mahipal Challa (6): raw/octeontx2_ep: add build infra and device probe raw/octeontx2_ep: add device configuration raw/octeontx2_ep: add device uninitialization raw/octeontx2_ep: add enqueue operation raw/octeontx2_ep: add dequeue operation raw/octeontx2_ep: add driver self test MAINTAINERS| 5 + config/common_base | 5 + doc/guides/rawdevs/index.rst | 1 + doc/guides/rawdevs/octeontx2_ep.rst| 89 +++ drivers/common/octeontx2/hw/otx2_sdp.h | 184 + drivers/common/octeontx2/otx2_common.c | 9 + drivers/common/octeontx2/otx2_common.h | 4 + .../octeontx2/rte_common_octeontx2_version.map | 6 + drivers/raw/Makefile | 1 + drivers/raw/meson.build| 1 + drivers/raw/octeontx2_ep/Makefile | 44 ++ drivers/raw/octeontx2_ep/meson.build | 9 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 844 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 52 ++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 361 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 499 drivers/raw/octeontx2_ep/otx2_ep_test.c| 164 drivers/raw/octeontx2_ep/otx2_ep_vf.c | 476 drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + .../rte_rawdev_octeontx2_ep_version.map| 4 + mk/rte.app.mk | 2 + 21 files changed, 2770 insertions(+) create mode 100644 doc/guides/rawdevs/octeontx2_ep.rst create mode 100644 drivers/common/octeontx2/hw/otx2_sdp.h create mode 100644 drivers/raw/octeontx2_ep/Makefile create mode 100644 drivers/raw/octeontx2_ep/meson.build create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.h create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_test.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.h create mode 100644 drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map -- 1.8.3.1
[dpdk-dev] [dpdk-dev PATCH v2 2/6] raw/octeontx2_ep: add device configuration
Register "dev_configure" API to configure/initialize the SDP VF PCIe devices. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst| 29 ++ drivers/common/octeontx2/hw/otx2_sdp.h | 184 + drivers/common/octeontx2/otx2_common.c | 9 + drivers/common/octeontx2/otx2_common.h | 4 + .../octeontx2/rte_common_octeontx2_version.map | 6 + drivers/raw/octeontx2_ep/Makefile | 3 + drivers/raw/octeontx2_ep/meson.build | 4 +- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 294 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 11 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 148 +++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 434 - drivers/raw/octeontx2_ep/otx2_ep_vf.c | 408 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + 13 files changed, 1542 insertions(+), 2 deletions(-) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 5f5ed01..2507fcf 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -39,3 +39,32 @@ entry `sriov_numvfs` for the corresponding PF driver. Once the required VFs are enabled, to be accessible from DPDK, VFs need to be bound to vfio-pci driver. + +Device Setup + + +The OCTEON TX2 SDP End Point VF devices will need to be bound to a +user-space IO driver for use. The script ``dpdk-devbind.py`` script +included with DPDK can be used to view the state of the devices and to bind +them to a suitable DPDK-supported kernel driver. When querying the status +of the devices, they will appear under the category of "Misc (rawdev) +devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be +used to see the state of those devices alone. + +Device Configuration + + +Configuring SDP EP rawdev device is done using the ``rte_rawdev_configure()`` +API, which takes the mempool as parameter. PMD uses this pool to send/receive +packets to/from the HW. + +The following code shows how the device is configured + +.. code-block:: c + + struct sdp_rawdev_info config = {0}; + struct rte_rawdev_info rdev_info = {.dev_private = &config}; + config.enqdeq_mpool = (void *)rte_mempool_create(...); + + rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); + diff --git a/drivers/common/octeontx2/hw/otx2_sdp.h b/drivers/common/octeontx2/hw/otx2_sdp.h new file mode 100644 index 000..7e03317 --- /dev/null +++ b/drivers/common/octeontx2/hw/otx2_sdp.h @@ -0,0 +1,184 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#ifndef __OTX2_SDP_HW_H_ +#define __OTX2_SDP_HW_H_ + +/* SDP VF IOQs */ +#define SDP_MIN_RINGS_PER_VF(1) +#define SDP_MAX_RINGS_PER_VF(8) + +/* SDP VF IQ configuration */ +#define SDP_VF_MAX_IQ_DESCRIPTORS (512) +#define SDP_VF_MIN_IQ_DESCRIPTORS (128) + +#define SDP_VF_DB_MIN (1) +#define SDP_VF_DB_TIMEOUT (1) +#define SDP_VF_INTR_THRESHOLD (0x) + +#define SDP_VF_64BYTE_INSTR (64) +#define SDP_VF_32BYTE_INSTR (32) + +/* SDP VF OQ configuration */ +#define SDP_VF_MAX_OQ_DESCRIPTORS (512) +#define SDP_VF_MIN_OQ_DESCRIPTORS (128) +#define SDP_VF_OQ_BUF_SIZE (2048) +#define SDP_VF_OQ_REFIL_THRESHOLD (16) + +#define SDP_VF_OQ_INFOPTR_MODE (1) +#define SDP_VF_OQ_BUFPTR_MODE (0) + +#define SDP_VF_OQ_INTR_PKT (1) +#define SDP_VF_OQ_INTR_TIME (10) +#define SDP_VF_CFG_IO_QUEUESSDP_MAX_RINGS_PER_VF + +/* Wait time in milliseconds for FLR */ +#define SDP_VF_PCI_FLR_WAIT (100) +#define SDP_VF_BUSY_LOOP_COUNT (1) + +#define SDP_VF_MAX_IO_QUEUESSDP_MAX_RINGS_PER_VF +#define SDP_VF_MIN_IO_QUEUESSDP_MIN_RINGS_PER_VF + +/* SDP VF IOQs per rawdev */ +#define SDP_VF_MAX_IOQS_PER_RAWDEV SDP_VF_MAX_IO_QUEUES +#define SDP_VF_DEFAULT_IOQS_PER_RAWDEV SDP_VF_MIN_IO_QUEUES + +/* SDP VF Register definitions */ +#define SDP_VF_RING_OFFSET(0x1ull << 17) + +/* SDP VF IQ Registers */ +#define SDP_VF_R_IN_CONTROL_START (0x1) +#define SDP_VF_R_IN_ENABLE_START (0x10010) +#define SDP_VF_R_IN_INSTR_BADDR_START (0x10020) +#define SDP_VF_R_IN_INSTR_RSIZE_START (0x10030) +#define SDP_VF_R_IN_INSTR_DBELL_START (0x10040) +#define SDP_VF_R_IN_CNTS_START(0x10050) +#define SDP_VF_R_IN_INT_LEVELS_START (0x10060) +#define SDP_VF_R_IN_PKT_CNT_START (0x10080) +#define SDP_VF_R_IN_BYTE_CNT_START(0x10090) + +#define SDP_VF_R_IN_CONTROL(ring) \ + (SDP_VF_R_IN_CONTROL_START + ((ring) * SDP_VF_RING_OFFSET)) + +#define SDP_VF_R_IN_ENABLE(ring) \ + (SDP_VF_R_IN_ENABLE_START + ((ring) * SDP_VF_RING_OFFSET)) + +#define SDP_VF_R_IN_INSTR_BADDR(ring) \ +
[dpdk-dev] [dpdk-dev PATCH v2 1/6] raw/octeontx2_ep: add build infra and device probe
Add the OCTEON TX2 SDP EP device probe along with the build infrastructure for Make and meson builds. Signed-off-by: Mahipal Challa --- MAINTAINERS| 5 + config/common_base | 5 + doc/guides/rawdevs/index.rst | 1 + doc/guides/rawdevs/octeontx2_ep.rst| 41 +++ drivers/raw/Makefile | 1 + drivers/raw/meson.build| 1 + drivers/raw/octeontx2_ep/Makefile | 40 +++ drivers/raw/octeontx2_ep/meson.build | 6 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 132 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 21 .../rte_rawdev_octeontx2_ep_version.map| 4 + mk/rte.app.mk | 2 + 12 files changed, 259 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 4395d8d..24f1240 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1173,6 +1173,11 @@ M: Vamsi Attunuru F: drivers/raw/octeontx2_dma/ F: doc/guides/rawdevs/octeontx2_dma.rst +Marvell OCTEON TX2 EP +M: Mahipal Challa +F: drivers/raw/octeontx2_ep/ +F: doc/guides/rawdevs/octeontx2_ep.rst + NTB M: Xiaoyun Li M: Jingjing Wu diff --git a/config/common_base b/config/common_base index 7dec7ed..8e7dad2 100644 --- a/config/common_base +++ b/config/common_base @@ -796,6 +796,11 @@ CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV=y # +# Compile PMD for octeontx2 EP raw device +# +CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y + +# # Compile PMD for NTB raw device # CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y diff --git a/doc/guides/rawdevs/index.rst b/doc/guides/rawdevs/index.rst index 22bc013..f64ec44 100644 --- a/doc/guides/rawdevs/index.rst +++ b/doc/guides/rawdevs/index.rst @@ -17,3 +17,4 @@ application through rawdev API. ioat ntb octeontx2_dma +octeontx2_ep diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst new file mode 100644 index 000..5f5ed01 --- /dev/null +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -0,0 +1,41 @@ +.. SPDX-License-Identifier: BSD-3-Clause +Copyright(c) 2019 Marvell International Ltd. + +Marvell OCTEON TX2 End Point Rawdev Driver +== + +OCTEON TX2 has an internal SDP unit which provides End Point mode of operation +by exposing its IOQs to Host, IOQs are used for packet I/O between Host and +OCTEON TX2. Each OCTEON TX2 SDP PF supports a max of 128 VFs and Each VF is +associated with a set of IOQ pairs. + +Features + + +This OCTEON TX2 End Point mode PMD supports + +#. Packet Input - Host to OCTEON TX2 with direct data instruction mode. + +#. Packet Output - OCTEON TX2 to Host with info pointer mode. + +Config File Options +~~~ + +The following options can be modified in the ``config`` file. + +- ``CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV`` (default ``y``) + + Toggle compilation of the ``lrte_pmd_octeontx2_ep`` driver. + +Initialization +-- + +The number of SDP VFs enabled, can be controlled by setting sysfs +entry `sriov_numvfs` for the corresponding PF driver. + +.. code-block:: console + + echo > /sys/bus/pci/drivers/octeontx2-ep/\:04\:00.0/sriov_numvfs + +Once the required VFs are enabled, to be accessible from DPDK, VFs need to be +bound to vfio-pci driver. diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index 0b6d13d..80b043e 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -13,5 +13,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat DIRS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) += ntb DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV) += octeontx2_dma +DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += octeontx2_ep include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/raw/meson.build b/drivers/raw/meson.build index d7037cd..bb57977 100644 --- a/drivers/raw/meson.build +++ b/drivers/raw/meson.build @@ -4,6 +4,7 @@ drivers = ['dpaa2_cmdif', 'dpaa2_qdma', 'ifpga', 'ioat', 'ntb', 'octeontx2_dma', + 'octeontx2_ep', 'skeleton'] std_deps = ['rawdev'] config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV' diff --git a/drivers/raw/octeontx2_ep/Makefile b/drivers/raw/octeontx2_ep/Makefile new file mode 100644 index 000..8cec6bd --- /dev/null +++ b/drivers/raw/octeontx2_ep/Makefile @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2019 Marvell International Ltd. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# Library name +LIB = librte_rawdev_octeontx2_ep.a + +# Build flags +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2/ +CFLAGS += -I$(RTE_SDK)/drivers/raw/octeontx2_ep/ +
[dpdk-dev] [dpdk-dev PATCH v2 3/6] raw/octeontx2_ep: add device uninitialization
Add rawdev close/uninitialize operation for SDP VF devices. Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 111 ++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 78 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 8 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.c | 44 4 files changed, 241 insertions(+) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 8857004..584b818 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -21,6 +21,59 @@ #include "otx2_common.h" #include "otx2_ep_enqdeq.h" +static void +sdp_dmazone_free(const struct rte_memzone *mz) +{ + const struct rte_memzone *mz_tmp; + int ret = 0; + + if (mz == NULL) { + otx2_err("Memzone %s : NULL", mz->name); + return; + } + + mz_tmp = rte_memzone_lookup(mz->name); + if (mz_tmp == NULL) { + otx2_err("Memzone %s Not Found", mz->name); + return; + } + + ret = rte_memzone_free(mz); + if (ret) + otx2_err("Memzone free failed : ret = %d", ret); + +} + +/* Free IQ resources */ +int +sdp_delete_iqs(struct sdp_device *sdpvf, uint32_t iq_no) +{ + struct sdp_instr_queue *iq; + + iq = sdpvf->instr_queue[iq_no]; + if (iq == NULL) { + otx2_err("Invalid IQ[%d]\n", iq_no); + return -ENOMEM; + } + + rte_free(iq->req_list); + iq->req_list = NULL; + + if (iq->iq_mz) { + sdp_dmazone_free(iq->iq_mz); + iq->iq_mz = NULL; + } + + rte_free(sdpvf->instr_queue[iq_no]); + sdpvf->instr_queue[iq_no] = NULL; + + sdpvf->num_iqs--; + + otx2_info("IQ[%d] is deleted", iq_no); + + return 0; +} + /* IQ initialization */ static int sdp_init_instr_queue(struct sdp_device *sdpvf, int iq_no) @@ -126,6 +179,7 @@ return 0; delete_IQ: + sdp_delete_iqs(sdpvf, iq_no); return -ENOMEM; } @@ -139,6 +193,61 @@ rte_atomic64_set(&droq->pkts_pending, 0); } +static void +sdp_droq_destroy_ring_buffers(struct sdp_device *sdpvf, + struct sdp_droq *droq) +{ + uint32_t idx; + + for (idx = 0; idx < droq->nb_desc; idx++) { + if (droq->recv_buf_list[idx].buffer) { + rte_mempool_put(sdpvf->enqdeq_mpool, + droq->recv_buf_list[idx].buffer); + + droq->recv_buf_list[idx].buffer = NULL; + } + } + + sdp_droq_reset_indices(droq); +} + +/* Free OQs resources */ +int +sdp_delete_oqs(struct sdp_device *sdpvf, uint32_t oq_no) +{ + struct sdp_droq *droq; + + droq = sdpvf->droq[oq_no]; + if (droq == NULL) { + otx2_err("Invalid droq[%d]", oq_no); + return -ENOMEM; + } + + sdp_droq_destroy_ring_buffers(sdpvf, droq); + rte_free(droq->recv_buf_list); + droq->recv_buf_list = NULL; + + if (droq->info_mz) { + sdp_dmazone_free(droq->info_mz); + droq->info_mz = NULL; + } + + if (droq->desc_ring_mz) { + sdp_dmazone_free(droq->desc_ring_mz); + droq->desc_ring_mz = NULL; + } + + memset(droq, 0, SDP_DROQ_SIZE); + + rte_free(sdpvf->droq[oq_no]); + sdpvf->droq[oq_no] = NULL; + + sdpvf->num_oqs--; + + otx2_info("OQ[%d] is deleted", oq_no); + return 0; +} + static int sdp_droq_setup_ring_buffers(struct sdp_device *sdpvf, struct sdp_droq *droq) @@ -290,5 +399,7 @@ return 0; delete_OQ: + sdp_delete_oqs(sdpvf, oq_no); return -ENOMEM; } + diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c index 0c56609..3db5a74 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c @@ -63,6 +63,45 @@ } static int +sdp_vfdev_exit(struct rte_rawdev *rawdev) +{ + struct sdp_device *sdpvf; + uint32_t rawdev_queues, q; + + otx2_info("%s:", __func__); + + sdpvf = (struct sdp_device *)rawdev->dev_private; + + sdpvf->fn_list.disable_io_queues(sdpvf); + + rawdev_queues = sdpvf->num_oqs; + for (q = 0; q < rawdev_queues; q++) { + if (sdp_delete_oqs(sdpvf, q)) { + otx2_err("Failed to delete OQ:%d", q); + return -ENOMEM; + } + } + otx2_info("Num OQs:%d freed", sdpvf->num_oqs); + + /* Free the oqbuf_pool */ + rte_mempool_free(sdpv
[dpdk-dev] [dpdk-dev PATCH v2 4/6] raw/octeontx2_ep: add enqueue operation
Add rawdev enqueue operation for SDP VF devices. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst | 6 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 242 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 39 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 20 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.c | 24 +++ 6 files changed, 332 insertions(+) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 2507fcf..39a7c29 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -68,3 +68,9 @@ The following code shows how the device is configured rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); +Performing Data Transfer + + +To perform data transfer using SDP VF EP rawdev devices use standard +``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` APIs. + diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 584b818..6910f08 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -403,3 +403,245 @@ return -ENOMEM; } +static inline void +sdp_iqreq_delete(struct sdp_device *sdpvf, + struct sdp_instr_queue *iq, uint32_t idx) +{ + uint32_t reqtype; + void *buf; + + buf = iq->req_list[idx].buf; + reqtype = iq->req_list[idx].reqtype; + + switch (reqtype) { + case SDP_REQTYPE_NORESP: + rte_mempool_put(sdpvf->enqdeq_mpool, buf); + otx2_sdp_dbg("IQ buffer freed at idx[%d]", idx); + break; + + case SDP_REQTYPE_NORESP_GATHER: + case SDP_REQTYPE_NONE: + default: + otx2_info("This iqreq mode is not supported:%d", reqtype); + + } + + /* Reset the request list at this index */ + iq->req_list[idx].buf = NULL; + iq->req_list[idx].reqtype = 0; +} + +static inline void +sdp_iqreq_add(struct sdp_instr_queue *iq, void *buf, + uint32_t reqtype) +{ + iq->req_list[iq->host_write_index].buf = buf; + iq->req_list[iq->host_write_index].reqtype = reqtype; + + otx2_sdp_dbg("IQ buffer added at idx[%d]", iq->host_write_index); + +} + +static void +sdp_flush_iq(struct sdp_device *sdpvf, + struct sdp_instr_queue *iq, + uint32_t pending_thresh __rte_unused) +{ + uint32_t instr_processed = 0; + + rte_spinlock_lock(&iq->lock); + + iq->otx_read_index = sdpvf->fn_list.update_iq_read_idx(iq); + while (iq->flush_index != iq->otx_read_index) { + /* Free the IQ data buffer to the pool */ + sdp_iqreq_delete(sdpvf, iq, iq->flush_index); + iq->flush_index = + sdp_incr_index(iq->flush_index, 1, iq->nb_desc); + + instr_processed++; + } + + iq->stats.instr_processed = instr_processed; + rte_atomic64_sub(&iq->instr_pending, instr_processed); + + rte_spinlock_unlock(&iq->lock); +} + +static inline void +sdp_ring_doorbell(struct sdp_device *sdpvf __rte_unused, + struct sdp_instr_queue *iq) +{ + otx2_write64(iq->fill_cnt, iq->doorbell_reg); + + /* Make sure doorbell write goes through */ + rte_cio_wmb(); + iq->fill_cnt = 0; + +} + +static inline int +post_iqcmd(struct sdp_instr_queue *iq, uint8_t *iqcmd) +{ + uint8_t *iqptr, cmdsize; + + /* This ensures that the read index does not wrap around to +* the same position if queue gets full before OCTEON TX2 could +* fetch any instr. +*/ + if (rte_atomic64_read(&iq->instr_pending) >= + (int32_t)(iq->nb_desc - 1)) { + otx2_err("IQ is full, pending:%ld", +(long)rte_atomic64_read(&iq->instr_pending)); + + return SDP_IQ_SEND_FAILED; + } + + /* Copy cmd into iq */ + cmdsize = ((iq->iqcmd_64B) ? 64 : 32); + iqptr = iq->base_addr + (cmdsize * iq->host_write_index); + + rte_memcpy(iqptr, iqcmd, cmdsize); + + otx2_sdp_dbg("IQ cmd posted @ index:%d", iq->host_write_index); + + /* Increment the host write index */ + iq->host_write_index = + sdp_incr_index(iq->host_write_index, 1, iq->nb_desc); + + iq->fill_cnt++; + + /* Flush the command into memory. We need to be sure the data +* is in memory before indicating that the instruction is +* pending. +*/ + rte_io_wmb(); + rte_atomic64_inc(&iq->instr_pending); + + /* SDP_IQ_SEND_SUCCESS */ + return 0; +} + + +stat
[dpdk-dev] [dpdk-dev PATCH v2 5/6] raw/octeontx2_ep: add dequeue operation
Add rawdev dequeue operation for SDP VF devices. Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 197 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 2 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 18 ++- 4 files changed, 217 insertions(+), 1 deletion(-) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 6910f08..dd270b5 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -260,6 +260,7 @@ rte_mempool_get(sdpvf->enqdeq_mpool, &buf); if (buf == NULL) { otx2_err("OQ buffer alloc failed"); + droq->stats.rx_alloc_failure++; /* sdp_droq_destroy_ring_buffers(droq);*/ return -ENOMEM; } @@ -645,3 +646,199 @@ return SDP_IQ_SEND_FAILED; } +static uint32_t +sdp_droq_refill(struct sdp_device *sdpvf, struct sdp_droq *droq) +{ + struct sdp_droq_desc *desc_ring; + uint32_t desc_refilled = 0; + void *buf = NULL; + + desc_ring = droq->desc_ring; + + while (droq->refill_count && (desc_refilled < droq->nb_desc)) { + /* If a valid buffer exists (happens if there is no dispatch), +* reuse the buffer, else allocate. +*/ + if (droq->recv_buf_list[droq->refill_idx].buffer != NULL) + break; + + rte_mempool_get(sdpvf->enqdeq_mpool, &buf); + /* If a buffer could not be allocated, no point in +* continuing +*/ + if (buf == NULL) { + droq->stats.rx_alloc_failure++; + break; + } + + droq->recv_buf_list[droq->refill_idx].buffer = buf; + desc_ring[droq->refill_idx].buffer_ptr = rte_mem_virt2iova(buf); + + /* Reset any previous values in the length field. */ + droq->info_list[droq->refill_idx].length = 0; + + droq->refill_idx = sdp_incr_index(droq->refill_idx, 1, + droq->nb_desc); + + desc_refilled++; + droq->refill_count--; + + } + + return desc_refilled; +} + +static int +sdp_droq_read_packet(struct sdp_device *sdpvf __rte_unused, +struct sdp_droq *droq, +struct sdp_droq_pkt *droq_pkt) +{ + struct sdp_droq_info *info; + uint32_t total_len = 0; + uint32_t pkt_len = 0; + + info = &droq->info_list[droq->read_idx]; + sdp_swap_8B_data((uint64_t *)&info->length, 1); + if (!info->length) { + otx2_err("OQ info_list->length[%ld]", (long)info->length); + goto oq_read_fail; + } + + /* Deduce the actual data size */ + info->length -= SDP_RH_SIZE; + total_len += (uint32_t)info->length; + + otx2_sdp_dbg("OQ: pkt_len[%ld], buffer_size %d", + (long)info->length, droq->buffer_size); + if (info->length > droq->buffer_size) { + otx2_err("This mode is not supported: pkt_len > buffer_size"); + goto oq_read_fail; + } + + if (info->length <= droq->buffer_size) { + pkt_len = (uint32_t)info->length; + droq_pkt->data = droq->recv_buf_list[droq->read_idx].buffer; + droq_pkt->len = pkt_len; + + droq->recv_buf_list[droq->read_idx].buffer = NULL; + droq->read_idx = sdp_incr_index(droq->read_idx, 1,/* count */ + droq->nb_desc /* max rd idx */); + droq->refill_count++; + + } + + info->length = 0; + + return SDP_OQ_RECV_SUCCESS; + +oq_read_fail: + return SDP_OQ_RECV_FAILED; +} + +static inline uint32_t +sdp_check_droq_pkts(struct sdp_droq *droq, uint32_t burst_size) +{ + uint32_t min_pkts = 0; + uint32_t new_pkts; + uint32_t pkt_count; + + /* Latest available OQ packets */ + pkt_count = rte_read32(droq->pkts_sent_reg); + + /* Newly arrived packets */ + new_pkts = pkt_count - droq->last_pkt_count; + otx2_sdp_dbg("Recvd [%d] new OQ pkts", new_pkts); + + min_pkts = (new_pkts > burst_size) ? burst_size : new_pkts; + if (min_pkts) { + rte_atomic64_add(&droq->pkts_pending, min_pkts); + /* Back up the aggregated packet count so far */ + droq->last_pkt_count += min_pkts; + } + + return min_pkts; +} + +/* Check for response
[dpdk-dev] [dpdk-dev PATCH v2 6/6] raw/octeontx2_ep: add driver self test
Add rawdev's selftest feature in SDP VF driver, which verifies the EP mode functionality test. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst | 13 +++ drivers/raw/octeontx2_ep/Makefile | 1 + drivers/raw/octeontx2_ep/meson.build | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 2 + drivers/raw/octeontx2_ep/otx2_ep_test.c | 164 ++ 6 files changed, 182 insertions(+) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 39a7c29..bbcf530 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -74,3 +74,16 @@ Performing Data Transfer To perform data transfer using SDP VF EP rawdev devices use standard ``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` APIs. +Self test +- + +On EAL initialization, SDP VF devices will be probed and populated into the +raw devices. The rawdev ID of the device can be obtained using + +* Invoke ``rte_rawdev_get_dev_id("SDPEP:x")`` from the test application + where x is the VF device's bus id specified in "bus:device.func"(BDF) + format. Use this index for further rawdev function calls. + +* The driver's selftest rawdev API can be used to verify the SDP EP mode + functional tests which can send/receive the raw data packets to/from the + EP device. diff --git a/drivers/raw/octeontx2_ep/Makefile b/drivers/raw/octeontx2_ep/Makefile index 02853fb..44fdf89 100644 --- a/drivers/raw/octeontx2_ep/Makefile +++ b/drivers/raw/octeontx2_ep/Makefile @@ -37,6 +37,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_rawdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_enqdeq.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_test.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_vf.c diff --git a/drivers/raw/octeontx2_ep/meson.build b/drivers/raw/octeontx2_ep/meson.build index 99e6c6d..0e6338f 100644 --- a/drivers/raw/octeontx2_ep/meson.build +++ b/drivers/raw/octeontx2_ep/meson.build @@ -5,4 +5,5 @@ deps += ['bus_pci', 'common_octeontx2', 'rawdev'] sources = files('otx2_ep_rawdev.c', 'otx2_ep_enqdeq.c', + 'otx2_ep_test.c', 'otx2_ep_vf.c') diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c index 7158b97..0778603 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c @@ -253,6 +253,7 @@ .dev_close = sdp_rawdev_close, .enqueue_bufs = sdp_rawdev_enqueue, .dequeue_bufs = sdp_rawdev_dequeue, + .dev_selftest = sdp_rawdev_selftest, }; static int diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h index a77cbab..dab2fb7 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h @@ -494,4 +494,6 @@ int sdp_rawdev_enqueue(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, int sdp_rawdev_dequeue(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, unsigned int count, rte_rawdev_obj_t context); +int sdp_rawdev_selftest(uint16_t dev_id); + #endif /* _OTX2_EP_RAWDEV_H_ */ diff --git a/drivers/raw/octeontx2_ep/otx2_ep_test.c b/drivers/raw/octeontx2_ep/otx2_ep_test.c new file mode 100644 index 000..96fedb5 --- /dev/null +++ b/drivers/raw/octeontx2_ep/otx2_ep_test.c @@ -0,0 +1,164 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "otx2_common.h" +#include "otx2_ep_rawdev.h" + +#define SDP_IOQ_NUM_BUFS (4 * 1024) +#define SDP_IOQ_BUF_SIZE (2 * 1024) + +#define SDP_TEST_PKT_FSZ (0) +#define SDP_TEST_PKT_SIZE (1024) + +static int +sdp_validate_data(struct sdp_droq_pkt *oq_pkt, uint8_t *iq_pkt, + uint32_t pkt_len) +{ + if (!oq_pkt) + return -EINVAL; + + if (pkt_len != oq_pkt->len) { + otx2_err("Invalid packet length"); + return -EINVAL; + } + + if (memcmp(oq_pkt->data, iq_pkt, pkt_len) != 0) { + otx2_err("Data validation failed"); + return -EINVAL; + } + otx2_sdp_dbg("Data validation successful"); + + return 0; +} + +static void +sdp_ioq_buffer_fill(uint8_t *addr, uint32_t len) +{ + uint32_t idx; + + memset(addr, 0, len); + + for (idx = 0; idx < len; idx++) + addr[idx] = idx; +} + +static struct rte_mempool* +sdp_ioq_mempool_
Re: [dpdk-dev] [PATCH v2 0/6] OCTEON TX2 End Point Driver
Hi Gavin, Please see inline. From: Gavin Hu Sent: Thursday, January 2, 2020 3:46 PM To: Mahipal Challa ; dev@dpdk.org Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju Athreya ; Subrahmanyam Nilla ; Venkateshwarlu Nalla ; nd Subject: [EXT] RE: [dpdk-dev] [PATCH v2 0/6] OCTEON TX2 End Point Driver External Email -- Hi Mahipal, Could you make old versions 'Superseded' when you have new ones? /Gavin [Mahipal]: Marked older v1 patches state as "Superseded".
Re: [dpdk-dev] [dpdk-dev PATCH v2 6/6] raw/octeontx2_ep: add driver self test
Hi Gavin, Please see the response inline. From: Gavin Hu Sent: Thursday, January 2, 2020 3:48 PM To: Mahipal Challa ; dev@dpdk.org Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju Athreya ; Subrahmanyam Nilla ; Venkateshwarlu Nalla ; nd Subject: [EXT] RE: [dpdk-dev] [dpdk-dev PATCH v2 6/6] raw/octeontx2_ep: add driver self test External Email -- Hi Mahipal, > -Original Message- > From: dev On Behalf Of Mahipal Challa > Sent: Friday, December 27, 2019 8:40 PM > To: dev@dpdk.org > Cc: jer...@marvell.com; pathr...@marvell.com; sni...@marvell.com; > venk...@marvell.com > Subject: [dpdk-dev] [dpdk-dev PATCH v2 6/6] raw/octeontx2_ep: add driver > self test > > Add rawdev's selftest feature in SDP VF driver, which > verifies the EP mode functionality test. > > Signed-off-by: Mahipal Challa > --- > doc/guides/rawdevs/octeontx2_ep.rst | 13 +++ > drivers/raw/octeontx2_ep/Makefile | 1 + > drivers/raw/octeontx2_ep/meson.build | 1 + > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 2 + > drivers/raw/octeontx2_ep/otx2_ep_test.c | 164 > ++ > 6 files changed, 182 insertions(+) > > diff --git a/doc/guides/rawdevs/octeontx2_ep.rst > b/doc/guides/rawdevs/octeontx2_ep.rst > index 39a7c29..bbcf530 100644 > --- a/doc/guides/rawdevs/octeontx2_ep.rst > +++ b/doc/guides/rawdevs/octeontx2_ep.rst > @@ -74,3 +74,16 @@ Performing Data Transfer > To perform data transfer using SDP VF EP rawdev devices use standard > ``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` > APIs. > > +Self test > +- > + > +On EAL initialization, SDP VF devices will be probed and populated into the > +raw devices. The rawdev ID of the device can be obtained using > + > +* Invoke ``rte_rawdev_get_dev_id("SDPEP:x")`` from the test application > + where x is the VF device's bus id specified in "bus:device.func"(BDF) > + format. Use this index for further rawdev function calls. > + > +* The driver's selftest rawdev API can be used to verify the SDP EP mode > + functional tests which can send/receive the raw data packets to/from the > + EP device. > diff --git a/drivers/raw/octeontx2_ep/Makefile > b/drivers/raw/octeontx2_ep/Makefile > index 02853fb..44fdf89 100644 > --- a/drivers/raw/octeontx2_ep/Makefile > +++ b/drivers/raw/octeontx2_ep/Makefile > @@ -37,6 +37,7 @@ LIBABIVER := 1 > # > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += > otx2_ep_rawdev.c > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += > otx2_ep_enqdeq.c > +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += > otx2_ep_test.c > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += > otx2_ep_vf.c > > > diff --git a/drivers/raw/octeontx2_ep/meson.build > b/drivers/raw/octeontx2_ep/meson.build > index 99e6c6d..0e6338f 100644 > --- a/drivers/raw/octeontx2_ep/meson.build > +++ b/drivers/raw/octeontx2_ep/meson.build > @@ -5,4 +5,5 @@ > deps += ['bus_pci', 'common_octeontx2', 'rawdev'] > sources = files('otx2_ep_rawdev.c', >'otx2_ep_enqdeq.c', > + 'otx2_ep_test.c', >'otx2_ep_vf.c') > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > index 7158b97..0778603 100644 > --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > @@ -253,6 +253,7 @@ >.dev_close = sdp_rawdev_close, >.enqueue_bufs = sdp_rawdev_enqueue, >.dequeue_bufs = sdp_rawdev_dequeue, > + .dev_selftest = sdp_rawdev_selftest, > }; > > static int > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > index a77cbab..dab2fb7 100644 > --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > @@ -494,4 +494,6 @@ int sdp_rawdev_enqueue(struct rte_rawdev *dev, > struct rte_rawdev_buf **buffers, > int sdp_rawdev_dequeue(struct rte_rawdev *dev, struct rte_rawdev_buf > **buffers, > unsigned int count, rte_rawdev_obj_t context); > > +int sdp_rawdev_selftest(uint16_t dev_id); > + > #endif /* _OTX2_EP_RAWDEV_H_ */ > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_test.c > b/drivers/raw/octeontx2_ep/otx2_ep_test.c > new file mode 100644 > index 000..96fedb5 > --- /dev/null > +++ b/drivers/raw/octeontx2_ep/otx2_ep_test.c > @@ -0,0 +1,164 @@ > +/* SPD
Re: [dpdk-dev] [dpdk-dev PATCH v2 2/6] raw/octeontx2_ep: add device configuration
Hi Gavin, Please see response inline. > -Original Message- > From: Gavin Hu > Sent: Thursday, January 2, 2020 3:48 PM > To: Mahipal Challa ; dev@dpdk.org > Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju > Athreya ; Subrahmanyam Nilla > ; Venkateshwarlu Nalla ; nd > > Subject: [EXT] RE: [dpdk-dev] [dpdk-dev PATCH v2 2/6] raw/octeontx2_ep: > add device configuration > > External Email > > -- > Hi Mahipal, > > 3 comments inline. > > > -----Original Message- > > From: dev On Behalf Of Mahipal Challa > > Sent: Friday, December 27, 2019 8:40 PM > > To: dev@dpdk.org > > Cc: jer...@marvell.com; pathr...@marvell.com; sni...@marvell.com; > > venk...@marvell.com > > Subject: [dpdk-dev] [dpdk-dev PATCH v2 2/6] raw/octeontx2_ep: add > device > > configuration > > > > Register "dev_configure" API to configure/initialize the SDP > > VF PCIe devices. > > > > Signed-off-by: Mahipal Challa > > --- > > doc/guides/rawdevs/octeontx2_ep.rst| 29 ++ > > drivers/common/octeontx2/hw/otx2_sdp.h | 184 + > > drivers/common/octeontx2/otx2_common.c | 9 + > > drivers/common/octeontx2/otx2_common.h | 4 + > > .../octeontx2/rte_common_octeontx2_version.map | 6 + > > drivers/raw/octeontx2_ep/Makefile | 3 + > > drivers/raw/octeontx2_ep/meson.build | 4 +- > > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 294 ++ > > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 11 + > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 148 +++ > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 434 > > - > > drivers/raw/octeontx2_ep/otx2_ep_vf.c | 408 > +++ > > drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + > > 13 files changed, 1542 insertions(+), 2 deletions(-) > > > > diff --git a/doc/guides/rawdevs/octeontx2_ep.rst > > b/doc/guides/rawdevs/octeontx2_ep.rst > > index 5f5ed01..2507fcf 100644 > > --- a/doc/guides/rawdevs/octeontx2_ep.rst > > +++ b/doc/guides/rawdevs/octeontx2_ep.rst > > @@ -39,3 +39,32 @@ entry `sriov_numvfs` for the corresponding PF > driver. > > > > Once the required VFs are enabled, to be accessible from DPDK, VFs need > to > > be > > bound to vfio-pci driver. > > + > > +Device Setup > > + > > + > > +The OCTEON TX2 SDP End Point VF devices will need to be bound to a > > +user-space IO driver for use. The script ``dpdk-devbind.py`` script > > +included with DPDK can be used to view the state of the devices and to > bind > > +them to a suitable DPDK-supported kernel driver. When querying the > status > > +of the devices, they will appear under the category of "Misc (rawdev) > > +devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be > > +used to see the state of those devices alone. > > + > > +Device Configuration > > + > > + > > +Configuring SDP EP rawdev device is done using the > > ``rte_rawdev_configure()`` > > +API, which takes the mempool as parameter. PMD uses this pool to > > send/receive > > +packets to/from the HW. > > + > > +The following code shows how the device is configured > > + > > +.. code-block:: c > > + > > + struct sdp_rawdev_info config = {0}; > > + struct rte_rawdev_info rdev_info = {.dev_private = &config}; > > + config.enqdeq_mpool = (void *)rte_mempool_create(...); > > + > > + rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); > > + > > diff --git a/drivers/common/octeontx2/hw/otx2_sdp.h > > b/drivers/common/octeontx2/hw/otx2_sdp.h > > new file mode 100644 > > index 000..7e03317 > > --- /dev/null > > +++ b/drivers/common/octeontx2/hw/otx2_sdp.h > > @@ -0,0 +1,184 @@ > > +/* SPDX-License-Identifier: BSD-3-Clause > > + * Copyright(C) 2019 Marvell International Ltd. > > + */ > > + > > +#ifndef __OTX2_SDP_HW_H_ > > +#define __OTX2_SDP_HW_H_ > > + > > +/* SDP VF IOQs */ > > +#define SDP_MIN_RINGS_PER_VF(1) > > +#define SDP_MAX_RINGS_PER_VF(8) > > + > > +/* SDP VF IQ configuration */ > > +#define SDP_VF_MAX_IQ_DESCRIPTORS (512) > > +#define SDP_VF_MIN_IQ_DESCRIPTORS (128) > > + > > +#define SDP_VF_DB_MIN (1) > > +#define SDP_VF_DB_TIMEOUT
Re: [dpdk-dev] [dpdk-dev PATCH v2 4/6] raw/octeontx2_ep: add enqueue operation
Hi Gavin, Please see response inline. > -Original Message- > From: Gavin Hu > Sent: Thursday, January 2, 2020 4:13 PM > To: Mahipal Challa ; dev@dpdk.org > Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju > Athreya ; Subrahmanyam Nilla > ; Venkateshwarlu Nalla ; nd > > Subject: [EXT] RE: [dpdk-dev] [dpdk-dev PATCH v2 4/6] raw/octeontx2_ep: > add enqueue operation > > External Email > > -- > Hi Mahipal, > > > -Original Message- > > From: dev On Behalf Of Mahipal Challa > > Sent: Friday, December 27, 2019 8:40 PM > > To: dev@dpdk.org > > Cc: jer...@marvell.com; pathr...@marvell.com; sni...@marvell.com; > > venk...@marvell.com > > Subject: [dpdk-dev] [dpdk-dev PATCH v2 4/6] raw/octeontx2_ep: add > > enqueue operation > > > > Add rawdev enqueue operation for SDP VF devices. > > > > Signed-off-by: Mahipal Challa > > --- > > doc/guides/rawdevs/octeontx2_ep.rst | 6 + > > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 242 > > ++ > > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 39 + > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 20 +++ > > drivers/raw/octeontx2_ep/otx2_ep_vf.c | 24 +++ > > 6 files changed, 332 insertions(+) > > > > diff --git a/doc/guides/rawdevs/octeontx2_ep.rst > > b/doc/guides/rawdevs/octeontx2_ep.rst > > index 2507fcf..39a7c29 100644 > > --- a/doc/guides/rawdevs/octeontx2_ep.rst > > +++ b/doc/guides/rawdevs/octeontx2_ep.rst > > @@ -68,3 +68,9 @@ The following code shows how the device is > > configured > > > > rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); > > > > +Performing Data Transfer > > + > > + > > +To perform data transfer using SDP VF EP rawdev devices use standard > > +``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` > > APIs. > > + > > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > > b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > > index 584b818..6910f08 100644 > > --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > > +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > > @@ -403,3 +403,245 @@ > > return -ENOMEM; > > } > > > > +static inline void > > +sdp_iqreq_delete(struct sdp_device *sdpvf, > > + struct sdp_instr_queue *iq, uint32_t idx) { > > + uint32_t reqtype; > > + void *buf; > > + > > + buf = iq->req_list[idx].buf; > > + reqtype = iq->req_list[idx].reqtype; > > + > > + switch (reqtype) { > > + case SDP_REQTYPE_NORESP: > > + rte_mempool_put(sdpvf->enqdeq_mpool, buf); > > + otx2_sdp_dbg("IQ buffer freed at idx[%d]", idx); > > + break; > > + > > + case SDP_REQTYPE_NORESP_GATHER: > > + case SDP_REQTYPE_NONE: > > + default: > > + otx2_info("This iqreq mode is not supported:%d", reqtype); > > + > > + } > > + > > + /* Reset the request list at this index */ > > + iq->req_list[idx].buf = NULL; > > + iq->req_list[idx].reqtype = 0; > > +} > > + > > +static inline void > > +sdp_iqreq_add(struct sdp_instr_queue *iq, void *buf, > > + uint32_t reqtype) > > +{ > > + iq->req_list[iq->host_write_index].buf = buf; > > + iq->req_list[iq->host_write_index].reqtype = reqtype; > > + > > + otx2_sdp_dbg("IQ buffer added at idx[%d]", iq->host_write_index); > > + > > +} > > + > > +static void > > +sdp_flush_iq(struct sdp_device *sdpvf, > > + struct sdp_instr_queue *iq, > > + uint32_t pending_thresh __rte_unused) { > > + uint32_t instr_processed = 0; > > + > > + rte_spinlock_lock(&iq->lock); > > + > > + iq->otx_read_index = sdpvf->fn_list.update_iq_read_idx(iq); > > + while (iq->flush_index != iq->otx_read_index) { > > + /* Free the IQ data buffer to the pool */ > > + sdp_iqreq_delete(sdpvf, iq, iq->flush_index); > > + iq->flush_index = > > + sdp_incr_index(iq->flush_index, 1, iq->nb_desc); > > + > > + instr_processed++; > > + } > > + > > + iq->stats.instr_processed = instr_processed; > > + rte_atomic64_sub(&iq->instr_pending, instr_processed); > > + > > +
[dpdk-dev] [PATCH v3 1/6] raw/octeontx2_ep: add build infra and device probe
Add the OCTEON TX2 SDP EP device probe along with the build infrastructure for Make and meson builds. Signed-off-by: Mahipal Challa --- MAINTAINERS| 5 + config/common_base | 5 + doc/guides/rawdevs/index.rst | 1 + doc/guides/rawdevs/octeontx2_ep.rst| 41 +++ drivers/raw/Makefile | 1 + drivers/raw/meson.build| 1 + drivers/raw/octeontx2_ep/Makefile | 40 +++ drivers/raw/octeontx2_ep/meson.build | 6 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 132 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 21 .../rte_rawdev_octeontx2_ep_version.map| 4 + mk/rte.app.mk | 2 + 12 files changed, 259 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 4395d8d..24f1240 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1173,6 +1173,11 @@ M: Vamsi Attunuru F: drivers/raw/octeontx2_dma/ F: doc/guides/rawdevs/octeontx2_dma.rst +Marvell OCTEON TX2 EP +M: Mahipal Challa +F: drivers/raw/octeontx2_ep/ +F: doc/guides/rawdevs/octeontx2_ep.rst + NTB M: Xiaoyun Li M: Jingjing Wu diff --git a/config/common_base b/config/common_base index 7dec7ed..8e7dad2 100644 --- a/config/common_base +++ b/config/common_base @@ -796,6 +796,11 @@ CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV=y # +# Compile PMD for octeontx2 EP raw device +# +CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y + +# # Compile PMD for NTB raw device # CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y diff --git a/doc/guides/rawdevs/index.rst b/doc/guides/rawdevs/index.rst index 22bc013..f64ec44 100644 --- a/doc/guides/rawdevs/index.rst +++ b/doc/guides/rawdevs/index.rst @@ -17,3 +17,4 @@ application through rawdev API. ioat ntb octeontx2_dma +octeontx2_ep diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst new file mode 100644 index 000..5f5ed01 --- /dev/null +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -0,0 +1,41 @@ +.. SPDX-License-Identifier: BSD-3-Clause +Copyright(c) 2019 Marvell International Ltd. + +Marvell OCTEON TX2 End Point Rawdev Driver +== + +OCTEON TX2 has an internal SDP unit which provides End Point mode of operation +by exposing its IOQs to Host, IOQs are used for packet I/O between Host and +OCTEON TX2. Each OCTEON TX2 SDP PF supports a max of 128 VFs and Each VF is +associated with a set of IOQ pairs. + +Features + + +This OCTEON TX2 End Point mode PMD supports + +#. Packet Input - Host to OCTEON TX2 with direct data instruction mode. + +#. Packet Output - OCTEON TX2 to Host with info pointer mode. + +Config File Options +~~~ + +The following options can be modified in the ``config`` file. + +- ``CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV`` (default ``y``) + + Toggle compilation of the ``lrte_pmd_octeontx2_ep`` driver. + +Initialization +-- + +The number of SDP VFs enabled, can be controlled by setting sysfs +entry `sriov_numvfs` for the corresponding PF driver. + +.. code-block:: console + + echo > /sys/bus/pci/drivers/octeontx2-ep/\:04\:00.0/sriov_numvfs + +Once the required VFs are enabled, to be accessible from DPDK, VFs need to be +bound to vfio-pci driver. diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index 0b6d13d..80b043e 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -13,5 +13,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat DIRS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) += ntb DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV) += octeontx2_dma +DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += octeontx2_ep include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/raw/meson.build b/drivers/raw/meson.build index d7037cd..bb57977 100644 --- a/drivers/raw/meson.build +++ b/drivers/raw/meson.build @@ -4,6 +4,7 @@ drivers = ['dpaa2_cmdif', 'dpaa2_qdma', 'ifpga', 'ioat', 'ntb', 'octeontx2_dma', + 'octeontx2_ep', 'skeleton'] std_deps = ['rawdev'] config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV' diff --git a/drivers/raw/octeontx2_ep/Makefile b/drivers/raw/octeontx2_ep/Makefile new file mode 100644 index 000..8cec6bd --- /dev/null +++ b/drivers/raw/octeontx2_ep/Makefile @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2019 Marvell International Ltd. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# Library name +LIB = librte_rawdev_octeontx2_ep.a + +# Build flags +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2/ +CFLAGS += -I$(RTE_SDK)/drivers/raw/octeontx2_ep/ +
[dpdk-dev] [PATCH v3 0/6] OCTEON TX2 End Point Driver
This patchset adds support for OCTEON TX2 end point mode of operation. The driver implementation uses DPDK rawdevice sub-system. v2: * Updated memory barrior API's as per Gavin Hu suggestion. v3: * Fixed memory leak possibility issues. Mahipal Challa (6): raw/octeontx2_ep: add build infra and device probe raw/octeontx2_ep: add device configuration raw/octeontx2_ep: add device uninitialization raw/octeontx2_ep: add enqueue operation raw/octeontx2_ep: add dequeue operation raw/octeontx2_ep: add driver self test MAINTAINERS| 5 + config/common_base | 5 + doc/guides/rawdevs/index.rst | 1 + doc/guides/rawdevs/octeontx2_ep.rst| 89 +++ drivers/common/octeontx2/hw/otx2_sdp.h | 184 + drivers/common/octeontx2/otx2_common.c | 9 + drivers/common/octeontx2/otx2_common.h | 4 + .../octeontx2/rte_common_octeontx2_version.map | 6 + drivers/raw/Makefile | 1 + drivers/raw/meson.build| 1 + drivers/raw/octeontx2_ep/Makefile | 44 ++ drivers/raw/octeontx2_ep/meson.build | 9 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 844 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 52 ++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 361 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 499 drivers/raw/octeontx2_ep/otx2_ep_test.c| 166 drivers/raw/octeontx2_ep/otx2_ep_vf.c | 476 drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + .../rte_rawdev_octeontx2_ep_version.map| 4 + mk/rte.app.mk | 2 + 21 files changed, 2772 insertions(+) create mode 100644 doc/guides/rawdevs/octeontx2_ep.rst create mode 100644 drivers/common/octeontx2/hw/otx2_sdp.h create mode 100644 drivers/raw/octeontx2_ep/Makefile create mode 100644 drivers/raw/octeontx2_ep/meson.build create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.h create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_test.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.h create mode 100644 drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map -- 1.8.3.1
[dpdk-dev] [PATCH v3 3/6] raw/octeontx2_ep: add device uninitialization
Add rawdev close/uninitialize operation for SDP VF devices. Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 111 ++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 78 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 8 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.c | 44 4 files changed, 241 insertions(+) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 8857004..584b818 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -21,6 +21,59 @@ #include "otx2_common.h" #include "otx2_ep_enqdeq.h" +static void +sdp_dmazone_free(const struct rte_memzone *mz) +{ + const struct rte_memzone *mz_tmp; + int ret = 0; + + if (mz == NULL) { + otx2_err("Memzone %s : NULL", mz->name); + return; + } + + mz_tmp = rte_memzone_lookup(mz->name); + if (mz_tmp == NULL) { + otx2_err("Memzone %s Not Found", mz->name); + return; + } + + ret = rte_memzone_free(mz); + if (ret) + otx2_err("Memzone free failed : ret = %d", ret); + +} + +/* Free IQ resources */ +int +sdp_delete_iqs(struct sdp_device *sdpvf, uint32_t iq_no) +{ + struct sdp_instr_queue *iq; + + iq = sdpvf->instr_queue[iq_no]; + if (iq == NULL) { + otx2_err("Invalid IQ[%d]\n", iq_no); + return -ENOMEM; + } + + rte_free(iq->req_list); + iq->req_list = NULL; + + if (iq->iq_mz) { + sdp_dmazone_free(iq->iq_mz); + iq->iq_mz = NULL; + } + + rte_free(sdpvf->instr_queue[iq_no]); + sdpvf->instr_queue[iq_no] = NULL; + + sdpvf->num_iqs--; + + otx2_info("IQ[%d] is deleted", iq_no); + + return 0; +} + /* IQ initialization */ static int sdp_init_instr_queue(struct sdp_device *sdpvf, int iq_no) @@ -126,6 +179,7 @@ return 0; delete_IQ: + sdp_delete_iqs(sdpvf, iq_no); return -ENOMEM; } @@ -139,6 +193,61 @@ rte_atomic64_set(&droq->pkts_pending, 0); } +static void +sdp_droq_destroy_ring_buffers(struct sdp_device *sdpvf, + struct sdp_droq *droq) +{ + uint32_t idx; + + for (idx = 0; idx < droq->nb_desc; idx++) { + if (droq->recv_buf_list[idx].buffer) { + rte_mempool_put(sdpvf->enqdeq_mpool, + droq->recv_buf_list[idx].buffer); + + droq->recv_buf_list[idx].buffer = NULL; + } + } + + sdp_droq_reset_indices(droq); +} + +/* Free OQs resources */ +int +sdp_delete_oqs(struct sdp_device *sdpvf, uint32_t oq_no) +{ + struct sdp_droq *droq; + + droq = sdpvf->droq[oq_no]; + if (droq == NULL) { + otx2_err("Invalid droq[%d]", oq_no); + return -ENOMEM; + } + + sdp_droq_destroy_ring_buffers(sdpvf, droq); + rte_free(droq->recv_buf_list); + droq->recv_buf_list = NULL; + + if (droq->info_mz) { + sdp_dmazone_free(droq->info_mz); + droq->info_mz = NULL; + } + + if (droq->desc_ring_mz) { + sdp_dmazone_free(droq->desc_ring_mz); + droq->desc_ring_mz = NULL; + } + + memset(droq, 0, SDP_DROQ_SIZE); + + rte_free(sdpvf->droq[oq_no]); + sdpvf->droq[oq_no] = NULL; + + sdpvf->num_oqs--; + + otx2_info("OQ[%d] is deleted", oq_no); + return 0; +} + static int sdp_droq_setup_ring_buffers(struct sdp_device *sdpvf, struct sdp_droq *droq) @@ -290,5 +399,7 @@ return 0; delete_OQ: + sdp_delete_oqs(sdpvf, oq_no); return -ENOMEM; } + diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c index 0c56609..3db5a74 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c @@ -63,6 +63,45 @@ } static int +sdp_vfdev_exit(struct rte_rawdev *rawdev) +{ + struct sdp_device *sdpvf; + uint32_t rawdev_queues, q; + + otx2_info("%s:", __func__); + + sdpvf = (struct sdp_device *)rawdev->dev_private; + + sdpvf->fn_list.disable_io_queues(sdpvf); + + rawdev_queues = sdpvf->num_oqs; + for (q = 0; q < rawdev_queues; q++) { + if (sdp_delete_oqs(sdpvf, q)) { + otx2_err("Failed to delete OQ:%d", q); + return -ENOMEM; + } + } + otx2_info("Num OQs:%d freed", sdpvf->num_oqs); + + /* Free the oqbuf_pool */ + rte_mempool_free(sdpv
[dpdk-dev] [PATCH v3 2/6] raw/octeontx2_ep: add device configuration
Register "dev_configure" API to configure/initialize the SDP VF PCIe devices. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst| 29 ++ drivers/common/octeontx2/hw/otx2_sdp.h | 184 + drivers/common/octeontx2/otx2_common.c | 9 + drivers/common/octeontx2/otx2_common.h | 4 + .../octeontx2/rte_common_octeontx2_version.map | 6 + drivers/raw/octeontx2_ep/Makefile | 3 + drivers/raw/octeontx2_ep/meson.build | 4 +- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 294 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 11 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 148 +++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 434 - drivers/raw/octeontx2_ep/otx2_ep_vf.c | 408 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + 13 files changed, 1542 insertions(+), 2 deletions(-) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 5f5ed01..2507fcf 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -39,3 +39,32 @@ entry `sriov_numvfs` for the corresponding PF driver. Once the required VFs are enabled, to be accessible from DPDK, VFs need to be bound to vfio-pci driver. + +Device Setup + + +The OCTEON TX2 SDP End Point VF devices will need to be bound to a +user-space IO driver for use. The script ``dpdk-devbind.py`` script +included with DPDK can be used to view the state of the devices and to bind +them to a suitable DPDK-supported kernel driver. When querying the status +of the devices, they will appear under the category of "Misc (rawdev) +devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be +used to see the state of those devices alone. + +Device Configuration + + +Configuring SDP EP rawdev device is done using the ``rte_rawdev_configure()`` +API, which takes the mempool as parameter. PMD uses this pool to send/receive +packets to/from the HW. + +The following code shows how the device is configured + +.. code-block:: c + + struct sdp_rawdev_info config = {0}; + struct rte_rawdev_info rdev_info = {.dev_private = &config}; + config.enqdeq_mpool = (void *)rte_mempool_create(...); + + rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); + diff --git a/drivers/common/octeontx2/hw/otx2_sdp.h b/drivers/common/octeontx2/hw/otx2_sdp.h new file mode 100644 index 000..1e690f8 --- /dev/null +++ b/drivers/common/octeontx2/hw/otx2_sdp.h @@ -0,0 +1,184 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#ifndef __OTX2_SDP_HW_H_ +#define __OTX2_SDP_HW_H_ + +/* SDP VF IOQs */ +#define SDP_MIN_RINGS_PER_VF(1) +#define SDP_MAX_RINGS_PER_VF(8) + +/* SDP VF IQ configuration */ +#define SDP_VF_MAX_IQ_DESCRIPTORS (512) +#define SDP_VF_MIN_IQ_DESCRIPTORS (128) + +#define SDP_VF_DB_MIN (1) +#define SDP_VF_DB_TIMEOUT (1) +#define SDP_VF_INTR_THRESHOLD (0x) + +#define SDP_VF_64BYTE_INSTR (64) +#define SDP_VF_32BYTE_INSTR (32) + +/* SDP VF OQ configuration */ +#define SDP_VF_MAX_OQ_DESCRIPTORS (512) +#define SDP_VF_MIN_OQ_DESCRIPTORS (128) +#define SDP_VF_OQ_BUF_SIZE (2048) +#define SDP_VF_OQ_REFIL_THRESHOLD (16) + +#define SDP_VF_OQ_INFOPTR_MODE (1) +#define SDP_VF_OQ_BUFPTR_MODE (0) + +#define SDP_VF_OQ_INTR_PKT (1) +#define SDP_VF_OQ_INTR_TIME (10) +#define SDP_VF_CFG_IO_QUEUESSDP_MAX_RINGS_PER_VF + +/* Wait time in milliseconds for FLR */ +#define SDP_VF_PCI_FLR_WAIT (100) +#define SDP_VF_BUSY_LOOP_COUNT (1) + +#define SDP_VF_MAX_IO_QUEUESSDP_MAX_RINGS_PER_VF +#define SDP_VF_MIN_IO_QUEUESSDP_MIN_RINGS_PER_VF + +/* SDP VF IOQs per rawdev */ +#define SDP_VF_MAX_IOQS_PER_RAWDEV SDP_VF_MAX_IO_QUEUES +#define SDP_VF_DEFAULT_IOQS_PER_RAWDEV SDP_VF_MIN_IO_QUEUES + +/* SDP VF Register definitions */ +#define SDP_VF_RING_OFFSET(0x1ull << 17) + +/* SDP VF IQ Registers */ +#define SDP_VF_R_IN_CONTROL_START (0x1) +#define SDP_VF_R_IN_ENABLE_START (0x10010) +#define SDP_VF_R_IN_INSTR_BADDR_START (0x10020) +#define SDP_VF_R_IN_INSTR_RSIZE_START (0x10030) +#define SDP_VF_R_IN_INSTR_DBELL_START (0x10040) +#define SDP_VF_R_IN_CNTS_START(0x10050) +#define SDP_VF_R_IN_INT_LEVELS_START (0x10060) +#define SDP_VF_R_IN_PKT_CNT_START (0x10080) +#define SDP_VF_R_IN_BYTE_CNT_START(0x10090) + +#define SDP_VF_R_IN_CONTROL(ring) \ + (SDP_VF_R_IN_CONTROL_START + ((ring) * SDP_VF_RING_OFFSET)) + +#define SDP_VF_R_IN_ENABLE(ring) \ + (SDP_VF_R_IN_ENABLE_START + ((ring) * SDP_VF_RING_OFFSET)) + +#define SDP_VF_R_IN_INSTR_BADDR(ring) \ +
[dpdk-dev] [PATCH v3 4/6] raw/octeontx2_ep: add enqueue operation
Add rawdev enqueue operation for SDP VF devices. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst | 6 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 242 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 39 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 20 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.c | 24 +++ 6 files changed, 332 insertions(+) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 2507fcf..39a7c29 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -68,3 +68,9 @@ The following code shows how the device is configured rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); +Performing Data Transfer + + +To perform data transfer using SDP VF EP rawdev devices use standard +``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` APIs. + diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 584b818..6910f08 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -403,3 +403,245 @@ return -ENOMEM; } +static inline void +sdp_iqreq_delete(struct sdp_device *sdpvf, + struct sdp_instr_queue *iq, uint32_t idx) +{ + uint32_t reqtype; + void *buf; + + buf = iq->req_list[idx].buf; + reqtype = iq->req_list[idx].reqtype; + + switch (reqtype) { + case SDP_REQTYPE_NORESP: + rte_mempool_put(sdpvf->enqdeq_mpool, buf); + otx2_sdp_dbg("IQ buffer freed at idx[%d]", idx); + break; + + case SDP_REQTYPE_NORESP_GATHER: + case SDP_REQTYPE_NONE: + default: + otx2_info("This iqreq mode is not supported:%d", reqtype); + + } + + /* Reset the request list at this index */ + iq->req_list[idx].buf = NULL; + iq->req_list[idx].reqtype = 0; +} + +static inline void +sdp_iqreq_add(struct sdp_instr_queue *iq, void *buf, + uint32_t reqtype) +{ + iq->req_list[iq->host_write_index].buf = buf; + iq->req_list[iq->host_write_index].reqtype = reqtype; + + otx2_sdp_dbg("IQ buffer added at idx[%d]", iq->host_write_index); + +} + +static void +sdp_flush_iq(struct sdp_device *sdpvf, + struct sdp_instr_queue *iq, + uint32_t pending_thresh __rte_unused) +{ + uint32_t instr_processed = 0; + + rte_spinlock_lock(&iq->lock); + + iq->otx_read_index = sdpvf->fn_list.update_iq_read_idx(iq); + while (iq->flush_index != iq->otx_read_index) { + /* Free the IQ data buffer to the pool */ + sdp_iqreq_delete(sdpvf, iq, iq->flush_index); + iq->flush_index = + sdp_incr_index(iq->flush_index, 1, iq->nb_desc); + + instr_processed++; + } + + iq->stats.instr_processed = instr_processed; + rte_atomic64_sub(&iq->instr_pending, instr_processed); + + rte_spinlock_unlock(&iq->lock); +} + +static inline void +sdp_ring_doorbell(struct sdp_device *sdpvf __rte_unused, + struct sdp_instr_queue *iq) +{ + otx2_write64(iq->fill_cnt, iq->doorbell_reg); + + /* Make sure doorbell write goes through */ + rte_cio_wmb(); + iq->fill_cnt = 0; + +} + +static inline int +post_iqcmd(struct sdp_instr_queue *iq, uint8_t *iqcmd) +{ + uint8_t *iqptr, cmdsize; + + /* This ensures that the read index does not wrap around to +* the same position if queue gets full before OCTEON TX2 could +* fetch any instr. +*/ + if (rte_atomic64_read(&iq->instr_pending) >= + (int32_t)(iq->nb_desc - 1)) { + otx2_err("IQ is full, pending:%ld", +(long)rte_atomic64_read(&iq->instr_pending)); + + return SDP_IQ_SEND_FAILED; + } + + /* Copy cmd into iq */ + cmdsize = ((iq->iqcmd_64B) ? 64 : 32); + iqptr = iq->base_addr + (cmdsize * iq->host_write_index); + + rte_memcpy(iqptr, iqcmd, cmdsize); + + otx2_sdp_dbg("IQ cmd posted @ index:%d", iq->host_write_index); + + /* Increment the host write index */ + iq->host_write_index = + sdp_incr_index(iq->host_write_index, 1, iq->nb_desc); + + iq->fill_cnt++; + + /* Flush the command into memory. We need to be sure the data +* is in memory before indicating that the instruction is +* pending. +*/ + rte_io_wmb(); + rte_atomic64_inc(&iq->instr_pending); + + /* SDP_IQ_SEND_SUCCESS */ + return 0; +} + + +stat
[dpdk-dev] [PATCH v3 6/6] raw/octeontx2_ep: add driver self test
Add rawdev's selftest feature in SDP VF driver, which verifies the EP mode functionality test. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst | 13 +++ drivers/raw/octeontx2_ep/Makefile | 1 + drivers/raw/octeontx2_ep/meson.build | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 2 + drivers/raw/octeontx2_ep/otx2_ep_test.c | 166 ++ 6 files changed, 184 insertions(+) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 39a7c29..bbcf530 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -74,3 +74,16 @@ Performing Data Transfer To perform data transfer using SDP VF EP rawdev devices use standard ``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` APIs. +Self test +- + +On EAL initialization, SDP VF devices will be probed and populated into the +raw devices. The rawdev ID of the device can be obtained using + +* Invoke ``rte_rawdev_get_dev_id("SDPEP:x")`` from the test application + where x is the VF device's bus id specified in "bus:device.func"(BDF) + format. Use this index for further rawdev function calls. + +* The driver's selftest rawdev API can be used to verify the SDP EP mode + functional tests which can send/receive the raw data packets to/from the + EP device. diff --git a/drivers/raw/octeontx2_ep/Makefile b/drivers/raw/octeontx2_ep/Makefile index 02853fb..44fdf89 100644 --- a/drivers/raw/octeontx2_ep/Makefile +++ b/drivers/raw/octeontx2_ep/Makefile @@ -37,6 +37,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_rawdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_enqdeq.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_test.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_vf.c diff --git a/drivers/raw/octeontx2_ep/meson.build b/drivers/raw/octeontx2_ep/meson.build index 99e6c6d..0e6338f 100644 --- a/drivers/raw/octeontx2_ep/meson.build +++ b/drivers/raw/octeontx2_ep/meson.build @@ -5,4 +5,5 @@ deps += ['bus_pci', 'common_octeontx2', 'rawdev'] sources = files('otx2_ep_rawdev.c', 'otx2_ep_enqdeq.c', + 'otx2_ep_test.c', 'otx2_ep_vf.c') diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c index 7158b97..0778603 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c @@ -253,6 +253,7 @@ .dev_close = sdp_rawdev_close, .enqueue_bufs = sdp_rawdev_enqueue, .dequeue_bufs = sdp_rawdev_dequeue, + .dev_selftest = sdp_rawdev_selftest, }; static int diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h index a77cbab..dab2fb7 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h @@ -494,4 +494,6 @@ int sdp_rawdev_enqueue(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, int sdp_rawdev_dequeue(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, unsigned int count, rte_rawdev_obj_t context); +int sdp_rawdev_selftest(uint16_t dev_id); + #endif /* _OTX2_EP_RAWDEV_H_ */ diff --git a/drivers/raw/octeontx2_ep/otx2_ep_test.c b/drivers/raw/octeontx2_ep/otx2_ep_test.c new file mode 100644 index 000..fc913a6 --- /dev/null +++ b/drivers/raw/octeontx2_ep/otx2_ep_test.c @@ -0,0 +1,166 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "otx2_common.h" +#include "otx2_ep_rawdev.h" + +#define SDP_IOQ_NUM_BUFS (4 * 1024) +#define SDP_IOQ_BUF_SIZE (2 * 1024) + +#define SDP_TEST_PKT_FSZ (0) +#define SDP_TEST_PKT_SIZE (1024) + +static int +sdp_validate_data(struct sdp_droq_pkt *oq_pkt, uint8_t *iq_pkt, + uint32_t pkt_len) +{ + if (!oq_pkt) + return -EINVAL; + + if (pkt_len != oq_pkt->len) { + otx2_err("Invalid packet length"); + return -EINVAL; + } + + if (memcmp(oq_pkt->data, iq_pkt, pkt_len) != 0) { + otx2_err("Data validation failed"); + return -EINVAL; + } + otx2_sdp_dbg("Data validation successful"); + + return 0; +} + +static void +sdp_ioq_buffer_fill(uint8_t *addr, uint32_t len) +{ + uint32_t idx; + + memset(addr, 0, len); + + for (idx = 0; idx < len; idx++) + addr[idx] = idx; +} + +static struct rte_mempool* +sdp_ioq_mempool_
[dpdk-dev] [PATCH v3 5/6] raw/octeontx2_ep: add dequeue operation
Add rawdev dequeue operation for SDP VF devices. Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 197 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 2 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 18 ++- 4 files changed, 217 insertions(+), 1 deletion(-) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 6910f08..dd270b5 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -260,6 +260,7 @@ rte_mempool_get(sdpvf->enqdeq_mpool, &buf); if (buf == NULL) { otx2_err("OQ buffer alloc failed"); + droq->stats.rx_alloc_failure++; /* sdp_droq_destroy_ring_buffers(droq);*/ return -ENOMEM; } @@ -645,3 +646,199 @@ return SDP_IQ_SEND_FAILED; } +static uint32_t +sdp_droq_refill(struct sdp_device *sdpvf, struct sdp_droq *droq) +{ + struct sdp_droq_desc *desc_ring; + uint32_t desc_refilled = 0; + void *buf = NULL; + + desc_ring = droq->desc_ring; + + while (droq->refill_count && (desc_refilled < droq->nb_desc)) { + /* If a valid buffer exists (happens if there is no dispatch), +* reuse the buffer, else allocate. +*/ + if (droq->recv_buf_list[droq->refill_idx].buffer != NULL) + break; + + rte_mempool_get(sdpvf->enqdeq_mpool, &buf); + /* If a buffer could not be allocated, no point in +* continuing +*/ + if (buf == NULL) { + droq->stats.rx_alloc_failure++; + break; + } + + droq->recv_buf_list[droq->refill_idx].buffer = buf; + desc_ring[droq->refill_idx].buffer_ptr = rte_mem_virt2iova(buf); + + /* Reset any previous values in the length field. */ + droq->info_list[droq->refill_idx].length = 0; + + droq->refill_idx = sdp_incr_index(droq->refill_idx, 1, + droq->nb_desc); + + desc_refilled++; + droq->refill_count--; + + } + + return desc_refilled; +} + +static int +sdp_droq_read_packet(struct sdp_device *sdpvf __rte_unused, +struct sdp_droq *droq, +struct sdp_droq_pkt *droq_pkt) +{ + struct sdp_droq_info *info; + uint32_t total_len = 0; + uint32_t pkt_len = 0; + + info = &droq->info_list[droq->read_idx]; + sdp_swap_8B_data((uint64_t *)&info->length, 1); + if (!info->length) { + otx2_err("OQ info_list->length[%ld]", (long)info->length); + goto oq_read_fail; + } + + /* Deduce the actual data size */ + info->length -= SDP_RH_SIZE; + total_len += (uint32_t)info->length; + + otx2_sdp_dbg("OQ: pkt_len[%ld], buffer_size %d", + (long)info->length, droq->buffer_size); + if (info->length > droq->buffer_size) { + otx2_err("This mode is not supported: pkt_len > buffer_size"); + goto oq_read_fail; + } + + if (info->length <= droq->buffer_size) { + pkt_len = (uint32_t)info->length; + droq_pkt->data = droq->recv_buf_list[droq->read_idx].buffer; + droq_pkt->len = pkt_len; + + droq->recv_buf_list[droq->read_idx].buffer = NULL; + droq->read_idx = sdp_incr_index(droq->read_idx, 1,/* count */ + droq->nb_desc /* max rd idx */); + droq->refill_count++; + + } + + info->length = 0; + + return SDP_OQ_RECV_SUCCESS; + +oq_read_fail: + return SDP_OQ_RECV_FAILED; +} + +static inline uint32_t +sdp_check_droq_pkts(struct sdp_droq *droq, uint32_t burst_size) +{ + uint32_t min_pkts = 0; + uint32_t new_pkts; + uint32_t pkt_count; + + /* Latest available OQ packets */ + pkt_count = rte_read32(droq->pkts_sent_reg); + + /* Newly arrived packets */ + new_pkts = pkt_count - droq->last_pkt_count; + otx2_sdp_dbg("Recvd [%d] new OQ pkts", new_pkts); + + min_pkts = (new_pkts > burst_size) ? burst_size : new_pkts; + if (min_pkts) { + rte_atomic64_add(&droq->pkts_pending, min_pkts); + /* Back up the aggregated packet count so far */ + droq->last_pkt_count += min_pkts; + } + + return min_pkts; +} + +/* Check for response
Re: [dpdk-dev] [PATCH v3 6/6] raw/octeontx2_ep: add driver self test
Hi Gavin, Please see response inline > -Original Message- > From: Gavin Hu > Sent: Tuesday, January 7, 2020 8:13 AM > To: Mahipal Challa ; dev@dpdk.org > Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju > Athreya ; Subrahmanyam Nilla > ; Venkateshwarlu Nalla ; nd > > Subject: [EXT] RE: [dpdk-dev] [PATCH v3 6/6] raw/octeontx2_ep: add driver > self test > > External Email > > -- > Hi Mahipal, > > > -Original Message- > > From: Mahipal Challa > > Sent: Monday, January 6, 2020 8:07 PM > > To: dev@dpdk.org > > Cc: jer...@marvell.com; pathr...@marvell.com; sni...@marvell.com; > > venk...@marvell.com; Gavin Hu > > Subject: [dpdk-dev] [PATCH v3 6/6] raw/octeontx2_ep: add driver self > > test > > > > Add rawdev's selftest feature in SDP VF driver, which verifies the EP > > mode functionality test. > > > > Signed-off-by: Mahipal Challa > > --- > > doc/guides/rawdevs/octeontx2_ep.rst | 13 +++ > > drivers/raw/octeontx2_ep/Makefile | 1 + > > drivers/raw/octeontx2_ep/meson.build | 1 + > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 2 + > > drivers/raw/octeontx2_ep/otx2_ep_test.c | 166 > > ++ > > 6 files changed, 184 insertions(+) > > > > diff --git a/doc/guides/rawdevs/octeontx2_ep.rst > > b/doc/guides/rawdevs/octeontx2_ep.rst > > index 39a7c29..bbcf530 100644 > > --- a/doc/guides/rawdevs/octeontx2_ep.rst > > +++ b/doc/guides/rawdevs/octeontx2_ep.rst > > @@ -74,3 +74,16 @@ Performing Data Transfer To perform data transfer > > using SDP VF EP rawdev devices use standard > > ``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` > > APIs. > > > > +Self test > > +- > > + > > +On EAL initialization, SDP VF devices will be probed and populated > > +into the raw devices. The rawdev ID of the device can be obtained > > +using > > + > > +* Invoke ``rte_rawdev_get_dev_id("SDPEP:x")`` from the test > > +application > > + where x is the VF device's bus id specified in > > +"bus:device.func"(BDF) > > + format. Use this index for further rawdev function calls. > > + > > +* The driver's selftest rawdev API can be used to verify the SDP EP > > +mode > > + functional tests which can send/receive the raw data packets > > +to/from the > > + EP device. > > diff --git a/drivers/raw/octeontx2_ep/Makefile > > b/drivers/raw/octeontx2_ep/Makefile > > index 02853fb..44fdf89 100644 > > --- a/drivers/raw/octeontx2_ep/Makefile > > +++ b/drivers/raw/octeontx2_ep/Makefile > > @@ -37,6 +37,7 @@ LIBABIVER := 1 > > # > > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += > otx2_ep_rawdev.c > > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += > otx2_ep_enqdeq.c > > +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += > > otx2_ep_test.c > > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += > otx2_ep_vf.c > > > > > > diff --git a/drivers/raw/octeontx2_ep/meson.build > > b/drivers/raw/octeontx2_ep/meson.build > > index 99e6c6d..0e6338f 100644 > > --- a/drivers/raw/octeontx2_ep/meson.build > > +++ b/drivers/raw/octeontx2_ep/meson.build > > @@ -5,4 +5,5 @@ > > deps += ['bus_pci', 'common_octeontx2', 'rawdev'] sources = > > files('otx2_ep_rawdev.c', > > 'otx2_ep_enqdeq.c', > > + 'otx2_ep_test.c', > > 'otx2_ep_vf.c') > > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > > b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > > index 7158b97..0778603 100644 > > --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > > +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > > @@ -253,6 +253,7 @@ > > .dev_close = sdp_rawdev_close, > > .enqueue_bufs = sdp_rawdev_enqueue, > > .dequeue_bufs = sdp_rawdev_dequeue, > > + .dev_selftest = sdp_rawdev_selftest, > > }; > > > > static int > > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > > b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > > index a77cbab..dab2fb7 100644 > > --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > > +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > > @@ -494,4 +494,6 @@ int sdp_rawdev_enqueue(struct rte_rawdev *dev, > > struct rte_rawdev_buf **buffers, int sdp_rawdev
Re: [dpdk-dev] [PATCH v3 2/6] raw/octeontx2_ep: add device configuration
Hi Gavin, Please see the response inline. Thanks, Mahipal > -Original Message- > From: Gavin Hu > Sent: Tuesday, January 7, 2020 11:31 AM > To: Mahipal Challa ; dev@dpdk.org > Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju > Athreya ; Subrahmanyam Nilla > ; Venkateshwarlu Nalla ; nd > > Subject: [EXT] RE: [dpdk-dev] [PATCH v3 2/6] raw/octeontx2_ep: add device > configuration > > External Email > > -- > Hi Mahipal, > > > -Original Message- > > From: Mahipal Challa > > Sent: Monday, January 6, 2020 8:07 PM > > To: dev@dpdk.org > > Cc: jer...@marvell.com; pathr...@marvell.com; sni...@marvell.com; > > venk...@marvell.com; Gavin Hu > > Subject: [dpdk-dev] [PATCH v3 2/6] raw/octeontx2_ep: add device > > configuration > > > > Register "dev_configure" API to configure/initialize the SDP > > VF PCIe devices. > > > > Signed-off-by: Mahipal Challa > > --- > > doc/guides/rawdevs/octeontx2_ep.rst| 29 ++ > > drivers/common/octeontx2/hw/otx2_sdp.h | 184 + > > drivers/common/octeontx2/otx2_common.c | 9 + > > drivers/common/octeontx2/otx2_common.h | 4 + > > .../octeontx2/rte_common_octeontx2_version.map | 6 + > > drivers/raw/octeontx2_ep/Makefile | 3 + > > drivers/raw/octeontx2_ep/meson.build | 4 +- > > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 294 ++ > > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 11 + > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 148 +++ > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 434 > > - > > drivers/raw/octeontx2_ep/otx2_ep_vf.c | 408 > > +++ > > drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + > > 13 files changed, 1542 insertions(+), 2 deletions(-) > > > > diff --git a/doc/guides/rawdevs/octeontx2_ep.rst > > b/doc/guides/rawdevs/octeontx2_ep.rst > > index 5f5ed01..2507fcf 100644 > > --- a/doc/guides/rawdevs/octeontx2_ep.rst > > +++ b/doc/guides/rawdevs/octeontx2_ep.rst > > @@ -39,3 +39,32 @@ entry `sriov_numvfs` for the corresponding PF > driver. > > > > Once the required VFs are enabled, to be accessible from DPDK, VFs need > to > > be > > bound to vfio-pci driver. > > + > > +Device Setup > > + > > + > > +The OCTEON TX2 SDP End Point VF devices will need to be bound to a > > +user-space IO driver for use. The script ``dpdk-devbind.py`` script > > +included with DPDK can be used to view the state of the devices and to > bind > > +them to a suitable DPDK-supported kernel driver. When querying the > status > > +of the devices, they will appear under the category of "Misc (rawdev) > > +devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be > > +used to see the state of those devices alone. > > + > > +Device Configuration > > + > > + > > +Configuring SDP EP rawdev device is done using the > > ``rte_rawdev_configure()`` > > +API, which takes the mempool as parameter. PMD uses this pool to > > send/receive > > +packets to/from the HW. > > + > > +The following code shows how the device is configured > > + > > +.. code-block:: c > > + > > + struct sdp_rawdev_info config = {0}; > > + struct rte_rawdev_info rdev_info = {.dev_private = &config}; > > + config.enqdeq_mpool = (void *)rte_mempool_create(...); > > + > > + rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); > > + > > diff --git a/drivers/common/octeontx2/hw/otx2_sdp.h > > b/drivers/common/octeontx2/hw/otx2_sdp.h > > new file mode 100644 > > index 000..1e690f8 > > --- /dev/null > > +++ b/drivers/common/octeontx2/hw/otx2_sdp.h > > @@ -0,0 +1,184 @@ > > +/* SPDX-License-Identifier: BSD-3-Clause > > + * Copyright(C) 2019 Marvell International Ltd. > > + */ > > + > > +#ifndef __OTX2_SDP_HW_H_ > > +#define __OTX2_SDP_HW_H_ > > + > > +/* SDP VF IOQs */ > > +#define SDP_MIN_RINGS_PER_VF(1) > > +#define SDP_MAX_RINGS_PER_VF(8) > > + > > +/* SDP VF IQ configuration */ > > +#define SDP_VF_MAX_IQ_DESCRIPTORS (512) > > +#define SDP_VF_MIN_IQ_DESCRIPTORS (128) > > + > > +#define SDP_VF_DB_MIN (1) > > +#define SDP_VF_DB_TIMEOUT (1) > > +#define SDP_VF_INTR_THRE
Re: [dpdk-dev] [PATCH v3 4/6] raw/octeontx2_ep: add enqueue operation
Hi Gavin, Please see the response inline. > -Original Message- > From: Gavin Hu > Sent: Tuesday, January 7, 2020 11:26 AM > To: Mahipal Challa ; dev@dpdk.org; Honnappa > Nagarahalli > Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju > Athreya ; Subrahmanyam Nilla > ; Venkateshwarlu Nalla ; nd > > Subject: [EXT] RE: [dpdk-dev] [PATCH v3 4/6] raw/octeontx2_ep: add > enqueue operation > > External Email > > -- > Hi Mahipal, > > > -Original Message- > > From: Mahipal Challa > > Sent: Monday, January 6, 2020 8:07 PM > > To: dev@dpdk.org > > Cc: jer...@marvell.com; pathr...@marvell.com; sni...@marvell.com; > > venk...@marvell.com; Gavin Hu > > Subject: [dpdk-dev] [PATCH v3 4/6] raw/octeontx2_ep: add enqueue > > operation > > > > Add rawdev enqueue operation for SDP VF devices. > > > > Signed-off-by: Mahipal Challa > > --- > > doc/guides/rawdevs/octeontx2_ep.rst | 6 + > > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 242 > > ++ > > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 39 + > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 20 +++ > > drivers/raw/octeontx2_ep/otx2_ep_vf.c | 24 +++ > > 6 files changed, 332 insertions(+) > > > > diff --git a/doc/guides/rawdevs/octeontx2_ep.rst > > b/doc/guides/rawdevs/octeontx2_ep.rst > > index 2507fcf..39a7c29 100644 > > --- a/doc/guides/rawdevs/octeontx2_ep.rst > > +++ b/doc/guides/rawdevs/octeontx2_ep.rst > > @@ -68,3 +68,9 @@ The following code shows how the device is > > configured > > > > rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); > > > > +Performing Data Transfer > > + > > + > > +To perform data transfer using SDP VF EP rawdev devices use standard > > +``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` > > APIs. > > + > > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > > b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > > index 584b818..6910f08 100644 > > --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > > +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > > @@ -403,3 +403,245 @@ > > return -ENOMEM; > > } > > > > +static inline void > > +sdp_iqreq_delete(struct sdp_device *sdpvf, > > + struct sdp_instr_queue *iq, uint32_t idx) { > > + uint32_t reqtype; > > + void *buf; > > + > > + buf = iq->req_list[idx].buf; > > + reqtype = iq->req_list[idx].reqtype; > > + > > + switch (reqtype) { > > + case SDP_REQTYPE_NORESP: > > + rte_mempool_put(sdpvf->enqdeq_mpool, buf); > > + otx2_sdp_dbg("IQ buffer freed at idx[%d]", idx); > > + break; > > + > > + case SDP_REQTYPE_NORESP_GATHER: > > + case SDP_REQTYPE_NONE: > > + default: > > + otx2_info("This iqreq mode is not supported:%d", reqtype); > > + > > + } > > + > > + /* Reset the request list at this index */ > > + iq->req_list[idx].buf = NULL; > > + iq->req_list[idx].reqtype = 0; > > +} > > + > > +static inline void > > +sdp_iqreq_add(struct sdp_instr_queue *iq, void *buf, > > + uint32_t reqtype) > > +{ > > + iq->req_list[iq->host_write_index].buf = buf; > > + iq->req_list[iq->host_write_index].reqtype = reqtype; > > + > > + otx2_sdp_dbg("IQ buffer added at idx[%d]", iq->host_write_index); > > + > > +} > > + > > +static void > > +sdp_flush_iq(struct sdp_device *sdpvf, > > + struct sdp_instr_queue *iq, > > + uint32_t pending_thresh __rte_unused) { > > + uint32_t instr_processed = 0; > > + > > + rte_spinlock_lock(&iq->lock); > > + > > + iq->otx_read_index = sdpvf->fn_list.update_iq_read_idx(iq); > > + while (iq->flush_index != iq->otx_read_index) { > > + /* Free the IQ data buffer to the pool */ > > + sdp_iqreq_delete(sdpvf, iq, iq->flush_index); > > + iq->flush_index = > > + sdp_incr_index(iq->flush_index, 1, iq->nb_desc); > > + > > + instr_processed++; > > + } > > + > > + iq->stats.instr_processed = instr_processed; > > + rte_atomic64_sub(&iq->instr_pending, instr_processed); > > + > > +
Re: [dpdk-dev] [PATCH v3 5/6] raw/octeontx2_ep: add dequeue operation
Hi Gavin, Please see the response inline. > -Original Message- > From: Gavin Hu > Sent: Tuesday, January 7, 2020 11:13 AM > To: Mahipal Challa ; dev@dpdk.org > Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju > Athreya ; Subrahmanyam Nilla > ; Venkateshwarlu Nalla ; nd > > Subject: [EXT] RE: [dpdk-dev] [PATCH v3 5/6] raw/octeontx2_ep: add > dequeue operation > > External Email > > -- > Hi Mahipal, Jerin, > > > -Original Message- > > From: Mahipal Challa > > Sent: Monday, January 6, 2020 8:07 PM > > To: dev@dpdk.org > > Cc: jer...@marvell.com; pathr...@marvell.com; sni...@marvell.com; > > venk...@marvell.com; Gavin Hu > > Subject: [dpdk-dev] [PATCH v3 5/6] raw/octeontx2_ep: add dequeue > > operation > > > > Add rawdev dequeue operation for SDP VF devices. > > > > Signed-off-by: Mahipal Challa > > --- > > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 197 > > ++ > > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 2 + > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 18 ++- > > 4 files changed, 217 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > > b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > > index 6910f08..dd270b5 100644 > > --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > > +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > > @@ -260,6 +260,7 @@ > > rte_mempool_get(sdpvf->enqdeq_mpool, &buf); > > if (buf == NULL) { > > otx2_err("OQ buffer alloc failed"); > > + droq->stats.rx_alloc_failure++; > > /* sdp_droq_destroy_ring_buffers(droq);*/ > > return -ENOMEM; > > } > > @@ -645,3 +646,199 @@ > > return SDP_IQ_SEND_FAILED; > > } > > > > +static uint32_t > > +sdp_droq_refill(struct sdp_device *sdpvf, struct sdp_droq *droq) { > > + struct sdp_droq_desc *desc_ring; > > + uint32_t desc_refilled = 0; > > + void *buf = NULL; > > + > > + desc_ring = droq->desc_ring; > > + > > + while (droq->refill_count && (desc_refilled < droq->nb_desc)) { > > + /* If a valid buffer exists (happens if there is no dispatch), > > +* reuse the buffer, else allocate. > > +*/ > > + if (droq->recv_buf_list[droq->refill_idx].buffer != NULL) > > + break; > > + > > + rte_mempool_get(sdpvf->enqdeq_mpool, &buf); > > + /* If a buffer could not be allocated, no point in > > +* continuing > > +*/ > > + if (buf == NULL) { > > + droq->stats.rx_alloc_failure++; > > + break; > > + } > > + > > + droq->recv_buf_list[droq->refill_idx].buffer = buf; > > + desc_ring[droq->refill_idx].buffer_ptr = > > rte_mem_virt2iova(buf); > > + > > + /* Reset any previous values in the length field. */ > > + droq->info_list[droq->refill_idx].length = 0; > > + > > + droq->refill_idx = sdp_incr_index(droq->refill_idx, 1, > > + droq->nb_desc); > > + > > + desc_refilled++; > > + droq->refill_count--; > > + > > + } > > + > > + return desc_refilled; > > +} > > + > > +static int > > +sdp_droq_read_packet(struct sdp_device *sdpvf __rte_unused, > > +struct sdp_droq *droq, > > +struct sdp_droq_pkt *droq_pkt) { > > + struct sdp_droq_info *info; > > + uint32_t total_len = 0; > > + uint32_t pkt_len = 0; > > + > > + info = &droq->info_list[droq->read_idx]; > > + sdp_swap_8B_data((uint64_t *)&info->length, 1); > > + if (!info->length) { > > + otx2_err("OQ info_list->length[%ld]", (long)info->length); > > + goto oq_read_fail; > > + } > > + > > + /* Deduce the actual data size */ > > + info->length -= SDP_RH_SIZE; > > + total_len += (uint32_t)info->length; > > + > > + otx2_sdp_dbg("OQ: pkt_len[%ld], buffer_size %d", > > + (long)info->length, droq->buffer_size); > > + if (info->length > dro
[dpdk-dev] [PATCH v4 0/6] OCTEON TX2 End Point Driver
This patchset adds support for OCTEON TX2 end point mode of operation. The driver implementation uses DPDK rawdevice sub-system. v2: * Updated memory barrior API's as per Gavin Hu suggestion. v3: * Fixed memory leak possibility issues. v4: * Improved error handling in selftest API. Mahipal Challa (6): raw/octeontx2_ep: add build infra and device probe raw/octeontx2_ep: add device configuration raw/octeontx2_ep: add device uninitialization raw/octeontx2_ep: add enqueue operation raw/octeontx2_ep: add dequeue operation raw/octeontx2_ep: add driver self test MAINTAINERS| 5 + config/common_base | 5 + doc/guides/rawdevs/index.rst | 1 + doc/guides/rawdevs/octeontx2_ep.rst| 89 +++ drivers/common/octeontx2/hw/otx2_sdp.h | 184 + drivers/common/octeontx2/otx2_common.c | 9 + drivers/common/octeontx2/otx2_common.h | 4 + .../octeontx2/rte_common_octeontx2_version.map | 6 + drivers/raw/Makefile | 1 + drivers/raw/meson.build| 1 + drivers/raw/octeontx2_ep/Makefile | 44 ++ drivers/raw/octeontx2_ep/meson.build | 9 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 844 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 52 ++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 361 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 499 drivers/raw/octeontx2_ep/otx2_ep_test.c| 173 + drivers/raw/octeontx2_ep/otx2_ep_vf.c | 476 drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + .../rte_rawdev_octeontx2_ep_version.map| 4 + mk/rte.app.mk | 2 + 21 files changed, 2779 insertions(+) create mode 100644 doc/guides/rawdevs/octeontx2_ep.rst create mode 100644 drivers/common/octeontx2/hw/otx2_sdp.h create mode 100644 drivers/raw/octeontx2_ep/Makefile create mode 100644 drivers/raw/octeontx2_ep/meson.build create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.h create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_test.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.h create mode 100644 drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map -- 1.8.3.1
[dpdk-dev] [PATCH v4 2/6] raw/octeontx2_ep: add device configuration
Register "dev_configure" API to configure/initialize the SDP VF PCIe devices. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst| 29 ++ drivers/common/octeontx2/hw/otx2_sdp.h | 184 + drivers/common/octeontx2/otx2_common.c | 9 + drivers/common/octeontx2/otx2_common.h | 4 + .../octeontx2/rte_common_octeontx2_version.map | 6 + drivers/raw/octeontx2_ep/Makefile | 3 + drivers/raw/octeontx2_ep/meson.build | 4 +- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 294 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 11 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 148 +++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 434 - drivers/raw/octeontx2_ep/otx2_ep_vf.c | 408 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + 13 files changed, 1542 insertions(+), 2 deletions(-) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 5f5ed01..2507fcf 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -39,3 +39,32 @@ entry `sriov_numvfs` for the corresponding PF driver. Once the required VFs are enabled, to be accessible from DPDK, VFs need to be bound to vfio-pci driver. + +Device Setup + + +The OCTEON TX2 SDP End Point VF devices will need to be bound to a +user-space IO driver for use. The script ``dpdk-devbind.py`` script +included with DPDK can be used to view the state of the devices and to bind +them to a suitable DPDK-supported kernel driver. When querying the status +of the devices, they will appear under the category of "Misc (rawdev) +devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be +used to see the state of those devices alone. + +Device Configuration + + +Configuring SDP EP rawdev device is done using the ``rte_rawdev_configure()`` +API, which takes the mempool as parameter. PMD uses this pool to send/receive +packets to/from the HW. + +The following code shows how the device is configured + +.. code-block:: c + + struct sdp_rawdev_info config = {0}; + struct rte_rawdev_info rdev_info = {.dev_private = &config}; + config.enqdeq_mpool = (void *)rte_mempool_create(...); + + rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); + diff --git a/drivers/common/octeontx2/hw/otx2_sdp.h b/drivers/common/octeontx2/hw/otx2_sdp.h new file mode 100644 index 000..1e690f8 --- /dev/null +++ b/drivers/common/octeontx2/hw/otx2_sdp.h @@ -0,0 +1,184 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#ifndef __OTX2_SDP_HW_H_ +#define __OTX2_SDP_HW_H_ + +/* SDP VF IOQs */ +#define SDP_MIN_RINGS_PER_VF(1) +#define SDP_MAX_RINGS_PER_VF(8) + +/* SDP VF IQ configuration */ +#define SDP_VF_MAX_IQ_DESCRIPTORS (512) +#define SDP_VF_MIN_IQ_DESCRIPTORS (128) + +#define SDP_VF_DB_MIN (1) +#define SDP_VF_DB_TIMEOUT (1) +#define SDP_VF_INTR_THRESHOLD (0x) + +#define SDP_VF_64BYTE_INSTR (64) +#define SDP_VF_32BYTE_INSTR (32) + +/* SDP VF OQ configuration */ +#define SDP_VF_MAX_OQ_DESCRIPTORS (512) +#define SDP_VF_MIN_OQ_DESCRIPTORS (128) +#define SDP_VF_OQ_BUF_SIZE (2048) +#define SDP_VF_OQ_REFIL_THRESHOLD (16) + +#define SDP_VF_OQ_INFOPTR_MODE (1) +#define SDP_VF_OQ_BUFPTR_MODE (0) + +#define SDP_VF_OQ_INTR_PKT (1) +#define SDP_VF_OQ_INTR_TIME (10) +#define SDP_VF_CFG_IO_QUEUESSDP_MAX_RINGS_PER_VF + +/* Wait time in milliseconds for FLR */ +#define SDP_VF_PCI_FLR_WAIT (100) +#define SDP_VF_BUSY_LOOP_COUNT (1) + +#define SDP_VF_MAX_IO_QUEUESSDP_MAX_RINGS_PER_VF +#define SDP_VF_MIN_IO_QUEUESSDP_MIN_RINGS_PER_VF + +/* SDP VF IOQs per rawdev */ +#define SDP_VF_MAX_IOQS_PER_RAWDEV SDP_VF_MAX_IO_QUEUES +#define SDP_VF_DEFAULT_IOQS_PER_RAWDEV SDP_VF_MIN_IO_QUEUES + +/* SDP VF Register definitions */ +#define SDP_VF_RING_OFFSET(0x1ull << 17) + +/* SDP VF IQ Registers */ +#define SDP_VF_R_IN_CONTROL_START (0x1) +#define SDP_VF_R_IN_ENABLE_START (0x10010) +#define SDP_VF_R_IN_INSTR_BADDR_START (0x10020) +#define SDP_VF_R_IN_INSTR_RSIZE_START (0x10030) +#define SDP_VF_R_IN_INSTR_DBELL_START (0x10040) +#define SDP_VF_R_IN_CNTS_START(0x10050) +#define SDP_VF_R_IN_INT_LEVELS_START (0x10060) +#define SDP_VF_R_IN_PKT_CNT_START (0x10080) +#define SDP_VF_R_IN_BYTE_CNT_START(0x10090) + +#define SDP_VF_R_IN_CONTROL(ring) \ + (SDP_VF_R_IN_CONTROL_START + ((ring) * SDP_VF_RING_OFFSET)) + +#define SDP_VF_R_IN_ENABLE(ring) \ + (SDP_VF_R_IN_ENABLE_START + ((ring) * SDP_VF_RING_OFFSET)) + +#define SDP_VF_R_IN_INSTR_BADDR(ring) \ +
[dpdk-dev] [PATCH v4 1/6] raw/octeontx2_ep: add build infra and device probe
Add the OCTEON TX2 SDP EP device probe along with the build infrastructure for Make and meson builds. Signed-off-by: Mahipal Challa --- MAINTAINERS| 5 + config/common_base | 5 + doc/guides/rawdevs/index.rst | 1 + doc/guides/rawdevs/octeontx2_ep.rst| 41 +++ drivers/raw/Makefile | 1 + drivers/raw/meson.build| 1 + drivers/raw/octeontx2_ep/Makefile | 40 +++ drivers/raw/octeontx2_ep/meson.build | 6 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 132 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 21 .../rte_rawdev_octeontx2_ep_version.map| 4 + mk/rte.app.mk | 2 + 12 files changed, 259 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 4395d8d..24f1240 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1173,6 +1173,11 @@ M: Vamsi Attunuru F: drivers/raw/octeontx2_dma/ F: doc/guides/rawdevs/octeontx2_dma.rst +Marvell OCTEON TX2 EP +M: Mahipal Challa +F: drivers/raw/octeontx2_ep/ +F: doc/guides/rawdevs/octeontx2_ep.rst + NTB M: Xiaoyun Li M: Jingjing Wu diff --git a/config/common_base b/config/common_base index 7dec7ed..8e7dad2 100644 --- a/config/common_base +++ b/config/common_base @@ -796,6 +796,11 @@ CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV=y # +# Compile PMD for octeontx2 EP raw device +# +CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y + +# # Compile PMD for NTB raw device # CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y diff --git a/doc/guides/rawdevs/index.rst b/doc/guides/rawdevs/index.rst index 22bc013..f64ec44 100644 --- a/doc/guides/rawdevs/index.rst +++ b/doc/guides/rawdevs/index.rst @@ -17,3 +17,4 @@ application through rawdev API. ioat ntb octeontx2_dma +octeontx2_ep diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst new file mode 100644 index 000..5f5ed01 --- /dev/null +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -0,0 +1,41 @@ +.. SPDX-License-Identifier: BSD-3-Clause +Copyright(c) 2019 Marvell International Ltd. + +Marvell OCTEON TX2 End Point Rawdev Driver +== + +OCTEON TX2 has an internal SDP unit which provides End Point mode of operation +by exposing its IOQs to Host, IOQs are used for packet I/O between Host and +OCTEON TX2. Each OCTEON TX2 SDP PF supports a max of 128 VFs and Each VF is +associated with a set of IOQ pairs. + +Features + + +This OCTEON TX2 End Point mode PMD supports + +#. Packet Input - Host to OCTEON TX2 with direct data instruction mode. + +#. Packet Output - OCTEON TX2 to Host with info pointer mode. + +Config File Options +~~~ + +The following options can be modified in the ``config`` file. + +- ``CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV`` (default ``y``) + + Toggle compilation of the ``lrte_pmd_octeontx2_ep`` driver. + +Initialization +-- + +The number of SDP VFs enabled, can be controlled by setting sysfs +entry `sriov_numvfs` for the corresponding PF driver. + +.. code-block:: console + + echo > /sys/bus/pci/drivers/octeontx2-ep/\:04\:00.0/sriov_numvfs + +Once the required VFs are enabled, to be accessible from DPDK, VFs need to be +bound to vfio-pci driver. diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index 0b6d13d..80b043e 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -13,5 +13,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat DIRS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) += ntb DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV) += octeontx2_dma +DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += octeontx2_ep include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/raw/meson.build b/drivers/raw/meson.build index d7037cd..bb57977 100644 --- a/drivers/raw/meson.build +++ b/drivers/raw/meson.build @@ -4,6 +4,7 @@ drivers = ['dpaa2_cmdif', 'dpaa2_qdma', 'ifpga', 'ioat', 'ntb', 'octeontx2_dma', + 'octeontx2_ep', 'skeleton'] std_deps = ['rawdev'] config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV' diff --git a/drivers/raw/octeontx2_ep/Makefile b/drivers/raw/octeontx2_ep/Makefile new file mode 100644 index 000..8cec6bd --- /dev/null +++ b/drivers/raw/octeontx2_ep/Makefile @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2019 Marvell International Ltd. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# Library name +LIB = librte_rawdev_octeontx2_ep.a + +# Build flags +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2/ +CFLAGS += -I$(RTE_SDK)/drivers/raw/octeontx2_ep/ +
[dpdk-dev] [PATCH v4 4/6] raw/octeontx2_ep: add enqueue operation
Add rawdev enqueue operation for SDP VF devices. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst | 6 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 242 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 39 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 20 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.c | 24 +++ 6 files changed, 332 insertions(+) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 2507fcf..39a7c29 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -68,3 +68,9 @@ The following code shows how the device is configured rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); +Performing Data Transfer + + +To perform data transfer using SDP VF EP rawdev devices use standard +``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` APIs. + diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 584b818..87ca3cd 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -403,3 +403,245 @@ return -ENOMEM; } +static inline void +sdp_iqreq_delete(struct sdp_device *sdpvf, + struct sdp_instr_queue *iq, uint32_t idx) +{ + uint32_t reqtype; + void *buf; + + buf = iq->req_list[idx].buf; + reqtype = iq->req_list[idx].reqtype; + + switch (reqtype) { + case SDP_REQTYPE_NORESP: + rte_mempool_put(sdpvf->enqdeq_mpool, buf); + otx2_sdp_dbg("IQ buffer freed at idx[%d]", idx); + break; + + case SDP_REQTYPE_NORESP_GATHER: + case SDP_REQTYPE_NONE: + default: + otx2_info("This iqreq mode is not supported:%d", reqtype); + + } + + /* Reset the request list at this index */ + iq->req_list[idx].buf = NULL; + iq->req_list[idx].reqtype = 0; +} + +static inline void +sdp_iqreq_add(struct sdp_instr_queue *iq, void *buf, + uint32_t reqtype) +{ + iq->req_list[iq->host_write_index].buf = buf; + iq->req_list[iq->host_write_index].reqtype = reqtype; + + otx2_sdp_dbg("IQ buffer added at idx[%d]", iq->host_write_index); + +} + +static void +sdp_flush_iq(struct sdp_device *sdpvf, + struct sdp_instr_queue *iq, + uint32_t pending_thresh __rte_unused) +{ + uint32_t instr_processed = 0; + + rte_spinlock_lock(&iq->lock); + + iq->otx_read_index = sdpvf->fn_list.update_iq_read_idx(iq); + while (iq->flush_index != iq->otx_read_index) { + /* Free the IQ data buffer to the pool */ + sdp_iqreq_delete(sdpvf, iq, iq->flush_index); + iq->flush_index = + sdp_incr_index(iq->flush_index, 1, iq->nb_desc); + + instr_processed++; + } + + iq->stats.instr_processed = instr_processed; + rte_atomic64_sub(&iq->instr_pending, instr_processed); + + rte_spinlock_unlock(&iq->lock); +} + +static inline void +sdp_ring_doorbell(struct sdp_device *sdpvf __rte_unused, + struct sdp_instr_queue *iq) +{ + otx2_write64(iq->fill_cnt, iq->doorbell_reg); + + /* Make sure doorbell writes observed by HW */ + rte_cio_wmb(); + iq->fill_cnt = 0; + +} + +static inline int +post_iqcmd(struct sdp_instr_queue *iq, uint8_t *iqcmd) +{ + uint8_t *iqptr, cmdsize; + + /* This ensures that the read index does not wrap around to +* the same position if queue gets full before OCTEON TX2 could +* fetch any instr. +*/ + if (rte_atomic64_read(&iq->instr_pending) >= + (int32_t)(iq->nb_desc - 1)) { + otx2_err("IQ is full, pending:%ld", +(long)rte_atomic64_read(&iq->instr_pending)); + + return SDP_IQ_SEND_FAILED; + } + + /* Copy cmd into iq */ + cmdsize = ((iq->iqcmd_64B) ? 64 : 32); + iqptr = iq->base_addr + (cmdsize * iq->host_write_index); + + rte_memcpy(iqptr, iqcmd, cmdsize); + + otx2_sdp_dbg("IQ cmd posted @ index:%d", iq->host_write_index); + + /* Increment the host write index */ + iq->host_write_index = + sdp_incr_index(iq->host_write_index, 1, iq->nb_desc); + + iq->fill_cnt++; + + /* Flush the command into memory. We need to be sure the data +* is in memory before indicating that the instruction is +* pending. +*/ + rte_smp_wmb(); + rte_atomic64_inc(&iq->instr_pending); + + /* SDP_IQ_SEND_SUCCESS */ + return 0; +} + + +stat
[dpdk-dev] [PATCH v4 5/6] raw/octeontx2_ep: add dequeue operation
Add rawdev dequeue operation for SDP VF devices. Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 197 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 2 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 18 ++- 4 files changed, 217 insertions(+), 1 deletion(-) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 87ca3cd..b9287a5 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -260,6 +260,7 @@ rte_mempool_get(sdpvf->enqdeq_mpool, &buf); if (buf == NULL) { otx2_err("OQ buffer alloc failed"); + droq->stats.rx_alloc_failure++; /* sdp_droq_destroy_ring_buffers(droq);*/ return -ENOMEM; } @@ -645,3 +646,199 @@ return SDP_IQ_SEND_FAILED; } +static uint32_t +sdp_droq_refill(struct sdp_device *sdpvf, struct sdp_droq *droq) +{ + struct sdp_droq_desc *desc_ring; + uint32_t desc_refilled = 0; + void *buf = NULL; + + desc_ring = droq->desc_ring; + + while (droq->refill_count && (desc_refilled < droq->nb_desc)) { + /* If a valid buffer exists (happens if there is no dispatch), +* reuse the buffer, else allocate. +*/ + if (droq->recv_buf_list[droq->refill_idx].buffer != NULL) + break; + + rte_mempool_get(sdpvf->enqdeq_mpool, &buf); + /* If a buffer could not be allocated, no point in +* continuing +*/ + if (buf == NULL) { + droq->stats.rx_alloc_failure++; + break; + } + + droq->recv_buf_list[droq->refill_idx].buffer = buf; + desc_ring[droq->refill_idx].buffer_ptr = rte_mem_virt2iova(buf); + + /* Reset any previous values in the length field. */ + droq->info_list[droq->refill_idx].length = 0; + + droq->refill_idx = sdp_incr_index(droq->refill_idx, 1, + droq->nb_desc); + + desc_refilled++; + droq->refill_count--; + + } + + return desc_refilled; +} + +static int +sdp_droq_read_packet(struct sdp_device *sdpvf __rte_unused, +struct sdp_droq *droq, +struct sdp_droq_pkt *droq_pkt) +{ + struct sdp_droq_info *info; + uint32_t total_len = 0; + uint32_t pkt_len = 0; + + info = &droq->info_list[droq->read_idx]; + sdp_swap_8B_data((uint64_t *)&info->length, 1); + if (!info->length) { + otx2_err("OQ info_list->length[%ld]", (long)info->length); + goto oq_read_fail; + } + + /* Deduce the actual data size */ + info->length -= SDP_RH_SIZE; + total_len += (uint32_t)info->length; + + otx2_sdp_dbg("OQ: pkt_len[%ld], buffer_size %d", + (long)info->length, droq->buffer_size); + if (info->length > droq->buffer_size) { + otx2_err("This mode is not supported: pkt_len > buffer_size"); + goto oq_read_fail; + } + + if (info->length <= droq->buffer_size) { + pkt_len = (uint32_t)info->length; + droq_pkt->data = droq->recv_buf_list[droq->read_idx].buffer; + droq_pkt->len = pkt_len; + + droq->recv_buf_list[droq->read_idx].buffer = NULL; + droq->read_idx = sdp_incr_index(droq->read_idx, 1,/* count */ + droq->nb_desc /* max rd idx */); + droq->refill_count++; + + } + + info->length = 0; + + return SDP_OQ_RECV_SUCCESS; + +oq_read_fail: + return SDP_OQ_RECV_FAILED; +} + +static inline uint32_t +sdp_check_droq_pkts(struct sdp_droq *droq, uint32_t burst_size) +{ + uint32_t min_pkts = 0; + uint32_t new_pkts; + uint32_t pkt_count; + + /* Latest available OQ packets */ + pkt_count = rte_read32(droq->pkts_sent_reg); + + /* Newly arrived packets */ + new_pkts = pkt_count - droq->last_pkt_count; + otx2_sdp_dbg("Recvd [%d] new OQ pkts", new_pkts); + + min_pkts = (new_pkts > burst_size) ? burst_size : new_pkts; + if (min_pkts) { + rte_atomic64_add(&droq->pkts_pending, min_pkts); + /* Back up the aggregated packet count so far */ + droq->last_pkt_count += min_pkts; + } + + return min_pkts; +} + +/* Check for response
[dpdk-dev] [PATCH v4 3/6] raw/octeontx2_ep: add device uninitialization
Add rawdev close/uninitialize operation for SDP VF devices. Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 111 ++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 78 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 8 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.c | 44 4 files changed, 241 insertions(+) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 8857004..584b818 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -21,6 +21,59 @@ #include "otx2_common.h" #include "otx2_ep_enqdeq.h" +static void +sdp_dmazone_free(const struct rte_memzone *mz) +{ + const struct rte_memzone *mz_tmp; + int ret = 0; + + if (mz == NULL) { + otx2_err("Memzone %s : NULL", mz->name); + return; + } + + mz_tmp = rte_memzone_lookup(mz->name); + if (mz_tmp == NULL) { + otx2_err("Memzone %s Not Found", mz->name); + return; + } + + ret = rte_memzone_free(mz); + if (ret) + otx2_err("Memzone free failed : ret = %d", ret); + +} + +/* Free IQ resources */ +int +sdp_delete_iqs(struct sdp_device *sdpvf, uint32_t iq_no) +{ + struct sdp_instr_queue *iq; + + iq = sdpvf->instr_queue[iq_no]; + if (iq == NULL) { + otx2_err("Invalid IQ[%d]\n", iq_no); + return -ENOMEM; + } + + rte_free(iq->req_list); + iq->req_list = NULL; + + if (iq->iq_mz) { + sdp_dmazone_free(iq->iq_mz); + iq->iq_mz = NULL; + } + + rte_free(sdpvf->instr_queue[iq_no]); + sdpvf->instr_queue[iq_no] = NULL; + + sdpvf->num_iqs--; + + otx2_info("IQ[%d] is deleted", iq_no); + + return 0; +} + /* IQ initialization */ static int sdp_init_instr_queue(struct sdp_device *sdpvf, int iq_no) @@ -126,6 +179,7 @@ return 0; delete_IQ: + sdp_delete_iqs(sdpvf, iq_no); return -ENOMEM; } @@ -139,6 +193,61 @@ rte_atomic64_set(&droq->pkts_pending, 0); } +static void +sdp_droq_destroy_ring_buffers(struct sdp_device *sdpvf, + struct sdp_droq *droq) +{ + uint32_t idx; + + for (idx = 0; idx < droq->nb_desc; idx++) { + if (droq->recv_buf_list[idx].buffer) { + rte_mempool_put(sdpvf->enqdeq_mpool, + droq->recv_buf_list[idx].buffer); + + droq->recv_buf_list[idx].buffer = NULL; + } + } + + sdp_droq_reset_indices(droq); +} + +/* Free OQs resources */ +int +sdp_delete_oqs(struct sdp_device *sdpvf, uint32_t oq_no) +{ + struct sdp_droq *droq; + + droq = sdpvf->droq[oq_no]; + if (droq == NULL) { + otx2_err("Invalid droq[%d]", oq_no); + return -ENOMEM; + } + + sdp_droq_destroy_ring_buffers(sdpvf, droq); + rte_free(droq->recv_buf_list); + droq->recv_buf_list = NULL; + + if (droq->info_mz) { + sdp_dmazone_free(droq->info_mz); + droq->info_mz = NULL; + } + + if (droq->desc_ring_mz) { + sdp_dmazone_free(droq->desc_ring_mz); + droq->desc_ring_mz = NULL; + } + + memset(droq, 0, SDP_DROQ_SIZE); + + rte_free(sdpvf->droq[oq_no]); + sdpvf->droq[oq_no] = NULL; + + sdpvf->num_oqs--; + + otx2_info("OQ[%d] is deleted", oq_no); + return 0; +} + static int sdp_droq_setup_ring_buffers(struct sdp_device *sdpvf, struct sdp_droq *droq) @@ -290,5 +399,7 @@ return 0; delete_OQ: + sdp_delete_oqs(sdpvf, oq_no); return -ENOMEM; } + diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c index 0c56609..3db5a74 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c @@ -63,6 +63,45 @@ } static int +sdp_vfdev_exit(struct rte_rawdev *rawdev) +{ + struct sdp_device *sdpvf; + uint32_t rawdev_queues, q; + + otx2_info("%s:", __func__); + + sdpvf = (struct sdp_device *)rawdev->dev_private; + + sdpvf->fn_list.disable_io_queues(sdpvf); + + rawdev_queues = sdpvf->num_oqs; + for (q = 0; q < rawdev_queues; q++) { + if (sdp_delete_oqs(sdpvf, q)) { + otx2_err("Failed to delete OQ:%d", q); + return -ENOMEM; + } + } + otx2_info("Num OQs:%d freed", sdpvf->num_oqs); + + /* Free the oqbuf_pool */ + rte_mempool_free(sdpv
[dpdk-dev] [PATCH v4 6/6] raw/octeontx2_ep: add driver self test
Add rawdev's selftest feature in SDP VF driver, which verifies the EP mode functionality test. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst | 13 +++ drivers/raw/octeontx2_ep/Makefile | 1 + drivers/raw/octeontx2_ep/meson.build | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 2 + drivers/raw/octeontx2_ep/otx2_ep_test.c | 173 ++ 6 files changed, 191 insertions(+) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 39a7c29..bbcf530 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -74,3 +74,16 @@ Performing Data Transfer To perform data transfer using SDP VF EP rawdev devices use standard ``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` APIs. +Self test +- + +On EAL initialization, SDP VF devices will be probed and populated into the +raw devices. The rawdev ID of the device can be obtained using + +* Invoke ``rte_rawdev_get_dev_id("SDPEP:x")`` from the test application + where x is the VF device's bus id specified in "bus:device.func"(BDF) + format. Use this index for further rawdev function calls. + +* The driver's selftest rawdev API can be used to verify the SDP EP mode + functional tests which can send/receive the raw data packets to/from the + EP device. diff --git a/drivers/raw/octeontx2_ep/Makefile b/drivers/raw/octeontx2_ep/Makefile index 02853fb..44fdf89 100644 --- a/drivers/raw/octeontx2_ep/Makefile +++ b/drivers/raw/octeontx2_ep/Makefile @@ -37,6 +37,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_rawdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_enqdeq.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_test.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_vf.c diff --git a/drivers/raw/octeontx2_ep/meson.build b/drivers/raw/octeontx2_ep/meson.build index 99e6c6d..0e6338f 100644 --- a/drivers/raw/octeontx2_ep/meson.build +++ b/drivers/raw/octeontx2_ep/meson.build @@ -5,4 +5,5 @@ deps += ['bus_pci', 'common_octeontx2', 'rawdev'] sources = files('otx2_ep_rawdev.c', 'otx2_ep_enqdeq.c', + 'otx2_ep_test.c', 'otx2_ep_vf.c') diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c index 7158b97..0778603 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c @@ -253,6 +253,7 @@ .dev_close = sdp_rawdev_close, .enqueue_bufs = sdp_rawdev_enqueue, .dequeue_bufs = sdp_rawdev_dequeue, + .dev_selftest = sdp_rawdev_selftest, }; static int diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h index a77cbab..dab2fb7 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h @@ -494,4 +494,6 @@ int sdp_rawdev_enqueue(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, int sdp_rawdev_dequeue(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, unsigned int count, rte_rawdev_obj_t context); +int sdp_rawdev_selftest(uint16_t dev_id); + #endif /* _OTX2_EP_RAWDEV_H_ */ diff --git a/drivers/raw/octeontx2_ep/otx2_ep_test.c b/drivers/raw/octeontx2_ep/otx2_ep_test.c new file mode 100644 index 000..9746840 --- /dev/null +++ b/drivers/raw/octeontx2_ep/otx2_ep_test.c @@ -0,0 +1,173 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "otx2_common.h" +#include "otx2_ep_rawdev.h" + +#define SDP_IOQ_NUM_BUFS (4 * 1024) +#define SDP_IOQ_BUF_SIZE (2 * 1024) + +#define SDP_TEST_PKT_FSZ (0) +#define SDP_TEST_PKT_SIZE (1024) + +static int +sdp_validate_data(struct sdp_droq_pkt *oq_pkt, uint8_t *iq_pkt, + uint32_t pkt_len) +{ + if (!oq_pkt) + return -EINVAL; + + if (pkt_len != oq_pkt->len) { + otx2_err("Invalid packet length"); + return -EINVAL; + } + + if (memcmp(oq_pkt->data, iq_pkt, pkt_len) != 0) { + otx2_err("Data validation failed"); + return -EINVAL; + } + otx2_sdp_dbg("Data validation successful"); + + return 0; +} + +static void +sdp_ioq_buffer_fill(uint8_t *addr, uint32_t len) +{ + uint32_t idx; + + memset(addr, 0, len); + + for (idx = 0; idx < len; idx++) + addr[idx] = idx; +} + +static struct rte_mempool* +sdp_ioq_mempool_
Re: [dpdk-dev] [PATCH v4 0/6] OCTEON TX2 End Point Driver
Hi Gavin, We have incorporated the changes you suggested in v3, please ack. We like to take up performance improvement optimizations later( that you suggested in v3) and upstream in the future, so for this release 20.02 we like to go with the existing patch set sources(v4), please ack. Thanks, Mahipal > -Original Message- > From: dev On Behalf Of Mahipal Challa > Sent: Tuesday, January 7, 2020 7:53 PM > To: dev@dpdk.org > Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju > Athreya ; Subrahmanyam Nilla > ; Venkateshwarlu Nalla ; > gavin...@arm.com > Subject: [dpdk-dev] [PATCH v4 0/6] OCTEON TX2 End Point Driver > > This patchset adds support for OCTEON TX2 end point mode of operation. > The driver implementation uses DPDK rawdevice sub-system. > > v2: > * Updated memory barrior API's as per Gavin Hu suggestion. > > v3: > * Fixed memory leak possibility issues. > > v4: > * Improved error handling in selftest API. > > Mahipal Challa (6): > raw/octeontx2_ep: add build infra and device probe > raw/octeontx2_ep: add device configuration > raw/octeontx2_ep: add device uninitialization > raw/octeontx2_ep: add enqueue operation > raw/octeontx2_ep: add dequeue operation > raw/octeontx2_ep: add driver self test > > MAINTAINERS| 5 + > config/common_base | 5 + > doc/guides/rawdevs/index.rst | 1 + > doc/guides/rawdevs/octeontx2_ep.rst| 89 +++ > drivers/common/octeontx2/hw/otx2_sdp.h | 184 + > drivers/common/octeontx2/otx2_common.c | 9 + > drivers/common/octeontx2/otx2_common.h | 4 + > .../octeontx2/rte_common_octeontx2_version.map | 6 + > drivers/raw/Makefile | 1 + > drivers/raw/meson.build| 1 + > drivers/raw/octeontx2_ep/Makefile | 44 ++ > drivers/raw/octeontx2_ep/meson.build | 9 + > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 844 > + > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 52 ++ > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 361 + > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 499 > drivers/raw/octeontx2_ep/otx2_ep_test.c| 173 + > drivers/raw/octeontx2_ep/otx2_ep_vf.c | 476 > drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + > .../rte_rawdev_octeontx2_ep_version.map| 4 + > mk/rte.app.mk | 2 + > 21 files changed, 2779 insertions(+) > create mode 100644 doc/guides/rawdevs/octeontx2_ep.rst > create mode 100644 drivers/common/octeontx2/hw/otx2_sdp.h > create mode 100644 drivers/raw/octeontx2_ep/Makefile create mode > 100644 drivers/raw/octeontx2_ep/meson.build > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_test.c > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.c > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.h > create mode 100644 > drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map > > -- > 1.8.3.1
Re: [dpdk-dev] [PATCH v4 0/6] OCTEON TX2 End Point Driver
Hi Thomas, Assuming that this series is ready for merging now, would you please merge this series. Thank you Gavin for reviewing the series. Thanks, Mahipal > -Original Message- > From: Gavin Hu > Sent: Wednesday, January 8, 2020 1:45 PM > To: Mahipal Challa ; dev@dpdk.org; > tho...@monjalon.net; Jerin Jacob Kollanukkaran > Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju > Athreya ; Subrahmanyam Nilla > ; Venkateshwarlu Nalla ; nd > > Subject: [EXT] RE: [dpdk-dev] [PATCH v4 0/6] OCTEON TX2 End Point Driver > > External Email > > -- > Hi Mahipal, > > Please cc me in your future optimization patches. > > Series-reviewed-by: Gavin Hu > > > > -Original Message- > > From: Mahipal Challa > > Sent: Wednesday, January 8, 2020 3:32 PM > > To: dev@dpdk.org; tho...@monjalon.net; jer...@marvell.com; Gavin Hu > > > > Cc: jer...@marvell.com; Narayana Prasad Raju Athreya > > ; Subrahmanyam Nilla ; > > Venkateshwarlu Nalla ; Gavin Hu > > > > Subject: RE: [dpdk-dev] [PATCH v4 0/6] OCTEON TX2 End Point Driver > > > > Hi Gavin, > > We have incorporated the changes you suggested in v3, please ack. > > We like to take up performance improvement optimizations later( that > > you suggested in v3) and upstream in the future, so for this release > > 20.02 we like to go with the existing patch set sources(v4), please ack. > > > > Thanks, > > Mahipal > > > > > -Original Message- > > > From: dev On Behalf Of Mahipal Challa > > > Sent: Tuesday, January 7, 2020 7:53 PM > > > To: dev@dpdk.org > > > Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad > > > Raju Athreya ; Subrahmanyam Nilla > > > ; Venkateshwarlu Nalla ; > > > gavin...@arm.com > > > Subject: [dpdk-dev] [PATCH v4 0/6] OCTEON TX2 End Point Driver > > > > > > This patchset adds support for OCTEON TX2 end point mode of > operation. > > > The driver implementation uses DPDK rawdevice sub-system. > > > > > > v2: > > > * Updated memory barrior API's as per Gavin Hu suggestion. > > > > > > v3: > > > * Fixed memory leak possibility issues. > > > > > > v4: > > > * Improved error handling in selftest API. > > > > > > Mahipal Challa (6): > > > raw/octeontx2_ep: add build infra and device probe > > > raw/octeontx2_ep: add device configuration > > > raw/octeontx2_ep: add device uninitialization > > > raw/octeontx2_ep: add enqueue operation > > > raw/octeontx2_ep: add dequeue operation > > > raw/octeontx2_ep: add driver self test > > > > > > MAINTAINERS| 5 + > > > config/common_base | 5 + > > > doc/guides/rawdevs/index.rst | 1 + > > > doc/guides/rawdevs/octeontx2_ep.rst| 89 +++ > > > drivers/common/octeontx2/hw/otx2_sdp.h | 184 + > > > drivers/common/octeontx2/otx2_common.c | 9 + > > > drivers/common/octeontx2/otx2_common.h | 4 + > > > .../octeontx2/rte_common_octeontx2_version.map | 6 + > > > drivers/raw/Makefile | 1 + > > > drivers/raw/meson.build| 1 + > > > drivers/raw/octeontx2_ep/Makefile | 44 ++ > > > drivers/raw/octeontx2_ep/meson.build | 9 + > > > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 844 > > > + > > > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 52 ++ > > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 361 + > > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 499 > > > drivers/raw/octeontx2_ep/otx2_ep_test.c| 173 + > > > drivers/raw/octeontx2_ep/otx2_ep_vf.c | 476 > > > drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + > > > .../rte_rawdev_octeontx2_ep_version.map| 4 + > > > mk/rte.app.mk | 2 + > > > 21 files changed, 2779 insertions(+) create mode 100644 > > > doc/guides/rawdevs/octeontx2_ep.rst > > > create mode 100644 drivers/common/octeontx2/hw/otx2_sdp.h > > > create mode 100644 drivers/raw/octeontx2_ep/Makefile create mode > > > 100644 drivers/raw/octeontx2_ep/meson.build > > > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > > > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h > > > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > > > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > > > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_test.c > > > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.c > > > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.h > > > create mode 100644 > > > drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map > > > > > > -- > > > 1.8.3.1
Re: [dpdk-dev] [EXT] Re: [PATCH v4 0/6] OCTEON TX2 End Point Driver
Hi Jerin, Please see the response inline. > -Original Message- > From: Jerin Jacob > Sent: Friday, January 10, 2020 1:19 PM > To: Mahipal Challa > Cc: dpdk-dev ; Jerin Jacob Kollanukkaran > ; Narayana Prasad Raju Athreya > ; Subrahmanyam Nilla ; > Venkateshwarlu Nalla ; Gavin Hu > > Subject: [EXT] Re: [dpdk-dev] [PATCH v4 0/6] OCTEON TX2 End Point Driver > > External Email > > ------ > On Tue, Jan 7, 2020 at 7:53 PM Mahipal Challa > wrote: > > > > This patchset adds support for OCTEON TX2 end point mode of operation. > > The driver implementation uses DPDK rawdevice sub-system. > > > > v2: > > * Updated memory barrior API's as per Gavin Hu suggestion. > > > > v3: > > * Fixed memory leak possibility issues. > > > > v4: > > * Improved error handling in selftest API. > > > > Mahipal Challa (6): > > raw/octeontx2_ep: add build infra and device probe > > raw/octeontx2_ep: add device configuration > > raw/octeontx2_ep: add device uninitialization > > raw/octeontx2_ep: add enqueue operation > > raw/octeontx2_ep: add dequeue operation > > raw/octeontx2_ep: add driver self test > > > > MAINTAINERS| 5 + > > config/common_base | 5 + > > doc/guides/rawdevs/index.rst | 1 + > > doc/guides/rawdevs/octeontx2_ep.rst| 89 +++ > > > Please update the release notes as well (See > doc/guides/rel_notes/release_20_02.rst) [Mahipal]: Sure, will update it and send the new series v5 patch set. Thanks, Mahipal
[dpdk-dev] [PATCH v5 2/6] raw/octeontx2_ep: add device configuration
Register "dev_configure" API to configure/initialize the SDP VF PCIe devices. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst| 29 ++ drivers/common/octeontx2/hw/otx2_sdp.h | 184 + drivers/common/octeontx2/otx2_common.c | 9 + drivers/common/octeontx2/otx2_common.h | 4 + .../octeontx2/rte_common_octeontx2_version.map | 6 + drivers/raw/octeontx2_ep/Makefile | 3 + drivers/raw/octeontx2_ep/meson.build | 4 +- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 294 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 11 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 148 +++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 434 - drivers/raw/octeontx2_ep/otx2_ep_vf.c | 408 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + 13 files changed, 1542 insertions(+), 2 deletions(-) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 5f5ed01..2507fcf 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -39,3 +39,32 @@ entry `sriov_numvfs` for the corresponding PF driver. Once the required VFs are enabled, to be accessible from DPDK, VFs need to be bound to vfio-pci driver. + +Device Setup + + +The OCTEON TX2 SDP End Point VF devices will need to be bound to a +user-space IO driver for use. The script ``dpdk-devbind.py`` script +included with DPDK can be used to view the state of the devices and to bind +them to a suitable DPDK-supported kernel driver. When querying the status +of the devices, they will appear under the category of "Misc (rawdev) +devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be +used to see the state of those devices alone. + +Device Configuration + + +Configuring SDP EP rawdev device is done using the ``rte_rawdev_configure()`` +API, which takes the mempool as parameter. PMD uses this pool to send/receive +packets to/from the HW. + +The following code shows how the device is configured + +.. code-block:: c + + struct sdp_rawdev_info config = {0}; + struct rte_rawdev_info rdev_info = {.dev_private = &config}; + config.enqdeq_mpool = (void *)rte_mempool_create(...); + + rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); + diff --git a/drivers/common/octeontx2/hw/otx2_sdp.h b/drivers/common/octeontx2/hw/otx2_sdp.h new file mode 100644 index 000..1e690f8 --- /dev/null +++ b/drivers/common/octeontx2/hw/otx2_sdp.h @@ -0,0 +1,184 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#ifndef __OTX2_SDP_HW_H_ +#define __OTX2_SDP_HW_H_ + +/* SDP VF IOQs */ +#define SDP_MIN_RINGS_PER_VF(1) +#define SDP_MAX_RINGS_PER_VF(8) + +/* SDP VF IQ configuration */ +#define SDP_VF_MAX_IQ_DESCRIPTORS (512) +#define SDP_VF_MIN_IQ_DESCRIPTORS (128) + +#define SDP_VF_DB_MIN (1) +#define SDP_VF_DB_TIMEOUT (1) +#define SDP_VF_INTR_THRESHOLD (0x) + +#define SDP_VF_64BYTE_INSTR (64) +#define SDP_VF_32BYTE_INSTR (32) + +/* SDP VF OQ configuration */ +#define SDP_VF_MAX_OQ_DESCRIPTORS (512) +#define SDP_VF_MIN_OQ_DESCRIPTORS (128) +#define SDP_VF_OQ_BUF_SIZE (2048) +#define SDP_VF_OQ_REFIL_THRESHOLD (16) + +#define SDP_VF_OQ_INFOPTR_MODE (1) +#define SDP_VF_OQ_BUFPTR_MODE (0) + +#define SDP_VF_OQ_INTR_PKT (1) +#define SDP_VF_OQ_INTR_TIME (10) +#define SDP_VF_CFG_IO_QUEUESSDP_MAX_RINGS_PER_VF + +/* Wait time in milliseconds for FLR */ +#define SDP_VF_PCI_FLR_WAIT (100) +#define SDP_VF_BUSY_LOOP_COUNT (1) + +#define SDP_VF_MAX_IO_QUEUESSDP_MAX_RINGS_PER_VF +#define SDP_VF_MIN_IO_QUEUESSDP_MIN_RINGS_PER_VF + +/* SDP VF IOQs per rawdev */ +#define SDP_VF_MAX_IOQS_PER_RAWDEV SDP_VF_MAX_IO_QUEUES +#define SDP_VF_DEFAULT_IOQS_PER_RAWDEV SDP_VF_MIN_IO_QUEUES + +/* SDP VF Register definitions */ +#define SDP_VF_RING_OFFSET(0x1ull << 17) + +/* SDP VF IQ Registers */ +#define SDP_VF_R_IN_CONTROL_START (0x1) +#define SDP_VF_R_IN_ENABLE_START (0x10010) +#define SDP_VF_R_IN_INSTR_BADDR_START (0x10020) +#define SDP_VF_R_IN_INSTR_RSIZE_START (0x10030) +#define SDP_VF_R_IN_INSTR_DBELL_START (0x10040) +#define SDP_VF_R_IN_CNTS_START(0x10050) +#define SDP_VF_R_IN_INT_LEVELS_START (0x10060) +#define SDP_VF_R_IN_PKT_CNT_START (0x10080) +#define SDP_VF_R_IN_BYTE_CNT_START(0x10090) + +#define SDP_VF_R_IN_CONTROL(ring) \ + (SDP_VF_R_IN_CONTROL_START + ((ring) * SDP_VF_RING_OFFSET)) + +#define SDP_VF_R_IN_ENABLE(ring) \ + (SDP_VF_R_IN_ENABLE_START + ((ring) * SDP_VF_RING_OFFSET)) + +#define SDP_VF_R_IN_INSTR_BADDR(ring) \ +
[dpdk-dev] [PATCH v5 1/6] raw/octeontx2_ep: add build infra and device probe
Add the OCTEON TX2 SDP EP device probe along with the build infrastructure for Make and meson builds. Signed-off-by: Mahipal Challa --- MAINTAINERS| 5 + config/common_base | 5 + doc/guides/rawdevs/index.rst | 1 + doc/guides/rawdevs/octeontx2_ep.rst| 41 +++ doc/guides/rel_notes/release_20_02.rst | 4 + drivers/raw/Makefile | 1 + drivers/raw/meson.build| 1 + drivers/raw/octeontx2_ep/Makefile | 40 +++ drivers/raw/octeontx2_ep/meson.build | 6 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 132 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 21 .../rte_rawdev_octeontx2_ep_version.map| 4 + mk/rte.app.mk | 2 + 13 files changed, 263 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 4395d8d..24f1240 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1173,6 +1173,11 @@ M: Vamsi Attunuru F: drivers/raw/octeontx2_dma/ F: doc/guides/rawdevs/octeontx2_dma.rst +Marvell OCTEON TX2 EP +M: Mahipal Challa +F: drivers/raw/octeontx2_ep/ +F: doc/guides/rawdevs/octeontx2_ep.rst + NTB M: Xiaoyun Li M: Jingjing Wu diff --git a/config/common_base b/config/common_base index 7dec7ed..8e7dad2 100644 --- a/config/common_base +++ b/config/common_base @@ -796,6 +796,11 @@ CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV=y # +# Compile PMD for octeontx2 EP raw device +# +CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y + +# # Compile PMD for NTB raw device # CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y diff --git a/doc/guides/rawdevs/index.rst b/doc/guides/rawdevs/index.rst index 22bc013..f64ec44 100644 --- a/doc/guides/rawdevs/index.rst +++ b/doc/guides/rawdevs/index.rst @@ -17,3 +17,4 @@ application through rawdev API. ioat ntb octeontx2_dma +octeontx2_ep diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst new file mode 100644 index 000..5f5ed01 --- /dev/null +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -0,0 +1,41 @@ +.. SPDX-License-Identifier: BSD-3-Clause +Copyright(c) 2019 Marvell International Ltd. + +Marvell OCTEON TX2 End Point Rawdev Driver +== + +OCTEON TX2 has an internal SDP unit which provides End Point mode of operation +by exposing its IOQs to Host, IOQs are used for packet I/O between Host and +OCTEON TX2. Each OCTEON TX2 SDP PF supports a max of 128 VFs and Each VF is +associated with a set of IOQ pairs. + +Features + + +This OCTEON TX2 End Point mode PMD supports + +#. Packet Input - Host to OCTEON TX2 with direct data instruction mode. + +#. Packet Output - OCTEON TX2 to Host with info pointer mode. + +Config File Options +~~~ + +The following options can be modified in the ``config`` file. + +- ``CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV`` (default ``y``) + + Toggle compilation of the ``lrte_pmd_octeontx2_ep`` driver. + +Initialization +-- + +The number of SDP VFs enabled, can be controlled by setting sysfs +entry `sriov_numvfs` for the corresponding PF driver. + +.. code-block:: console + + echo > /sys/bus/pci/drivers/octeontx2-ep/\:04\:00.0/sriov_numvfs + +Once the required VFs are enabled, to be accessible from DPDK, VFs need to be +bound to vfio-pci driver. diff --git a/doc/guides/rel_notes/release_20_02.rst b/doc/guides/rel_notes/release_20_02.rst index 0eaa45a..ec9be83 100644 --- a/doc/guides/rel_notes/release_20_02.rst +++ b/doc/guides/rel_notes/release_20_02.rst @@ -56,6 +56,10 @@ New Features Also, make sure to start the actual text at the margin. = +* **Added Marvell OCTEON TX2 End Point rawdev PMD.** + + Added a new OCTEON TX2 rawdev PMD for End Point mode of operation. + See the :doc:`../rawdevs/octeontx2_ep` for more details on this new PMD. Removed Items - diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index 0b6d13d..80b043e 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -13,5 +13,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat DIRS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) += ntb DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV) += octeontx2_dma +DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += octeontx2_ep include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/raw/meson.build b/drivers/raw/meson.build index d7037cd..bb57977 100644 --- a/drivers/raw/meson.build +++ b/drivers/raw/meson.build @@ -4,6 +4,7 @@ drivers = ['dpaa2_cmdif', 'dpaa2_qdma', 'ifpga', 'ioat', 'ntb', 'octeontx2_dma', + 'octeontx2_ep',
[dpdk-dev] [PATCH v5 0/6] OCTEON TX2 End Point Driver
This patchset adds support for OCTEON TX2 end point mode of operation. The driver implementation uses DPDK rawdevice sub-system. v2: * Updated memory barrier API's as per Gavin Hu suggestion. v3: * Fixed memory leak possibility issues. v4: * Improved error handling in selftest API. v5: * Updated "doc/guides/rel_notes/release_20_02.rst". Series-reviewed-by: Gavin Hu Mahipal Challa (6): raw/octeontx2_ep: add build infra and device probe raw/octeontx2_ep: add device configuration raw/octeontx2_ep: add device uninitialization raw/octeontx2_ep: add enqueue operation raw/octeontx2_ep: add dequeue operation raw/octeontx2_ep: add driver self test MAINTAINERS| 5 + config/common_base | 5 + doc/guides/rawdevs/index.rst | 1 + doc/guides/rawdevs/octeontx2_ep.rst| 89 +++ doc/guides/rel_notes/release_20_02.rst | 4 + drivers/common/octeontx2/hw/otx2_sdp.h | 184 + drivers/common/octeontx2/otx2_common.c | 9 + drivers/common/octeontx2/otx2_common.h | 4 + .../octeontx2/rte_common_octeontx2_version.map | 6 + drivers/raw/Makefile | 1 + drivers/raw/meson.build| 1 + drivers/raw/octeontx2_ep/Makefile | 44 ++ drivers/raw/octeontx2_ep/meson.build | 9 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 844 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 52 ++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 361 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 499 drivers/raw/octeontx2_ep/otx2_ep_test.c| 173 + drivers/raw/octeontx2_ep/otx2_ep_vf.c | 476 drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + .../rte_rawdev_octeontx2_ep_version.map| 4 + mk/rte.app.mk | 2 + 22 files changed, 2783 insertions(+) create mode 100644 doc/guides/rawdevs/octeontx2_ep.rst create mode 100644 drivers/common/octeontx2/hw/otx2_sdp.h create mode 100644 drivers/raw/octeontx2_ep/Makefile create mode 100644 drivers/raw/octeontx2_ep/meson.build create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.h create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_test.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.h create mode 100644 drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map -- 1.8.3.1
[dpdk-dev] [PATCH v5 3/6] raw/octeontx2_ep: add device uninitialization
Add rawdev close/uninitialize operation for SDP VF devices. Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 111 ++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 78 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 8 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.c | 44 4 files changed, 241 insertions(+) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 8857004..584b818 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -21,6 +21,59 @@ #include "otx2_common.h" #include "otx2_ep_enqdeq.h" +static void +sdp_dmazone_free(const struct rte_memzone *mz) +{ + const struct rte_memzone *mz_tmp; + int ret = 0; + + if (mz == NULL) { + otx2_err("Memzone %s : NULL", mz->name); + return; + } + + mz_tmp = rte_memzone_lookup(mz->name); + if (mz_tmp == NULL) { + otx2_err("Memzone %s Not Found", mz->name); + return; + } + + ret = rte_memzone_free(mz); + if (ret) + otx2_err("Memzone free failed : ret = %d", ret); + +} + +/* Free IQ resources */ +int +sdp_delete_iqs(struct sdp_device *sdpvf, uint32_t iq_no) +{ + struct sdp_instr_queue *iq; + + iq = sdpvf->instr_queue[iq_no]; + if (iq == NULL) { + otx2_err("Invalid IQ[%d]\n", iq_no); + return -ENOMEM; + } + + rte_free(iq->req_list); + iq->req_list = NULL; + + if (iq->iq_mz) { + sdp_dmazone_free(iq->iq_mz); + iq->iq_mz = NULL; + } + + rte_free(sdpvf->instr_queue[iq_no]); + sdpvf->instr_queue[iq_no] = NULL; + + sdpvf->num_iqs--; + + otx2_info("IQ[%d] is deleted", iq_no); + + return 0; +} + /* IQ initialization */ static int sdp_init_instr_queue(struct sdp_device *sdpvf, int iq_no) @@ -126,6 +179,7 @@ return 0; delete_IQ: + sdp_delete_iqs(sdpvf, iq_no); return -ENOMEM; } @@ -139,6 +193,61 @@ rte_atomic64_set(&droq->pkts_pending, 0); } +static void +sdp_droq_destroy_ring_buffers(struct sdp_device *sdpvf, + struct sdp_droq *droq) +{ + uint32_t idx; + + for (idx = 0; idx < droq->nb_desc; idx++) { + if (droq->recv_buf_list[idx].buffer) { + rte_mempool_put(sdpvf->enqdeq_mpool, + droq->recv_buf_list[idx].buffer); + + droq->recv_buf_list[idx].buffer = NULL; + } + } + + sdp_droq_reset_indices(droq); +} + +/* Free OQs resources */ +int +sdp_delete_oqs(struct sdp_device *sdpvf, uint32_t oq_no) +{ + struct sdp_droq *droq; + + droq = sdpvf->droq[oq_no]; + if (droq == NULL) { + otx2_err("Invalid droq[%d]", oq_no); + return -ENOMEM; + } + + sdp_droq_destroy_ring_buffers(sdpvf, droq); + rte_free(droq->recv_buf_list); + droq->recv_buf_list = NULL; + + if (droq->info_mz) { + sdp_dmazone_free(droq->info_mz); + droq->info_mz = NULL; + } + + if (droq->desc_ring_mz) { + sdp_dmazone_free(droq->desc_ring_mz); + droq->desc_ring_mz = NULL; + } + + memset(droq, 0, SDP_DROQ_SIZE); + + rte_free(sdpvf->droq[oq_no]); + sdpvf->droq[oq_no] = NULL; + + sdpvf->num_oqs--; + + otx2_info("OQ[%d] is deleted", oq_no); + return 0; +} + static int sdp_droq_setup_ring_buffers(struct sdp_device *sdpvf, struct sdp_droq *droq) @@ -290,5 +399,7 @@ return 0; delete_OQ: + sdp_delete_oqs(sdpvf, oq_no); return -ENOMEM; } + diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c index 0c56609..3db5a74 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c @@ -63,6 +63,45 @@ } static int +sdp_vfdev_exit(struct rte_rawdev *rawdev) +{ + struct sdp_device *sdpvf; + uint32_t rawdev_queues, q; + + otx2_info("%s:", __func__); + + sdpvf = (struct sdp_device *)rawdev->dev_private; + + sdpvf->fn_list.disable_io_queues(sdpvf); + + rawdev_queues = sdpvf->num_oqs; + for (q = 0; q < rawdev_queues; q++) { + if (sdp_delete_oqs(sdpvf, q)) { + otx2_err("Failed to delete OQ:%d", q); + return -ENOMEM; + } + } + otx2_info("Num OQs:%d freed", sdpvf->num_oqs); + + /* Free the oqbuf_pool */ + rte_mempool_free(sdpv
[dpdk-dev] [PATCH v5 5/6] raw/octeontx2_ep: add dequeue operation
Add rawdev dequeue operation for SDP VF devices. Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 197 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 2 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 18 ++- 4 files changed, 217 insertions(+), 1 deletion(-) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 87ca3cd..b9287a5 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -260,6 +260,7 @@ rte_mempool_get(sdpvf->enqdeq_mpool, &buf); if (buf == NULL) { otx2_err("OQ buffer alloc failed"); + droq->stats.rx_alloc_failure++; /* sdp_droq_destroy_ring_buffers(droq);*/ return -ENOMEM; } @@ -645,3 +646,199 @@ return SDP_IQ_SEND_FAILED; } +static uint32_t +sdp_droq_refill(struct sdp_device *sdpvf, struct sdp_droq *droq) +{ + struct sdp_droq_desc *desc_ring; + uint32_t desc_refilled = 0; + void *buf = NULL; + + desc_ring = droq->desc_ring; + + while (droq->refill_count && (desc_refilled < droq->nb_desc)) { + /* If a valid buffer exists (happens if there is no dispatch), +* reuse the buffer, else allocate. +*/ + if (droq->recv_buf_list[droq->refill_idx].buffer != NULL) + break; + + rte_mempool_get(sdpvf->enqdeq_mpool, &buf); + /* If a buffer could not be allocated, no point in +* continuing +*/ + if (buf == NULL) { + droq->stats.rx_alloc_failure++; + break; + } + + droq->recv_buf_list[droq->refill_idx].buffer = buf; + desc_ring[droq->refill_idx].buffer_ptr = rte_mem_virt2iova(buf); + + /* Reset any previous values in the length field. */ + droq->info_list[droq->refill_idx].length = 0; + + droq->refill_idx = sdp_incr_index(droq->refill_idx, 1, + droq->nb_desc); + + desc_refilled++; + droq->refill_count--; + + } + + return desc_refilled; +} + +static int +sdp_droq_read_packet(struct sdp_device *sdpvf __rte_unused, +struct sdp_droq *droq, +struct sdp_droq_pkt *droq_pkt) +{ + struct sdp_droq_info *info; + uint32_t total_len = 0; + uint32_t pkt_len = 0; + + info = &droq->info_list[droq->read_idx]; + sdp_swap_8B_data((uint64_t *)&info->length, 1); + if (!info->length) { + otx2_err("OQ info_list->length[%ld]", (long)info->length); + goto oq_read_fail; + } + + /* Deduce the actual data size */ + info->length -= SDP_RH_SIZE; + total_len += (uint32_t)info->length; + + otx2_sdp_dbg("OQ: pkt_len[%ld], buffer_size %d", + (long)info->length, droq->buffer_size); + if (info->length > droq->buffer_size) { + otx2_err("This mode is not supported: pkt_len > buffer_size"); + goto oq_read_fail; + } + + if (info->length <= droq->buffer_size) { + pkt_len = (uint32_t)info->length; + droq_pkt->data = droq->recv_buf_list[droq->read_idx].buffer; + droq_pkt->len = pkt_len; + + droq->recv_buf_list[droq->read_idx].buffer = NULL; + droq->read_idx = sdp_incr_index(droq->read_idx, 1,/* count */ + droq->nb_desc /* max rd idx */); + droq->refill_count++; + + } + + info->length = 0; + + return SDP_OQ_RECV_SUCCESS; + +oq_read_fail: + return SDP_OQ_RECV_FAILED; +} + +static inline uint32_t +sdp_check_droq_pkts(struct sdp_droq *droq, uint32_t burst_size) +{ + uint32_t min_pkts = 0; + uint32_t new_pkts; + uint32_t pkt_count; + + /* Latest available OQ packets */ + pkt_count = rte_read32(droq->pkts_sent_reg); + + /* Newly arrived packets */ + new_pkts = pkt_count - droq->last_pkt_count; + otx2_sdp_dbg("Recvd [%d] new OQ pkts", new_pkts); + + min_pkts = (new_pkts > burst_size) ? burst_size : new_pkts; + if (min_pkts) { + rte_atomic64_add(&droq->pkts_pending, min_pkts); + /* Back up the aggregated packet count so far */ + droq->last_pkt_count += min_pkts; + } + + return min_pkts; +} + +/* Check for response
[dpdk-dev] [PATCH v5 4/6] raw/octeontx2_ep: add enqueue operation
Add rawdev enqueue operation for SDP VF devices. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst | 6 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 242 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 39 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 20 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.c | 24 +++ 6 files changed, 332 insertions(+) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 2507fcf..39a7c29 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -68,3 +68,9 @@ The following code shows how the device is configured rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); +Performing Data Transfer + + +To perform data transfer using SDP VF EP rawdev devices use standard +``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` APIs. + diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 584b818..87ca3cd 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -403,3 +403,245 @@ return -ENOMEM; } +static inline void +sdp_iqreq_delete(struct sdp_device *sdpvf, + struct sdp_instr_queue *iq, uint32_t idx) +{ + uint32_t reqtype; + void *buf; + + buf = iq->req_list[idx].buf; + reqtype = iq->req_list[idx].reqtype; + + switch (reqtype) { + case SDP_REQTYPE_NORESP: + rte_mempool_put(sdpvf->enqdeq_mpool, buf); + otx2_sdp_dbg("IQ buffer freed at idx[%d]", idx); + break; + + case SDP_REQTYPE_NORESP_GATHER: + case SDP_REQTYPE_NONE: + default: + otx2_info("This iqreq mode is not supported:%d", reqtype); + + } + + /* Reset the request list at this index */ + iq->req_list[idx].buf = NULL; + iq->req_list[idx].reqtype = 0; +} + +static inline void +sdp_iqreq_add(struct sdp_instr_queue *iq, void *buf, + uint32_t reqtype) +{ + iq->req_list[iq->host_write_index].buf = buf; + iq->req_list[iq->host_write_index].reqtype = reqtype; + + otx2_sdp_dbg("IQ buffer added at idx[%d]", iq->host_write_index); + +} + +static void +sdp_flush_iq(struct sdp_device *sdpvf, + struct sdp_instr_queue *iq, + uint32_t pending_thresh __rte_unused) +{ + uint32_t instr_processed = 0; + + rte_spinlock_lock(&iq->lock); + + iq->otx_read_index = sdpvf->fn_list.update_iq_read_idx(iq); + while (iq->flush_index != iq->otx_read_index) { + /* Free the IQ data buffer to the pool */ + sdp_iqreq_delete(sdpvf, iq, iq->flush_index); + iq->flush_index = + sdp_incr_index(iq->flush_index, 1, iq->nb_desc); + + instr_processed++; + } + + iq->stats.instr_processed = instr_processed; + rte_atomic64_sub(&iq->instr_pending, instr_processed); + + rte_spinlock_unlock(&iq->lock); +} + +static inline void +sdp_ring_doorbell(struct sdp_device *sdpvf __rte_unused, + struct sdp_instr_queue *iq) +{ + otx2_write64(iq->fill_cnt, iq->doorbell_reg); + + /* Make sure doorbell writes observed by HW */ + rte_cio_wmb(); + iq->fill_cnt = 0; + +} + +static inline int +post_iqcmd(struct sdp_instr_queue *iq, uint8_t *iqcmd) +{ + uint8_t *iqptr, cmdsize; + + /* This ensures that the read index does not wrap around to +* the same position if queue gets full before OCTEON TX2 could +* fetch any instr. +*/ + if (rte_atomic64_read(&iq->instr_pending) >= + (int32_t)(iq->nb_desc - 1)) { + otx2_err("IQ is full, pending:%ld", +(long)rte_atomic64_read(&iq->instr_pending)); + + return SDP_IQ_SEND_FAILED; + } + + /* Copy cmd into iq */ + cmdsize = ((iq->iqcmd_64B) ? 64 : 32); + iqptr = iq->base_addr + (cmdsize * iq->host_write_index); + + rte_memcpy(iqptr, iqcmd, cmdsize); + + otx2_sdp_dbg("IQ cmd posted @ index:%d", iq->host_write_index); + + /* Increment the host write index */ + iq->host_write_index = + sdp_incr_index(iq->host_write_index, 1, iq->nb_desc); + + iq->fill_cnt++; + + /* Flush the command into memory. We need to be sure the data +* is in memory before indicating that the instruction is +* pending. +*/ + rte_smp_wmb(); + rte_atomic64_inc(&iq->instr_pending); + + /* SDP_IQ_SEND_SUCCESS */ + return 0; +} + + +stat
[dpdk-dev] [PATCH v5 6/6] raw/octeontx2_ep: add driver self test
Add rawdev's selftest feature in SDP VF driver, which verifies the EP mode functionality test. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst | 13 +++ drivers/raw/octeontx2_ep/Makefile | 1 + drivers/raw/octeontx2_ep/meson.build | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 2 + drivers/raw/octeontx2_ep/otx2_ep_test.c | 173 ++ 6 files changed, 191 insertions(+) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 39a7c29..bbcf530 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -74,3 +74,16 @@ Performing Data Transfer To perform data transfer using SDP VF EP rawdev devices use standard ``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` APIs. +Self test +- + +On EAL initialization, SDP VF devices will be probed and populated into the +raw devices. The rawdev ID of the device can be obtained using + +* Invoke ``rte_rawdev_get_dev_id("SDPEP:x")`` from the test application + where x is the VF device's bus id specified in "bus:device.func"(BDF) + format. Use this index for further rawdev function calls. + +* The driver's selftest rawdev API can be used to verify the SDP EP mode + functional tests which can send/receive the raw data packets to/from the + EP device. diff --git a/drivers/raw/octeontx2_ep/Makefile b/drivers/raw/octeontx2_ep/Makefile index 02853fb..44fdf89 100644 --- a/drivers/raw/octeontx2_ep/Makefile +++ b/drivers/raw/octeontx2_ep/Makefile @@ -37,6 +37,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_rawdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_enqdeq.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_test.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_vf.c diff --git a/drivers/raw/octeontx2_ep/meson.build b/drivers/raw/octeontx2_ep/meson.build index 99e6c6d..0e6338f 100644 --- a/drivers/raw/octeontx2_ep/meson.build +++ b/drivers/raw/octeontx2_ep/meson.build @@ -5,4 +5,5 @@ deps += ['bus_pci', 'common_octeontx2', 'rawdev'] sources = files('otx2_ep_rawdev.c', 'otx2_ep_enqdeq.c', + 'otx2_ep_test.c', 'otx2_ep_vf.c') diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c index 7158b97..0778603 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c @@ -253,6 +253,7 @@ .dev_close = sdp_rawdev_close, .enqueue_bufs = sdp_rawdev_enqueue, .dequeue_bufs = sdp_rawdev_dequeue, + .dev_selftest = sdp_rawdev_selftest, }; static int diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h index a77cbab..dab2fb7 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h @@ -494,4 +494,6 @@ int sdp_rawdev_enqueue(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, int sdp_rawdev_dequeue(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, unsigned int count, rte_rawdev_obj_t context); +int sdp_rawdev_selftest(uint16_t dev_id); + #endif /* _OTX2_EP_RAWDEV_H_ */ diff --git a/drivers/raw/octeontx2_ep/otx2_ep_test.c b/drivers/raw/octeontx2_ep/otx2_ep_test.c new file mode 100644 index 000..9746840 --- /dev/null +++ b/drivers/raw/octeontx2_ep/otx2_ep_test.c @@ -0,0 +1,173 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "otx2_common.h" +#include "otx2_ep_rawdev.h" + +#define SDP_IOQ_NUM_BUFS (4 * 1024) +#define SDP_IOQ_BUF_SIZE (2 * 1024) + +#define SDP_TEST_PKT_FSZ (0) +#define SDP_TEST_PKT_SIZE (1024) + +static int +sdp_validate_data(struct sdp_droq_pkt *oq_pkt, uint8_t *iq_pkt, + uint32_t pkt_len) +{ + if (!oq_pkt) + return -EINVAL; + + if (pkt_len != oq_pkt->len) { + otx2_err("Invalid packet length"); + return -EINVAL; + } + + if (memcmp(oq_pkt->data, iq_pkt, pkt_len) != 0) { + otx2_err("Data validation failed"); + return -EINVAL; + } + otx2_sdp_dbg("Data validation successful"); + + return 0; +} + +static void +sdp_ioq_buffer_fill(uint8_t *addr, uint32_t len) +{ + uint32_t idx; + + memset(addr, 0, len); + + for (idx = 0; idx < len; idx++) + addr[idx] = idx; +} + +static struct rte_mempool* +sdp_ioq_mempool_
Re: [dpdk-dev] [PATCH v5 0/6] OCTEON TX2 End Point Driver
Hi Thomas, Would you please merge this series. Thanks, Mahipal > -Original Message- > From: dev On Behalf Of Mahipal Challa > Sent: Monday, January 13, 2020 11:31 AM > To: dev@dpdk.org; tho...@monjalon.net > Cc: gavin...@arm.com; Jerin Jacob Kollanukkaran ; > Narayana Prasad Raju Athreya ; Subrahmanyam > Nilla ; Venkateshwarlu Nalla > Subject: [dpdk-dev] [PATCH v5 0/6] OCTEON TX2 End Point Driver > > This patchset adds support for OCTEON TX2 end point mode of operation. > The driver implementation uses DPDK rawdevice sub-system. > > v2: > * Updated memory barrier API's as per Gavin Hu suggestion. > > v3: > * Fixed memory leak possibility issues. > > v4: > * Improved error handling in selftest API. > > v5: > * Updated "doc/guides/rel_notes/release_20_02.rst". > > Series-reviewed-by: Gavin Hu > > Mahipal Challa (6): > raw/octeontx2_ep: add build infra and device probe > raw/octeontx2_ep: add device configuration > raw/octeontx2_ep: add device uninitialization > raw/octeontx2_ep: add enqueue operation > raw/octeontx2_ep: add dequeue operation > raw/octeontx2_ep: add driver self test > > MAINTAINERS| 5 + > config/common_base | 5 + > doc/guides/rawdevs/index.rst | 1 + > doc/guides/rawdevs/octeontx2_ep.rst| 89 +++ > doc/guides/rel_notes/release_20_02.rst | 4 + > drivers/common/octeontx2/hw/otx2_sdp.h | 184 + > drivers/common/octeontx2/otx2_common.c | 9 + > drivers/common/octeontx2/otx2_common.h | 4 + > .../octeontx2/rte_common_octeontx2_version.map | 6 + > drivers/raw/Makefile | 1 + > drivers/raw/meson.build| 1 + > drivers/raw/octeontx2_ep/Makefile | 44 ++ > drivers/raw/octeontx2_ep/meson.build | 9 + > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 844 > + > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 52 ++ > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 361 + > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 499 > drivers/raw/octeontx2_ep/otx2_ep_test.c| 173 + > drivers/raw/octeontx2_ep/otx2_ep_vf.c | 476 > drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + > .../rte_rawdev_octeontx2_ep_version.map| 4 + > mk/rte.app.mk | 2 + > 22 files changed, 2783 insertions(+) > create mode 100644 doc/guides/rawdevs/octeontx2_ep.rst > create mode 100644 drivers/common/octeontx2/hw/otx2_sdp.h > create mode 100644 drivers/raw/octeontx2_ep/Makefile create mode > 100644 drivers/raw/octeontx2_ep/meson.build > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_test.c > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.c > create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.h > create mode 100644 > drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map > > -- > 1.8.3.1
[dpdk-dev] [dpdk-dev PATCH] raw/octeontx2_ep: fix coverity scan reported defects
Defects reported by coverity scan are resolved. Coverity issue: CID 353611 - Error handling. Coverity issue: CID 353622 - Error handling. Coverity issue: CID 353632 - NULL pointer dereference. Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 1ba27c9..9f1e5ed 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -257,8 +257,8 @@ void *buf; for (idx = 0; idx < droq->nb_desc; idx++) { - rte_mempool_get(sdpvf->enqdeq_mpool, &buf); - if (buf == NULL) { + if (rte_mempool_get(sdpvf->enqdeq_mpool, &buf) || + (buf == NULL)) { otx2_err("OQ buffer alloc failed"); droq->stats.rx_alloc_failure++; /* sdp_droq_destroy_ring_buffers(droq);*/ @@ -662,11 +662,11 @@ if (droq->recv_buf_list[droq->refill_idx].buffer != NULL) break; - rte_mempool_get(sdpvf->enqdeq_mpool, &buf); - /* If a buffer could not be allocated, no point in -* continuing -*/ - if (buf == NULL) { + if (rte_mempool_get(sdpvf->enqdeq_mpool, &buf) || + (buf == NULL)) { + /* If a buffer could not be allocated, no point in +* continuing +*/ droq->stats.rx_alloc_failure++; break; } @@ -780,7 +780,7 @@ droq = sdpvf->droq[q_no]; if (!droq) { otx2_err("Invalid droq[%d]", q_no); - goto deq_fail; + goto droq_err; } /* Grab the lock */ @@ -840,5 +840,7 @@ deq_fail: rte_spinlock_unlock(&droq->lock); + +droq_err: return SDP_OQ_RECV_FAILED; } -- 1.8.3.1
[dpdk-dev] [PATCH 1/1] raw/octeontx2_ep: update the ABI version
Changed the ABI version to 20.0.1. Fixes: 56d46d13f736 ("raw/octeontx2_ep: add build infra and device probe") Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map b/drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map index ff357af..bc8fd6d 100644 --- a/drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map +++ b/drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map @@ -1,4 +1,4 @@ -DPDK_20.02 { +DPDK_20.0.1 { local: *; }; -- 1.8.3.1
[dpdk-dev] [PATCH v1 1/6] raw/octeontx2_ep: add build infra and device probe
Add the OCTEON TX2 SDP EP device probe along with the build infrastructure for Make and meson builds. Signed-off-by: Mahipal Challa --- MAINTAINERS| 5 + config/common_base | 5 + doc/guides/rawdevs/index.rst | 1 + doc/guides/rawdevs/octeontx2_ep.rst| 41 +++ drivers/raw/Makefile | 1 + drivers/raw/meson.build| 1 + drivers/raw/octeontx2_ep/Makefile | 40 +++ drivers/raw/octeontx2_ep/meson.build | 6 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 132 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 21 .../rte_rawdev_octeontx2_ep_version.map| 4 + mk/rte.app.mk | 2 + 12 files changed, 259 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 4395d8d..24f1240 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1173,6 +1173,11 @@ M: Vamsi Attunuru F: drivers/raw/octeontx2_dma/ F: doc/guides/rawdevs/octeontx2_dma.rst +Marvell OCTEON TX2 EP +M: Mahipal Challa +F: drivers/raw/octeontx2_ep/ +F: doc/guides/rawdevs/octeontx2_ep.rst + NTB M: Xiaoyun Li M: Jingjing Wu diff --git a/config/common_base b/config/common_base index 7dec7ed..8e7dad2 100644 --- a/config/common_base +++ b/config/common_base @@ -796,6 +796,11 @@ CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV=y # +# Compile PMD for octeontx2 EP raw device +# +CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y + +# # Compile PMD for NTB raw device # CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y diff --git a/doc/guides/rawdevs/index.rst b/doc/guides/rawdevs/index.rst index 22bc013..f64ec44 100644 --- a/doc/guides/rawdevs/index.rst +++ b/doc/guides/rawdevs/index.rst @@ -17,3 +17,4 @@ application through rawdev API. ioat ntb octeontx2_dma +octeontx2_ep diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst new file mode 100644 index 000..5f5ed01 --- /dev/null +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -0,0 +1,41 @@ +.. SPDX-License-Identifier: BSD-3-Clause +Copyright(c) 2019 Marvell International Ltd. + +Marvell OCTEON TX2 End Point Rawdev Driver +== + +OCTEON TX2 has an internal SDP unit which provides End Point mode of operation +by exposing its IOQs to Host, IOQs are used for packet I/O between Host and +OCTEON TX2. Each OCTEON TX2 SDP PF supports a max of 128 VFs and Each VF is +associated with a set of IOQ pairs. + +Features + + +This OCTEON TX2 End Point mode PMD supports + +#. Packet Input - Host to OCTEON TX2 with direct data instruction mode. + +#. Packet Output - OCTEON TX2 to Host with info pointer mode. + +Config File Options +~~~ + +The following options can be modified in the ``config`` file. + +- ``CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV`` (default ``y``) + + Toggle compilation of the ``lrte_pmd_octeontx2_ep`` driver. + +Initialization +-- + +The number of SDP VFs enabled, can be controlled by setting sysfs +entry `sriov_numvfs` for the corresponding PF driver. + +.. code-block:: console + + echo > /sys/bus/pci/drivers/octeontx2-ep/\:04\:00.0/sriov_numvfs + +Once the required VFs are enabled, to be accessible from DPDK, VFs need to be +bound to vfio-pci driver. diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index 0b6d13d..80b043e 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -13,5 +13,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat DIRS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) += ntb DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV) += octeontx2_dma +DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += octeontx2_ep include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/raw/meson.build b/drivers/raw/meson.build index d7037cd..bb57977 100644 --- a/drivers/raw/meson.build +++ b/drivers/raw/meson.build @@ -4,6 +4,7 @@ drivers = ['dpaa2_cmdif', 'dpaa2_qdma', 'ifpga', 'ioat', 'ntb', 'octeontx2_dma', + 'octeontx2_ep', 'skeleton'] std_deps = ['rawdev'] config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV' diff --git a/drivers/raw/octeontx2_ep/Makefile b/drivers/raw/octeontx2_ep/Makefile new file mode 100644 index 000..8cec6bd --- /dev/null +++ b/drivers/raw/octeontx2_ep/Makefile @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2019 Marvell International Ltd. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# Library name +LIB = librte_rawdev_octeontx2_ep.a + +# Build flags +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2/ +CFLAGS += -I$(RTE_SDK)/drivers/raw/octeontx2_ep/ +
[dpdk-dev] [PATCH v1 2/6] raw/octeontx2_ep: add device configuration
Register "dev_configure" API to configure/initialize the SDP VF PCIe devices. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst| 29 ++ drivers/common/octeontx2/hw/otx2_sdp.h | 184 + drivers/common/octeontx2/otx2_common.c | 9 + drivers/common/octeontx2/otx2_common.h | 4 + .../octeontx2/rte_common_octeontx2_version.map | 6 + drivers/raw/octeontx2_ep/Makefile | 3 + drivers/raw/octeontx2_ep/meson.build | 4 +- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 294 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 11 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 148 +++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 434 - drivers/raw/octeontx2_ep/otx2_ep_vf.c | 408 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + 13 files changed, 1542 insertions(+), 2 deletions(-) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 5f5ed01..2507fcf 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -39,3 +39,32 @@ entry `sriov_numvfs` for the corresponding PF driver. Once the required VFs are enabled, to be accessible from DPDK, VFs need to be bound to vfio-pci driver. + +Device Setup + + +The OCTEON TX2 SDP End Point VF devices will need to be bound to a +user-space IO driver for use. The script ``dpdk-devbind.py`` script +included with DPDK can be used to view the state of the devices and to bind +them to a suitable DPDK-supported kernel driver. When querying the status +of the devices, they will appear under the category of "Misc (rawdev) +devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be +used to see the state of those devices alone. + +Device Configuration + + +Configuring SDP EP rawdev device is done using the ``rte_rawdev_configure()`` +API, which takes the mempool as parameter. PMD uses this pool to send/receive +packets to/from the HW. + +The following code shows how the device is configured + +.. code-block:: c + + struct sdp_rawdev_info config = {0}; + struct rte_rawdev_info rdev_info = {.dev_private = &config}; + config.enqdeq_mpool = (void *)rte_mempool_create(...); + + rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); + diff --git a/drivers/common/octeontx2/hw/otx2_sdp.h b/drivers/common/octeontx2/hw/otx2_sdp.h new file mode 100644 index 000..7e03317 --- /dev/null +++ b/drivers/common/octeontx2/hw/otx2_sdp.h @@ -0,0 +1,184 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#ifndef __OTX2_SDP_HW_H_ +#define __OTX2_SDP_HW_H_ + +/* SDP VF IOQs */ +#define SDP_MIN_RINGS_PER_VF(1) +#define SDP_MAX_RINGS_PER_VF(8) + +/* SDP VF IQ configuration */ +#define SDP_VF_MAX_IQ_DESCRIPTORS (512) +#define SDP_VF_MIN_IQ_DESCRIPTORS (128) + +#define SDP_VF_DB_MIN (1) +#define SDP_VF_DB_TIMEOUT (1) +#define SDP_VF_INTR_THRESHOLD (0x) + +#define SDP_VF_64BYTE_INSTR (64) +#define SDP_VF_32BYTE_INSTR (32) + +/* SDP VF OQ configuration */ +#define SDP_VF_MAX_OQ_DESCRIPTORS (512) +#define SDP_VF_MIN_OQ_DESCRIPTORS (128) +#define SDP_VF_OQ_BUF_SIZE (2048) +#define SDP_VF_OQ_REFIL_THRESHOLD (16) + +#define SDP_VF_OQ_INFOPTR_MODE (1) +#define SDP_VF_OQ_BUFPTR_MODE (0) + +#define SDP_VF_OQ_INTR_PKT (1) +#define SDP_VF_OQ_INTR_TIME (10) +#define SDP_VF_CFG_IO_QUEUESSDP_MAX_RINGS_PER_VF + +/* Wait time in milliseconds for FLR */ +#define SDP_VF_PCI_FLR_WAIT (100) +#define SDP_VF_BUSY_LOOP_COUNT (1) + +#define SDP_VF_MAX_IO_QUEUESSDP_MAX_RINGS_PER_VF +#define SDP_VF_MIN_IO_QUEUESSDP_MIN_RINGS_PER_VF + +/* SDP VF IOQs per rawdev */ +#define SDP_VF_MAX_IOQS_PER_RAWDEV SDP_VF_MAX_IO_QUEUES +#define SDP_VF_DEFAULT_IOQS_PER_RAWDEV SDP_VF_MIN_IO_QUEUES + +/* SDP VF Register definitions */ +#define SDP_VF_RING_OFFSET(0x1ull << 17) + +/* SDP VF IQ Registers */ +#define SDP_VF_R_IN_CONTROL_START (0x1) +#define SDP_VF_R_IN_ENABLE_START (0x10010) +#define SDP_VF_R_IN_INSTR_BADDR_START (0x10020) +#define SDP_VF_R_IN_INSTR_RSIZE_START (0x10030) +#define SDP_VF_R_IN_INSTR_DBELL_START (0x10040) +#define SDP_VF_R_IN_CNTS_START(0x10050) +#define SDP_VF_R_IN_INT_LEVELS_START (0x10060) +#define SDP_VF_R_IN_PKT_CNT_START (0x10080) +#define SDP_VF_R_IN_BYTE_CNT_START(0x10090) + +#define SDP_VF_R_IN_CONTROL(ring) \ + (SDP_VF_R_IN_CONTROL_START + ((ring) * SDP_VF_RING_OFFSET)) + +#define SDP_VF_R_IN_ENABLE(ring) \ + (SDP_VF_R_IN_ENABLE_START + ((ring) * SDP_VF_RING_OFFSET)) + +#define SDP_VF_R_IN_INSTR_BADDR(ring) \ +
[dpdk-dev] [PATCH v1 4/6] raw/octeontx2_ep: add enqueue operation
Add rawdev enqueue operation for SDP VF devices. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst | 6 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 242 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 39 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 20 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.c | 24 +++ 6 files changed, 332 insertions(+) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 2507fcf..39a7c29 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -68,3 +68,9 @@ The following code shows how the device is configured rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); +Performing Data Transfer + + +To perform data transfer using SDP VF EP rawdev devices use standard +``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` APIs. + diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 584b818..ebbacfb 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -403,3 +403,245 @@ return -ENOMEM; } +static inline void +sdp_iqreq_delete(struct sdp_device *sdpvf, + struct sdp_instr_queue *iq, uint32_t idx) +{ + uint32_t reqtype; + void *buf; + + buf = iq->req_list[idx].buf; + reqtype = iq->req_list[idx].reqtype; + + switch (reqtype) { + case SDP_REQTYPE_NORESP: + rte_mempool_put(sdpvf->enqdeq_mpool, buf); + otx2_sdp_dbg("IQ buffer freed at idx[%d]", idx); + break; + + case SDP_REQTYPE_NORESP_GATHER: + case SDP_REQTYPE_NONE: + default: + otx2_info("This iqreq mode is not supported:%d", reqtype); + + } + + /* Reset the request list at this index */ + iq->req_list[idx].buf = NULL; + iq->req_list[idx].reqtype = 0; +} + +static inline void +sdp_iqreq_add(struct sdp_instr_queue *iq, void *buf, + uint32_t reqtype) +{ + iq->req_list[iq->host_write_index].buf = buf; + iq->req_list[iq->host_write_index].reqtype = reqtype; + + otx2_sdp_dbg("IQ buffer added at idx[%d]", iq->host_write_index); + +} + +static void +sdp_flush_iq(struct sdp_device *sdpvf, + struct sdp_instr_queue *iq, + uint32_t pending_thresh __rte_unused) +{ + uint32_t instr_processed = 0; + + rte_spinlock_lock(&iq->lock); + + iq->otx_read_index = sdpvf->fn_list.update_iq_read_idx(iq); + while (iq->flush_index != iq->otx_read_index) { + /* Free the IQ data buffer to the pool */ + sdp_iqreq_delete(sdpvf, iq, iq->flush_index); + iq->flush_index = + sdp_incr_index(iq->flush_index, 1, iq->nb_desc); + + instr_processed++; + } + + iq->stats.instr_processed = instr_processed; + rte_atomic64_sub(&iq->instr_pending, instr_processed); + + rte_spinlock_unlock(&iq->lock); +} + +static inline void +sdp_ring_doorbell(struct sdp_device *sdpvf __rte_unused, + struct sdp_instr_queue *iq) +{ + otx2_write64(iq->fill_cnt, iq->doorbell_reg); + + /* Make sure doorbell write goes through */ + rte_wmb(); + iq->fill_cnt = 0; + +} + +static inline int +post_iqcmd(struct sdp_instr_queue *iq, uint8_t *iqcmd) +{ + uint8_t *iqptr, cmdsize; + + /* This ensures that the read index does not wrap around to +* the same position if queue gets full before OCTEON TX2 could +* fetch any instr. +*/ + if (rte_atomic64_read(&iq->instr_pending) >= + (int32_t)(iq->nb_desc - 1)) { + otx2_err("IQ is full, pending:%ld", +(long)rte_atomic64_read(&iq->instr_pending)); + + return SDP_IQ_SEND_FAILED; + } + + /* Copy cmd into iq */ + cmdsize = ((iq->iqcmd_64B) ? 64 : 32); + iqptr = iq->base_addr + (cmdsize * iq->host_write_index); + + rte_memcpy(iqptr, iqcmd, cmdsize); + + otx2_sdp_dbg("IQ cmd posted @ index:%d", iq->host_write_index); + + /* Increment the host write index */ + iq->host_write_index = + sdp_incr_index(iq->host_write_index, 1, iq->nb_desc); + + iq->fill_cnt++; + + /* Flush the command into memory. We need to be sure the data +* is in memory before indicating that the instruction is +* pending. +*/ + rte_wmb(); + rte_atomic64_inc(&iq->instr_pending); + + /* SDP_IQ_SEND_SUCCESS */ + return 0; +} + + +stat
[dpdk-dev] [PATCH v1 3/6] raw/octeontx2_ep: add device uninitialization
Add rawdev close/uninitialize operation for SDP VF devices. Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 111 ++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 78 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 8 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.c | 44 4 files changed, 241 insertions(+) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 8857004..584b818 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -21,6 +21,59 @@ #include "otx2_common.h" #include "otx2_ep_enqdeq.h" +static void +sdp_dmazone_free(const struct rte_memzone *mz) +{ + const struct rte_memzone *mz_tmp; + int ret = 0; + + if (mz == NULL) { + otx2_err("Memzone %s : NULL", mz->name); + return; + } + + mz_tmp = rte_memzone_lookup(mz->name); + if (mz_tmp == NULL) { + otx2_err("Memzone %s Not Found", mz->name); + return; + } + + ret = rte_memzone_free(mz); + if (ret) + otx2_err("Memzone free failed : ret = %d", ret); + +} + +/* Free IQ resources */ +int +sdp_delete_iqs(struct sdp_device *sdpvf, uint32_t iq_no) +{ + struct sdp_instr_queue *iq; + + iq = sdpvf->instr_queue[iq_no]; + if (iq == NULL) { + otx2_err("Invalid IQ[%d]\n", iq_no); + return -ENOMEM; + } + + rte_free(iq->req_list); + iq->req_list = NULL; + + if (iq->iq_mz) { + sdp_dmazone_free(iq->iq_mz); + iq->iq_mz = NULL; + } + + rte_free(sdpvf->instr_queue[iq_no]); + sdpvf->instr_queue[iq_no] = NULL; + + sdpvf->num_iqs--; + + otx2_info("IQ[%d] is deleted", iq_no); + + return 0; +} + /* IQ initialization */ static int sdp_init_instr_queue(struct sdp_device *sdpvf, int iq_no) @@ -126,6 +179,7 @@ return 0; delete_IQ: + sdp_delete_iqs(sdpvf, iq_no); return -ENOMEM; } @@ -139,6 +193,61 @@ rte_atomic64_set(&droq->pkts_pending, 0); } +static void +sdp_droq_destroy_ring_buffers(struct sdp_device *sdpvf, + struct sdp_droq *droq) +{ + uint32_t idx; + + for (idx = 0; idx < droq->nb_desc; idx++) { + if (droq->recv_buf_list[idx].buffer) { + rte_mempool_put(sdpvf->enqdeq_mpool, + droq->recv_buf_list[idx].buffer); + + droq->recv_buf_list[idx].buffer = NULL; + } + } + + sdp_droq_reset_indices(droq); +} + +/* Free OQs resources */ +int +sdp_delete_oqs(struct sdp_device *sdpvf, uint32_t oq_no) +{ + struct sdp_droq *droq; + + droq = sdpvf->droq[oq_no]; + if (droq == NULL) { + otx2_err("Invalid droq[%d]", oq_no); + return -ENOMEM; + } + + sdp_droq_destroy_ring_buffers(sdpvf, droq); + rte_free(droq->recv_buf_list); + droq->recv_buf_list = NULL; + + if (droq->info_mz) { + sdp_dmazone_free(droq->info_mz); + droq->info_mz = NULL; + } + + if (droq->desc_ring_mz) { + sdp_dmazone_free(droq->desc_ring_mz); + droq->desc_ring_mz = NULL; + } + + memset(droq, 0, SDP_DROQ_SIZE); + + rte_free(sdpvf->droq[oq_no]); + sdpvf->droq[oq_no] = NULL; + + sdpvf->num_oqs--; + + otx2_info("OQ[%d] is deleted", oq_no); + return 0; +} + static int sdp_droq_setup_ring_buffers(struct sdp_device *sdpvf, struct sdp_droq *droq) @@ -290,5 +399,7 @@ return 0; delete_OQ: + sdp_delete_oqs(sdpvf, oq_no); return -ENOMEM; } + diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c index 5db9b50..2c43d3f 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c @@ -63,6 +63,45 @@ } static int +sdp_vfdev_exit(struct rte_rawdev *rawdev) +{ + struct sdp_device *sdpvf; + uint32_t rawdev_queues, q; + + otx2_info("%s:", __func__); + + sdpvf = (struct sdp_device *)rawdev->dev_private; + + sdpvf->fn_list.disable_io_queues(sdpvf); + + rawdev_queues = sdpvf->num_oqs; + for (q = 0; q < rawdev_queues; q++) { + if (sdp_delete_oqs(sdpvf, q)) { + otx2_err("Failed to delete OQ:%d", q); + return -ENOMEM; + } + } + otx2_info("Num OQs:%d freed", sdpvf->num_oqs); + + /* Free the oqbuf_pool */ + rte_mempool_free(sdpv
[dpdk-dev] [PATCH v1 0/6] OCTEON TX2 End Point Driver
This patchset adds support for OCTEON TX2 end point mode of operation. The driver implementation uses DPDK rawdevice sub-system. Mahipal Challa (6): raw/octeontx2_ep: add build infra and device probe raw/octeontx2_ep: add device configuration raw/octeontx2_ep: add device uninitialization raw/octeontx2_ep: add enqueue operation raw/octeontx2_ep: add dequeue operation raw/octeontx2_ep: add driver self test MAINTAINERS| 5 + config/common_base | 5 + doc/guides/rawdevs/index.rst | 1 + doc/guides/rawdevs/octeontx2_ep.rst| 89 +++ drivers/common/octeontx2/hw/otx2_sdp.h | 184 + drivers/common/octeontx2/otx2_common.c | 9 + drivers/common/octeontx2/otx2_common.h | 4 + .../octeontx2/rte_common_octeontx2_version.map | 6 + drivers/raw/Makefile | 1 + drivers/raw/meson.build| 1 + drivers/raw/octeontx2_ep/Makefile | 44 ++ drivers/raw/octeontx2_ep/meson.build | 9 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 846 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 52 ++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 361 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 499 drivers/raw/octeontx2_ep/otx2_ep_test.c| 164 drivers/raw/octeontx2_ep/otx2_ep_vf.c | 476 drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + .../rte_rawdev_octeontx2_ep_version.map| 4 + mk/rte.app.mk | 2 + 21 files changed, 2772 insertions(+) create mode 100644 doc/guides/rawdevs/octeontx2_ep.rst create mode 100644 drivers/common/octeontx2/hw/otx2_sdp.h create mode 100644 drivers/raw/octeontx2_ep/Makefile create mode 100644 drivers/raw/octeontx2_ep/meson.build create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.h create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_test.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.h create mode 100644 drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map -- 1.8.3.1
[dpdk-dev] [PATCH v1 5/6] raw/octeontx2_ep: add dequeue operation
Add rawdev dequeue operation for SDP VF devices. Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 199 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 2 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 18 ++- 4 files changed, 219 insertions(+), 1 deletion(-) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index ebbacfb..451fcc0 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -260,6 +260,7 @@ rte_mempool_get(sdpvf->enqdeq_mpool, &buf); if (buf == NULL) { otx2_err("OQ buffer alloc failed"); + droq->stats.rx_alloc_failure++; /* sdp_droq_destroy_ring_buffers(droq);*/ return -ENOMEM; } @@ -645,3 +646,201 @@ return SDP_IQ_SEND_FAILED; } +static uint32_t +sdp_droq_refill(struct sdp_device *sdpvf, struct sdp_droq *droq) +{ + struct sdp_droq_desc *desc_ring; + uint32_t desc_refilled = 0; + void *buf = NULL; + + desc_ring = droq->desc_ring; + + while (droq->refill_count && (desc_refilled < droq->nb_desc)) { + /* If a valid buffer exists (happens if there is no dispatch), +* reuse the buffer, else allocate. +*/ + if (droq->recv_buf_list[droq->refill_idx].buffer != NULL) + break; + + rte_mempool_get(sdpvf->enqdeq_mpool, &buf); + /* If a buffer could not be allocated, no point in +* continuing +*/ + if (buf == NULL) { + droq->stats.rx_alloc_failure++; + break; + } + + droq->recv_buf_list[droq->refill_idx].buffer = buf; + desc_ring[droq->refill_idx].buffer_ptr = rte_mem_virt2iova(buf); + + /* Reset any previous values in the length field. */ + droq->info_list[droq->refill_idx].length = 0; + + droq->refill_idx = sdp_incr_index(droq->refill_idx, 1, + droq->nb_desc); + + desc_refilled++; + droq->refill_count--; + + } + + return desc_refilled; +} + +static int +sdp_droq_read_packet(struct sdp_device *sdpvf __rte_unused, +struct sdp_droq *droq, +struct sdp_droq_pkt *droq_pkt) +{ + struct sdp_droq_info *info; + uint32_t total_len = 0; + uint32_t pkt_len = 0; + + info = &droq->info_list[droq->read_idx]; + sdp_swap_8B_data((uint64_t *)&info->length, 1); + if (!info->length) { + otx2_err("OQ info_list->length[%ld]", (long)info->length); + goto oq_read_fail; + } + + /* Deduce the actual data size */ + info->length -= SDP_RH_SIZE; + total_len += (uint32_t)info->length; + + otx2_sdp_dbg("OQ: pkt_len[%ld], buffer_size %d", + (long)info->length, droq->buffer_size); + if (info->length > droq->buffer_size) { + otx2_err("This mode is not supported: pkt_len > buffer_size"); + goto oq_read_fail; + } + + if (info->length <= droq->buffer_size) { + pkt_len = (uint32_t)info->length; + droq_pkt->data = droq->recv_buf_list[droq->read_idx].buffer; + droq_pkt->len = pkt_len; + + droq->recv_buf_list[droq->read_idx].buffer = NULL; + droq->read_idx = sdp_incr_index(droq->read_idx, 1,/* count */ + droq->nb_desc /* max rd idx */); + droq->refill_count++; + + } + + info->length = 0; + + return SDP_OQ_RECV_SUCCESS; + +oq_read_fail: + return SDP_OQ_RECV_FAILED; +} + +static inline uint32_t +sdp_check_droq_pkts(struct sdp_droq *droq, uint32_t burst_size) +{ + uint32_t min_pkts = 0; + uint32_t new_pkts; + uint32_t pkt_count; + + /* Latest available OQ packets */ + pkt_count = rte_read32(droq->pkts_sent_reg); + + /* Newly arrived packets */ + new_pkts = pkt_count - droq->last_pkt_count; + otx2_sdp_dbg("Recvd [%d] new OQ pkts", new_pkts); + + min_pkts = (new_pkts > burst_size) ? burst_size : new_pkts; + if (min_pkts) { + rte_atomic64_add(&droq->pkts_pending, min_pkts); + /* Back up the aggregated packet count so far */ + droq->last_pkt_count += min_pkts; + } + + return min_pkts; +} + +/* Check for response
[dpdk-dev] [PATCH v1 6/6] raw/octeontx2_ep: add driver self test
Add rawdev's selftest feature in SDP VF driver, which verifies the EP mode functionality test. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst | 13 +++ drivers/raw/octeontx2_ep/Makefile | 1 + drivers/raw/octeontx2_ep/meson.build | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 2 + drivers/raw/octeontx2_ep/otx2_ep_test.c | 164 ++ 6 files changed, 182 insertions(+) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 39a7c29..bbcf530 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -74,3 +74,16 @@ Performing Data Transfer To perform data transfer using SDP VF EP rawdev devices use standard ``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` APIs. +Self test +- + +On EAL initialization, SDP VF devices will be probed and populated into the +raw devices. The rawdev ID of the device can be obtained using + +* Invoke ``rte_rawdev_get_dev_id("SDPEP:x")`` from the test application + where x is the VF device's bus id specified in "bus:device.func"(BDF) + format. Use this index for further rawdev function calls. + +* The driver's selftest rawdev API can be used to verify the SDP EP mode + functional tests which can send/receive the raw data packets to/from the + EP device. diff --git a/drivers/raw/octeontx2_ep/Makefile b/drivers/raw/octeontx2_ep/Makefile index 02853fb..44fdf89 100644 --- a/drivers/raw/octeontx2_ep/Makefile +++ b/drivers/raw/octeontx2_ep/Makefile @@ -37,6 +37,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_rawdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_enqdeq.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_test.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_vf.c diff --git a/drivers/raw/octeontx2_ep/meson.build b/drivers/raw/octeontx2_ep/meson.build index 99e6c6d..0e6338f 100644 --- a/drivers/raw/octeontx2_ep/meson.build +++ b/drivers/raw/octeontx2_ep/meson.build @@ -5,4 +5,5 @@ deps += ['bus_pci', 'common_octeontx2', 'rawdev'] sources = files('otx2_ep_rawdev.c', 'otx2_ep_enqdeq.c', + 'otx2_ep_test.c', 'otx2_ep_vf.c') diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c index ddb208d..c5c0cf3 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c @@ -253,6 +253,7 @@ .dev_close = sdp_rawdev_close, .enqueue_bufs = sdp_rawdev_enqueue, .dequeue_bufs = sdp_rawdev_dequeue, + .dev_selftest = sdp_rawdev_selftest, }; static int diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h index a77cbab..dab2fb7 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h @@ -494,4 +494,6 @@ int sdp_rawdev_enqueue(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, int sdp_rawdev_dequeue(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, unsigned int count, rte_rawdev_obj_t context); +int sdp_rawdev_selftest(uint16_t dev_id); + #endif /* _OTX2_EP_RAWDEV_H_ */ diff --git a/drivers/raw/octeontx2_ep/otx2_ep_test.c b/drivers/raw/octeontx2_ep/otx2_ep_test.c new file mode 100644 index 000..96fedb5 --- /dev/null +++ b/drivers/raw/octeontx2_ep/otx2_ep_test.c @@ -0,0 +1,164 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "otx2_common.h" +#include "otx2_ep_rawdev.h" + +#define SDP_IOQ_NUM_BUFS (4 * 1024) +#define SDP_IOQ_BUF_SIZE (2 * 1024) + +#define SDP_TEST_PKT_FSZ (0) +#define SDP_TEST_PKT_SIZE (1024) + +static int +sdp_validate_data(struct sdp_droq_pkt *oq_pkt, uint8_t *iq_pkt, + uint32_t pkt_len) +{ + if (!oq_pkt) + return -EINVAL; + + if (pkt_len != oq_pkt->len) { + otx2_err("Invalid packet length"); + return -EINVAL; + } + + if (memcmp(oq_pkt->data, iq_pkt, pkt_len) != 0) { + otx2_err("Data validation failed"); + return -EINVAL; + } + otx2_sdp_dbg("Data validation successful"); + + return 0; +} + +static void +sdp_ioq_buffer_fill(uint8_t *addr, uint32_t len) +{ + uint32_t idx; + + memset(addr, 0, len); + + for (idx = 0; idx < len; idx++) + addr[idx] = idx; +} + +static struct rte_mempool* +sdp_ioq_mempool_
[dpdk-dev] [PATCH v1 2/6] raw/octeontx2_ep: add device configuration
Register "dev_configure" API to configure/initialize the SDP VF PCIe devices. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst| 29 ++ drivers/common/octeontx2/hw/otx2_sdp.h | 184 + drivers/common/octeontx2/otx2_common.c | 9 + drivers/common/octeontx2/otx2_common.h | 4 + .../octeontx2/rte_common_octeontx2_version.map | 6 + drivers/raw/octeontx2_ep/Makefile | 3 + drivers/raw/octeontx2_ep/meson.build | 4 +- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 294 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 11 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 148 +++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 434 - drivers/raw/octeontx2_ep/otx2_ep_vf.c | 408 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + 13 files changed, 1542 insertions(+), 2 deletions(-) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 5f5ed01..2507fcf 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -39,3 +39,32 @@ entry `sriov_numvfs` for the corresponding PF driver. Once the required VFs are enabled, to be accessible from DPDK, VFs need to be bound to vfio-pci driver. + +Device Setup + + +The OCTEON TX2 SDP End Point VF devices will need to be bound to a +user-space IO driver for use. The script ``dpdk-devbind.py`` script +included with DPDK can be used to view the state of the devices and to bind +them to a suitable DPDK-supported kernel driver. When querying the status +of the devices, they will appear under the category of "Misc (rawdev) +devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be +used to see the state of those devices alone. + +Device Configuration + + +Configuring SDP EP rawdev device is done using the ``rte_rawdev_configure()`` +API, which takes the mempool as parameter. PMD uses this pool to send/receive +packets to/from the HW. + +The following code shows how the device is configured + +.. code-block:: c + + struct sdp_rawdev_info config = {0}; + struct rte_rawdev_info rdev_info = {.dev_private = &config}; + config.enqdeq_mpool = (void *)rte_mempool_create(...); + + rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); + diff --git a/drivers/common/octeontx2/hw/otx2_sdp.h b/drivers/common/octeontx2/hw/otx2_sdp.h new file mode 100644 index 000..7e03317 --- /dev/null +++ b/drivers/common/octeontx2/hw/otx2_sdp.h @@ -0,0 +1,184 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#ifndef __OTX2_SDP_HW_H_ +#define __OTX2_SDP_HW_H_ + +/* SDP VF IOQs */ +#define SDP_MIN_RINGS_PER_VF(1) +#define SDP_MAX_RINGS_PER_VF(8) + +/* SDP VF IQ configuration */ +#define SDP_VF_MAX_IQ_DESCRIPTORS (512) +#define SDP_VF_MIN_IQ_DESCRIPTORS (128) + +#define SDP_VF_DB_MIN (1) +#define SDP_VF_DB_TIMEOUT (1) +#define SDP_VF_INTR_THRESHOLD (0x) + +#define SDP_VF_64BYTE_INSTR (64) +#define SDP_VF_32BYTE_INSTR (32) + +/* SDP VF OQ configuration */ +#define SDP_VF_MAX_OQ_DESCRIPTORS (512) +#define SDP_VF_MIN_OQ_DESCRIPTORS (128) +#define SDP_VF_OQ_BUF_SIZE (2048) +#define SDP_VF_OQ_REFIL_THRESHOLD (16) + +#define SDP_VF_OQ_INFOPTR_MODE (1) +#define SDP_VF_OQ_BUFPTR_MODE (0) + +#define SDP_VF_OQ_INTR_PKT (1) +#define SDP_VF_OQ_INTR_TIME (10) +#define SDP_VF_CFG_IO_QUEUESSDP_MAX_RINGS_PER_VF + +/* Wait time in milliseconds for FLR */ +#define SDP_VF_PCI_FLR_WAIT (100) +#define SDP_VF_BUSY_LOOP_COUNT (1) + +#define SDP_VF_MAX_IO_QUEUESSDP_MAX_RINGS_PER_VF +#define SDP_VF_MIN_IO_QUEUESSDP_MIN_RINGS_PER_VF + +/* SDP VF IOQs per rawdev */ +#define SDP_VF_MAX_IOQS_PER_RAWDEV SDP_VF_MAX_IO_QUEUES +#define SDP_VF_DEFAULT_IOQS_PER_RAWDEV SDP_VF_MIN_IO_QUEUES + +/* SDP VF Register definitions */ +#define SDP_VF_RING_OFFSET(0x1ull << 17) + +/* SDP VF IQ Registers */ +#define SDP_VF_R_IN_CONTROL_START (0x1) +#define SDP_VF_R_IN_ENABLE_START (0x10010) +#define SDP_VF_R_IN_INSTR_BADDR_START (0x10020) +#define SDP_VF_R_IN_INSTR_RSIZE_START (0x10030) +#define SDP_VF_R_IN_INSTR_DBELL_START (0x10040) +#define SDP_VF_R_IN_CNTS_START(0x10050) +#define SDP_VF_R_IN_INT_LEVELS_START (0x10060) +#define SDP_VF_R_IN_PKT_CNT_START (0x10080) +#define SDP_VF_R_IN_BYTE_CNT_START(0x10090) + +#define SDP_VF_R_IN_CONTROL(ring) \ + (SDP_VF_R_IN_CONTROL_START + ((ring) * SDP_VF_RING_OFFSET)) + +#define SDP_VF_R_IN_ENABLE(ring) \ + (SDP_VF_R_IN_ENABLE_START + ((ring) * SDP_VF_RING_OFFSET)) + +#define SDP_VF_R_IN_INSTR_BADDR(ring) \ +
[dpdk-dev] [PATCH v1 1/6] raw/octeontx2_ep: add build infra and device probe
Add the OCTEON TX2 SDP EP device probe along with the build infrastructure for Make and meson builds. Signed-off-by: Mahipal Challa --- MAINTAINERS| 5 + config/common_base | 5 + doc/guides/rawdevs/index.rst | 1 + doc/guides/rawdevs/octeontx2_ep.rst| 41 +++ drivers/raw/Makefile | 1 + drivers/raw/meson.build| 1 + drivers/raw/octeontx2_ep/Makefile | 40 +++ drivers/raw/octeontx2_ep/meson.build | 6 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 132 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 21 .../rte_rawdev_octeontx2_ep_version.map| 4 + mk/rte.app.mk | 2 + 12 files changed, 259 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 4395d8d..24f1240 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1173,6 +1173,11 @@ M: Vamsi Attunuru F: drivers/raw/octeontx2_dma/ F: doc/guides/rawdevs/octeontx2_dma.rst +Marvell OCTEON TX2 EP +M: Mahipal Challa +F: drivers/raw/octeontx2_ep/ +F: doc/guides/rawdevs/octeontx2_ep.rst + NTB M: Xiaoyun Li M: Jingjing Wu diff --git a/config/common_base b/config/common_base index 7dec7ed..8e7dad2 100644 --- a/config/common_base +++ b/config/common_base @@ -796,6 +796,11 @@ CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV=y # +# Compile PMD for octeontx2 EP raw device +# +CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y + +# # Compile PMD for NTB raw device # CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y diff --git a/doc/guides/rawdevs/index.rst b/doc/guides/rawdevs/index.rst index 22bc013..f64ec44 100644 --- a/doc/guides/rawdevs/index.rst +++ b/doc/guides/rawdevs/index.rst @@ -17,3 +17,4 @@ application through rawdev API. ioat ntb octeontx2_dma +octeontx2_ep diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst new file mode 100644 index 000..5f5ed01 --- /dev/null +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -0,0 +1,41 @@ +.. SPDX-License-Identifier: BSD-3-Clause +Copyright(c) 2019 Marvell International Ltd. + +Marvell OCTEON TX2 End Point Rawdev Driver +== + +OCTEON TX2 has an internal SDP unit which provides End Point mode of operation +by exposing its IOQs to Host, IOQs are used for packet I/O between Host and +OCTEON TX2. Each OCTEON TX2 SDP PF supports a max of 128 VFs and Each VF is +associated with a set of IOQ pairs. + +Features + + +This OCTEON TX2 End Point mode PMD supports + +#. Packet Input - Host to OCTEON TX2 with direct data instruction mode. + +#. Packet Output - OCTEON TX2 to Host with info pointer mode. + +Config File Options +~~~ + +The following options can be modified in the ``config`` file. + +- ``CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV`` (default ``y``) + + Toggle compilation of the ``lrte_pmd_octeontx2_ep`` driver. + +Initialization +-- + +The number of SDP VFs enabled, can be controlled by setting sysfs +entry `sriov_numvfs` for the corresponding PF driver. + +.. code-block:: console + + echo > /sys/bus/pci/drivers/octeontx2-ep/\:04\:00.0/sriov_numvfs + +Once the required VFs are enabled, to be accessible from DPDK, VFs need to be +bound to vfio-pci driver. diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index 0b6d13d..80b043e 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -13,5 +13,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat DIRS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) += ntb DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV) += octeontx2_dma +DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += octeontx2_ep include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/raw/meson.build b/drivers/raw/meson.build index d7037cd..bb57977 100644 --- a/drivers/raw/meson.build +++ b/drivers/raw/meson.build @@ -4,6 +4,7 @@ drivers = ['dpaa2_cmdif', 'dpaa2_qdma', 'ifpga', 'ioat', 'ntb', 'octeontx2_dma', + 'octeontx2_ep', 'skeleton'] std_deps = ['rawdev'] config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV' diff --git a/drivers/raw/octeontx2_ep/Makefile b/drivers/raw/octeontx2_ep/Makefile new file mode 100644 index 000..8cec6bd --- /dev/null +++ b/drivers/raw/octeontx2_ep/Makefile @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2019 Marvell International Ltd. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# Library name +LIB = librte_rawdev_octeontx2_ep.a + +# Build flags +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2/ +CFLAGS += -I$(RTE_SDK)/drivers/raw/octeontx2_ep/ +
[dpdk-dev] [PATCH v1 0/6] OCTEON TX2 End Point Driver
This patchset adds support for OCTEON TX2 end point mode of operation. The driver implementation uses DPDK rawdevice sub-system. Mahipal Challa (6): raw/octeontx2_ep: add build infra and device probe raw/octeontx2_ep: add device configuration raw/octeontx2_ep: add device uninitialization raw/octeontx2_ep: add enqueue operation raw/octeontx2_ep: add dequeue operation raw/octeontx2_ep: add driver self test MAINTAINERS| 5 + config/common_base | 5 + doc/guides/rawdevs/index.rst | 1 + doc/guides/rawdevs/octeontx2_ep.rst| 89 +++ drivers/common/octeontx2/hw/otx2_sdp.h | 184 + drivers/common/octeontx2/otx2_common.c | 9 + drivers/common/octeontx2/otx2_common.h | 4 + .../octeontx2/rte_common_octeontx2_version.map | 6 + drivers/raw/Makefile | 1 + drivers/raw/meson.build| 1 + drivers/raw/octeontx2_ep/Makefile | 44 ++ drivers/raw/octeontx2_ep/meson.build | 9 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 846 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 52 ++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 361 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 499 drivers/raw/octeontx2_ep/otx2_ep_test.c| 164 drivers/raw/octeontx2_ep/otx2_ep_vf.c | 476 drivers/raw/octeontx2_ep/otx2_ep_vf.h | 10 + .../rte_rawdev_octeontx2_ep_version.map| 4 + mk/rte.app.mk | 2 + 21 files changed, 2772 insertions(+) create mode 100644 doc/guides/rawdevs/octeontx2_ep.rst create mode 100644 drivers/common/octeontx2/hw/otx2_sdp.h create mode 100644 drivers/raw/octeontx2_ep/Makefile create mode 100644 drivers/raw/octeontx2_ep/meson.build create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_rawdev.h create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_test.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.c create mode 100644 drivers/raw/octeontx2_ep/otx2_ep_vf.h create mode 100644 drivers/raw/octeontx2_ep/rte_rawdev_octeontx2_ep_version.map -- 1.8.3.1
[dpdk-dev] [PATCH v1 3/6] raw/octeontx2_ep: add device uninitialization
Add rawdev close/uninitialize operation for SDP VF devices. Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 111 ++ drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 78 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 8 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.c | 44 4 files changed, 241 insertions(+) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 8857004..584b818 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -21,6 +21,59 @@ #include "otx2_common.h" #include "otx2_ep_enqdeq.h" +static void +sdp_dmazone_free(const struct rte_memzone *mz) +{ + const struct rte_memzone *mz_tmp; + int ret = 0; + + if (mz == NULL) { + otx2_err("Memzone %s : NULL", mz->name); + return; + } + + mz_tmp = rte_memzone_lookup(mz->name); + if (mz_tmp == NULL) { + otx2_err("Memzone %s Not Found", mz->name); + return; + } + + ret = rte_memzone_free(mz); + if (ret) + otx2_err("Memzone free failed : ret = %d", ret); + +} + +/* Free IQ resources */ +int +sdp_delete_iqs(struct sdp_device *sdpvf, uint32_t iq_no) +{ + struct sdp_instr_queue *iq; + + iq = sdpvf->instr_queue[iq_no]; + if (iq == NULL) { + otx2_err("Invalid IQ[%d]\n", iq_no); + return -ENOMEM; + } + + rte_free(iq->req_list); + iq->req_list = NULL; + + if (iq->iq_mz) { + sdp_dmazone_free(iq->iq_mz); + iq->iq_mz = NULL; + } + + rte_free(sdpvf->instr_queue[iq_no]); + sdpvf->instr_queue[iq_no] = NULL; + + sdpvf->num_iqs--; + + otx2_info("IQ[%d] is deleted", iq_no); + + return 0; +} + /* IQ initialization */ static int sdp_init_instr_queue(struct sdp_device *sdpvf, int iq_no) @@ -126,6 +179,7 @@ return 0; delete_IQ: + sdp_delete_iqs(sdpvf, iq_no); return -ENOMEM; } @@ -139,6 +193,61 @@ rte_atomic64_set(&droq->pkts_pending, 0); } +static void +sdp_droq_destroy_ring_buffers(struct sdp_device *sdpvf, + struct sdp_droq *droq) +{ + uint32_t idx; + + for (idx = 0; idx < droq->nb_desc; idx++) { + if (droq->recv_buf_list[idx].buffer) { + rte_mempool_put(sdpvf->enqdeq_mpool, + droq->recv_buf_list[idx].buffer); + + droq->recv_buf_list[idx].buffer = NULL; + } + } + + sdp_droq_reset_indices(droq); +} + +/* Free OQs resources */ +int +sdp_delete_oqs(struct sdp_device *sdpvf, uint32_t oq_no) +{ + struct sdp_droq *droq; + + droq = sdpvf->droq[oq_no]; + if (droq == NULL) { + otx2_err("Invalid droq[%d]", oq_no); + return -ENOMEM; + } + + sdp_droq_destroy_ring_buffers(sdpvf, droq); + rte_free(droq->recv_buf_list); + droq->recv_buf_list = NULL; + + if (droq->info_mz) { + sdp_dmazone_free(droq->info_mz); + droq->info_mz = NULL; + } + + if (droq->desc_ring_mz) { + sdp_dmazone_free(droq->desc_ring_mz); + droq->desc_ring_mz = NULL; + } + + memset(droq, 0, SDP_DROQ_SIZE); + + rte_free(sdpvf->droq[oq_no]); + sdpvf->droq[oq_no] = NULL; + + sdpvf->num_oqs--; + + otx2_info("OQ[%d] is deleted", oq_no); + return 0; +} + static int sdp_droq_setup_ring_buffers(struct sdp_device *sdpvf, struct sdp_droq *droq) @@ -290,5 +399,7 @@ return 0; delete_OQ: + sdp_delete_oqs(sdpvf, oq_no); return -ENOMEM; } + diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c index 5db9b50..2c43d3f 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c @@ -63,6 +63,45 @@ } static int +sdp_vfdev_exit(struct rte_rawdev *rawdev) +{ + struct sdp_device *sdpvf; + uint32_t rawdev_queues, q; + + otx2_info("%s:", __func__); + + sdpvf = (struct sdp_device *)rawdev->dev_private; + + sdpvf->fn_list.disable_io_queues(sdpvf); + + rawdev_queues = sdpvf->num_oqs; + for (q = 0; q < rawdev_queues; q++) { + if (sdp_delete_oqs(sdpvf, q)) { + otx2_err("Failed to delete OQ:%d", q); + return -ENOMEM; + } + } + otx2_info("Num OQs:%d freed", sdpvf->num_oqs); + + /* Free the oqbuf_pool */ + rte_mempool_free(sdpv
[dpdk-dev] [PATCH v1 4/6] raw/octeontx2_ep: add enqueue operation
Add rawdev enqueue operation for SDP VF devices. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst | 6 + drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 242 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 39 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 20 +++ drivers/raw/octeontx2_ep/otx2_ep_vf.c | 24 +++ 6 files changed, 332 insertions(+) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 2507fcf..39a7c29 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -68,3 +68,9 @@ The following code shows how the device is configured rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); +Performing Data Transfer + + +To perform data transfer using SDP VF EP rawdev devices use standard +``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` APIs. + diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index 584b818..ebbacfb 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -403,3 +403,245 @@ return -ENOMEM; } +static inline void +sdp_iqreq_delete(struct sdp_device *sdpvf, + struct sdp_instr_queue *iq, uint32_t idx) +{ + uint32_t reqtype; + void *buf; + + buf = iq->req_list[idx].buf; + reqtype = iq->req_list[idx].reqtype; + + switch (reqtype) { + case SDP_REQTYPE_NORESP: + rte_mempool_put(sdpvf->enqdeq_mpool, buf); + otx2_sdp_dbg("IQ buffer freed at idx[%d]", idx); + break; + + case SDP_REQTYPE_NORESP_GATHER: + case SDP_REQTYPE_NONE: + default: + otx2_info("This iqreq mode is not supported:%d", reqtype); + + } + + /* Reset the request list at this index */ + iq->req_list[idx].buf = NULL; + iq->req_list[idx].reqtype = 0; +} + +static inline void +sdp_iqreq_add(struct sdp_instr_queue *iq, void *buf, + uint32_t reqtype) +{ + iq->req_list[iq->host_write_index].buf = buf; + iq->req_list[iq->host_write_index].reqtype = reqtype; + + otx2_sdp_dbg("IQ buffer added at idx[%d]", iq->host_write_index); + +} + +static void +sdp_flush_iq(struct sdp_device *sdpvf, + struct sdp_instr_queue *iq, + uint32_t pending_thresh __rte_unused) +{ + uint32_t instr_processed = 0; + + rte_spinlock_lock(&iq->lock); + + iq->otx_read_index = sdpvf->fn_list.update_iq_read_idx(iq); + while (iq->flush_index != iq->otx_read_index) { + /* Free the IQ data buffer to the pool */ + sdp_iqreq_delete(sdpvf, iq, iq->flush_index); + iq->flush_index = + sdp_incr_index(iq->flush_index, 1, iq->nb_desc); + + instr_processed++; + } + + iq->stats.instr_processed = instr_processed; + rte_atomic64_sub(&iq->instr_pending, instr_processed); + + rte_spinlock_unlock(&iq->lock); +} + +static inline void +sdp_ring_doorbell(struct sdp_device *sdpvf __rte_unused, + struct sdp_instr_queue *iq) +{ + otx2_write64(iq->fill_cnt, iq->doorbell_reg); + + /* Make sure doorbell write goes through */ + rte_wmb(); + iq->fill_cnt = 0; + +} + +static inline int +post_iqcmd(struct sdp_instr_queue *iq, uint8_t *iqcmd) +{ + uint8_t *iqptr, cmdsize; + + /* This ensures that the read index does not wrap around to +* the same position if queue gets full before OCTEON TX2 could +* fetch any instr. +*/ + if (rte_atomic64_read(&iq->instr_pending) >= + (int32_t)(iq->nb_desc - 1)) { + otx2_err("IQ is full, pending:%ld", +(long)rte_atomic64_read(&iq->instr_pending)); + + return SDP_IQ_SEND_FAILED; + } + + /* Copy cmd into iq */ + cmdsize = ((iq->iqcmd_64B) ? 64 : 32); + iqptr = iq->base_addr + (cmdsize * iq->host_write_index); + + rte_memcpy(iqptr, iqcmd, cmdsize); + + otx2_sdp_dbg("IQ cmd posted @ index:%d", iq->host_write_index); + + /* Increment the host write index */ + iq->host_write_index = + sdp_incr_index(iq->host_write_index, 1, iq->nb_desc); + + iq->fill_cnt++; + + /* Flush the command into memory. We need to be sure the data +* is in memory before indicating that the instruction is +* pending. +*/ + rte_wmb(); + rte_atomic64_inc(&iq->instr_pending); + + /* SDP_IQ_SEND_SUCCESS */ + return 0; +} + + +stat
[dpdk-dev] [PATCH v1 5/6] raw/octeontx2_ep: add dequeue operation
Add rawdev dequeue operation for SDP VF devices. Signed-off-by: Mahipal Challa --- drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 199 ++ drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 2 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 18 ++- 4 files changed, 219 insertions(+), 1 deletion(-) diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c index ebbacfb..451fcc0 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c @@ -260,6 +260,7 @@ rte_mempool_get(sdpvf->enqdeq_mpool, &buf); if (buf == NULL) { otx2_err("OQ buffer alloc failed"); + droq->stats.rx_alloc_failure++; /* sdp_droq_destroy_ring_buffers(droq);*/ return -ENOMEM; } @@ -645,3 +646,201 @@ return SDP_IQ_SEND_FAILED; } +static uint32_t +sdp_droq_refill(struct sdp_device *sdpvf, struct sdp_droq *droq) +{ + struct sdp_droq_desc *desc_ring; + uint32_t desc_refilled = 0; + void *buf = NULL; + + desc_ring = droq->desc_ring; + + while (droq->refill_count && (desc_refilled < droq->nb_desc)) { + /* If a valid buffer exists (happens if there is no dispatch), +* reuse the buffer, else allocate. +*/ + if (droq->recv_buf_list[droq->refill_idx].buffer != NULL) + break; + + rte_mempool_get(sdpvf->enqdeq_mpool, &buf); + /* If a buffer could not be allocated, no point in +* continuing +*/ + if (buf == NULL) { + droq->stats.rx_alloc_failure++; + break; + } + + droq->recv_buf_list[droq->refill_idx].buffer = buf; + desc_ring[droq->refill_idx].buffer_ptr = rte_mem_virt2iova(buf); + + /* Reset any previous values in the length field. */ + droq->info_list[droq->refill_idx].length = 0; + + droq->refill_idx = sdp_incr_index(droq->refill_idx, 1, + droq->nb_desc); + + desc_refilled++; + droq->refill_count--; + + } + + return desc_refilled; +} + +static int +sdp_droq_read_packet(struct sdp_device *sdpvf __rte_unused, +struct sdp_droq *droq, +struct sdp_droq_pkt *droq_pkt) +{ + struct sdp_droq_info *info; + uint32_t total_len = 0; + uint32_t pkt_len = 0; + + info = &droq->info_list[droq->read_idx]; + sdp_swap_8B_data((uint64_t *)&info->length, 1); + if (!info->length) { + otx2_err("OQ info_list->length[%ld]", (long)info->length); + goto oq_read_fail; + } + + /* Deduce the actual data size */ + info->length -= SDP_RH_SIZE; + total_len += (uint32_t)info->length; + + otx2_sdp_dbg("OQ: pkt_len[%ld], buffer_size %d", + (long)info->length, droq->buffer_size); + if (info->length > droq->buffer_size) { + otx2_err("This mode is not supported: pkt_len > buffer_size"); + goto oq_read_fail; + } + + if (info->length <= droq->buffer_size) { + pkt_len = (uint32_t)info->length; + droq_pkt->data = droq->recv_buf_list[droq->read_idx].buffer; + droq_pkt->len = pkt_len; + + droq->recv_buf_list[droq->read_idx].buffer = NULL; + droq->read_idx = sdp_incr_index(droq->read_idx, 1,/* count */ + droq->nb_desc /* max rd idx */); + droq->refill_count++; + + } + + info->length = 0; + + return SDP_OQ_RECV_SUCCESS; + +oq_read_fail: + return SDP_OQ_RECV_FAILED; +} + +static inline uint32_t +sdp_check_droq_pkts(struct sdp_droq *droq, uint32_t burst_size) +{ + uint32_t min_pkts = 0; + uint32_t new_pkts; + uint32_t pkt_count; + + /* Latest available OQ packets */ + pkt_count = rte_read32(droq->pkts_sent_reg); + + /* Newly arrived packets */ + new_pkts = pkt_count - droq->last_pkt_count; + otx2_sdp_dbg("Recvd [%d] new OQ pkts", new_pkts); + + min_pkts = (new_pkts > burst_size) ? burst_size : new_pkts; + if (min_pkts) { + rte_atomic64_add(&droq->pkts_pending, min_pkts); + /* Back up the aggregated packet count so far */ + droq->last_pkt_count += min_pkts; + } + + return min_pkts; +} + +/* Check for response
[dpdk-dev] [PATCH v1 6/6] raw/octeontx2_ep: add driver self test
Add rawdev's selftest feature in SDP VF driver, which verifies the EP mode functionality test. Signed-off-by: Mahipal Challa --- doc/guides/rawdevs/octeontx2_ep.rst | 13 +++ drivers/raw/octeontx2_ep/Makefile | 1 + drivers/raw/octeontx2_ep/meson.build | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 2 + drivers/raw/octeontx2_ep/otx2_ep_test.c | 164 ++ 6 files changed, 182 insertions(+) diff --git a/doc/guides/rawdevs/octeontx2_ep.rst b/doc/guides/rawdevs/octeontx2_ep.rst index 39a7c29..bbcf530 100644 --- a/doc/guides/rawdevs/octeontx2_ep.rst +++ b/doc/guides/rawdevs/octeontx2_ep.rst @@ -74,3 +74,16 @@ Performing Data Transfer To perform data transfer using SDP VF EP rawdev devices use standard ``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` APIs. +Self test +- + +On EAL initialization, SDP VF devices will be probed and populated into the +raw devices. The rawdev ID of the device can be obtained using + +* Invoke ``rte_rawdev_get_dev_id("SDPEP:x")`` from the test application + where x is the VF device's bus id specified in "bus:device.func"(BDF) + format. Use this index for further rawdev function calls. + +* The driver's selftest rawdev API can be used to verify the SDP EP mode + functional tests which can send/receive the raw data packets to/from the + EP device. diff --git a/drivers/raw/octeontx2_ep/Makefile b/drivers/raw/octeontx2_ep/Makefile index 02853fb..44fdf89 100644 --- a/drivers/raw/octeontx2_ep/Makefile +++ b/drivers/raw/octeontx2_ep/Makefile @@ -37,6 +37,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_rawdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_enqdeq.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_test.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) += otx2_ep_vf.c diff --git a/drivers/raw/octeontx2_ep/meson.build b/drivers/raw/octeontx2_ep/meson.build index 99e6c6d..0e6338f 100644 --- a/drivers/raw/octeontx2_ep/meson.build +++ b/drivers/raw/octeontx2_ep/meson.build @@ -5,4 +5,5 @@ deps += ['bus_pci', 'common_octeontx2', 'rawdev'] sources = files('otx2_ep_rawdev.c', 'otx2_ep_enqdeq.c', + 'otx2_ep_test.c', 'otx2_ep_vf.c') diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c index ddb208d..c5c0cf3 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c @@ -253,6 +253,7 @@ .dev_close = sdp_rawdev_close, .enqueue_bufs = sdp_rawdev_enqueue, .dequeue_bufs = sdp_rawdev_dequeue, + .dev_selftest = sdp_rawdev_selftest, }; static int diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h index a77cbab..dab2fb7 100644 --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h @@ -494,4 +494,6 @@ int sdp_rawdev_enqueue(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, int sdp_rawdev_dequeue(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, unsigned int count, rte_rawdev_obj_t context); +int sdp_rawdev_selftest(uint16_t dev_id); + #endif /* _OTX2_EP_RAWDEV_H_ */ diff --git a/drivers/raw/octeontx2_ep/otx2_ep_test.c b/drivers/raw/octeontx2_ep/otx2_ep_test.c new file mode 100644 index 000..96fedb5 --- /dev/null +++ b/drivers/raw/octeontx2_ep/otx2_ep_test.c @@ -0,0 +1,164 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "otx2_common.h" +#include "otx2_ep_rawdev.h" + +#define SDP_IOQ_NUM_BUFS (4 * 1024) +#define SDP_IOQ_BUF_SIZE (2 * 1024) + +#define SDP_TEST_PKT_FSZ (0) +#define SDP_TEST_PKT_SIZE (1024) + +static int +sdp_validate_data(struct sdp_droq_pkt *oq_pkt, uint8_t *iq_pkt, + uint32_t pkt_len) +{ + if (!oq_pkt) + return -EINVAL; + + if (pkt_len != oq_pkt->len) { + otx2_err("Invalid packet length"); + return -EINVAL; + } + + if (memcmp(oq_pkt->data, iq_pkt, pkt_len) != 0) { + otx2_err("Data validation failed"); + return -EINVAL; + } + otx2_sdp_dbg("Data validation successful"); + + return 0; +} + +static void +sdp_ioq_buffer_fill(uint8_t *addr, uint32_t len) +{ + uint32_t idx; + + memset(addr, 0, len); + + for (idx = 0; idx < len; idx++) + addr[idx] = idx; +} + +static struct rte_mempool* +sdp_ioq_mempool_
Re: [dpdk-dev] [EXT] Re: [PATCH] maintainers: Update for OcteonTx2 DMA and EP
-Original Message- From: Radha Mohan Sent: Tuesday, November 10, 2020 11:44 PM To: Radha Chintakuntla ; Satha Koteswara Rao Kottidi ; Mahipal Challa Cc: dev@dpdk.org; Thomas Monjalon ; Veerasenareddy Burru ; Satananda Burla ; Jerin Jacob Kollanukkaran Subject: [EXT] Re: [dpdk-dev] [PATCH] maintainers: Update for OcteonTx2 DMA and EP External Email -- On Mon, Nov 9, 2020 at 4:20 PM Radha Mohan Chintakuntla wrote: > > Replace the maintainers for OcteonTx2 DMA and EP drivers. > > Signed-off-by: Radha Mohan Chintakuntla > --- > MAINTAINERS | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/MAINTAINERS b/MAINTAINERS index a720cf672e..214515060a > 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -1258,12 +1258,14 @@ F: drivers/raw/dpaa2_cmdif/ > F: doc/guides/rawdevs/dpaa2_cmdif.rst > > Marvell OCTEON TX2 DMA > -M: Satha Rao > +M: Radha Mohan Chintakuntla > +M: Veerasenareddy Burru > F: drivers/raw/octeontx2_dma/ > F: doc/guides/rawdevs/octeontx2_dma.rst > > Marvell OCTEON TX2 EP > -M: Mahipal Challa > +M: Radha Mohan Chintakuntla > +M: Veerasenareddy Burru > F: drivers/raw/octeontx2_ep/ > F: doc/guides/rawdevs/octeontx2_ep.rst > > -- > 2.24.1 > >Adding previous maintainers to ack. Acked-by: Mahipal Challa