From: "Nalla, Pradeep" <pnalla@marvell.com>
To: "Nalla, Pradeep" <pnalla@marvell.com>,
Radha Mohan Chintakuntla <radhac@marvell.com>,
Veerasenareddy Burru <vburru@marvell.com>
Cc: <jerinj@marvell.com>, <sburla@marvell.com>, <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 12/15] net/octeontx_ep: INFO PTR mode support added.
Date: Thu, 31 Dec 2020 07:22:44 +0000 [thread overview]
Message-ID: <20201231072247.5719-13-pnalla@marvell.com> (raw)
In-Reply-To: <20201231072247.5719-1-pnalla@marvell.com>
From: "Nalla Pradeep" <pnalla@marvell.com>
Hardware can be programmed to write the meta data of incoming packet in
the same buffer it uses to fill the packet(BUF PTR mode) or a different
buffer (INFO PTR mode).
Signed-off-by: Nalla Pradeep <pnalla@marvell.com>
---
drivers/net/octeontx_ep/meson.build | 2 +-
drivers/net/octeontx_ep/otx_ep_common.h | 8 ++++
drivers/net/octeontx_ep/otx_ep_rxtx.c | 55 ++++++++++++++++++++++++-
3 files changed, 63 insertions(+), 2 deletions(-)
diff --git a/drivers/net/octeontx_ep/meson.build b/drivers/net/octeontx_ep/meson.build
index 8d804a0398..08e8131bfe 100644
--- a/drivers/net/octeontx_ep/meson.build
+++ b/drivers/net/octeontx_ep/meson.build
@@ -9,7 +9,7 @@ sources = files(
'otx_ep_rxtx.c',
)
-extra_flags = []
+extra_flags = ['-DBUFPTR_ONLY_MODE']
# This integrated controller runs only on a arm64 machine, remove 32bit warnings
if not dpdk_conf.get('RTE_ARCH_64')
extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
diff --git a/drivers/net/octeontx_ep/otx_ep_common.h b/drivers/net/octeontx_ep/otx_ep_common.h
index 978cceab01..0b6e7e2042 100644
--- a/drivers/net/octeontx_ep/otx_ep_common.h
+++ b/drivers/net/octeontx_ep/otx_ep_common.h
@@ -239,11 +239,19 @@ union otx_ep_rh {
* about the packet.
*/
struct otx_ep_droq_info {
+#ifndef BUFPTR_ONLY_MODE
+ /* The Output Receive Header. */
+ union otx_ep_rh rh;
+
+ /* The Length of the packet. */
+ uint64_t length;
+#else
/* The Length of the packet. */
uint64_t length;
/* The Output Receive Header. */
union otx_ep_rh rh;
+#endif
};
#define OTX_EP_DROQ_INFO_SIZE (sizeof(struct otx_ep_droq_info))
diff --git a/drivers/net/octeontx_ep/otx_ep_rxtx.c b/drivers/net/octeontx_ep/otx_ep_rxtx.c
index 4ffe0b8546..279ab9f6d6 100644
--- a/drivers/net/octeontx_ep/otx_ep_rxtx.c
+++ b/drivers/net/octeontx_ep/otx_ep_rxtx.c
@@ -215,6 +215,13 @@ otx_ep_delete_oqs(struct otx_ep_device *otx_ep, uint32_t oq_no)
rte_free(droq->recv_buf_list);
droq->recv_buf_list = NULL;
+#ifndef BUFPTR_ONLY_MODE
+ if (droq->info_mz) {
+ otx_ep_dmazone_free(droq->info_mz);
+ droq->info_mz = NULL;
+ }
+#endif
+
if (droq->desc_ring_mz) {
otx_ep_dmazone_free(droq->desc_ring_mz);
droq->desc_ring_mz = NULL;
@@ -249,6 +256,13 @@ otx_ep_droq_setup_ring_buffers(struct otx_ep_droq *droq)
}
droq->recv_buf_list[idx] = buf;
+#ifndef BUFPTR_ONLY_MODE
+ droq->info_list[idx].length = 0;
+
+ /* Map ring buffers into memory */
+ desc_ring[idx].info_ptr = (uint64_t)(droq->info_list_dma +
+ (idx * OTX_EP_DROQ_INFO_SIZE));
+#endif
info = rte_pktmbuf_mtod(buf, struct otx_ep_droq_info *);
memset(info, 0, sizeof(*info));
desc_ring[idx].buffer_ptr = rte_mbuf_data_iova_default(buf);
@@ -259,6 +273,28 @@ otx_ep_droq_setup_ring_buffers(struct otx_ep_droq *droq)
return 0;
}
+#ifndef BUFPTR_ONLY_MODE
+static void *
+otx_ep_alloc_info_buffer(struct otx_ep_device *otx_ep __rte_unused,
+ struct otx_ep_droq *droq, unsigned int socket_id)
+{
+ droq->info_mz = rte_memzone_reserve_aligned("OQ_info_list",
+ (droq->nb_desc * OTX_EP_DROQ_INFO_SIZE),
+ socket_id,
+ RTE_MEMZONE_IOVA_CONTIG,
+ OTX_EP_PCI_RING_ALIGN);
+
+ if (droq->info_mz == NULL)
+ return NULL;
+
+ droq->info_list_dma = droq->info_mz->iova;
+ droq->info_alloc_size = droq->info_mz->len;
+ droq->info_base_addr = (size_t)droq->info_mz->addr;
+
+ return droq->info_mz->addr;
+}
+#endif
+
/* OQ initialization */
static int
otx_ep_init_droq(struct otx_ep_device *otx_ep, uint32_t q_no,
@@ -301,6 +337,16 @@ otx_ep_init_droq(struct otx_ep_device *otx_ep, uint32_t q_no,
q_no, droq->desc_ring, (unsigned long)droq->desc_ring_dma);
otx_ep_dbg("OQ[%d]: num_desc: %d\n", q_no, droq->nb_desc);
+#ifndef BUFPTR_ONLY_MODE
+ /* OQ info_list set up */
+ droq->info_list = otx_ep_alloc_info_buffer(otx_ep, droq, socket_id);
+ if (droq->info_list == NULL) {
+ otx_ep_err("memory allocation failed for OQ[%d] info_list\n",
+ q_no);
+ goto init_droq_fail;
+ }
+
+#endif
/* OQ buf_list set up */
droq->recv_buf_list = rte_zmalloc_socket("recv_buf_list",
(droq->nb_desc * sizeof(struct rte_mbuf *)),
@@ -836,7 +882,10 @@ otx_ep_droq_refill(struct otx_ep_droq *droq)
desc_ring[droq->refill_idx].buffer_ptr =
rte_mbuf_data_iova_default(buf);
-
+#ifndef BUFPTR_ONLY_MODE
+ /* Reset any previous values in the length field. */
+ droq->info_list[droq->refill_idx].length = 0;
+#endif
droq->refill_idx = otx_ep_incr_index(droq->refill_idx, 1,
droq->nb_desc);
@@ -862,6 +911,9 @@ otx_ep_droq_read_packet(struct otx_ep_device *otx_ep,
droq_pkt = droq->recv_buf_list[droq->read_idx];
droq_pkt2 = droq->recv_buf_list[droq->read_idx];
+#ifndef BUFPTR_ONLY_MODE
+ info = &droq->info_list[droq->read_idx];
+#else
info = rte_pktmbuf_mtod(droq_pkt, struct otx_ep_droq_info *);
/* make sure info is available */
rte_rmb();
@@ -893,6 +945,7 @@ otx_ep_droq_read_packet(struct otx_ep_device *otx_ep,
info2 = rte_pktmbuf_mtod(droq_pkt2, struct otx_ep_droq_info *);
rte_prefetch_non_temporal((const void *)info2);
}
+#endif
info->length = rte_bswap64(info->length);
/* Deduce the actual data size */
--
2.17.1
next prev parent reply other threads:[~2020-12-31 7:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-31 7:22 [dpdk-dev] [PATCH 00/15] Octeon Tx/Tx2 Endpoint pmd Nalla, Pradeep
2020-12-31 7:22 ` [dpdk-dev] [PATCH 01/15] net/octeontx_ep: add build and doc infrastructure Nalla, Pradeep
2020-12-31 7:22 ` [dpdk-dev] [PATCH 02/15] net/octeontx_ep: add ethdev probe and remove Nalla, Pradeep
2020-12-31 7:22 ` [dpdk-dev] [PATCH 03/15] net/octeontx_ep: add device init and uninit Nalla, Pradeep
2020-12-31 7:22 ` [dpdk-dev] [PATCH 04/15] net/octeontx_ep: Added basic device setup Nalla, Pradeep
2020-12-31 7:22 ` [dpdk-dev] [PATCH 05/15] net/octeontx_ep: Add dev info get and configure Nalla, Pradeep
2020-12-31 7:22 ` [dpdk-dev] [PATCH 06/15] net/octeontx_ep: Added rxq setup and release Nalla, Pradeep
2020-12-31 7:22 ` [dpdk-dev] [PATCH 07/15] net/octeontx_ep: Added tx queue " Nalla, Pradeep
2020-12-31 7:22 ` [dpdk-dev] [PATCH 08/15] net/octeontx_ep: Setting up iq and oq registers Nalla, Pradeep
2020-12-31 7:22 ` [dpdk-dev] [PATCH 09/15] net/octeontx_ep: Added dev start and stop Nalla, Pradeep
2020-12-31 7:22 ` [dpdk-dev] [PATCH 10/15] net/octeontx_ep: Receive data path function added Nalla, Pradeep
2020-12-31 7:22 ` [dpdk-dev] [PATCH 11/15] net/octeontx_ep: Transmit " Nalla, Pradeep
2020-12-31 7:22 ` Nalla, Pradeep [this message]
2020-12-31 7:22 ` [dpdk-dev] [PATCH 13/15] net/octeontx_ep: stats get/reset and link update Nalla, Pradeep
2020-12-31 7:22 ` [dpdk-dev] [PATCH 14/15] net/octeontx_ep: rx queue interrupt Nalla, Pradeep
2020-12-31 7:22 ` [dpdk-dev] [PATCH 15/15] net/octeontx_ep: Input output reset Nalla, Pradeep
2021-01-04 11:51 ` [dpdk-dev] [PATCH 00/15] Octeon Tx/Tx2 Endpoint pmd Ferruh Yigit
2021-01-05 14:43 ` [dpdk-dev] [EXT] " Pradeep Kumar Nalla
2021-01-05 15:29 ` Ferruh Yigit
2021-01-06 11:35 ` Pradeep Kumar Nalla
2021-01-06 11:58 ` Jerin Jacob
2021-01-06 14:24 ` Ferruh Yigit
2021-01-06 14:43 ` Jerin Jacob
2021-01-06 15:30 ` Pradeep Kumar Nalla
2021-01-06 18:13 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201231072247.5719-13-pnalla@marvell.com \
--to=pnalla@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=radhac@marvell.com \
--cc=sburla@marvell.com \
--cc=vburru@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).