summaryrefslogtreecommitdiffstats
path: root/linux/drivers/soc/fsl/qbman/qman_portal.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-06-23 11:39:26 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-23 09:24:07 +0200
commite8181287892a255692f08f9f8e5d7df9f530f77d (patch)
tree0830258c7edfc9827266e3a6175145f19da9d1ce /linux/drivers/soc/fsl/qbman/qman_portal.c
parentdpaa: Set portal interrupt affinity (diff)
downloadrtems-libbsd-e8181287892a255692f08f9f8e5d7df9f530f77d.tar.bz2
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@ff6000000 { qman-portal@0 { libbsd,dequeue = "disabled"; }; }; };
Diffstat (limited to '')
-rw-r--r--linux/drivers/soc/fsl/qbman/qman_portal.c45
1 files 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 ffef1854..45aba3a8 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();
}