All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/enic: fix crash when changing number of Rx or Tx queues
@ 2016-07-10 21:15 John Daley
  2016-07-15 21:28 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: John Daley @ 2016-07-10 21:15 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, John Daley

The check that all Tx and Rx queues were set up was not
adequate when reconfiguring with a different number of
queues. Only the number of completion queues (CQs) was
being used to make the determination, but the CQ array
is shared between the underlying Rx and Tx queues.

Check that the internal Rx, Tx and CQs are all set up
before completing port configuration.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Nelson Escobar <neescoba@cisco.com>
---
 drivers/net/enic/enic_ethdev.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 633e431..9ab6dc2 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -146,9 +146,21 @@ static int enicpmd_dev_setup_intr(struct enic *enic)
 		if (!enic->cq[index].ctrl)
 			break;
 	}
-
 	if (enic->cq_count != index)
 		return 0;
+	for (index = 0; index < enic->wq_count; index++) {
+		if (!enic->wq[index].ctrl)
+			break;
+	}
+	if (enic->wq_count != index)
+		return 0;
+	/* check start of packet (SOP) RQs only in case scatter is disabled. */
+	for (index = 0; index < enic->rq_count; index++) {
+		if (!enic->rq[enic_sop_rq(index)].ctrl)
+			break;
+	}
+	if (enic->rq_count != index)
+		return 0;
 
 	ret = enic_alloc_intr_resources(enic);
 	if (ret) {
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/enic: fix crash when changing number of Rx or Tx queues
  2016-07-10 21:15 [PATCH] net/enic: fix crash when changing number of Rx or Tx queues John Daley
@ 2016-07-15 21:28 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2016-07-15 21:28 UTC (permalink / raw)
  To: John Daley; +Cc: dev, bruce.richardson

2016-07-10 14:15, John Daley:
> The check that all Tx and Rx queues were set up was not
> adequate when reconfiguring with a different number of
> queues. Only the number of completion queues (CQs) was
> being used to make the determination, but the CQ array
> is shared between the underlying Rx and Tx queues.
> 
> Check that the internal Rx, Tx and CQs are all set up
> before completing port configuration.
> 
> Fixes: fefed3d1e62c ("enic: new driver")
> 
> Signed-off-by: John Daley <johndale@cisco.com>
> Reviewed-by: Nelson Escobar <neescoba@cisco.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-15 21:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-10 21:15 [PATCH] net/enic: fix crash when changing number of Rx or Tx queues John Daley
2016-07-15 21:28 ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.