net: stmmac: Always enable MAC RX queues
Subsystems (4)
PATCH 1/3 net: stmmac: Always enable MAC RX queues
From: Thierry Reding <[email protected]>
The MAC RX queues always need to be enabled in order to receive network packets. Remove the condition that this only needs to be done for multi- queue configurations.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -1
@@ -1943,7 +1943,7 @@ static void stmmac_mtl_configuration(struct stmmac_priv *priv)stmmac_rx_queue_dma_chan_map (priv);/* Enable MAC RX Queues */ -if (rx_queues_count >1 && priv->hw->mac->rx_queue_enable) +if (priv->hw->mac->rx_queue_enable)stmmac_mac_enable_rx_queues (priv);/* Set the HW DMA mode and the COE */
Signature · 1 line
2.12.0
PATCH 2/3 net: stmmac: Restore DT backwards-compatibility
From: Thierry Reding <[email protected]>
Recent changes to support multiple queues in the device tree bindings resulted in the number of RX and TX queues to be initialized to zero for device trees not adhering to the new bindings.
Restore backwards-compatibility with those device trees by falling back to a single RX and TX queues each.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +7 -0
@@ -143,6 +143,13 @@ static void stmmac_mtl_setup(struct platform_device *pdev,struct device_node *tx_node;u8 queue =0 ; +/* For backwards-compatibility with device trees that don't have any +* snps,mtl-rx-config or snps,mtl-tx-config properties, we fall back +* to one RX and TX queues each. +*/ + plat->rx_queues_to_use =1 ; + plat->tx_queues_to_use =1 ; + rx_node =of_parse_phandle (pdev->dev.of_node,"snps,mtl-rx-config" ,0 );if (!rx_node)return ;
Signature · 1 line
2.12.0
PATCH 3/3 net: stmmac: Use AVB mode by default
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Prior to the recent multi-queue changes the driver would configure the queues to use the AVB mode, but the mode then got switched to DCB. The hardware still works fine in DCB mode, but my testing capabilities are limited, so it's safer to revert to the prior setting anyway.
--- include/linux/stmmac.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/stmmac.h +2 -2
@@ -56,8 +56,8 @@#define MTL_RX_ALGORITHM_WSP 0x5/* RX/TX Queue Mode */ -#define MTL_QUEUE_DCB 0x0 -#define MTL_QUEUE_AVB 0x1 +#define MTL_QUEUE_AVB 0x0 +#define MTL_QUEUE_DCB 0x1/* The MDC clock could be set higher than the IEEE 802.3 * specified frequency limit 0f 2.5 MHz, by programming a clock divider
Signature · 1 line
2.12.0
Re: [PATCH 2/3] net: stmmac: Restore DT backwards-compatibility
In reply to Thierry RedingÀs 3:12 PM de 3/21/2017, Thierry Reding escreveu:
Quoted 23 lines
From: Thierry Reding <[email protected]>
Recent changes to support multiple queues in the device tree bindings resulted in the number of RX and TX queues to be initialized to zero for device trees not adhering to the new bindings.
Restore backwards-compatibility with those device trees by falling back to a single RX and TX queues each.
Signed-off-by Thierry Reding <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +0
-0@@ -143,6 +143,13 @@ static void stmmac_mtl_setup(struct platform_device *pdev,struct device_node *tx_node;u8 queue =0 ;
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c static void stmmac_mtl_setup(struct platform_device *pdev, · line 155
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +7
-0+/* For backwards-compatibility with device trees that don't have any +* snps,mtl-rx-config or snps,mtl-tx-config properties, we fall back +* to one RX and TX queues each. +*/ + plat->rx_queues_to_use =1 ; + plat->tx_queues_to_use =1 ; + rx_node =of_parse_phandle (pdev->dev.of_node,"snps,mtl-rx-config" ,0 );if (!rx_node)return ;
Às 3:12 PM de 3/21/2017, Thierry Reding escreveu:
Quoted 17 lines
From: Thierry Reding <[email protected]>
The MAC RX queues always need to be enabled in order to receive network packets. Remove the condition that this only needs to be done for multi- queue configurations.
Signed-off-by Thierry Reding <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static void stmmac_mtl_configuration(struct stmmac_priv *priv) · line 1949
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1
-1@@ -1943,7 +1943,7 @@ static void stmmac_mtl_configuration(struct stmmac_priv *priv)stmmac_rx_queue_dma_chan_map (priv);/* Enable MAC RX Queues */ -if (rx_queues_count >1 && priv->hw->mac->rx_queue_enable) +if (priv->hw->mac->rx_queue_enable)stmmac_mac_enable_rx_queues (priv);/* Set the HW DMA mode and the COE */
This text is from the Databook:
"In multiple Rx queues configuration, all the queues are disabled by default. Enable the Rx queue by programming the corresponding field in this register."
So by theory, only multiple queue configured cores needs the enable operation.
Quoted 1 line
Quoted 1 line
Quoted 1 line
But came to my attention a setup that has 1 RX queue and 2 TX queues, which
enables multiple queues mechanism inside the core (even with 1 RX) and so RX needs to be enabled. Because of that I agree with this patch.
Re: [PATCH 3/3] net: stmmac: Use AVB mode by default
In reply to Thierry RedingÀs 3:12 PM de 3/21/2017, Thierry Reding escreveu:
Quoted 18 lines
From: Thierry Reding <[email protected]>
Prior to the recent multi-queue changes the driver would configure the queues to use the AVB mode, but the mode then got switched to DCB. The hardware still works fine in DCB mode, but my testing capabilities are limited, so it's safer to revert to the prior setting anyway.
Signed-off-by Thierry Reding <[email protected]>--- include/linux/stmmac.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/linux/stmmac.h +0
-0
include/linux/stmmac.h line 63
Quoted 10 lines
include/linux/stmmac.h +2
-2@@ -56,8 +56,8 @@#define MTL_RX_ALGORITHM_WSP 0x5/* RX/TX Queue Mode */ -#define MTL_QUEUE_DCB 0x0 -#define MTL_QUEUE_AVB 0x1 +#define MTL_QUEUE_AVB 0x0 +#define MTL_QUEUE_DCB 0x1/* The MDC clock could be set higher than the IEEE 802.3 * specified frequency limit 0f 2.5 MHz, by programming a clock divider
Thierry, I don't understand this patch. It will have 0 impact.
In stmmac_platform configuration, 0 impact:
if (of_property_read_bool(q_node, "snps,dcb-algorithm")) plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB; else if (of_property_read_bool(q_node, "snps,avb-algorithm")) plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_AVB; else
** plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB;
In dwmac4_core, 0 impact:
value &= GMAC_RX_QUEUE_CLEAR(queue); if (mode == MTL_QUEUE_AVB) value |= GMAC_RX_AV_QUEUE_ENABLE(queue); else if (mode == MTL_QUEUE_DCB) value |= GMAC_RX_DCB_QUEUE_ENABLE(queue);
I think you should set the default mode in (**).
Thanks.
Quoted 29 lines · Joao Pinto
Às 3:12 PM de 3/21/2017, Thierry Reding escreveu:
Quoted 17 lines
From: Thierry Reding <[email protected]>
The MAC RX queues always need to be enabled in order to receive network packets. Remove the condition that this only needs to be done for multi- queue configurations.
Signed-off-by Thierry Reding <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static void stmmac_mtl_configuration(struct stmmac_priv *priv) · line 1949
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1
-1@@ -1943,7 +1943,7 @@ static void stmmac_mtl_configuration(struct stmmac_priv *priv)stmmac_rx_queue_dma_chan_map (priv);/* Enable MAC RX Queues */ -if (rx_queues_count >1 && priv->hw->mac->rx_queue_enable) +if (priv->hw->mac->rx_queue_enable)stmmac_mac_enable_rx_queues (priv);/* Set the HW DMA mode and the COE */ This text is from the Databook:
Quoted 4 lines
"In multiple Rx queues configuration, all the queues are disabled by default. Enable the Rx queue by programming the corresponding field in this register."
So by theory, only multiple queue configured cores needs the enable operation.
But that's related to multiple queues configured in the core when it was instantiated (i.e. the capabilities). rx_queues_count reflects the number of queues enabled in the driver, so it can be 1 even if the core itself supports more than one queue.
In that case, we still want to enable the MAC RX queue because it will otherwise remain disabled.
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
But came to my attention a setup that has 1 RX queue and 2 TX queues, which
enables multiple queues mechanism inside the core (even with 1 RX) and so RX needs to be enabled. Because of that I agree with this patch.
Acked-by Joao Pinto <[email protected]>
Yeah, that case would also require this patch.
Thierry
Re: [PATCH 3/3] net: stmmac: Use AVB mode by default
In reply to Joao PintoQuoted 43 lines · Joao Pinto
Às 3:12 PM de 3/21/2017, Thierry Reding escreveu:
Quoted 18 lines
From: Thierry Reding <[email protected]>
Prior to the recent multi-queue changes the driver would configure the queues to use the AVB mode, but the mode then got switched to DCB. The hardware still works fine in DCB mode, but my testing capabilities are limited, so it's safer to revert to the prior setting anyway.
Signed-off-by Thierry Reding <[email protected]>--- include/linux/stmmac.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/linux/stmmac.h +0
-0include/linux/stmmac.h line 63
Quoted 10 lines
include/linux/stmmac.h +2
-2@@ -56,8 +56,8 @@#define MTL_RX_ALGORITHM_WSP 0x5/* RX/TX Queue Mode */ -#define MTL_QUEUE_DCB 0x0 -#define MTL_QUEUE_AVB 0x1 +#define MTL_QUEUE_AVB 0x0 +#define MTL_QUEUE_DCB 0x1/* The MDC clock could be set higher than the IEEE 802.3 * specified frequency limit 0f 2.5 MHz, by programming a clock divider Thierry, I don't understand this patch. It will have 0 impact.
In
stmmac_platformconfiguration, 0 impact:if (of_property_read_bool(q_node, "snps,dcb-algorithm")) plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB; else if (of_property_read_bool(q_node, "snps,avb-algorithm")) plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_AVB; else** plat->rx_queues_cfg[queue].mode_to_use =
MTL_QUEUE_DCB;In
dwmac4_core, 0 impact:
Quoted 7 lines
value &= GMAC_RX_QUEUE_CLEAR(queue); if (mode == MTL_QUEUE_AVB) value |= GMAC_RX_AV_QUEUE_ENABLE(queue); else if (mode == MTL_QUEUE_DCB) value |= GMAC_RX_DCB_QUEUE_ENABLE(queue);I think you should set the default mode in (**).
That was my initial attempt, but then I realized that for old DTBs, stmmac_mtl_setup() will already exit prematurely because of the missing snps,mtl-{rx,tx}-config properties. It's pretty much for the same reason as the separate assignment of the default {rx,tx}_queues_to_use. In this case it's somewhat more obfuscated, though. Changing AVB to be mode 0 means that plat->rx_queues_cfg[].mode_to_use will contain AVB as default because plat is devm_kzalloc()'ed.
Effectively this change makes all queues use AVB by default unless they are configured using the new device tree bindings.
Thierry
Re: [PATCH 3/3] net: stmmac: Use AVB mode by default
Às 4:42 PM de 3/21/2017, Thierry Reding escreveu:
Quoted 60 lines · Joao Pinto
Quoted 43 lines
Às 3:12 PM de 3/21/2017, Thierry Reding escreveu:
Quoted 18 lines
From: Thierry Reding <[email protected]>
Prior to the recent multi-queue changes the driver would configure the queues to use the AVB mode, but the mode then got switched to DCB. The hardware still works fine in DCB mode, but my testing capabilities are limited, so it's safer to revert to the prior setting anyway.
Signed-off-by Thierry Reding <[email protected]>--- include/linux/stmmac.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/linux/stmmac.h +0
-0include/linux/stmmac.h line 63
Quoted 10 lines
include/linux/stmmac.h +2
-2@@ -56,8 +56,8 @@#define MTL_RX_ALGORITHM_WSP 0x5/* RX/TX Queue Mode */ -#define MTL_QUEUE_DCB 0x0 -#define MTL_QUEUE_AVB 0x1 +#define MTL_QUEUE_AVB 0x0 +#define MTL_QUEUE_DCB 0x1/* The MDC clock could be set higher than the IEEE 802.3 * specified frequency limit 0f 2.5 MHz, by programming a clock divider Thierry, I don't understand this patch. It will have 0 impact.
In
stmmac_platformconfiguration, 0 impact:if (of_property_read_bool(q_node, "snps,dcb-algorithm")) plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB; else if (of_property_read_bool(q_node, "snps,avb-algorithm")) plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_AVB; else** plat->rx_queues_cfg[queue].mode_to_use =
MTL_QUEUE_DCB;In
dwmac4_core, 0 impact:Quoted 7 lines
value &= GMAC_RX_QUEUE_CLEAR(queue); if (mode == MTL_QUEUE_AVB) value |= GMAC_RX_AV_QUEUE_ENABLE(queue); else if (mode == MTL_QUEUE_DCB) value |= GMAC_RX_DCB_QUEUE_ENABLE(queue);I think you should set the default mode in (**).
That was my initial attempt, but then I realized that for old DTBs,
stmmac_mtl_setup()will already exit prematurely because of the missing snps,mtl-{rx,tx}-config properties. It's pretty much for the same reason as the separate assignment of the default {rx,tx}_queues_to_use. In this case it's somewhat more obfuscated, though. Changing AVB to be mode 0 means that plat->rx_queues_cfg[].mode_to_use will contain AVB as default because plat is devm_kzalloc()'ed.
Quoted 2 lines
Effectively this change makes all queues use AVB by default unless they are configured using the new device tree bindings.
Yes I keep forgeting that :), but you are assuming that plat->rx_queues_cfg[queue].mode_to_use is 0 by default, which might not be the case, but I agree with you that this is the simpler approach. Let's see what others have to say.
Quoted 3 lines
Thierry
Joao Pinto
Acked-byRe: [PATCH 3/3] net: stmmac: Use AVB mode by default
Às 4:50 PM de 3/21/2017, Joao Pinto escreveu:
Quoted 61 lines
Às 4:42 PM de 3/21/2017, Thierry Reding escreveu:
Quoted 60 lines · Joao Pinto
Quoted 43 lines
Às 3:12 PM de 3/21/2017, Thierry Reding escreveu:
Quoted 18 lines
From: Thierry Reding <[email protected]>
Prior to the recent multi-queue changes the driver would configure the queues to use the AVB mode, but the mode then got switched to DCB. The hardware still works fine in DCB mode, but my testing capabilities are limited, so it's safer to revert to the prior setting anyway.
Signed-off-by Thierry Reding <[email protected]>--- include/linux/stmmac.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/linux/stmmac.h +0
-0include/linux/stmmac.h line 63
Quoted 10 lines
include/linux/stmmac.h +2
-2@@ -56,8 +56,8 @@#define MTL_RX_ALGORITHM_WSP 0x5/* RX/TX Queue Mode */ -#define MTL_QUEUE_DCB 0x0 -#define MTL_QUEUE_AVB 0x1 +#define MTL_QUEUE_AVB 0x0 +#define MTL_QUEUE_DCB 0x1/* The MDC clock could be set higher than the IEEE 802.3 * specified frequency limit 0f 2.5 MHz, by programming a clock divider Thierry, I don't understand this patch. It will have 0 impact.
In
stmmac_platformconfiguration, 0 impact:if (of_property_read_bool(q_node, "snps,dcb-algorithm")) plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB; else if (of_property_read_bool(q_node, "snps,avb-algorithm")) plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_AVB; else** plat->rx_queues_cfg[queue].mode_to_use =
MTL_QUEUE_DCB;In
dwmac4_core, 0 impact:Quoted 7 lines
value &= GMAC_RX_QUEUE_CLEAR(queue); if (mode == MTL_QUEUE_AVB) value |= GMAC_RX_AV_QUEUE_ENABLE(queue); else if (mode == MTL_QUEUE_DCB) value |= GMAC_RX_DCB_QUEUE_ENABLE(queue);I think you should set the default mode in (**).
That was my initial attempt, but then I realized that for old DTBs,
stmmac_mtl_setup()will already exit prematurely because of the missing snps,mtl-{rx,tx}-config properties. It's pretty much for the same reason as the separate assignment of the default {rx,tx}_queues_to_use. In this case it's somewhat more obfuscated, though. Changing AVB to be mode 0 means that plat->rx_queues_cfg[].mode_to_use will contain AVB as default because plat is devm_kzalloc()'ed.
Quoted 7 lines
Quoted 2 lines
Effectively this change makes all queues use AVB by default unless they are configured using the new device tree bindings.
Yes I keep forgeting that :), but you are assuming that plat->rx_queues_cfg[queue].mode_to_use is 0 by default, which might not be the case, but I agree with you that this is the simpler approach. Let's see what others have to say.
Forget what I said, yes devm_kzalloc() in plat guarantees this. I need a cup of coffee :).
Quoted 4 lines
Quoted 3 lines
Thierry
Re: [PATCH 2/3] net: stmmac: Restore DT backwards-compatibility
In reply to Thierry RedingQuoted 35 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Recent changes to support multiple queues in the device tree bindings resulted in the number of RX and TX queues to be initialized to zero for device trees not adhering to the new bindings.
Restore backwards-compatibility with those device trees by falling back to a single RX and TX queues each.
Signed-off-by Thierry Reding <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +7
-0@@ -143,6 +143,13 @@ static void stmmac_mtl_setup(struct platform_device *pdev,struct device_node *tx_node;u8 queue =0 ; +/* For backwards-compatibility with device trees that don't have any +* snps,mtl-rx-config or snps,mtl-tx-config properties, we fall back +* to one RX and TX queues each. +*/ + plat->rx_queues_to_use =1 ; + plat->tx_queues_to_use =1 ; + rx_node =of_parse_phandle (pdev->dev.of_node,"snps,mtl-rx-config" ,0 );if (!rx_node)return ;Signature · 1 line
2.12.0
Fix one of the reported problem on dwmac-sunxi and dwmac-sun8i Regards
From: Thierry Reding <[email protected]>
Date: Tue, 21 Mar 2017 16:12:09 +0100
Quoted 7 lines
From: Thierry Reding <[email protected]>
The MAC RX queues always need to be enabled in order to receive network packets. Remove the condition that this only needs to be done for multi- queue configurations.
Signed-off-by Thierry Reding <[email protected]>
Applied to net-next
Re: [PATCH 2/3] net: stmmac: Restore DT backwards-compatibility
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Date: Tue, 21 Mar 2017 16:12:10 +0100
Quoted 10 lines
From: Thierry Reding <[email protected]>
Recent changes to support multiple queues in the device tree bindings resulted in the number of RX and TX queues to be initialized to zero for device trees not adhering to the new bindings.
Restore backwards-compatibility with those device trees by falling back to a single RX and TX queues each.
Signed-off-by Thierry Reding <[email protected]>
Applied to net-next
Re: [PATCH 3/3] net: stmmac: Use AVB mode by default
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Date: Tue, 21 Mar 2017 16:12:11 +0100
Quoted 8 lines
From: Thierry Reding <[email protected]>
Prior to the recent multi-queue changes the driver would configure the queues to use the AVB mode, but the mode then got switched to DCB. The hardware still works fine in DCB mode, but my testing capabilities are limited, so it's safer to revert to the prior setting anyway.
Signed-off-by Thierry Reding <[email protected]>
Applied to net-next