eventdev: limit port link operation to configured queues

On port_setup, the link_map is updated only
for configured number of event queues.
Limit the port_links_get scan only to configured number
of event queues. Also, Limit the port link and unlink queue
validation to configured number of event queues.

Fixes: 4f0804bbdfb9 ("eventdev: implement the northbound APIs")

Reported-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
This commit is contained in:
Jerin Jacob 2017-02-06 10:59:37 +05:30
parent e3368ca998
commit af316ecf58

View File

@ -798,7 +798,7 @@ rte_event_port_link(uint8_t dev_id, uint8_t port_id,
}
for (i = 0; i < nb_links; i++)
if (queues[i] >= RTE_EVENT_MAX_QUEUES_PER_DEV)
if (queues[i] >= dev->data->nb_queues)
return -EINVAL;
diag = (*dev->dev_ops->port_link)(dev, dev->data->ports[port_id],
@ -843,7 +843,7 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
}
for (i = 0; i < nb_unlinks; i++)
if (queues[i] >= RTE_EVENT_MAX_QUEUES_PER_DEV)
if (queues[i] >= dev->data->nb_queues)
return -EINVAL;
diag = (*dev->dev_ops->port_unlink)(dev, dev->data->ports[port_id],
@ -879,7 +879,7 @@ rte_event_port_links_get(uint8_t dev_id, uint8_t port_id,
links_map = dev->data->links_map;
/* Point links_map to this port specific area */
links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
for (i = 0; i < RTE_EVENT_MAX_QUEUES_PER_DEV; i++) {
for (i = 0; i < dev->data->nb_queues; i++) {
if (links_map[i] != EVENT_QUEUE_SERVICE_PRIORITY_INVALID) {
queues[count] = i;
priorities[count] = (uint8_t)links_map[i];