[dpdk-dev] [PATCH v2 14/46] net/liquidio: add API to setup IQ

Shijith Thotton shijith.thotton at caviumnetworks.com
Thu Mar 2 12:32:19 CET 2017


Map instruction queue registers and set queue size.

Signed-off-by: Shijith Thotton <shijith.thotton at caviumnetworks.com>
Signed-off-by: Jerin Jacob <jerin.jacob at caviumnetworks.com>
Signed-off-by: Derek Chickles <derek.chickles at caviumnetworks.com>
Signed-off-by: Venkat Koppula <venkat.koppula at caviumnetworks.com>
Signed-off-by: Srisivasubramanian S <ssrinivasan at caviumnetworks.com>
Signed-off-by: Mallesham Jatharakonda <mjatharakonda at oneconvergence.com>
---
 drivers/net/liquidio/base/lio_23xx_vf.c | 44 ++++++++++++++++++++++++++++++++-
 drivers/net/liquidio/lio_rxtx.c         |  2 ++
 drivers/net/liquidio/lio_struct.h       |  2 ++
 3 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/drivers/net/liquidio/base/lio_23xx_vf.c b/drivers/net/liquidio/base/lio_23xx_vf.c
index ed5b830..181f830 100644
--- a/drivers/net/liquidio/base/lio_23xx_vf.c
+++ b/drivers/net/liquidio/base/lio_23xx_vf.c
@@ -199,6 +199,40 @@
 }
 
 static void
+cn23xx_vf_setup_iq_regs(struct lio_device *lio_dev, uint32_t iq_no)
+{
+	struct lio_instr_queue *iq = lio_dev->instr_queue[iq_no];
+	uint64_t pkt_in_done = 0;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Write the start of the input queue's ring and its size */
+	lio_write_csr64(lio_dev, CN23XX_SLI_IQ_BASE_ADDR64(iq_no),
+			iq->base_addr_dma);
+	lio_write_csr(lio_dev, CN23XX_SLI_IQ_SIZE(iq_no), iq->max_count);
+
+	/* Remember the doorbell & instruction count register addr
+	 * for this queue
+	 */
+	iq->doorbell_reg = (uint8_t *)lio_dev->hw_addr +
+				CN23XX_SLI_IQ_DOORBELL(iq_no);
+	iq->inst_cnt_reg = (uint8_t *)lio_dev->hw_addr +
+				CN23XX_SLI_IQ_INSTR_COUNT64(iq_no);
+	lio_dev_dbg(lio_dev, "InstQ[%d]:dbell reg @ 0x%p instcnt_reg @ 0x%p\n",
+		    iq_no, iq->doorbell_reg, iq->inst_cnt_reg);
+
+	/* Store the current instruction counter (used in flush_iq
+	 * calculation)
+	 */
+	pkt_in_done = rte_read64(iq->inst_cnt_reg);
+
+	/* Clear the count by writing back what we read, but don't
+	 * enable data traffic here
+	 */
+	rte_write64(pkt_in_done, iq->inst_cnt_reg);
+}
+
+static void
 cn23xx_vf_free_mbox(struct lio_device *lio_dev)
 {
 	PMD_INIT_FUNC_TRACE();
@@ -298,8 +332,8 @@
 {
 	struct lio_mbox_cmd mbox_cmd;
 	struct lio_version *lio_ver = (struct lio_version *)&mbox_cmd.data[0];
+	uint32_t q_no, count = 0;
 	rte_atomic64_t status;
-	uint32_t count = 0;
 	uint32_t pfmajor;
 	uint32_t vfmajor;
 	uint32_t ret;
@@ -341,6 +375,10 @@
 		return -1;
 	}
 
+	for (q_no = 0; q_no < lio_dev->num_iqs; q_no++)
+		lio_dev->instr_queue[q_no]->txpciq.s.pkind =
+						lio_dev->pfvf_hsword.pkind;
+
 	vfmajor = LIO_BASE_MAJOR_VERSION;
 	pfmajor = ret >> 16;
 	if (pfmajor != vfmajor) {
@@ -355,6 +393,9 @@
 		ret = 0;
 	}
 
+	lio_dev_dbg(lio_dev, "got data from PF pkind is %d\n",
+		    lio_dev->pfvf_hsword.pkind);
+
 	return ret;
 }
 
@@ -394,6 +435,7 @@
 	if (lio_dev->default_config == NULL)
 		return -1;
 
+	lio_dev->fn_list.setup_iq_regs		= cn23xx_vf_setup_iq_regs;
 	lio_dev->fn_list.setup_mbox		= cn23xx_vf_setup_mbox;
 	lio_dev->fn_list.free_mbox		= cn23xx_vf_free_mbox;
 
diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c
index de98fc6..4a687d8 100644
--- a/drivers/net/liquidio/lio_rxtx.c
+++ b/drivers/net/liquidio/lio_rxtx.c
@@ -141,6 +141,8 @@
 	lio_dev->io_qmask.iq64B |= ((instr_type == 64) << iq_no);
 	iq->iqcmd_64B = (instr_type == 64);
 
+	lio_dev->fn_list.setup_iq_regs(lio_dev, iq_no);
+
 	return 0;
 }
 
diff --git a/drivers/net/liquidio/lio_struct.h b/drivers/net/liquidio/lio_struct.h
index 29059a5..2806c37 100644
--- a/drivers/net/liquidio/lio_struct.h
+++ b/drivers/net/liquidio/lio_struct.h
@@ -155,6 +155,8 @@ struct lio_io_enable {
 };
 
 struct lio_fn_list {
+	void (*setup_iq_regs)(struct lio_device *, uint32_t);
+
 	int (*setup_mbox)(struct lio_device *);
 	void (*free_mbox)(struct lio_device *);
 
-- 
1.8.3.1



More information about the dev mailing list