bus/fslmc: add frame queue based dq storage
authorHemant Agrawal <hemant.agrawal@nxp.com>
Tue, 11 Apr 2017 13:37:27 +0000 (19:07 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 19 Apr 2017 13:37:37 +0000 (15:37 +0200)
This patch adds generic functions for allowing dq storage
for the frame queues.
As the frame queues are common resource for different drivers
this is helpful.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
drivers/bus/fslmc/rte_bus_fslmc_version.map

index eaf35e9..a1a58b9 100644 (file)
@@ -411,3 +411,35 @@ dpaa2_create_dpio_device(struct fslmc_vfio_device *vdev,
 
        return 0;
 }
+
+void
+dpaa2_free_dq_storage(struct queue_storage_info_t *q_storage)
+{
+       int i = 0;
+
+       for (i = 0; i < NUM_DQS_PER_QUEUE; i++) {
+               if (q_storage->dq_storage[i])
+                       rte_free(q_storage->dq_storage[i]);
+       }
+}
+
+int
+dpaa2_alloc_dq_storage(struct queue_storage_info_t *q_storage)
+{
+       int i = 0;
+
+       for (i = 0; i < NUM_DQS_PER_QUEUE; i++) {
+               q_storage->dq_storage[i] = rte_malloc(NULL,
+                       DPAA2_DQRR_RING_SIZE * sizeof(struct qbman_result),
+                       RTE_CACHE_LINE_SIZE);
+               if (!q_storage->dq_storage[i])
+                       goto fail;
+       }
+       return 0;
+fail:
+       i -= 1;
+       while (i >= 0)
+               rte_free(q_storage->dq_storage[i]);
+
+       return -1;
+}
index b1a1b8f..f2e1168 100644 (file)
@@ -59,5 +59,12 @@ int dpaa2_affine_qbman_swp(void);
 /* Affine additional DPIO portal to current crypto processing thread */
 int dpaa2_affine_qbman_swp_sec(void);
 
+/* allocate memory for FQ - dq storage */
+int
+dpaa2_alloc_dq_storage(struct queue_storage_info_t *q_storage);
+
+/* free memory for FQ- dq storage */
+void
+dpaa2_free_dq_storage(struct queue_storage_info_t *q_storage);
 
 #endif /* _DPAA2_HW_DPIO_H_ */
index 09c4fac..a55b250 100644 (file)
@@ -4,7 +4,9 @@ DPDK_17.05 {
        dpaa2_affine_qbman_swp;
        dpaa2_affine_qbman_swp_sec;
        dpaa2_alloc_dpbp_dev;
+       dpaa2_alloc_dq_storage;
        dpaa2_free_dpbp_dev;
+       dpaa2_free_dq_storage;
        dpbp_disable;
        dpbp_enable;
        dpbp_get_attributes;