From: Anoob Joseph Date: Wed, 14 Nov 2018 09:22:03 +0000 (+0000) Subject: net/octeontx: fix failures when available ports > queues X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7efd5202f7fecc3f995cbf214cdae834e7a7494f;p=dpdk.git net/octeontx: fix failures when available ports > queues When eth_octeontx is initialized before event_octeontx, eth_octeontx would initiate setting up of the event device with the max ports and queues available. If number of ports is more than the number of queues, some ports would be left unused when the ports and queues are mapped 1:1. But even in that case the ports need to be setup, or otherwise it would lead to a segmentation fault when event device is started. Fixes: f7be70e5130e ("net/octeontx: add net device probe and remove") Cc: stable@dpdk.org Signed-off-by: Anoob Joseph Signed-off-by: Pavan Nikhilesh Acked-by: Jerin Jacob --- diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index a3063be426..046e129865 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -1238,15 +1238,8 @@ octeontx_probe(struct rte_vdev_device *dev) res = -EINVAL; goto parse_error; } - if (pnum > qnum) { - /* - * We don't poll on event ports - * that do not have any queues assigned. - */ - pnum = qnum; - PMD_INIT_LOG(INFO, - "reducing number of active event ports to %d", pnum); - } + + /* Enable all queues available */ for (i = 0; i < qnum; i++) { res = rte_event_queue_setup(evdev, i, NULL); if (res < 0) { @@ -1256,6 +1249,7 @@ octeontx_probe(struct rte_vdev_device *dev) } } + /* Enable all ports available */ for (i = 0; i < pnum; i++) { res = rte_event_port_setup(evdev, i, NULL); if (res < 0) { @@ -1264,6 +1258,14 @@ octeontx_probe(struct rte_vdev_device *dev) i, res); goto parse_error; } + } + + /* + * Do 1:1 links for ports & queues. All queues would be mapped to + * one port. If there are more ports than queues, then some ports + * won't be linked to any queue. + */ + for (i = 0; i < qnum; i++) { /* Link one queue to one event port */ qlist = i; res = rte_event_port_link(evdev, i, &qlist, NULL, 1);