netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] gianfar: Fix P1010 config regression (SQ polling)
@ 2014-03-19 13:39 Claudiu Manoil
  2014-03-20 20:09 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Claudiu Manoil @ 2014-03-19 13:39 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller

The P1010 device tree restricts the number of
supported interrupt groups to 1, although the eth
controller can support 2 interrupt groups and the
driver assumes the Multi-Group mode ("fsl,etsec2" model).

So, in this case the assumption that the Multi-Group
mode (MQ_MG_MODE) devices always support 2 interrupt
groups is false.  To fix this, a check for the actual
number of interrupt groups enabled in the board's
device tree has been added in gfar_probe for the
"fsl,etsec2" devices.

Without this fix, P1010 based boards claim support for
2 Tx queues to the net stack but only one is actually
allocated, leading to NULL access in xmit.  This issue
was introduced by enabling Single-Queue polling for
the P1010 devices.

Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
---
 drivers/net/ethernet/freescale/gianfar.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 6e12f93..9125d9a 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -754,9 +754,19 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
 		num_tx_qs = 1;
 		num_rx_qs = 1;
 	} else { /* MQ_MG_MODE */
+		/* get the actual number of supported groups */
+		unsigned int num_grps = of_get_available_child_count(np);
+
+		if (num_grps == 0 || num_grps > MAXGROUPS) {
+			dev_err(&ofdev->dev, "Invalid # of int groups(%d)\n",
+				num_grps);
+			pr_err("Cannot do alloc_etherdev, aborting\n");
+			return -EINVAL;
+		}
+
 		if (poll_mode == GFAR_SQ_POLLING) {
-			num_tx_qs = 2; /* one txq per int group */
-			num_rx_qs = 2; /* one rxq per int group */
+			num_tx_qs = num_grps; /* one txq per int group */
+			num_rx_qs = num_grps; /* one rxq per int group */
 		} else { /* GFAR_MQ_POLLING */
 			num_tx_qs = tx_queues ? *tx_queues : 1;
 			num_rx_qs = rx_queues ? *rx_queues : 1;
-- 
1.7.11.7

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

* Re: [PATCH net-next] gianfar: Fix P1010 config regression (SQ polling)
  2014-03-19 13:39 [PATCH net-next] gianfar: Fix P1010 config regression (SQ polling) Claudiu Manoil
@ 2014-03-20 20:09 ` David Miller
  2014-03-21  7:33   ` [PATCH net-next v2] " Claudiu Manoil
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2014-03-20 20:09 UTC (permalink / raw)
  To: claudiu.manoil; +Cc: netdev

From: Claudiu Manoil <claudiu.manoil@freescale.com>
Date: Wed, 19 Mar 2014 15:39:39 +0200

> The P1010 device tree restricts the number of
> supported interrupt groups to 1, although the eth
> controller can support 2 interrupt groups and the
> driver assumes the Multi-Group mode ("fsl,etsec2" model).
> 
> So, in this case the assumption that the Multi-Group
> mode (MQ_MG_MODE) devices always support 2 interrupt
> groups is false.  To fix this, a check for the actual
> number of interrupt groups enabled in the board's
> device tree has been added in gfar_probe for the
> "fsl,etsec2" devices.
> 
> Without this fix, P1010 based boards claim support for
> 2 Tx queues to the net stack but only one is actually
> allocated, leading to NULL access in xmit.  This issue
> was introduced by enabling Single-Queue polling for
> the P1010 devices.
> 
> Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>

Please repost this, referencing the specific commit that introduced
the regression.  Either inline in the commit message, or using
the standard "Fixes: " tag right before your signoff.

Thank you.

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

* [PATCH net-next v2] gianfar: Fix P1010 config regression (SQ polling)
  2014-03-20 20:09 ` David Miller
@ 2014-03-21  7:33   ` Claudiu Manoil
  2014-03-24  4:41     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Claudiu Manoil @ 2014-03-21  7:33 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller

The P1010 device tree restricts the number of
supported interrupt groups to 1, although the eth
controller can support 2 interrupt groups and the
driver assumes the Multi-Group mode ("fsl,etsec2" model).

So, in this case the assumption that the Multi-Group
mode (MQ_MG_MODE) devices always support 2 interrupt
groups is false.  To fix this, a check for the actual
number of interrupt groups enabled in the board's
device tree has been added in gfar_probe for the
"fsl,etsec2" devices.

Without this fix, P1010 based boards claim support for
2 Tx queues to the net stack but only one is actually
allocated, leading to NULL access in xmit.  This issue
was introduced by enabling Single-Queue polling for
the P1010 devices.
(71ff9e3 gianfar: Use Single-Queue polling for
"fsl,etsec2")

Fixes: 71ff9e3df7e1c5d3293af6b595309124e8c97412
Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
---
v2: added id of fixed commit to msg log

 drivers/net/ethernet/freescale/gianfar.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 6e12f93..9125d9a 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -754,9 +754,19 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
 		num_tx_qs = 1;
 		num_rx_qs = 1;
 	} else { /* MQ_MG_MODE */
+		/* get the actual number of supported groups */
+		unsigned int num_grps = of_get_available_child_count(np);
+
+		if (num_grps == 0 || num_grps > MAXGROUPS) {
+			dev_err(&ofdev->dev, "Invalid # of int groups(%d)\n",
+				num_grps);
+			pr_err("Cannot do alloc_etherdev, aborting\n");
+			return -EINVAL;
+		}
+
 		if (poll_mode == GFAR_SQ_POLLING) {
-			num_tx_qs = 2; /* one txq per int group */
-			num_rx_qs = 2; /* one rxq per int group */
+			num_tx_qs = num_grps; /* one txq per int group */
+			num_rx_qs = num_grps; /* one rxq per int group */
 		} else { /* GFAR_MQ_POLLING */
 			num_tx_qs = tx_queues ? *tx_queues : 1;
 			num_rx_qs = rx_queues ? *rx_queues : 1;
-- 
1.7.11.7

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

* Re: [PATCH net-next v2] gianfar: Fix P1010 config regression (SQ polling)
  2014-03-21  7:33   ` [PATCH net-next v2] " Claudiu Manoil
@ 2014-03-24  4:41     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-03-24  4:41 UTC (permalink / raw)
  To: claudiu.manoil; +Cc: netdev

From: Claudiu Manoil <claudiu.manoil@freescale.com>
Date: Fri, 21 Mar 2014 09:33:17 +0200

> The P1010 device tree restricts the number of
> supported interrupt groups to 1, although the eth
> controller can support 2 interrupt groups and the
> driver assumes the Multi-Group mode ("fsl,etsec2" model).
> 
> So, in this case the assumption that the Multi-Group
> mode (MQ_MG_MODE) devices always support 2 interrupt
> groups is false.  To fix this, a check for the actual
> number of interrupt groups enabled in the board's
> device tree has been added in gfar_probe for the
> "fsl,etsec2" devices.
> 
> Without this fix, P1010 based boards claim support for
> 2 Tx queues to the net stack but only one is actually
> allocated, leading to NULL access in xmit.  This issue
> was introduced by enabling Single-Queue polling for
> the P1010 devices.
> (71ff9e3 gianfar: Use Single-Queue polling for
> "fsl,etsec2")
> 
> Fixes: 71ff9e3df7e1c5d3293af6b595309124e8c97412
> Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>

Applied, thanks.

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

end of thread, other threads:[~2014-03-24  4:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-19 13:39 [PATCH net-next] gianfar: Fix P1010 config regression (SQ polling) Claudiu Manoil
2014-03-20 20:09 ` David Miller
2014-03-21  7:33   ` [PATCH net-next v2] " Claudiu Manoil
2014-03-24  4:41     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).