DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <shreyansh.jain@nxp.com>
Subject: [dpdk-dev] [PATCH 07/14] bus/fslmc: add qman HW fq query count API
Date: Fri, 8 Dec 2017 10:51:20 +0530	[thread overview]
Message-ID: <1512710487-32388-8-git-send-email-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <1512710487-32388-1-git-send-email-hemant.agrawal@nxp.com>

This patch add support for rx query debug API.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/fslmc/Makefile                        |  3 +-
 drivers/bus/fslmc/qbman/include/fsl_qbman_debug.h | 30 +++++++++++
 drivers/bus/fslmc/qbman/qbman_debug.c             | 66 +++++++++++++++++++++++
 drivers/bus/fslmc/rte_bus_fslmc_version.map       |  2 +
 4 files changed, 100 insertions(+), 1 deletion(-)
 create mode 100644 drivers/bus/fslmc/qbman/include/fsl_qbman_debug.h
 create mode 100644 drivers/bus/fslmc/qbman/qbman_debug.c

diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile
index c08b2af..7ab39cb 100644
--- a/drivers/bus/fslmc/Makefile
+++ b/drivers/bus/fslmc/Makefile
@@ -62,7 +62,8 @@ EXPORT_MAP := rte_bus_fslmc_version.map
 LIBABIVER := 1
 
 SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += \
-        qbman/qbman_portal.c
+        qbman/qbman_portal.c \
+        qbman/qbman_debug.c
 
 SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += \
 	mc/dpmng.c \
diff --git a/drivers/bus/fslmc/qbman/include/fsl_qbman_debug.h b/drivers/bus/fslmc/qbman/include/fsl_qbman_debug.h
new file mode 100644
index 0000000..072ad55
--- /dev/null
+++ b/drivers/bus/fslmc/qbman/include/fsl_qbman_debug.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:        BSD-3-Clause
+ */
+struct qbman_swp;
+
+struct qbman_fq_query_np_rslt {
+uint8_t verb;
+	uint8_t rslt;
+	uint8_t st1;
+	uint8_t st2;
+	uint8_t reserved[2];
+	uint16_t od1_sfdr;
+	uint16_t od2_sfdr;
+	uint16_t od3_sfdr;
+	uint16_t ra1_sfdr;
+	uint16_t ra2_sfdr;
+	uint32_t pfdr_hptr;
+	uint32_t pfdr_tptr;
+	uint32_t frm_cnt;
+	uint32_t byte_cnt;
+	uint16_t ics_surp;
+	uint8_t is;
+	uint8_t reserved2[29];
+};
+
+int qbman_fq_query_state(struct qbman_swp *s, uint32_t fqid,
+			 struct qbman_fq_query_np_rslt *r);
+uint32_t qbman_fq_state_frame_count(const struct qbman_fq_query_np_rslt *r);
+uint32_t qbman_fq_state_byte_count(const struct qbman_fq_query_np_rslt *r);
diff --git a/drivers/bus/fslmc/qbman/qbman_debug.c b/drivers/bus/fslmc/qbman/qbman_debug.c
new file mode 100644
index 0000000..591673a
--- /dev/null
+++ b/drivers/bus/fslmc/qbman/qbman_debug.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:        BSD-3-Clause
+ */
+
+#include "compat.h"
+#include <fsl_qbman_debug.h>
+#include "qbman_portal.h"
+
+/* QBMan portal management command code */
+#define QBMAN_BP_QUERY            0x32
+#define QBMAN_FQ_QUERY            0x44
+#define QBMAN_FQ_QUERY_NP         0x45
+#define QBMAN_WQ_QUERY            0x47
+#define QBMAN_CGR_QUERY           0x51
+#define QBMAN_WRED_QUERY          0x54
+#define QBMAN_CGR_STAT_QUERY      0x55
+#define QBMAN_CGR_STAT_QUERY_CLR  0x56
+
+struct qbman_fq_query_desc {
+	uint8_t verb;
+	uint8_t reserved[3];
+	uint32_t fqid;
+	uint8_t reserved2[57];
+};
+
+int qbman_fq_query_state(struct qbman_swp *s, uint32_t fqid,
+			 struct qbman_fq_query_np_rslt *r)
+{
+	struct qbman_fq_query_desc *p;
+
+	p = (struct qbman_fq_query_desc *)qbman_swp_mc_start(s);
+	if (!p)
+		return -EBUSY;
+
+	p->fqid = fqid;
+	*r = *(struct qbman_fq_query_np_rslt *)qbman_swp_mc_complete(s, p,
+						QBMAN_FQ_QUERY_NP);
+	if (!r) {
+		pr_err("qbman: Query FQID %d NP fields failed, no response\n",
+		       fqid);
+		return -EIO;
+	}
+
+	/* Decode the outcome */
+	QBMAN_BUG_ON((r->verb & QBMAN_RESPONSE_VERB_MASK) != QBMAN_FQ_QUERY_NP);
+
+	/* Determine success or failure */
+	if (r->rslt != QBMAN_MC_RSLT_OK) {
+		pr_err("Query NP fields of FQID 0x%x failed, code=0x%02x\n",
+		       fqid, r->rslt);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+uint32_t qbman_fq_state_frame_count(const struct qbman_fq_query_np_rslt *r)
+{
+	return (r->frm_cnt & 0x00FFFFFF);
+}
+
+uint32_t qbman_fq_state_byte_count(const struct qbman_fq_query_np_rslt *r)
+{
+	return r->byte_cnt;
+}
diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map
index f266d6d..f59fc67 100644
--- a/drivers/bus/fslmc/rte_bus_fslmc_version.map
+++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map
@@ -95,5 +95,7 @@ DPDK_18.02 {
 
 	dpaa2_svr_family;
 	dpaa2_virt_mode;
+	qbman_fq_query_state;
+	qbman_fq_state_frame_count;
 
 } DPDK_17.11;
-- 
2.7.4

  parent reply	other threads:[~2017-12-08  5:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08  5:21 [dpdk-dev] [PATCH 00/14] DPAA2 PMD fixes and enhancements Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 01/14] bus/fslmc: fix the cplusplus macro closure Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 02/14] drivers: change the deprecated memseg physaddr to iova Hemant Agrawal
2017-12-08  5:29   ` santosh
2017-12-08  5:21 ` [dpdk-dev] [PATCH 03/14] bus/fslmc: add support for dynamic iova for DPAA2 devices Hemant Agrawal
2017-12-12  0:52   ` Ferruh Yigit
2017-12-08  5:21 ` [dpdk-dev] [PATCH 04/14] net/dpaa2: link status check as driver flag Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 05/14] bus/fslmc: expose platform soc value register Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 06/14] bus/fslmc: add braces for pointers in macros Hemant Agrawal
2017-12-12  0:52   ` Ferruh Yigit
2017-12-12  5:22     ` Hemant Agrawal
2017-12-08  5:21 ` Hemant Agrawal [this message]
2017-12-08  5:21 ` [dpdk-dev] [PATCH 08/14] net/dpaa2: add Rx queue count support Hemant Agrawal
2017-12-12  1:28   ` Stephen Hemminger
2017-12-12  5:14     ` Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 09/14] net/dpaa2: align the frame size in MTU set Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 10/14] net/dpaa2: add VLAN insert offload Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 11/14] net/dpaa2: add parse function for LX2 device Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 12/14] net/dpaa2: optimize Rx path packet parsing Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 13/14] net/dpaa2: optimize Tx path for best case Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 14/14] net/dpaa2: prefetch the parse results from next fd Hemant Agrawal
2017-12-12  0:53 ` [dpdk-dev] [PATCH 00/14] DPAA2 PMD fixes and enhancements 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=1512710487-32388-8-git-send-email-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=shreyansh.jain@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).