DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shreyansh Jain <shreyansh.jain@nxp.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <hemant.agrawal@nxp.com>
Subject: [dpdk-dev] [RFC Patch 39/39] net/dpaa: add packet dump for debugging
Date: Sat, 27 May 2017 15:55:35 +0530	[thread overview]
Message-ID: <1495880735-1651-40-git-send-email-shreyansh.jain@nxp.com> (raw)
In-Reply-To: <1495880735-1651-1-git-send-email-shreyansh.jain@nxp.com>

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 config/defconfig_arm64-dpaa-linuxapp-gcc |  2 ++
 drivers/net/dpaa/dpaa_ethdev.c           | 42 ++++++++++++++++++++++++++++++++
 drivers/net/dpaa/dpaa_rxtx.c             | 36 +++++++++++++++++++++++++++
 3 files changed, 80 insertions(+)

diff --git a/config/defconfig_arm64-dpaa-linuxapp-gcc b/config/defconfig_arm64-dpaa-linuxapp-gcc
index fcc0231..ce1a10e 100644
--- a/config/defconfig_arm64-dpaa-linuxapp-gcc
+++ b/config/defconfig_arm64-dpaa-linuxapp-gcc
@@ -50,6 +50,8 @@ CONFIG_RTE_LIBRTE_DPAA_DEBUG_INIT=n
 CONFIG_RTE_LIBRTE_DPAA_DEBUG_DRIVER=n
 CONFIG_RTE_LIBRTE_DPAA_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_DPAA_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_DPAA_DEBUG_DRIVER_DISPLAY=n
+CONFIG_RTE_LIBRTE_DPAA_CHECKING=y
 
 # DPAA Mempool
 CONFIG_RTE_LIBRTE_DPAA_MEMPOOL=y
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 30ebc2b..92fac72 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -621,6 +621,39 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 	return ret;
 }
 
+#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
+/* Initialise a DEBUG FQ ([rt]x_error, rx_default). */
+static int dpaa_debug_queue_init(struct qman_fq *fq, uint32_t fqid)
+{
+	struct qm_mcc_initfq opts;
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	ret = qman_reserve_fqid(fqid);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "reserve debug fqid %d failed with ret: %d",
+			fqid, ret);
+		return -EINVAL;
+	}
+	/* "map" this Rx FQ to one of the interfaces Tx FQID */
+	PMD_DRV_LOG(DEBUG, "creating debug fq %p, fqid %d", fq, fqid);
+	ret = qman_create_fq(fqid, QMAN_FQ_FLAG_NO_ENQUEUE, fq);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "create debug fqid %d failed with ret: %d",
+			fqid, ret);
+		return ret;
+	}
+	opts.we_mask = QM_INITFQ_WE_DESTWQ | QM_INITFQ_WE_FQCTRL;
+	opts.fqd.dest.wq = DPAA_IF_DEBUG_PRIORITY;
+	ret = qman_init_fq(fq, 0, &opts);
+	if (ret)
+		PMD_DRV_LOG(ERR, "init debug fqid %d failed with ret: %d",
+			    fqid, ret);
+	return ret;
+}
+#endif
+
 /* Initialise a network interface */
 static int dpaa_eth_dev_init(struct rte_eth_dev *eth_dev)
 {
@@ -682,6 +715,15 @@ static int dpaa_eth_dev_init(struct rte_eth_dev *eth_dev)
 	}
 	dpaa_intf->nb_tx_queues = num_cores;
 
+#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
+	dpaa_debug_queue_init(&dpaa_intf->debug_queues[
+		DPAA_DEBUG_FQ_RX_ERROR], fman_intf->fqid_rx_err);
+	dpaa_intf->debug_queues[DPAA_DEBUG_FQ_RX_ERROR].dpaa_intf = dpaa_intf;
+	dpaa_debug_queue_init(&dpaa_intf->debug_queues[
+		DPAA_DEBUG_FQ_TX_ERROR], fman_intf->fqid_tx_err);
+	dpaa_intf->debug_queues[DPAA_DEBUG_FQ_TX_ERROR].dpaa_intf = dpaa_intf;
+#endif
+
 	PMD_DRV_LOG(DEBUG, "all fqs created");
 
 	/* Get the initial configuration for flow control */
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 9dc059e..d4396b1 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -85,6 +85,38 @@
 		(_fd)->bpid = _bpid; \
 	} while (0)
 
+#if (defined RTE_LIBRTE_DPAA_DEBUG_DRIVER_DISPLAY)
+void dpaa_display_frame(const struct qm_fd *fd)
+{
+	int ii;
+	char *ptr;
+
+	printf("%s::bpid %x addr %08x%08x, format %d off %d, len %d stat %x\n",
+	       __func__, fd->bpid, fd->addr_hi, fd->addr_lo, fd->format,
+		fd->offset, fd->length20, fd->status);
+
+	ptr = (char *)rte_dpaa_mem_ptov(fd->addr);
+	ptr += fd->offset;
+	printf("%02x ", *ptr);
+	for (ii = 1; ii < fd->length20; ii++) {
+		printf("%02x ", *ptr);
+		if ((ii % 16) == 0)
+			printf("\n");
+		ptr++;
+	}
+	printf("\n");
+}
+#else
+#define dpaa_display_frame(a)
+#endif
+
+static inline void dpaa_slow_parsing(struct rte_mbuf *m __rte_unused,
+				     uint64_t prs __rte_unused)
+{
+	PMD_RX_LOG(DEBUG, " Slow parsing");
+
+	/*TBD:XXX: to be implemented*/
+}
 
 static inline void dpaa_eth_packet_info(struct rte_mbuf *m,
 					uint64_t fd_virt_addr)
@@ -143,6 +175,7 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m,
 		break;
 	/* More switch cases can be added */
 	default:
+		dpaa_slow_parsing(m, prs);
 		break;
 	}
 
@@ -299,6 +332,8 @@ static inline struct rte_mbuf *dpaa_eth_fd_to_mbuf(struct qm_fd *fd,
 	struct pool_info_entry *bp_info = DPAA_BPID_TO_POOL_INFO(fd->bpid);
 	struct rte_mbuf *mbuf;
 	void *ptr;
+	uint8_t format =
+		(fd->opaque & DPAA_FD_FORMAT_MASK) >> DPAA_FD_FORMAT_SHIFT;
 	uint16_t offset =
 		(fd->opaque & DPAA_FD_OFFSET_MASK) >> DPAA_FD_OFFSET_SHIFT;
 	uint32_t length = fd->opaque & DPAA_FD_LENGTH_MASK;
@@ -309,6 +344,7 @@ static inline struct rte_mbuf *dpaa_eth_fd_to_mbuf(struct qm_fd *fd,
 		return dpaa_eth_sg_to_mbuf(fd, ifid);
 
 	/* Ignoring case when format != qm_fd_contig */
+	dpaa_display_frame(fd);
 	ptr = rte_dpaa_mem_ptov(fd->addr);
 	/* Ignoring case when ptr would be NULL. That is only possible incase
 	 * of a corrupted packet
-- 
2.7.4

      parent reply	other threads:[~2017-05-27 10:19 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-27 10:24 [dpdk-dev] [RFC Patch 00/39] Introduce NXP DPAA Bus, Mempool and PMD Shreyansh Jain
2017-05-27 10:24 ` [dpdk-dev] [RFC Patch 01/39] eal: add Bus log type Shreyansh Jain
2017-05-27 10:28   ` Shreyansh Jain
2017-05-27 10:24 ` [dpdk-dev] [RFC Patch 02/39] eal: add support for 24 40 and 48 bit operations Shreyansh Jain
2017-05-27 10:24 ` [dpdk-dev] [RFC Patch 03/39] config: add NXP DPAA SoC build configuration Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 04/39] bus/dpaa: introduce NXP DPAA Bus driver skeleton Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 05/39] bus/dpaa: add compatibility and helper macros Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 06/39] bus/dpaa: add OF parser for device scanning Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 07/39] bus/dpaa: introducing FMan configurations Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 08/39] bus/dpaa: add FMan hardware operations Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 09/39] bus/dpaa: enable DPAA IOCTL portal driver Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 10/39] bus/dpaa: add layer for interrupt emulation using pthread Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 11/39] bus/dpaa: add routines for managing a RB tree Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 12/39] bus/dpaa: add QMAN interface driver Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 13/39] bus/dpaa: add QMan driver core routines Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 14/39] bus/dpaa: add BMAN driver core Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 15/39] bus/dpaa: add support for FMAN frame queue lookup Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 16/39] bus/dpaa: add BMan hardware interfaces Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 17/39] bus/dpaa: add fman flow control threshold setting Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 18/39] bus/dpaa: integrate DPAA Bus with hardware blocks Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 19/39] doc: add NXP DPAA PMD documentation Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 20/39] mempool/dpaa: add support for NXP DPAA Mempool Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 21/39] drivers: enable compilation of DPAA Mempool driver Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 22/39] maintainers: claim ownership " Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 23/39] net/dpaa: add NXP DPAA PMD driver skeleton Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 24/39] config: enable NXP DPAA PMD compilation Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 25/39] net/dpaa: add support for Tx and Rx queue setup Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 26/39] net/dpaa: add support for MTU update Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 27/39] net/dpaa: add support for link status update Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 28/39] net/dpaa: add support for jumbo frames Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 29/39] net/dpaa: add support for promiscuous toggle Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 30/39] net/dpaa: add support for multicast toggle Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 31/39] net/dpaa: add support for basic stats Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 32/39] net/dpaa: add support for device info Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 33/39] net/dpaa: support for checksum offload Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 34/39] net/dpaa: add support for hashed RSS Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 35/39] net/dpaa: add support for MAC address update Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 36/39] net/dpaa: add support for packet type parsing Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 37/39] net/dpaa: add support for Scattered Rx Shreyansh Jain
2017-05-27 10:25 ` [dpdk-dev] [RFC Patch 38/39] net/dpaa: add support for flow control Shreyansh Jain
2017-05-27 10:25 ` Shreyansh Jain [this message]

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=1495880735-1651-40-git-send-email-shreyansh.jain@nxp.com \
    --to=shreyansh.jain@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=hemant.agrawal@nxp.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).