event/dpaa2: replace static with dynamic logging
[dpdk.git] / drivers / bus / dpaa / dpaa_bus.c
index 79f4858..329a125 100644 (file)
@@ -51,6 +51,8 @@ struct netcfg_info *dpaa_netcfg;
 /* define a variable to hold the portal_key, once created.*/
 pthread_key_t dpaa_portal_key;
 
+unsigned int dpaa_svr_family;
+
 RTE_DEFINE_PER_LCORE(bool, _dpaa_io);
 
 static inline void
@@ -262,8 +264,7 @@ _dpaa_portal_init(void *arg)
  * rte_dpaa_portal_init - Wrapper over _dpaa_portal_init with thread level check
  * XXX Complete this
  */
-int
-rte_dpaa_portal_init(void *arg)
+int rte_dpaa_portal_init(void *arg)
 {
        if (unlikely(!RTE_PER_LCORE(_dpaa_io)))
                return _dpaa_portal_init(arg);
@@ -271,6 +272,34 @@ rte_dpaa_portal_init(void *arg)
        return 0;
 }
 
+int
+rte_dpaa_portal_fq_init(void *arg, struct qman_fq *fq)
+{
+       /* Affine above created portal with channel*/
+       u32 sdqcr;
+       struct qman_portal *qp;
+
+       if (unlikely(!RTE_PER_LCORE(_dpaa_io)))
+               _dpaa_portal_init(arg);
+
+       /* Initialise qman specific portals */
+       qp = fsl_qman_portal_create();
+       if (!qp) {
+               DPAA_BUS_LOG(ERR, "Unable to alloc fq portal");
+               return -1;
+       }
+       fq->qp = qp;
+       sdqcr = QM_SDQCR_CHANNELS_POOL_CONV(fq->ch_id);
+       qman_static_dequeue_add(sdqcr, qp);
+
+       return 0;
+}
+
+int rte_dpaa_portal_fq_close(struct qman_fq *fq)
+{
+       return fsl_qman_portal_destroy(fq->qp);
+}
+
 void
 dpaa_portal_finish(void *arg)
 {
@@ -417,6 +446,8 @@ rte_dpaa_bus_probe(void)
        int ret = -1;
        struct rte_dpaa_device *dev;
        struct rte_dpaa_driver *drv;
+       FILE *svr_file = NULL;
+       unsigned int svr_ver;
 
        BUS_INIT_FUNC_TRACE();
 
@@ -436,6 +467,14 @@ rte_dpaa_bus_probe(void)
                        break;
                }
        }
+
+       svr_file = fopen(DPAA_SOC_ID_FILE, "r");
+       if (svr_file) {
+               if (fscanf(svr_file, "svr:%x", &svr_ver) > 0)
+                       dpaa_svr_family = svr_ver & SVR_MASK;
+               fclose(svr_file);
+       }
+
        return 0;
 }