summaryrefslogtreecommitdiff
path: root/drivers/bus/fslmc
diff options
context:
space:
mode:
authorNipun Gupta <nipun.gupta@nxp.com>2018-05-04 15:41:25 +0530
committerThomas Monjalon <thomas@monjalon.net>2018-05-08 14:20:06 +0200
commit91e96999ef7f8ce65bbbd6446e2702d7f4764b5d (patch)
tree08702a6f8e7dd311c4322dc4efa1ae38728704bd /drivers/bus/fslmc
parent3980bed77e992fb848a6afc9e67792acdc114026 (diff)
downloaddpdk-91e96999ef7f8ce65bbbd6446e2702d7f4764b5d.zip
dpdk-91e96999ef7f8ce65bbbd6446e2702d7f4764b5d.tar.gz
dpdk-91e96999ef7f8ce65bbbd6446e2702d7f4764b5d.tar.xz
bus/fslmc: keep Tx queues information for DPCI devices
The DPCI devices have both Tx and Rx queues. Event devices use DPCI Rx queues only, but CMDIF (AIOP) uses both Tx and Rx queues. This patch enables Tx queues configuration too. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Diffstat (limited to 'drivers/bus/fslmc')
-rw-r--r--drivers/bus/fslmc/portal/dpaa2_hw_dpci.c86
-rw-r--r--drivers/bus/fslmc/portal/dpaa2_hw_pvt.h3
2 files changed, 65 insertions, 24 deletions
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
index aee870a..5ad0374 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
@@ -39,13 +39,14 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused,
struct dpci_attr attr;
struct dpci_rx_queue_cfg rx_queue_cfg;
struct dpci_rx_queue_attr rx_attr;
+ struct dpci_tx_queue_attr tx_attr;
int ret, i;
/* Allocate DPAA2 dpci handle */
dpci_node = rte_malloc(NULL, sizeof(struct dpaa2_dpci_dev), 0);
if (!dpci_node) {
DPAA2_BUS_ERR("Memory allocation failed for DPCI Device");
- return -1;
+ return -ENOMEM;
}
/* Open the dpci object */
@@ -54,8 +55,7 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused,
CMD_PRI_LOW, dpci_id, &dpci_node->token);
if (ret) {
DPAA2_BUS_ERR("Resource alloc failure with err code: %d", ret);
- rte_free(dpci_node);
- return -1;
+ goto err;
}
/* Get the device attributes */
@@ -63,21 +63,40 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused,
CMD_PRI_LOW, dpci_node->token, &attr);
if (ret != 0) {
DPAA2_BUS_ERR("Reading device failed with err code: %d", ret);
- rte_free(dpci_node);
- return -1;
+ goto err;
}
- /* Set up the Rx Queue */
- memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg));
- ret = dpci_set_rx_queue(&dpci_node->dpci,
- CMD_PRI_LOW,
- dpci_node->token,
- 0, &rx_queue_cfg);
- if (ret) {
- DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d",
- ret);
- rte_free(dpci_node);
- return -1;
+ for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) {
+ struct dpaa2_queue *rxq;
+
+ memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg));
+ ret = dpci_set_rx_queue(&dpci_node->dpci,
+ CMD_PRI_LOW,
+ dpci_node->token,
+ i, &rx_queue_cfg);
+ if (ret) {
+ DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d",
+ ret);
+ goto err;
+ }
+
+ /* Allocate DQ storage for the DPCI Rx queues */
+ rxq = &(dpci_node->rx_queue[i]);
+ rxq->q_storage = rte_malloc("dq_storage",
+ sizeof(struct queue_storage_info_t),
+ RTE_CACHE_LINE_SIZE);
+ if (!rxq->q_storage) {
+ DPAA2_BUS_ERR("q_storage allocation failed\n");
+ ret = -ENOMEM;
+ goto err;
+ }
+
+ memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t));
+ ret = dpaa2_alloc_dq_storage(rxq->q_storage);
+ if (ret) {
+ DPAA2_BUS_ERR("dpaa2_alloc_dq_storage failed\n");
+ goto err;
+ }
}
/* Enable the device */
@@ -85,8 +104,7 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused,
CMD_PRI_LOW, dpci_node->token);
if (ret != 0) {
DPAA2_BUS_ERR("Enabling device failed with err code: %d", ret);
- rte_free(dpci_node);
- return -1;
+ goto err;
}
for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) {
@@ -96,13 +114,22 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused,
dpci_node->token, i,
&rx_attr);
if (ret != 0) {
- DPAA2_BUS_ERR("Rx queue fetch failed with err code:"
- " %d", ret);
- rte_free(dpci_node);
- return -1;
+ DPAA2_BUS_ERR("Rx queue fetch failed with err code: %d",
+ ret);
+ goto err;
}
+ dpci_node->rx_queue[i].fqid = rx_attr.fqid;
- dpci_node->queue[i].fqid = rx_attr.fqid;
+ ret = dpci_get_tx_queue(&dpci_node->dpci,
+ CMD_PRI_LOW,
+ dpci_node->token, i,
+ &tx_attr);
+ if (ret != 0) {
+ DPAA2_BUS_ERR("Reading device failed with err code: %d",
+ ret);
+ goto err;
+ }
+ dpci_node->tx_queue[i].fqid = tx_attr.fqid;
}
dpci_node->dpci_id = dpci_id;
@@ -111,6 +138,19 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused,
TAILQ_INSERT_TAIL(&dpci_dev_list, dpci_node, next);
return 0;
+
+err:
+ for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) {
+ struct dpaa2_queue *rxq = &(dpci_node->rx_queue[i]);
+
+ if (rxq->q_storage) {
+ dpaa2_free_dq_storage(rxq->q_storage);
+ rte_free(rxq->q_storage);
+ }
+ }
+ rte_free(dpci_node);
+
+ return ret;
}
struct dpaa2_dpci_dev *rte_dpaa2_alloc_dpci_dev(void)
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 09ea603..b09218f 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -142,7 +142,8 @@ struct dpaa2_dpci_dev {
uint16_t token;
rte_atomic16_t in_use;
uint32_t dpci_id; /*HW ID for DPCI object */
- struct dpaa2_queue queue[DPAA2_DPCI_MAX_QUEUES];
+ struct dpaa2_queue rx_queue[DPAA2_DPCI_MAX_QUEUES];
+ struct dpaa2_queue tx_queue[DPAA2_DPCI_MAX_QUEUES];
};
/*! Global MCP list */