* [PATCH net-next v1 0/7] net: stmmac: refactor FPE for gmac4 and xgmac
@ 2024-07-09 8:21 Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 1/7] net: stmmac: xgmac: drop incomplete FPE implementation Furong Xu
` (6 more replies)
0 siblings, 7 replies; 13+ messages in thread
From: Furong Xu @ 2024-07-09 8:21 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Alexandre Torgue, Jose Abreu,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Joao Pinto
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel, xfr, rock.xu,
Furong Xu
Refactor FPE implementation by moving common code for DWMAC4 and
DWXGMAC into a separate FPE module.
FPE implementation for DWMAC4 and DWXGMAC differs only for:
1) Offset address of MAC_FPE_CTRL_STS
2) FPRQ(Frame Preemption Residue Queue) field in MAC_RxQ_Ctrl1
Tested on DWMAC CORE 5.20a and DWXGMAC CORE 3.20a
Furong Xu (7):
net: stmmac: xgmac: drop incomplete FPE implementation
net: stmmac: gmac4: drop FPE implementation for refactoring
net: stmmac: refactor Frame Preemption(FPE) implementation
net: stmmac: gmac4: complete FPE support
net: stmmac: xgmac: rename XGMAC_RQ to XGMAC_FPRQ
net: stmmac: xgmac: complete FPE support
net: stmmac: xgmac: enable Frame Preemption Interrupt by default
drivers/net/ethernet/stmicro/stmmac/Makefile | 2 +-
drivers/net/ethernet/stmicro/stmmac/common.h | 1 +
.../net/ethernet/stmicro/stmmac/dwmac4_core.c | 6 -
drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 66 ---------
drivers/net/ethernet/stmicro/stmmac/dwmac5.h | 16 ---
.../net/ethernet/stmicro/stmmac/dwxgmac2.h | 9 +-
.../ethernet/stmicro/stmmac/dwxgmac2_core.c | 27 ----
drivers/net/ethernet/stmicro/stmmac/hwif.c | 7 +
drivers/net/ethernet/stmicro/stmmac/hwif.h | 30 ++--
.../net/ethernet/stmicro/stmmac/stmmac_fpe.c | 131 ++++++++++++++++++
.../net/ethernet/stmicro/stmmac/stmmac_fpe.h | 16 +++
11 files changed, 177 insertions(+), 134 deletions(-)
create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c
create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net-next v1 1/7] net: stmmac: xgmac: drop incomplete FPE implementation
2024-07-09 8:21 [PATCH net-next v1 0/7] net: stmmac: refactor FPE for gmac4 and xgmac Furong Xu
@ 2024-07-09 8:21 ` Furong Xu
2024-07-09 13:16 ` Andrew Lunn
2024-07-09 8:21 ` [PATCH net-next v1 2/7] net: stmmac: gmac4: drop FPE implementation for refactoring Furong Xu
` (5 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Furong Xu @ 2024-07-09 8:21 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Alexandre Torgue, Jose Abreu,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Joao Pinto
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel, xfr, rock.xu,
Furong Xu
The FPE support for xgmac is incomplete, drop it temporarily.
Once FPE implementation is refactored, xgmac support will be added.
Signed-off-by: Furong Xu <0x1207@gmail.com>
---
.../net/ethernet/stmicro/stmmac/dwxgmac2.h | 2 --
.../ethernet/stmicro/stmmac/dwxgmac2_core.c | 27 -------------------
2 files changed, 29 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
index 6a2c7d22df1e..917796293c26 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
@@ -193,8 +193,6 @@
#define XGMAC_MDIO_ADDR 0x00000200
#define XGMAC_MDIO_DATA 0x00000204
#define XGMAC_MDIO_C22P 0x00000220
-#define XGMAC_FPE_CTRL_STS 0x00000280
-#define XGMAC_EFPE BIT(0)
#define XGMAC_ADDRx_HIGH(x) (0x00000300 + (x) * 0x8)
#define XGMAC_ADDR_MAX 32
#define XGMAC_AE BIT(31)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
index 6a987cf598e4..e5bc3957041e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
@@ -1505,31 +1505,6 @@ static void dwxgmac2_set_arp_offload(struct mac_device_info *hw, bool en,
writel(value, ioaddr + XGMAC_RX_CONFIG);
}
-static void dwxgmac3_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
- u32 num_txq,
- u32 num_rxq, bool enable)
-{
- u32 value;
-
- if (!enable) {
- value = readl(ioaddr + XGMAC_FPE_CTRL_STS);
-
- value &= ~XGMAC_EFPE;
-
- writel(value, ioaddr + XGMAC_FPE_CTRL_STS);
- return;
- }
-
- value = readl(ioaddr + XGMAC_RXQ_CTRL1);
- value &= ~XGMAC_RQ;
- value |= (num_rxq - 1) << XGMAC_RQ_SHIFT;
- writel(value, ioaddr + XGMAC_RXQ_CTRL1);
-
- value = readl(ioaddr + XGMAC_FPE_CTRL_STS);
- value |= XGMAC_EFPE;
- writel(value, ioaddr + XGMAC_FPE_CTRL_STS);
-}
-
const struct stmmac_ops dwxgmac210_ops = {
.core_init = dwxgmac2_core_init,
.set_mac = dwxgmac2_set_mac,
@@ -1570,7 +1545,6 @@ const struct stmmac_ops dwxgmac210_ops = {
.config_l3_filter = dwxgmac2_config_l3_filter,
.config_l4_filter = dwxgmac2_config_l4_filter,
.set_arp_offload = dwxgmac2_set_arp_offload,
- .fpe_configure = dwxgmac3_fpe_configure,
};
static void dwxlgmac2_rx_queue_enable(struct mac_device_info *hw, u8 mode,
@@ -1627,7 +1601,6 @@ const struct stmmac_ops dwxlgmac2_ops = {
.config_l3_filter = dwxgmac2_config_l3_filter,
.config_l4_filter = dwxgmac2_config_l4_filter,
.set_arp_offload = dwxgmac2_set_arp_offload,
- .fpe_configure = dwxgmac3_fpe_configure,
};
int dwxgmac2_setup(struct stmmac_priv *priv)
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v1 2/7] net: stmmac: gmac4: drop FPE implementation for refactoring
2024-07-09 8:21 [PATCH net-next v1 0/7] net: stmmac: refactor FPE for gmac4 and xgmac Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 1/7] net: stmmac: xgmac: drop incomplete FPE implementation Furong Xu
@ 2024-07-09 8:21 ` Furong Xu
2024-07-09 13:24 ` Andrew Lunn
2024-07-09 8:21 ` [PATCH net-next v1 3/7] net: stmmac: refactor Frame Preemption(FPE) implementation Furong Xu
` (4 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Furong Xu @ 2024-07-09 8:21 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Alexandre Torgue, Jose Abreu,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Joao Pinto
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel, xfr, rock.xu,
Furong Xu
The FPE support for gmac4 is complete, still drop it temporarily.
Once FPE implementation is refactored, gmac4 support will be added.
Signed-off-by: Furong Xu <0x1207@gmail.com>
---
.../net/ethernet/stmicro/stmmac/dwmac4_core.c | 6 --
drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 66 -------------------
drivers/net/ethernet/stmicro/stmmac/dwmac5.h | 16 -----
3 files changed, 88 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index dbd9f93b2460..1505ac738b13 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -1265,9 +1265,6 @@ const struct stmmac_ops dwmac410_ops = {
.set_arp_offload = dwmac4_set_arp_offload,
.config_l3_filter = dwmac4_config_l3_filter,
.config_l4_filter = dwmac4_config_l4_filter,
- .fpe_configure = dwmac5_fpe_configure,
- .fpe_send_mpacket = dwmac5_fpe_send_mpacket,
- .fpe_irq_status = dwmac5_fpe_irq_status,
.add_hw_vlan_rx_fltr = dwmac4_add_hw_vlan_rx_fltr,
.del_hw_vlan_rx_fltr = dwmac4_del_hw_vlan_rx_fltr,
.restore_hw_vlan_rx_fltr = dwmac4_restore_hw_vlan_rx_fltr,
@@ -1317,9 +1314,6 @@ const struct stmmac_ops dwmac510_ops = {
.set_arp_offload = dwmac4_set_arp_offload,
.config_l3_filter = dwmac4_config_l3_filter,
.config_l4_filter = dwmac4_config_l4_filter,
- .fpe_configure = dwmac5_fpe_configure,
- .fpe_send_mpacket = dwmac5_fpe_send_mpacket,
- .fpe_irq_status = dwmac5_fpe_irq_status,
.add_hw_vlan_rx_fltr = dwmac4_add_hw_vlan_rx_fltr,
.del_hw_vlan_rx_fltr = dwmac4_del_hw_vlan_rx_fltr,
.restore_hw_vlan_rx_fltr = dwmac4_restore_hw_vlan_rx_fltr,
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c
index e02cebc3f1b7..1c431b918719 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c
@@ -572,69 +572,3 @@ int dwmac5_flex_pps_config(void __iomem *ioaddr, int index,
writel(val, ioaddr + MAC_PPS_CONTROL);
return 0;
}
-
-void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
- u32 num_txq, u32 num_rxq,
- bool enable)
-{
- u32 value;
-
- if (enable) {
- cfg->fpe_csr = EFPE;
- value = readl(ioaddr + GMAC_RXQ_CTRL1);
- value &= ~GMAC_RXQCTRL_FPRQ;
- value |= (num_rxq - 1) << GMAC_RXQCTRL_FPRQ_SHIFT;
- writel(value, ioaddr + GMAC_RXQ_CTRL1);
- } else {
- cfg->fpe_csr = 0;
- }
- writel(cfg->fpe_csr, ioaddr + MAC_FPE_CTRL_STS);
-}
-
-int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev)
-{
- u32 value;
- int status;
-
- status = FPE_EVENT_UNKNOWN;
-
- /* Reads from the MAC_FPE_CTRL_STS register should only be performed
- * here, since the status flags of MAC_FPE_CTRL_STS are "clear on read"
- */
- value = readl(ioaddr + MAC_FPE_CTRL_STS);
-
- if (value & TRSP) {
- status |= FPE_EVENT_TRSP;
- netdev_info(dev, "FPE: Respond mPacket is transmitted\n");
- }
-
- if (value & TVER) {
- status |= FPE_EVENT_TVER;
- netdev_info(dev, "FPE: Verify mPacket is transmitted\n");
- }
-
- if (value & RRSP) {
- status |= FPE_EVENT_RRSP;
- netdev_info(dev, "FPE: Respond mPacket is received\n");
- }
-
- if (value & RVER) {
- status |= FPE_EVENT_RVER;
- netdev_info(dev, "FPE: Verify mPacket is received\n");
- }
-
- return status;
-}
-
-void dwmac5_fpe_send_mpacket(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
- enum stmmac_mpacket_type type)
-{
- u32 value = cfg->fpe_csr;
-
- if (type == MPACKET_VERIFY)
- value |= SVER;
- else if (type == MPACKET_RESPONSE)
- value |= SRSP;
-
- writel(value, ioaddr + MAC_FPE_CTRL_STS);
-}
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.h b/drivers/net/ethernet/stmicro/stmmac/dwmac5.h
index bf33a51d229e..00b151b3b688 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.h
@@ -11,15 +11,6 @@
#define PRTYEN BIT(1)
#define TMOUTEN BIT(0)
-#define MAC_FPE_CTRL_STS 0x00000234
-#define TRSP BIT(19)
-#define TVER BIT(18)
-#define RRSP BIT(17)
-#define RVER BIT(16)
-#define SRSP BIT(2)
-#define SVER BIT(1)
-#define EFPE BIT(0)
-
#define MAC_PPS_CONTROL 0x00000b70
#define PPS_MAXIDX(x) ((((x) + 1) * 8) - 1)
#define PPS_MINIDX(x) ((x) * 8)
@@ -102,12 +93,5 @@ int dwmac5_rxp_config(void __iomem *ioaddr, struct stmmac_tc_entry *entries,
int dwmac5_flex_pps_config(void __iomem *ioaddr, int index,
struct stmmac_pps_cfg *cfg, bool enable,
u32 sub_second_inc, u32 systime_flags);
-void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
- u32 num_txq, u32 num_rxq,
- bool enable);
-void dwmac5_fpe_send_mpacket(void __iomem *ioaddr,
- struct stmmac_fpe_cfg *cfg,
- enum stmmac_mpacket_type type);
-int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev);
#endif /* __DWMAC5_H__ */
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v1 3/7] net: stmmac: refactor Frame Preemption(FPE) implementation
2024-07-09 8:21 [PATCH net-next v1 0/7] net: stmmac: refactor FPE for gmac4 and xgmac Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 1/7] net: stmmac: xgmac: drop incomplete FPE implementation Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 2/7] net: stmmac: gmac4: drop FPE implementation for refactoring Furong Xu
@ 2024-07-09 8:21 ` Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 4/7] net: stmmac: gmac4: complete FPE support Furong Xu
` (3 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Furong Xu @ 2024-07-09 8:21 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Alexandre Torgue, Jose Abreu,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Joao Pinto
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel, xfr, rock.xu,
Furong Xu
Refactor FPE implementation into a separate FPE module.
Interfaces only, implementations for gmac4 and xgmac will follow.
Signed-off-by: Furong Xu <0x1207@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/Makefile | 2 +-
drivers/net/ethernet/stmicro/stmmac/common.h | 1 +
drivers/net/ethernet/stmicro/stmmac/hwif.c | 3 ++
drivers/net/ethernet/stmicro/stmmac/hwif.h | 28 ++++++++++---------
.../net/ethernet/stmicro/stmmac/stmmac_fpe.c | 9 ++++++
.../net/ethernet/stmicro/stmmac/stmmac_fpe.h | 13 +++++++++
6 files changed, 42 insertions(+), 14 deletions(-)
create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c
create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index c2f0e91f6bf8..7e46dca90628 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -6,7 +6,7 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \
mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o dwmac4_descs.o \
dwmac4_dma.o dwmac4_lib.o dwmac4_core.o dwmac5.o hwif.o \
stmmac_tc.o dwxgmac2_core.o dwxgmac2_dma.o dwxgmac2_descs.o \
- stmmac_xdp.o stmmac_est.o \
+ stmmac_xdp.o stmmac_est.o stmmac_fpe.o \
$(stmmac-y)
stmmac-$(CONFIG_STMMAC_SELFTESTS) += stmmac_selftests.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index cd36ff4da68c..73c145dda11a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -591,6 +591,7 @@ struct mac_device_info {
const struct stmmac_tc_ops *tc;
const struct stmmac_mmc_ops *mmc;
const struct stmmac_est_ops *est;
+ const struct stmmac_fpe_ops *fpe;
struct dw_xpcs *xpcs;
struct phylink_pcs *phylink_pcs;
struct mii_regs mii; /* MII register Addresses */
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c
index 29367105df54..fc9f58f44180 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.c
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c
@@ -8,6 +8,7 @@
#include "stmmac.h"
#include "stmmac_ptp.h"
#include "stmmac_est.h"
+#include "stmmac_fpe.h"
static u32 stmmac_get_id(struct stmmac_priv *priv, u32 id_reg)
{
@@ -116,6 +117,7 @@ static const struct stmmac_hwif_entry {
const void *tc;
const void *mmc;
const void *est;
+ const void *fpe;
int (*setup)(struct stmmac_priv *priv);
int (*quirks)(struct stmmac_priv *priv);
} stmmac_hw[] = {
@@ -351,6 +353,7 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
mac->tc = mac->tc ? : entry->tc;
mac->mmc = mac->mmc ? : entry->mmc;
mac->est = mac->est ? : entry->est;
+ mac->fpe = mac->fpe ? : entry->fpe;
priv->hw = mac;
priv->ptpaddr = priv->ioaddr + entry->regs.ptp_off;
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h
index 97934ccba5b1..bd360f3ea784 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
@@ -418,13 +418,6 @@ struct stmmac_ops {
bool en, bool udp, bool sa, bool inv,
u32 match);
void (*set_arp_offload)(struct mac_device_info *hw, bool en, u32 addr);
- void (*fpe_configure)(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
- u32 num_txq, u32 num_rxq,
- bool enable);
- void (*fpe_send_mpacket)(void __iomem *ioaddr,
- struct stmmac_fpe_cfg *cfg,
- enum stmmac_mpacket_type type);
- int (*fpe_irq_status)(void __iomem *ioaddr, struct net_device *dev);
};
#define stmmac_core_init(__priv, __args...) \
@@ -523,12 +516,6 @@ struct stmmac_ops {
stmmac_do_callback(__priv, mac, config_l4_filter, __args)
#define stmmac_set_arp_offload(__priv, __args...) \
stmmac_do_void_callback(__priv, mac, set_arp_offload, __args)
-#define stmmac_fpe_configure(__priv, __args...) \
- stmmac_do_void_callback(__priv, mac, fpe_configure, __args)
-#define stmmac_fpe_send_mpacket(__priv, __args...) \
- stmmac_do_void_callback(__priv, mac, fpe_send_mpacket, __args)
-#define stmmac_fpe_irq_status(__priv, __args...) \
- stmmac_do_callback(__priv, mac, fpe_irq_status, __args)
/* PTP and HW Timer helpers */
struct stmmac_hwtimestamp {
@@ -660,6 +647,21 @@ struct stmmac_est_ops {
#define stmmac_est_irq_status(__priv, __args...) \
stmmac_do_void_callback(__priv, est, irq_status, __args)
+struct stmmac_fpe_ops {
+ void (*configure)(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
+ u32 num_txq, u32 num_rxq, bool enable);
+ int (*irq_status)(void __iomem *ioaddr, struct net_device *dev);
+ void (*send_mpacket)(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
+ enum stmmac_mpacket_type type);
+};
+
+#define stmmac_fpe_configure(__priv, __args...) \
+ stmmac_do_void_callback(__priv, fpe, configure, __args)
+#define stmmac_fpe_irq_status(__priv, __args...) \
+ stmmac_do_callback(__priv, fpe, irq_status, __args)
+#define stmmac_fpe_send_mpacket(__priv, __args...) \
+ stmmac_do_void_callback(__priv, fpe, send_mpacket, __args)
+
struct stmmac_regs_off {
u32 ptp_off;
u32 mmc_off;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c
new file mode 100644
index 000000000000..f6701ba93805
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2024 Furong Xu <0x1207@gmail.com>
+ * stmmac FPE(802.3 Qbu) handling
+ */
+
+#include "stmmac.h"
+#include "stmmac_fpe.h"
+
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h
new file mode 100644
index 000000000000..84e3ceb9bdda
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2024 Furong Xu <0x1207@gmail.com>
+ * stmmac FPE(802.3 Qbu) handling
+ */
+
+#define FPE_CTRL_STS_TRSP BIT(19)
+#define FPE_CTRL_STS_TVER BIT(18)
+#define FPE_CTRL_STS_RRSP BIT(17)
+#define FPE_CTRL_STS_RVER BIT(16)
+#define FPE_CTRL_STS_SRSP BIT(2)
+#define FPE_CTRL_STS_SVER BIT(1)
+#define FPE_CTRL_STS_EFPE BIT(0)
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v1 4/7] net: stmmac: gmac4: complete FPE support
2024-07-09 8:21 [PATCH net-next v1 0/7] net: stmmac: refactor FPE for gmac4 and xgmac Furong Xu
` (2 preceding siblings ...)
2024-07-09 8:21 ` [PATCH net-next v1 3/7] net: stmmac: refactor Frame Preemption(FPE) implementation Furong Xu
@ 2024-07-09 8:21 ` Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 5/7] net: stmmac: xgmac: rename XGMAC_RQ to XGMAC_FPRQ Furong Xu
` (2 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Furong Xu @ 2024-07-09 8:21 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Alexandre Torgue, Jose Abreu,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Joao Pinto
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel, xfr, rock.xu,
Furong Xu
Introduce dwmac4_fpe_ops to complete the FPE implementation for DWMAC4
Signed-off-by: Furong Xu <0x1207@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/hwif.c | 2 +
drivers/net/ethernet/stmicro/stmmac/hwif.h | 1 +
.../net/ethernet/stmicro/stmmac/stmmac_fpe.c | 85 +++++++++++++++++++
.../net/ethernet/stmicro/stmmac/stmmac_fpe.h | 2 +
4 files changed, 90 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c
index fc9f58f44180..655012ffbc0a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.c
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c
@@ -216,6 +216,7 @@ static const struct stmmac_hwif_entry {
.tc = &dwmac510_tc_ops,
.mmc = &dwmac_mmc_ops,
.est = &dwmac510_est_ops,
+ .fpe = &dwmac4_fpe_ops,
.setup = dwmac4_setup,
.quirks = NULL,
}, {
@@ -236,6 +237,7 @@ static const struct stmmac_hwif_entry {
.tc = &dwmac510_tc_ops,
.mmc = &dwmac_mmc_ops,
.est = &dwmac510_est_ops,
+ .fpe = &dwmac4_fpe_ops,
.setup = dwmac4_setup,
.quirks = NULL,
}, {
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h
index bd360f3ea784..7b19614c611d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
@@ -685,6 +685,7 @@ extern const struct stmmac_desc_ops dwxgmac210_desc_ops;
extern const struct stmmac_mmc_ops dwmac_mmc_ops;
extern const struct stmmac_mmc_ops dwxgmac_mmc_ops;
extern const struct stmmac_est_ops dwmac510_est_ops;
+extern const struct stmmac_fpe_ops dwmac4_fpe_ops;
#define GMAC_VERSION 0x00000020 /* GMAC CORE Version */
#define GMAC4_VERSION 0x00000110 /* GMAC4+ CORE Version */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c
index f6701ba93805..97e404fac56a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c
@@ -6,4 +6,89 @@
#include "stmmac.h"
#include "stmmac_fpe.h"
+#include "dwmac4.h"
+static int __fpe_irq_status(void __iomem *ioaddr, struct net_device *dev)
+{
+ u32 value;
+ int status;
+
+ status = FPE_EVENT_UNKNOWN;
+
+ /* Reads from the MAC_FPE_CTRL_STS register should only be performed
+ * here, since the status flags of MAC_FPE_CTRL_STS are "clear on read"
+ */
+ value = readl(ioaddr);
+
+ if (value & FPE_CTRL_STS_TRSP) {
+ status |= FPE_EVENT_TRSP;
+ netdev_info(dev, "FPE: Respond mPacket is transmitted\n");
+ }
+
+ if (value & FPE_CTRL_STS_TVER) {
+ status |= FPE_EVENT_TVER;
+ netdev_info(dev, "FPE: Verify mPacket is transmitted\n");
+ }
+
+ if (value & FPE_CTRL_STS_RRSP) {
+ status |= FPE_EVENT_RRSP;
+ netdev_info(dev, "FPE: Respond mPacket is received\n");
+ }
+
+ if (value & FPE_CTRL_STS_RVER) {
+ status |= FPE_EVENT_RVER;
+ netdev_info(dev, "FPE: Verify mPacket is received\n");
+ }
+
+ return status;
+}
+
+static void __fpe_send_mpacket(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
+ enum stmmac_mpacket_type type)
+{
+ u32 value = cfg->fpe_csr;
+
+ if (type == MPACKET_VERIFY)
+ value |= FPE_CTRL_STS_SVER;
+ else if (type == MPACKET_RESPONSE)
+ value |= FPE_CTRL_STS_SRSP;
+
+ writel(value, ioaddr);
+}
+
+static void dwmac4_fpe_configure(void __iomem *ioaddr,
+ struct stmmac_fpe_cfg *cfg,
+ u32 num_txq, u32 num_rxq, bool enable)
+{
+ u32 value;
+
+ if (enable) {
+ cfg->fpe_csr = FPE_CTRL_STS_EFPE;
+ value = readl(ioaddr + GMAC_RXQ_CTRL1);
+ value &= ~GMAC_RXQCTRL_FPRQ;
+ value |= (num_rxq - 1) << GMAC_RXQCTRL_FPRQ_SHIFT;
+ writel(value, ioaddr + GMAC_RXQ_CTRL1);
+ } else {
+ cfg->fpe_csr = 0;
+ }
+
+ writel(cfg->fpe_csr, ioaddr + FPE_CTRL_STS_GMAC4_OFFSET);
+}
+
+static int dwmac4_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev)
+{
+ return __fpe_irq_status(ioaddr + FPE_CTRL_STS_GMAC4_OFFSET, dev);
+}
+
+static void dwmac4_fpe_send_mpacket(void __iomem *ioaddr,
+ struct stmmac_fpe_cfg *cfg,
+ enum stmmac_mpacket_type type)
+{
+ __fpe_send_mpacket(ioaddr + FPE_CTRL_STS_GMAC4_OFFSET, cfg, type);
+}
+
+const struct stmmac_fpe_ops dwmac4_fpe_ops = {
+ .configure = dwmac4_fpe_configure,
+ .irq_status = dwmac4_fpe_irq_status,
+ .send_mpacket = dwmac4_fpe_send_mpacket,
+};
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h
index 84e3ceb9bdda..efdb5536e856 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h
@@ -4,6 +4,8 @@
* stmmac FPE(802.3 Qbu) handling
*/
+#define FPE_CTRL_STS_GMAC4_OFFSET 0x00000234
+
#define FPE_CTRL_STS_TRSP BIT(19)
#define FPE_CTRL_STS_TVER BIT(18)
#define FPE_CTRL_STS_RRSP BIT(17)
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v1 5/7] net: stmmac: xgmac: rename XGMAC_RQ to XGMAC_FPRQ
2024-07-09 8:21 [PATCH net-next v1 0/7] net: stmmac: refactor FPE for gmac4 and xgmac Furong Xu
` (3 preceding siblings ...)
2024-07-09 8:21 ` [PATCH net-next v1 4/7] net: stmmac: gmac4: complete FPE support Furong Xu
@ 2024-07-09 8:21 ` Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 6/7] net: stmmac: xgmac: complete FPE support Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 7/7] net: stmmac: xgmac: enable Frame Preemption Interrupt by default Furong Xu
6 siblings, 0 replies; 13+ messages in thread
From: Furong Xu @ 2024-07-09 8:21 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Alexandre Torgue, Jose Abreu,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Joao Pinto
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel, xfr, rock.xu,
Furong Xu
Synopsys XGMAC Databook defines MAC_RxQ_Ctrl1 register:
RQ: Frame Preemption Residue Queue
XGMAC_FPRQ is more readable and more consistent with GMAC4.
Signed-off-by: Furong Xu <0x1207@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
index 917796293c26..c66fa6040672 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
@@ -84,8 +84,8 @@
#define XGMAC_MCBCQEN BIT(15)
#define XGMAC_MCBCQ GENMASK(11, 8)
#define XGMAC_MCBCQ_SHIFT 8
-#define XGMAC_RQ GENMASK(7, 4)
-#define XGMAC_RQ_SHIFT 4
+#define XGMAC_FPRQ GENMASK(7, 4)
+#define XGMAC_FPRQ_SHIFT 4
#define XGMAC_UPQ GENMASK(3, 0)
#define XGMAC_UPQ_SHIFT 0
#define XGMAC_RXQ_CTRL2 0x000000a8
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v1 6/7] net: stmmac: xgmac: complete FPE support
2024-07-09 8:21 [PATCH net-next v1 0/7] net: stmmac: refactor FPE for gmac4 and xgmac Furong Xu
` (4 preceding siblings ...)
2024-07-09 8:21 ` [PATCH net-next v1 5/7] net: stmmac: xgmac: rename XGMAC_RQ to XGMAC_FPRQ Furong Xu
@ 2024-07-09 8:21 ` Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 7/7] net: stmmac: xgmac: enable Frame Preemption Interrupt by default Furong Xu
6 siblings, 0 replies; 13+ messages in thread
From: Furong Xu @ 2024-07-09 8:21 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Alexandre Torgue, Jose Abreu,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Joao Pinto
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel, xfr, rock.xu,
Furong Xu
FPE implementation for DWMAC4 and DWXGMAC differs only for:
1) Offset address of MAC_FPE_CTRL_STS
2) FPRQ(Frame Preemption Residue Queue) field in MAC_RxQ_Ctrl1
Introduce dwxgmac_fpe_ops to complete the FPE implementation for DWXGMAC.
Signed-off-by: Furong Xu <0x1207@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/hwif.c | 2 +
drivers/net/ethernet/stmicro/stmmac/hwif.h | 1 +
.../net/ethernet/stmicro/stmmac/stmmac_fpe.c | 37 +++++++++++++++++++
.../net/ethernet/stmicro/stmmac/stmmac_fpe.h | 1 +
4 files changed, 41 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c
index 655012ffbc0a..f13ed91b498f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.c
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c
@@ -259,6 +259,7 @@ static const struct stmmac_hwif_entry {
.tc = &dwmac510_tc_ops,
.mmc = &dwxgmac_mmc_ops,
.est = &dwmac510_est_ops,
+ .fpe = &dwxgmac_fpe_ops,
.setup = dwxgmac2_setup,
.quirks = NULL,
}, {
@@ -280,6 +281,7 @@ static const struct stmmac_hwif_entry {
.tc = &dwmac510_tc_ops,
.mmc = &dwxgmac_mmc_ops,
.est = &dwmac510_est_ops,
+ .fpe = &dwxgmac_fpe_ops,
.setup = dwxlgmac2_setup,
.quirks = stmmac_dwxlgmac_quirks,
},
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h
index 7b19614c611d..81ce8ede2641 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
@@ -686,6 +686,7 @@ extern const struct stmmac_mmc_ops dwmac_mmc_ops;
extern const struct stmmac_mmc_ops dwxgmac_mmc_ops;
extern const struct stmmac_est_ops dwmac510_est_ops;
extern const struct stmmac_fpe_ops dwmac4_fpe_ops;
+extern const struct stmmac_fpe_ops dwxgmac_fpe_ops;
#define GMAC_VERSION 0x00000020 /* GMAC CORE Version */
#define GMAC4_VERSION 0x00000110 /* GMAC4+ CORE Version */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c
index 97e404fac56a..c6894d5263c9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c
@@ -7,6 +7,7 @@
#include "stmmac.h"
#include "stmmac_fpe.h"
#include "dwmac4.h"
+#include "dwxgmac2.h"
static int __fpe_irq_status(void __iomem *ioaddr, struct net_device *dev)
{
@@ -92,3 +93,39 @@ const struct stmmac_fpe_ops dwmac4_fpe_ops = {
.irq_status = dwmac4_fpe_irq_status,
.send_mpacket = dwmac4_fpe_send_mpacket,
};
+
+static void dwxgmac_fpe_configure(void __iomem *ioaddr,
+ struct stmmac_fpe_cfg *cfg,
+ u32 num_txq, u32 num_rxq, bool enable)
+{
+ u32 value;
+
+ if (enable) {
+ cfg->fpe_csr = FPE_CTRL_STS_EFPE;
+ value = readl(ioaddr + XGMAC_RXQ_CTRL1);
+ value &= ~XGMAC_FPRQ;
+ value |= (num_rxq - 1) << XGMAC_FPRQ_SHIFT;
+ writel(value, ioaddr + XGMAC_RXQ_CTRL1);
+ } else {
+ cfg->fpe_csr = 0;
+ }
+
+ writel(cfg->fpe_csr, ioaddr + FPE_CTRL_STS_XGMAC_OFFSET);
+}
+
+static int dwxgmac_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev)
+{
+ return __fpe_irq_status(ioaddr + FPE_CTRL_STS_XGMAC_OFFSET, dev);
+}
+
+static void dwxgmac_fpe_send_mpacket(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
+ enum stmmac_mpacket_type type)
+{
+ __fpe_send_mpacket(ioaddr + FPE_CTRL_STS_XGMAC_OFFSET, cfg, type);
+}
+
+const struct stmmac_fpe_ops dwxgmac_fpe_ops = {
+ .configure = dwxgmac_fpe_configure,
+ .irq_status = dwxgmac_fpe_irq_status,
+ .send_mpacket = dwxgmac_fpe_send_mpacket,
+};
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h
index efdb5536e856..b74cf8f2c2f2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h
@@ -5,6 +5,7 @@
*/
#define FPE_CTRL_STS_GMAC4_OFFSET 0x00000234
+#define FPE_CTRL_STS_XGMAC_OFFSET 0x00000280
#define FPE_CTRL_STS_TRSP BIT(19)
#define FPE_CTRL_STS_TVER BIT(18)
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v1 7/7] net: stmmac: xgmac: enable Frame Preemption Interrupt by default
2024-07-09 8:21 [PATCH net-next v1 0/7] net: stmmac: refactor FPE for gmac4 and xgmac Furong Xu
` (5 preceding siblings ...)
2024-07-09 8:21 ` [PATCH net-next v1 6/7] net: stmmac: xgmac: complete FPE support Furong Xu
@ 2024-07-09 8:21 ` Furong Xu
2024-07-09 13:31 ` Andrew Lunn
6 siblings, 1 reply; 13+ messages in thread
From: Furong Xu @ 2024-07-09 8:21 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Alexandre Torgue, Jose Abreu,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Joao Pinto
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel, xfr, rock.xu,
Furong Xu
Frame Preemption Interrupt is required to finish FPE handshake.
XGMAC_FPEIE is read-only reserved if FPE is not supported by HW.
There is no harm that we always set XGMAC_FPEIE bit.
Signed-off-by: Furong Xu <0x1207@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
index c66fa6040672..f359d70beb83 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
@@ -96,10 +96,11 @@
#define XGMAC_LPIIS BIT(5)
#define XGMAC_PMTIS BIT(4)
#define XGMAC_INT_EN 0x000000b4
+#define XGMAC_FPEIE BIT(15)
#define XGMAC_TSIE BIT(12)
#define XGMAC_LPIIE BIT(5)
#define XGMAC_PMTIE BIT(4)
-#define XGMAC_INT_DEFAULT_EN (XGMAC_LPIIE | XGMAC_PMTIE)
+#define XGMAC_INT_DEFAULT_EN (XGMAC_FPEIE | XGMAC_LPIIE | XGMAC_PMTIE)
#define XGMAC_Qx_TX_FLOW_CTRL(x) (0x00000070 + (x) * 4)
#define XGMAC_PT GENMASK(31, 16)
#define XGMAC_PT_SHIFT 16
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH net-next v1 1/7] net: stmmac: xgmac: drop incomplete FPE implementation
2024-07-09 8:21 ` [PATCH net-next v1 1/7] net: stmmac: xgmac: drop incomplete FPE implementation Furong Xu
@ 2024-07-09 13:16 ` Andrew Lunn
2024-07-09 17:10 ` Vladimir Oltean
0 siblings, 1 reply; 13+ messages in thread
From: Andrew Lunn @ 2024-07-09 13:16 UTC (permalink / raw)
To: Furong Xu
Cc: David S. Miller, Alexandre Torgue, Jose Abreu, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Joao Pinto, netdev,
linux-stm32, linux-arm-kernel, linux-kernel, xfr, rock.xu
On Tue, Jul 09, 2024 at 04:21:19PM +0800, Furong Xu wrote:
> The FPE support for xgmac is incomplete, drop it temporarily.
> Once FPE implementation is refactored, xgmac support will be added.
This is a pretty unusual thing to do. What does the current
implementation do? Is there enough for it to actually work? If i was
doing a git bisect and landed on this patch, could i find my
networking is broken?
More normal is to build a new implementation by the side, and then
swap to it.
Andrew
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net-next v1 2/7] net: stmmac: gmac4: drop FPE implementation for refactoring
2024-07-09 8:21 ` [PATCH net-next v1 2/7] net: stmmac: gmac4: drop FPE implementation for refactoring Furong Xu
@ 2024-07-09 13:24 ` Andrew Lunn
0 siblings, 0 replies; 13+ messages in thread
From: Andrew Lunn @ 2024-07-09 13:24 UTC (permalink / raw)
To: Furong Xu
Cc: David S. Miller, Alexandre Torgue, Jose Abreu, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Joao Pinto, netdev,
linux-stm32, linux-arm-kernel, linux-kernel, xfr, rock.xu
On Tue, Jul 09, 2024 at 04:21:20PM +0800, Furong Xu wrote:
> The FPE support for gmac4 is complete, still drop it temporarily.
> Once FPE implementation is refactored, gmac4 support will be added.
So you say this implementation does work. So sorry, no.
NACK.
What we want is lots of small patches which are obviously correct. If
this code is correct, you could simply move it to a shared
location. Code which disappears from one file and reappears in another
file, no other changes, is obviously correct. You can make this clear
in the commit message: Moving code into a shared location. No
functional changes intended.
Once moved, you can then do refactoring changes, which when combined
with a good commit message should be obviously correct.
In linux, you do not throw code away and replace it with a new
implementation. You step by step transform it.
Andrew
---
pw-bot: cr
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net-next v1 7/7] net: stmmac: xgmac: enable Frame Preemption Interrupt by default
2024-07-09 8:21 ` [PATCH net-next v1 7/7] net: stmmac: xgmac: enable Frame Preemption Interrupt by default Furong Xu
@ 2024-07-09 13:31 ` Andrew Lunn
0 siblings, 0 replies; 13+ messages in thread
From: Andrew Lunn @ 2024-07-09 13:31 UTC (permalink / raw)
To: Furong Xu
Cc: David S. Miller, Alexandre Torgue, Jose Abreu, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Joao Pinto, netdev,
linux-stm32, linux-arm-kernel, linux-kernel, xfr, rock.xu
On Tue, Jul 09, 2024 at 04:21:25PM +0800, Furong Xu wrote:
> Frame Preemption Interrupt is required to finish FPE handshake.
>
> XGMAC_FPEIE is read-only reserved if FPE is not supported by HW.
> There is no harm that we always set XGMAC_FPEIE bit.
This is better, it explains what is going on, why the change is being
made. But when i see this, i think about the interrupt handler. You
don't just enable a new interrupt, you also need to handle the
interrupt. Where is that handler code?
The commit message is the place you try to answer the questions
reviewers are going to ask. So if the interrupt handler already looks
for this interrupt cause and handles it, add a statement to the commit
message explaining it.
Andrew
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net-next v1 1/7] net: stmmac: xgmac: drop incomplete FPE implementation
2024-07-09 13:16 ` Andrew Lunn
@ 2024-07-09 17:10 ` Vladimir Oltean
2024-07-10 7:57 ` Furong Xu
0 siblings, 1 reply; 13+ messages in thread
From: Vladimir Oltean @ 2024-07-09 17:10 UTC (permalink / raw)
To: Andrew Lunn, Furong Xu
Cc: Jianheng Zhang, David S. Miller, Alexandre Torgue, Jose Abreu,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Joao Pinto, netdev, linux-stm32, linux-arm-kernel, linux-kernel,
xfr, rock.xu
Hi Andrew, Furong,
On Tue, Jul 09, 2024 at 03:16:35PM +0200, Andrew Lunn wrote:
> On Tue, Jul 09, 2024 at 04:21:19PM +0800, Furong Xu wrote:
> > The FPE support for xgmac is incomplete, drop it temporarily.
> > Once FPE implementation is refactored, xgmac support will be added.
>
> This is a pretty unusual thing to do. What does the current
> implementation do? Is there enough for it to actually work? If i was
> doing a git bisect and landed on this patch, could i find my
> networking is broken?
>
> More normal is to build a new implementation by the side, and then
> swap to it.
>
> Andrew
>
There were 2 earlier attempts from Jianheng Zhang @ Synopsys to add FPE
support to new hardware.
I told him that the #1 priority should be to move the stmmac driver over
to the new standard API which uses ethtool + tc.
https://lore.kernel.org/netdev/CY5PR12MB63726FED738099761A9B81E7BF8FA@CY5PR12MB6372.namprd12.prod.outlook.com/
https://lore.kernel.org/netdev/CY5PR12MB63727C24923AE855CFF0D425BF8EA@CY5PR12MB6372.namprd12.prod.outlook.com/
I'm not sure what happened in the meantime. Jianheng must have faced
some issue, because he never came back.
I did comment this at the time:
| Even this very patch is slightly strange - it is not brand new hardware
| support, but it fills in some more FPE ops in dwxlgmac2_ops - when
| dwxgmac3_fpe_configure() was already there. So this suggests the
| existing support was incomplete. How complete is it now? No way to tell.
| There is a selftest to tell, but we can't run it because the driver
| doesn't integrate with those kernel APIs.
So it is relatively known that the support is incomplete. But I still
think we should push for more reviewer insight into this driver by
having access to a selftest to get a clearer picture of how it behaves.
For that, we need the compliance to the common API.
Otherwise, I completely agree to the idea that any development should be
done incrementally on top of whatever already exists, instead of putting
a curtain on and then taking it back off.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net-next v1 1/7] net: stmmac: xgmac: drop incomplete FPE implementation
2024-07-09 17:10 ` Vladimir Oltean
@ 2024-07-10 7:57 ` Furong Xu
0 siblings, 0 replies; 13+ messages in thread
From: Furong Xu @ 2024-07-10 7:57 UTC (permalink / raw)
To: Vladimir Oltean
Cc: Andrew Lunn, Jianheng Zhang, David S. Miller, Alexandre Torgue,
Jose Abreu, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Joao Pinto, netdev, linux-stm32,
linux-arm-kernel, linux-kernel, xfr, rock.xu
Hi Vladimir
On Tue, 9 Jul 2024 20:10:18 +0300, Vladimir Oltean <olteanv@gmail.com> wrote:
> Hi Andrew, Furong,
>
> On Tue, Jul 09, 2024 at 03:16:35PM +0200, Andrew Lunn wrote:
> > On Tue, Jul 09, 2024 at 04:21:19PM +0800, Furong Xu wrote:
> > > The FPE support for xgmac is incomplete, drop it temporarily.
> > > Once FPE implementation is refactored, xgmac support will be added.
> >
> > This is a pretty unusual thing to do. What does the current
> > implementation do? Is there enough for it to actually work? If i was
> > doing a git bisect and landed on this patch, could i find my
> > networking is broken?
> >
> > More normal is to build a new implementation by the side, and then
> > swap to it.
> >
> > Andrew
> >
>
> There were 2 earlier attempts from Jianheng Zhang @ Synopsys to add FPE
> support to new hardware.
>
> I told him that the #1 priority should be to move the stmmac driver over
> to the new standard API which uses ethtool + tc.
> https://lore.kernel.org/netdev/CY5PR12MB63726FED738099761A9B81E7BF8FA@CY5PR12MB6372.namprd12.prod.outlook.com/
> https://lore.kernel.org/netdev/CY5PR12MB63727C24923AE855CFF0D425BF8EA@CY5PR12MB6372.namprd12.prod.outlook.com/
>
> I'm not sure what happened in the meantime. Jianheng must have faced
> some issue, because he never came back.
>
> I did comment this at the time:
>
> | Even this very patch is slightly strange - it is not brand new hardware
> | support, but it fills in some more FPE ops in dwxlgmac2_ops - when
> | dwxgmac3_fpe_configure() was already there. So this suggests the
> | existing support was incomplete. How complete is it now? No way to tell.
> | There is a selftest to tell, but we can't run it because the driver
> | doesn't integrate with those kernel APIs.
>
> So it is relatively known that the support is incomplete. But I still
> think we should push for more reviewer insight into this driver by
> having access to a selftest to get a clearer picture of how it behaves.
> For that, we need the compliance to the common API.
>
After some searching and learning about your commits for FPE using the
generic framework, I think it is clear enough to me to implement the new
standard driver interface which uses ethtool + tc, and then the refactor
of low level FPE function can follow.
Thanks.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2024-07-10 7:57 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-09 8:21 [PATCH net-next v1 0/7] net: stmmac: refactor FPE for gmac4 and xgmac Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 1/7] net: stmmac: xgmac: drop incomplete FPE implementation Furong Xu
2024-07-09 13:16 ` Andrew Lunn
2024-07-09 17:10 ` Vladimir Oltean
2024-07-10 7:57 ` Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 2/7] net: stmmac: gmac4: drop FPE implementation for refactoring Furong Xu
2024-07-09 13:24 ` Andrew Lunn
2024-07-09 8:21 ` [PATCH net-next v1 3/7] net: stmmac: refactor Frame Preemption(FPE) implementation Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 4/7] net: stmmac: gmac4: complete FPE support Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 5/7] net: stmmac: xgmac: rename XGMAC_RQ to XGMAC_FPRQ Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 6/7] net: stmmac: xgmac: complete FPE support Furong Xu
2024-07-09 8:21 ` [PATCH net-next v1 7/7] net: stmmac: xgmac: enable Frame Preemption Interrupt by default Furong Xu
2024-07-09 13:31 ` Andrew Lunn
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).