From: Ong Boon Leong <hidden> Date: 2020-01-13 10:13:27
Patch-series that fixes couple of issues in stmmac:-
1/7: It fixes the incorrect setting of Rx Tail Pointer. Rx Tail Pointer
should points to the last valid descriptor that was replenished by
stmmac_rx_refill().
2/7: It ensures that the real_num_rx|tx_queues are set in both driver
probe() and resume(). So, move the netif_set_real_num_rx|tx_queues()
into stmmac_hw_setup().
3/7: It fixes missing netdev->features = features update in
stmmac_set_features().
4/7: It fixes incorrect MACRO function defininition for TX and RX user
priority queue steering for queue > 3.
5/7: It ensures that the previous value of GMAC_VLAN_TAG register is
read first before for updating the register.
6/7: It ensures the GMAC IP v4.xx and above behaves correctly to:-
ip link set <devname> multicast off|on
7/7: It ensures PCI platform data is using plat->phy_interface.
Thanks,
Boon Leong
Aashish Verma (1):
net: stmmac: Fix incorrect location to set real_num_rx|tx_queues
Ong Boon Leong (2):
net: stmmac: fix error in updating rx tail pointer to last free entry
net: stmmac: fix missing netdev->features in stmmac_set_features
Tan, Tee Min (1):
net: stmmac: fix incorrect GMAC_VLAN_TAG register writting
implementation
Verma, Aashish (1):
net: stmmac: fix missing IFF_MULTICAST check in dwmac4_set_filter
Voon Weifeng (2):
net: stmmac: Fix priority steering for tx/rx queue >3
net: stmmac: update pci platform data to use phy_interface
drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 10 ++++++----
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 9 +++++----
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++++++++------
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 14 ++++++++------
4 files changed, 29 insertions(+), 20 deletions(-)
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Ong Boon Leong <hidden> Date: 2020-01-13 10:13:30
DMA_CH(#i)_RxDesc_Tail_Pointer points to an offset from the base and
indicates the location of the last valid descriptor.
The change introduced by "net: stmmac: Update RX Tail Pointer to last
free entry" incorrectly updates the RxDesc_Tail_Pointer and causess
Rx operation to freeze in corner case. The issue is explained as
follow:-
Say, cur_rx=1 and dirty_rx=0, then we have dirty=1 and entry=0 before
the while (dirty-- > 0) loop of stmmac_rx_refill() is entered. When
the while loop is 1st entered, Rx buffer[entry=0] is refilled and after
entry++, then, entry=1. Now, the while loop condition check "dirty-- > 0"
and the while loop bails out because dirty=0. Up to this point, the
driver code works correctly.
However, the current implementation sets the Rx Tail Pointer to the
location pointed by dirty_rx, just updated to the value of entry(=1).
This is incorrect because the last Rx buffer that is refileld with empty
buffer is with entry=0. In another words, the current logics always sets
Rx Tail Pointer to the next Rx buffer to be refilled (too early).
So, we fix this by tracking the index of the most recently refilled Rx
buffer by using "last_refill" and use "last_refill" to update the Rx Tail
Pointer instead of using "entry" which points to the next dirty_rx to be
refilled in future.
Fixes: 858a31ffc3d9 ("net: stmmac: Update RX Tail Pointer to last free entry")
Signed-off-by: Ong Boon Leong <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
From: Ong Boon Leong <hidden> Date: 2020-01-13 10:13:35
From: Aashish Verma <redacted>
netif_set_real_num_tx_queues() & netif_set_real_num_rx_queues() should be
used to inform network stack about the real Tx & Rx queue (active) number
in both stmmac_open() and stmmac_resume(), therefore, we move the code
from stmmac_dvr_probe() to stmmac_hw_setup().
Fixes: c02b7a914551 ("net: stmmac: use netif_set_real_num_{rx,tx}_queues")
Signed-off-by: Aashish Verma <redacted>
Signed-off-by: Ong Boon Leong <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
@@ -2624,6 +2624,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)if(priv->dma_cap.vlins)stmmac_enable_vlan(priv,priv->hw,STMMAC_VLAN_INSERT);+/* Configure real RX and TX queues */+netif_set_real_num_rx_queues(dev,priv->plat->rx_queues_to_use);+netif_set_real_num_tx_queues(dev,priv->plat->tx_queues_to_use);+/* Start the ball rolling... */stmmac_start_all_dma(priv);
@@ -4624,10 +4628,6 @@ int stmmac_dvr_probe(struct device *device,stmmac_check_ether_addr(priv);-/* Configure real RX and TX queues */-netif_set_real_num_rx_queues(ndev,priv->plat->rx_queues_to_use);-netif_set_real_num_tx_queues(ndev,priv->plat->tx_queues_to_use);-ndev->netdev_ops=&stmmac_netdev_ops;ndev->hw_features=NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Ong Boon Leong <hidden> Date: 2020-01-13 10:13:46
From: "Tan, Tee Min" <redacted>
It should always do a read of current value of GMAC_VLAN_TAG instead of
directly overwriting the register value.
Fixes: c1be0022df0d ("net: stmmac: Add VLAN HASH filtering support in GMAC4+")
Signed-off-by: Tan, Tee Min <redacted>
Signed-off-by: Ong Boon Leong <redacted>
---
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
From: Ong Boon Leong <hidden> Date: 2020-01-13 10:13:48
From: "Verma, Aashish" <redacted>
Without checking for IFF_MULTICAST flag, it is wrong to assume multicast
filtering is always enabled. By checking against IFF_MULTICAST, now
the driver behaves correctly when the multicast support is toggled by below
command:-
ip link set <devname> multicast off|on
Fixes: 477286b53f55 ("stmmac: add GMAC4 core support")
Signed-off-by: Verma, Aashish <redacted>
Signed-off-by: Ong Boon Leong <redacted>
---
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -420,7 +420,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw,value|=GMAC_PACKET_FILTER_PM;/* Set all the bits of the HASH tab */memset(mc_filter,0xff,sizeof(mc_filter));-}elseif(!netdev_mc_empty(dev)){+}elseif(!netdev_mc_empty(dev)&&(dev->flags&IFF_MULTICAST)){structnetdev_hw_addr*ha;/* Hash filter for multicast */
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Ong Boon Leong <hidden> Date: 2020-01-13 10:13:52
From: Voon Weifeng <redacted>
The recent patch to support passive mode converter did not take care the
phy interface configuration in PCI platform data. Hence, converting all
the PCI platform data from plat->interface to plat->phy_interface as the
default mode is meant for PHY.
Fixes: 0060c8783330 ("net: stmmac: implement support for passive mode converters via dt")
Signed-off-by: Voon Weifeng <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
From: Jose Abreu <Jose.Abreu@synopsys.com> Date: 2020-01-13 10:29:34
From: Ong Boon Leong <redacted>
Date: Jan/14/2020, 02:01:10 (UTC+00:00)
DMA_CH(#i)_RxDesc_Tail_Pointer points to an offset from the base and
indicates the location of the last valid descriptor.
The change introduced by "net: stmmac: Update RX Tail Pointer to last
free entry" incorrectly updates the RxDesc_Tail_Pointer and causess
Rx operation to freeze in corner case. The issue is explained as
follow:-
Say, cur_rx=1 and dirty_rx=0, then we have dirty=1 and entry=0 before
the while (dirty-- > 0) loop of stmmac_rx_refill() is entered. When
the while loop is 1st entered, Rx buffer[entry=0] is refilled and after
entry++, then, entry=1. Now, the while loop condition check "dirty-- > 0"
and the while loop bails out because dirty=0. Up to this point, the
driver code works correctly.
However, the current implementation sets the Rx Tail Pointer to the
location pointed by dirty_rx, just updated to the value of entry(=1).
This is incorrect because the last Rx buffer that is refileld with empty
buffer is with entry=0. In another words, the current logics always sets
Rx Tail Pointer to the next Rx buffer to be refilled (too early).
So, we fix this by tracking the index of the most recently refilled Rx
buffer by using "last_refill" and use "last_refill" to update the Rx Tail
Pointer instead of using "entry" which points to the next dirty_rx to be
refilled in future.
I'm not sure about this ...
RX Tail points to last valid descriptor but it doesn't point to the base
address of that one, it points to the end address.
Let's say we have a ring buffer with just 1 descriptor. With your new
logic then: RX base == RX tail (== RX base), so the IP will not see any
descriptor. But with old logic: RX base == (RX base + 1), which causes
the IP to correctly see the descriptor.
Can you provide more information on the Rx operation freeze you
mentioned ? Can it be another issue ?
---
Thanks,
Jose Miguel Abreu
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Jakub Kicinski <hidden> Date: 2020-01-13 13:17:32
On Tue, 14 Jan 2020 10:01:12 +0800, Ong Boon Leong wrote:
Please fix the date on your system.
Please always provide a patch description. For bug fixes description of
how the bug manifest to the users is important to have.
Fixes: d2afb5bdffde ("stmmac: fix the rx csum feature")
Please remove the empty lines between the Fixes tag and the other tags
on all patches.
From: Ong Boon Leong <redacted>
Date: Jan/14/2020, 02:01:10 (UTC+00:00)
quoted
DMA_CH(#i)_RxDesc_Tail_Pointer points to an offset from the base and
indicates the location of the last valid descriptor.
The change introduced by "net: stmmac: Update RX Tail Pointer to last
free entry" incorrectly updates the RxDesc_Tail_Pointer and causess
Rx operation to freeze in corner case. The issue is explained as
follow:-
Say, cur_rx=1 and dirty_rx=0, then we have dirty=1 and entry=0 before
the while (dirty-- > 0) loop of stmmac_rx_refill() is entered. When
the while loop is 1st entered, Rx buffer[entry=0] is refilled and after
entry++, then, entry=1. Now, the while loop condition check "dirty-- > 0"
and the while loop bails out because dirty=0. Up to this point, the
driver code works correctly.
However, the current implementation sets the Rx Tail Pointer to the
location pointed by dirty_rx, just updated to the value of entry(=1).
This is incorrect because the last Rx buffer that is refileld with empty
buffer is with entry=0. In another words, the current logics always sets
Rx Tail Pointer to the next Rx buffer to be refilled (too early).
So, we fix this by tracking the index of the most recently refilled Rx
buffer by using "last_refill" and use "last_refill" to update the Rx Tail
Pointer instead of using "entry" which points to the next dirty_rx to be
refilled in future.
I'm not sure about this ...
RX Tail points to last valid descriptor but it doesn't point to the base
address of that one, it points to the end address.
Let's say we have a ring buffer with just 1 descriptor. With your new
logic then: RX base == RX tail (== RX base), so the IP will not see any
descriptor. But with old logic: RX base == (RX base + 1), which causes
the IP to correctly see the descriptor.
Can you provide more information on the Rx operation freeze you
mentioned ? Can it be another issue ?
I recheck on my side, it seems like the fix needed for simics model at my
end and not needed for actual SoC. This is strange but I can check internal
team. I also read through the databook which says that for 40-bit or 48-bit
addressing mode, the tail pointer must be advanced to the location
immediately after the descriptors are set, for the DMA to know that
additional descriptors are available.
Now, relooking at the current logic which sets the rx tail pointer according
to the value of "dirty_rx" which can be "zero" as it takes value from entry
that is incremented through STMMAC_GET_ENTRY(entry, DMA_RX_SIZE).
This too can give a situation that the base and tail registers is pointing to
the same location.
According to SNPS databook, the DMA engine goes into SUSPEND state if the
Rx descriptors are not OWN=1. The operation can be resumed by ensuring that
the descriptors are owned by the DMA and then update the tail pointer.
What is your opinion here if we always update the Rx tail pointer to pointer
the boundary of the DMA size as follow without depending on dirty_rx.
rx_q->rx_tail_addr = rx_q->dma_rx_phy + (DMA_RX_SIZE *
sizeof(struct dma_desc))
Thanks
Boon Leong
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On Tue, 14 Jan 2020 10:01:12 +0800, Ong Boon Leong wrote:
Please fix the date on your system.
Please always provide a patch description. For bug fixes description of
how the bug manifest to the users is important to have.
quoted
Fixes: d2afb5bdffde ("stmmac: fix the rx csum feature")
Please remove the empty lines between the Fixes tag and the other tags
on all patches.
This issue is indeed already fixed by the patch that you have pointed out.
Weifeng
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel