@@ -814,7 +814,7 @@ static const struct ppe_scheduler_port_config ppe_port_sch_config[] = {
/* The scheduler resource is applied to each PPE port, The resource
* includes the unicast & multicast queues, flow nodes and DRR nodes.
*/
-static const struct ppe_port_schedule_resource ppe_scheduler_res[] = {
+static const struct ppe_port_schedule_resource ipq9574_ppe_scheduler_res[] = {
{ .ucastq_start = 0,
.ucastq_end = 63,
.mcastq_start = 256,@@ -916,6 +916,64 @@ static const struct ppe_port_schedule_resource ppe_scheduler_res[] = {
},
};
+static const struct ppe_port_schedule_resource ipq5424_ppe_scheduler_res[] = {
+ { .ucastq_start = 0,
+ .ucastq_end = 63,
+ .mcastq_start = 256,
+ .mcastq_end = 271,
+ .flow_id_start = 0,
+ .flow_id_end = 0,
+ .l0node_start = 0,
+ .l0node_end = 7,
+ .l1node_start = 0,
+ .l1node_end = 0,
+ },
+ { .ucastq_start = 144,
+ .ucastq_end = 159,
+ .mcastq_start = 272,
+ .mcastq_end = 275,
+ .flow_id_start = 36,
+ .flow_id_end = 39,
+ .l0node_start = 48,
+ .l0node_end = 63,
+ .l1node_start = 8,
+ .l1node_end = 11,
+ },
+ { .ucastq_start = 160,
+ .ucastq_end = 175,
+ .mcastq_start = 276,
+ .mcastq_end = 279,
+ .flow_id_start = 40,
+ .flow_id_end = 43,
+ .l0node_start = 64,
+ .l0node_end = 79,
+ .l1node_start = 12,
+ .l1node_end = 15,
+ },
+ { .ucastq_start = 176,
+ .ucastq_end = 191,
+ .mcastq_start = 280,
+ .mcastq_end = 283,
+ .flow_id_start = 44,
+ .flow_id_end = 47,
+ .l0node_start = 80,
+ .l0node_end = 95,
+ .l1node_start = 16,
+ .l1node_end = 19,
+ },
+ { .ucastq_start = 64,
+ .ucastq_end = 143,
+ .mcastq_start = 0,
+ .mcastq_end = 0,
+ .flow_id_start = 1,
+ .flow_id_end = 35,
+ .l0node_start = 8,
+ .l0node_end = 47,
+ .l1node_start = 1,
+ .l1node_end = 7,
+ },
+};
+
/* Set the PPE queue level scheduler configuration. */
static int ppe_scheduler_l0_queue_map_set(struct ppe_device *ppe_dev,
int node_id, int port,@@ -1153,15 +1211,31 @@ int ppe_port_resource_get(struct ppe_device *ppe_dev, int port,
enum ppe_resource_type type,
int *res_start, int *res_end)
{
+ const struct ppe_port_schedule_resource *scheduler_res;
struct ppe_port_schedule_resource res;
+ unsigned int scheduler_res_len;
+
+ switch (ppe_dev->type) {
+ case IPQ9574_PPE:
+ scheduler_res = ipq9574_ppe_scheduler_res;
+ scheduler_res_len = ARRAY_SIZE(ipq9574_ppe_scheduler_res);
+ break;
+ case IPQ5424_PPE:
+ scheduler_res = ipq5424_ppe_scheduler_res;
+ scheduler_res_len = ARRAY_SIZE(ipq5424_ppe_scheduler_res);
+ break;
+ default:
+ dev_err(ppe_dev->dev, "Invalid PPE type %d\n", ppe_dev->type);
+ return -EINVAL;
+ }
- /* The reserved resource with the maximum port ID of PPE is
- * also allowed to be acquired.
+ /* The reserved resource, stored at the last entry of the
+ * scheduler resource table, is also allowed to be acquired.
*/
- if (port > ppe_dev->num_ports)
+ if (port >= scheduler_res_len)
return -EINVAL;
- res = ppe_scheduler_res[port];
+ res = scheduler_res[port];
switch (type) {
case PPE_RES_UCAST:
*res_start = res.ucastq_start;