summaryrefslogtreecommitdiff
path: root/drivers/bus
diff options
context:
space:
mode:
authorNipun Gupta <nipun.gupta@nxp.com>2019-02-22 11:16:01 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-03-01 18:17:35 +0100
commit16c4a3c46ab76d8fe130dac909c26e41b2684898 (patch)
tree1efc3525eea8776139f5ae7a2022f16ee050dd70 /drivers/bus
parentf8f9f645226ed63f3b55dd487faa22f766078e53 (diff)
downloaddpdk-16c4a3c46ab76d8fe130dac909c26e41b2684898.zip
dpdk-16c4a3c46ab76d8fe130dac909c26e41b2684898.tar.gz
dpdk-16c4a3c46ab76d8fe130dac909c26e41b2684898.tar.xz
bus/fslmc: add enqueue response read in qbman
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Diffstat (limited to 'drivers/bus')
-rw-r--r--drivers/bus/fslmc/portal/dpaa2_hw_dpio.c47
-rw-r--r--drivers/bus/fslmc/portal/dpaa2_hw_dpio.h4
-rw-r--r--drivers/bus/fslmc/portal/dpaa2_hw_pvt.h24
-rw-r--r--drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h56
-rw-r--r--drivers/bus/fslmc/qbman/qbman_portal.c26
-rw-r--r--drivers/bus/fslmc/rte_bus_fslmc_version.map16
6 files changed, 171 insertions, 2 deletions
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index f377f24..7bcbde8 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -526,6 +526,18 @@ dpaa2_create_dpio_device(int vdev_fd,
goto err;
}
+ dpio_dev->eqresp = rte_zmalloc(NULL, MAX_EQ_RESP_ENTRIES *
+ (sizeof(struct qbman_result) +
+ sizeof(struct eqresp_metadata)),
+ RTE_CACHE_LINE_SIZE);
+ if (!dpio_dev->eqresp) {
+ DPAA2_BUS_ERR("Memory allocation failed for eqresp");
+ goto err;
+ }
+ dpio_dev->eqresp_meta = (struct eqresp_metadata *)(dpio_dev->eqresp +
+ MAX_EQ_RESP_ENTRIES);
+
+
TAILQ_INSERT_TAIL(&dpio_dev_list, dpio_dev, next);
return 0;
@@ -588,6 +600,41 @@ fail:
return -1;
}
+uint32_t
+dpaa2_free_eq_descriptors(void)
+{
+ struct dpaa2_dpio_dev *dpio_dev = DPAA2_PER_LCORE_DPIO;
+ struct qbman_result *eqresp;
+ struct eqresp_metadata *eqresp_meta;
+ struct dpaa2_queue *txq;
+
+ while (dpio_dev->eqresp_ci != dpio_dev->eqresp_pi) {
+ eqresp = &dpio_dev->eqresp[dpio_dev->eqresp_ci];
+ eqresp_meta = &dpio_dev->eqresp_meta[dpio_dev->eqresp_ci];
+
+ if (!qbman_result_eqresp_rspid(eqresp))
+ break;
+
+ if (qbman_result_eqresp_rc(eqresp)) {
+ txq = eqresp_meta->dpaa2_q;
+ txq->cb_eqresp_free(dpio_dev->eqresp_ci);
+ }
+ qbman_result_eqresp_set_rspid(eqresp, 0);
+
+ dpio_dev->eqresp_ci + 1 < MAX_EQ_RESP_ENTRIES ?
+ dpio_dev->eqresp_ci++ : (dpio_dev->eqresp_ci = 0);
+ }
+
+ /* Return 1 less entry so that PI and CI are never same in a
+ * case there all the EQ responses are in use.
+ */
+ if (dpio_dev->eqresp_ci > dpio_dev->eqresp_pi)
+ return dpio_dev->eqresp_ci - dpio_dev->eqresp_pi - 1;
+ else
+ return dpio_dev->eqresp_ci - dpio_dev->eqresp_pi +
+ MAX_EQ_RESP_ENTRIES - 1;
+}
+
static struct rte_dpaa2_object rte_dpaa2_dpio_obj = {
.dev_type = DPAA2_IO,
.create = dpaa2_create_dpio_device,
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
index 4354c76..17e7e4f 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
@@ -51,4 +51,8 @@ dpaa2_alloc_dq_storage(struct queue_storage_info_t *q_storage);
void
dpaa2_free_dq_storage(struct queue_storage_info_t *q_storage);
+/* free the enqueue response descriptors */
+uint32_t
+dpaa2_free_eq_descriptors(void);
+
#endif /* _DPAA2_HW_DPIO_H_ */
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 626fcbb..4679e93 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -34,6 +34,7 @@
/* Maximum number of slots available in TX ring */
#define MAX_TX_RING_SLOTS 32
+#define MAX_EQ_RESP_ENTRIES (MAX_TX_RING_SLOTS + 1)
/* Maximum number of slots available in RX ring */
#define DPAA2_EQCR_RING_SIZE 8
@@ -50,6 +51,15 @@
/* EQCR shift to get EQCR size for LX2 (2 >> 5) = 32 for LX2 */
#define DPAA2_LX2_EQCR_SHIFT 5
+/* Flag to determine an ordered queue mbuf */
+#define DPAA2_ENQUEUE_FLAG_ORP (1ULL << 30)
+/* ORP ID shift and mask */
+#define DPAA2_EQCR_OPRID_SHIFT 16
+#define DPAA2_EQCR_OPRID_MASK 0x3FFF0000
+/* Sequence number shift and mask */
+#define DPAA2_EQCR_SEQNUM_SHIFT 0
+#define DPAA2_EQCR_SEQNUM_MASK 0x0000FFFF
+
#define DPAA2_SWP_CENA_REGION 0
#define DPAA2_SWP_CINH_REGION 1
#define DPAA2_SWP_CENA_MEM_REGION 2
@@ -77,12 +87,23 @@
#define DPAA2_DPCI_MAX_QUEUES 2
+struct dpaa2_queue;
+
+struct eqresp_metadata {
+ struct dpaa2_queue *dpaa2_q;
+ struct rte_mempool *mp;
+};
+
struct dpaa2_dpio_dev {
TAILQ_ENTRY(dpaa2_dpio_dev) next;
/**< Pointer to Next device instance */
uint16_t index; /**< Index of a instance in the list */
rte_atomic16_t ref_count;
/**< How many thread contexts are sharing this.*/
+ uint16_t eqresp_ci;
+ uint16_t eqresp_pi;
+ struct qbman_result *eqresp;
+ struct eqresp_metadata *eqresp_meta;
struct fsl_mc_io *dpio; /** handle to DPIO portal object */
uint16_t token;
struct qbman_swp *sw_portal; /** SW portal object */
@@ -125,6 +146,8 @@ typedef void (dpaa2_queue_cb_dqrr_t)(struct qbman_swp *swp,
struct dpaa2_queue *rxq,
struct rte_event *ev);
+typedef void (dpaa2_queue_cb_eqresp_free_t)(uint16_t eqresp_ci);
+
struct dpaa2_queue {
struct rte_mempool *mb_pool; /**< mbuf pool to populate RX ring. */
union {
@@ -144,6 +167,7 @@ struct dpaa2_queue {
};
struct rte_event ev;
dpaa2_queue_cb_dqrr_t *cb;
+ dpaa2_queue_cb_eqresp_free_t *cb_eqresp_free;
struct dpaa2_bp_info *bp_array;
};
diff --git a/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h b/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h
index 10c72e0..a9192d3 100644
--- a/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h
+++ b/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h
@@ -212,6 +212,23 @@ struct qbman_result {
__le32 rid_tok;
__le64 ctx;
} scn;
+ struct eq_resp {
+ uint8_t verb;
+ uint8_t dca;
+ __le16 seqnum;
+ __le16 oprid;
+ uint8_t reserved;
+ uint8_t rc;
+ __le32 tgtid;
+ __le32 tag;
+ uint16_t qdbin;
+ uint8_t qpri;
+ uint8_t reserved1;
+ __le32 fqid:24;
+ __le32 rspid:8;
+ __le64 rsp_addr;
+ uint8_t fd[32];
+ } eq_resp;
};
};
@@ -788,7 +805,6 @@ uint64_t qbman_result_cgcu_icnt(const struct qbman_result *scn);
/************/
/* Enqueues */
/************/
-
/* struct qbman_eq_desc - structure of enqueue descriptor */
struct qbman_eq_desc {
union {
@@ -957,6 +973,44 @@ void qbman_eq_desc_set_dca(struct qbman_eq_desc *d, int enable,
uint8_t dqrr_idx, int park);
/**
+ * qbman_result_eqresp_fd() - Get fd from enqueue response.
+ * @eqresp: enqueue response.
+ *
+ * Return the fd pointer.
+ */
+struct qbman_fd *qbman_result_eqresp_fd(struct qbman_result *eqresp);
+
+/**
+ * qbman_result_eqresp_set_rspid() - Set the response id in enqueue response.
+ * @eqresp: enqueue response.
+ * @val: values to set into the response id.
+ *
+ * This value is set into the response id before the enqueue command, which,
+ * get overwritten by qbman once the enqueue command is complete.
+ */
+void qbman_result_eqresp_set_rspid(struct qbman_result *eqresp, uint8_t val);
+
+/**
+ * qbman_result_eqresp_rspid() - Get the response id.
+ * @eqresp: enqueue response.
+ *
+ * Return the response id.
+ *
+ * At the time of enqueue user provides the response id. Response id gets
+ * copied into the enqueue response to determine if the command has been
+ * completed, and response has been updated.
+ */
+uint8_t qbman_result_eqresp_rspid(struct qbman_result *eqresp);
+
+/**
+ * qbman_result_eqresp_rc() - determines if enqueue command is sucessful.
+ * @eqresp: enqueue response.
+ *
+ * Return 0 when command is sucessful.
+ */
+uint8_t qbman_result_eqresp_rc(struct qbman_result *eqresp);
+
+/**
* qbman_swp_enqueue() - Issue an enqueue command.
* @s: the software portal used for enqueue.
* @d: the enqueue descriptor.
diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c
index 14f4b03..f49b180 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -1569,6 +1569,32 @@ uint64_t qbman_result_cgcu_icnt(const struct qbman_result *scn)
return qbman_result_SCN_ctx(scn);
}
+/********************/
+/* Parsing EQ RESP */
+/********************/
+struct qbman_fd *qbman_result_eqresp_fd(struct qbman_result *eqresp)
+{
+ return (struct qbman_fd *)&eqresp->eq_resp.fd[0];
+}
+
+void qbman_result_eqresp_set_rspid(struct qbman_result *eqresp, uint8_t val)
+{
+ eqresp->eq_resp.rspid = val;
+}
+
+uint8_t qbman_result_eqresp_rspid(struct qbman_result *eqresp)
+{
+ return eqresp->eq_resp.rspid;
+}
+
+uint8_t qbman_result_eqresp_rc(struct qbman_result *eqresp)
+{
+ if (eqresp->eq_resp.rc == 0xE)
+ return 0;
+ else
+ return -1;
+}
+
/******************/
/* Buffer release */
/******************/
diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map
index dcc4e08..811a2e7 100644
--- a/drivers/bus/fslmc/rte_bus_fslmc_version.map
+++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map
@@ -120,7 +120,6 @@ DPDK_18.05 {
DPDK_18.11 {
global:
-
dpaa2_dqrr_size;
dpaa2_eqcr_size;
dpci_get_link_state;
@@ -129,3 +128,18 @@ DPDK_18.11 {
dpci_set_opr;
} DPDK_18.05;
+
+DPDK_19.05 {
+ global:
+ dpaa2_free_eq_descriptors;
+
+ qbman_eq_desc_set_orp;
+ qbman_eq_desc_set_token;
+ qbman_result_DQ_odpid;
+ qbman_result_DQ_seqnum;
+ qbman_result_eqresp_fd;
+ qbman_result_eqresp_rc;
+ qbman_result_eqresp_rspid;
+ qbman_result_eqresp_set_rspid;
+} DPDK_18.11;
+