net: stmmac: Obvious cleanups and several fixes
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest20 patches 16 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/20 | net: phy: realtek: Fix events detection failure in LPI modedrivers/ | +37 | 15 replies | |
| 2/20 | net: stmmac: Free Rx descs on Tx allocation failuredrivers/ | +4 | 0 replies | |
| 3/20 | net: stmmac: Fix false MTL RX overflow handling for higher queuesdrivers/ | +4 | 0 replies | |
| 4/20 | net: stmmac: Assert reset control after MDIO de-registrationdrivers/ | +1 | 0 replies | |
| 5/20 | net: stmmac: Use dwmac410_disable_dma_irq for DW MAC v4.10 DMAdrivers/ | +1 | 0 replies | |
| 6/20 | net: stmmac: Use LPI IRQ status-related macro in DW MAC1000 isrdrivers/ | +1 | 0 replies | |
| 7/20 | net: stmmac: Clear descriptors before initializing themdrivers/ | +2 | 0 replies | |
| 8/20 | net: stmmac: Fix typo in the XGMAC_L3_ADDR3 macro namedrivers/ | +1 | 0 replies | |
| 9/20 | net: stmmac: Discard mii_irq array from private datadrivers/ | +0 | 1 reply | |
| 10/20 | net: stmmac: Discard Rx copybreak ethtool settingdrivers/ drivers/ drivers/ | +0 | 0 replies | |
| 11/20 | net: stmmac: Discard index usage in the dirty_rx initdrivers/ | +1 | 0 replies | |
| 12/20 | net: stmmac: Discard dwmac1000_dma_ops declaration from dwmac100.hdrivers/ | +0 | 0 replies | |
| 13/20 | net: stmmac: Move DMA Tx/Rx init methods to DW MAC libdrivers/ drivers/ drivers/ +1 more | +22 | 0 replies | |
| 14/20 | net: stmmac: Add DW GMAC disable LPI IRQ mask macrodrivers/ | +1 | 0 replies | |
| 15/20 | net: stmmac: Discard STMMAC_RESETING flagdrivers/ drivers/ | +0 | 0 replies | |
| 16/20 | net: stmmac: Discard conditional service task executiondrivers/ drivers/ | +1 | 0 replies | |
| 17/20 | net: stmmac: Add 'cause' arg to the service task executionerdrivers/ | +8 | 0 replies | |
| 18/20 | net: stmmac: Move PTP clock enabling to PTP-init methoddrivers/ | +17 | 0 replies | |
| 19/20 | net: stmmac: Move DMA stop procedure to HW-setup antagonistdrivers/ | +2 | 0 replies | |
| 20/20 | net: stmmac: Move MAC Tx/Rx disabling to HW-setup antagonistdrivers/ | +2 | 0 replies |
Reviews trailers per patch
2 of 20 patches have a Reviewed-by or Acked-by.
| Patch | Andrew Lunn |
|---|---|
| 1/20 | R-b |
| 2/20 | |
| 3/20 | |
| 4/20 | |
| 5/20 | |
| 6/20 | |
| 7/20 | |
| 8/20 | |
| 9/20 | R-b |
| 10/20 | |
| 11/20 | |
| 12/20 | |
| 13/20 | |
| 14/20 | |
| 15/20 | |
| 16/20 | |
| 17/20 | |
| 18/20 | |
| 19/20 | |
| 20/20 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 00/20] net: stmmac: Obvious cleanups and several fixes
This series consists of a preparation patches before adding DW MAC GPIOs and final Baikal-T1 GMAC support. (The later will be done in the framework of the Generic DW MAC glue-driver though.) It's mainly about cleaning the code up here and there by removing unused data and macro names, but also includes several bugs and design fixes.
The patchset starts from fixing the Realtek PHYs driver. In particular it has been discovered that disabling RXC in LPI (EEE) causes RTL8211E PHY partial freeze until the next MDIO read operation from the PHY CSRs. We suggest to fix that problem by dummy reading from the MMD Data register each time the PC1R.10 bit is intended to be set.
Then the series evolves in a set of bug fixes discovered in the main STMMAC driver code. First of all the cleanup-on-error path has been incorrectly implemented in the DMA descriptor allocation procedure due to which in case Tx DMA resources allocation failures the Rx DMA descriptors will be left unfreed. Secondly it has been discovered that the MTL IRQs handling procedure didn't do that quite well, so any MTL RX overflow errors will be handled for queues with higher order too, which most likely isn't what the code author originally intended. Thirdly the DW MAC reset control de-assetion should be performed after the MDIO-bus de-registration, because the later may need to access PHY registers, which is supposed to be done via the MAC SMA interface. Fourthly we've found out that DW MAC v4.x code was using a generic dwmac4_disable_dma_irq() method to disable DMA IRQs instead of having the dedicated dwmac410_disable_dma_irq() method utilized. That didn't cause any problem because the modified bits matches in both IP-core revisions, but for consistency we suggest to fix that. Fifthly for the same reason of the naming consistency the GMAC_INT_STATUS_PMT macro constant should be used instead of GMAC_INT_DISABLE_PMT to check the PMT IRQs status. Finally it's strange that the problem hasn't been discovered before, but it is most likely wrong to initialized Tx/Rx DMA descriptors, and then clean them up. That specifically concerns the Tx DMA descriptors initialization procedure in the Chain-mode. Please the patch for details.
The patchset then proceed with multiple optimizations and cleanups performed here and there in the code: fix typo in the XGMAC_L3_ADDR3 macro name, discard unused mii_irq array from the private data, discard nothing changing Rx copybreak ethtool setting, discard redundant index variable usage in the dirty_rx initialization method, discard dwmac1000_dma_ops declaration from dwmac100.h, move DMA Tx/Rx init methods to the DW MAC lib since they match for DW MAC and DW GMA IP-cores, discard pointless STMMAC_RESETING flag, discard conditional service task execution since it's called from CMWQ anyway (it's also errors prone, since any event happening during the service task execution will be lost), add 'cause' arg to the service task executioner to generalize the deferred events handling interface. Finally in the framework of the code cleanup procedure we suggest to extend the stmmac_hw_teardown() functionality with all the necessary hardware cleanups, which for some reason were directly performed in the network device release callback. That concerns PTP clocks disabling, DMA channels and MAC Tx/Rx de-activation.
Note the STMMAC driver is having much more weak design patterns and style problems (like calculating the total number of queues every time it's needed, or antagonist/cleanup methods absence while having the reversal code added in the remove/cleanup paths), than what is fixed in the framework of this series, which make the code hard to read, comprehend, maintain and extend with new features. Most likely the situation turned to be like that due to a long history of the driver evolving to support many different IP-core versions and vendor-specific MAC extensions. Anyway it would have taken not a single patches series to fix all of the problems. Since it hasn't been my primary target, here in this series I've introduced the cleanups and fixes, which prepared the corresponding parts of the code for easier alterations in the framework of adding the DW MAC GPIOs and Baikal-T1 GMAC support into the driver.
The series is supposed to be applied on top of the last revision of the next patchset:
otherwise a few patches won't get merged in cleanly.
Serge Semin (20):
net: phy: realtek: Fix events detection failure in LPI mode
net: stmmac: Free Rx descs on Tx allocation failure
net: stmmac: Fix false MTL RX overflow handling for higher queues
net: stmmac: Assert reset control after MDIO de-registration
net: stmmac: Use dwmac410_disable_dma_irq for DW MAC v4.10 DMA
net: stmmac: Use LPI IRQ status-related macro in DW MAC1000 isr
net: stmmac: Clear descriptors before initializing them
net: stmmac: Fix typo in the XGMAC_L3_ADDR3 macro name
net: stmmac: Discard mii_irq array from private data
net: stmmac: Discard Rx copybreak ethtool setting
net: stmmac: Discard index usage in the dirty_rx init
net: stmmac: Discard dwmac1000_dma_ops declaration from dwmac100.h
net: stmmac: Move DMA Tx/Rx init methods to DW MAC lib
net: stmmac: Add DW GMAC disable LPI IRQ mask macro
net: stmmac: Discard STMMAC_RESETING flag
net: stmmac: Discard conditional service task execution
net: stmmac: Add 'cause' arg to the service task executioner
net: stmmac: Move PTP clock enabling to PTP-init method
net: stmmac: Move DMA stop procedure to HW-setup antagonist
net: stmmac: Move MAC Tx/Rx disabling to HW-setup antagonist
.../net/ethernet/stmicro/stmmac/dwmac1000.h | 2 +- .../ethernet/stmicro/stmmac/dwmac1000_core.c | 2 +- .../ethernet/stmicro/stmmac/dwmac1000_dma.c | 20 +---- .../ethernet/stmicro/stmmac/dwmac100_dma.c | 20 +---- .../net/ethernet/stmicro/stmmac/dwmac4_dma.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac_dma.h | 4 + .../net/ethernet/stmicro/stmmac/dwmac_lib.c | 14 ++++ .../net/ethernet/stmicro/stmmac/dwxgmac2.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 5 -- .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 39 --------- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 81 +++++++++---------- drivers/net/phy/realtek.c | 37 +++++++++ 12 files changed, 102 insertions(+), 126 deletions(-)
Signature · 7 lines
2.29.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel