[rtems-libbsd commit] dpaa: Add "libbsd,dequeue" to QMan portals

Sebastian Huber sebh at rtems.org
Mon Oct 23 07:27:51 UTC 2017


Module:    rtems-libbsd
Branch:    master
Commit:    e8181287892a255692f08f9f8e5d7df9f530f77d
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=e8181287892a255692f08f9f8e5d7df9f530f77d

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jun 23 11:39:26 2017 +0200

dpaa: Add "libbsd,dequeue" to QMan portals

The dequeue support for processor affine QMan portals may be explicitly
disabled. The dequeue support is responsible for receiving frames and
completion of frame transmission, e.g. buffer recycling. Without at
least one enabled dequeue support, there will be no networking.

/ {
        qman-portals at ff6000000 {
                qman-portal at 0 {
                        libbsd,dequeue = "disabled";
                };
        };
};

---

 linux/drivers/soc/fsl/qbman/qman_portal.c | 45 ++++++++++++++++++++++---------
 1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/linux/drivers/soc/fsl/qbman/qman_portal.c b/linux/drivers/soc/fsl/qbman/qman_portal.c
index ffef185..45aba3a 100644
--- a/linux/drivers/soc/fsl/qbman/qman_portal.c
+++ b/linux/drivers/soc/fsl/qbman/qman_portal.c
@@ -381,7 +381,19 @@ module_driver(qman_portal_driver,
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 
-static struct qm_portal_config qman_configs[NR_CPUS];
+#define MAX_QMAN_PORTALS 50
+
+static struct qm_portal_config qman_configs[MAX_QMAN_PORTALS];
+
+static bool
+is_dequeue_enabled(const struct device_node *dn)
+{
+	const char *dequeue;
+	int len;
+
+	dequeue = of_get_property(dn, "libbsd,dequeue", &len);
+	return (len <= 0 || strcmp(dequeue, "disabled") != 0);
+}
 
 void
 qman_sysinit_portals(void)
@@ -390,7 +402,7 @@ qman_sysinit_portals(void)
 	struct device_node dn;
 	const char *name;
 	int cpu_count = (int)rtems_get_processor_count();
-	int cpu;
+	int i;
 	int ret;
 	int node;
 	int parent;
@@ -414,15 +426,12 @@ qman_sysinit_portals(void)
 	qoriq_clear_ci_portal(&qoriq_qman_portal[1][0],
 	    sizeof(qoriq_qman_portal[1]));
 
-	for (cpu = 0; cpu < cpu_count; ++cpu) {
-		struct qm_portal_config *pcfg = &qman_configs[cpu];
+	for (i = 0; node >= 0 && i < MAX_QMAN_PORTALS; ++i) {
+		struct qm_portal_config *pcfg = &qman_configs[i];
 		struct qman_portal *portal;
 		struct resource res;
 		u32 val;
 
-		if (node < 0)
-			panic("qman: missing portal in FDT");
-
 		ret = of_address_to_resource(&dn, 0, &res);
 		if (ret != 0)
 			panic("qman: no portal CE address");
@@ -452,19 +461,29 @@ qman_sysinit_portals(void)
 		if (pcfg->irq == NO_IRQ)
 			panic("qman: no portal interrupt");
 
-		pcfg->cpu = cpu;
-		pcfg->pools = qm_get_pools_sdqcr();
+		if (val < cpu_count) {
+			pcfg->cpu = val;
+
+			if (is_dequeue_enabled(&dn)) {
+				pcfg->pools = qm_get_pools_sdqcr();
+			}
 
-		portal = init_pcfg(pcfg);
-		if (portal == NULL)
-			panic("qman: cannot create portal");
+			portal = init_pcfg(pcfg);
+			if (portal == NULL)
+				panic("qman: cannot create portal");
 
-		qman_portal_update_sdest(pcfg, cpu);
+			qman_portal_update_sdest(pcfg, val);
+		} else {
+			pcfg->cpu = -1;
+		}
 
 		node = fdt_next_subnode(fdt, node);
 		dn.offset = node;
 	}
 
+	if (i < cpu_count)
+		panic("qman: not enough portals in FDT");
+
 	/* all assigned portals are initialized now */
 	qman_init_cgr_all();
 }




More information about the vc mailing list