net: stmmac: enhance XDP ZC driver level switching performance
Subsystems (6)
PATCH 1/1 net: stmmac: enhance XDP ZC driver level switching performance
The previous stmmac_xdp_set_prog() implementation uses stmmac_release() and stmmac_open() which tear down the PHY device and causes undesirable autonegotiation which causes a delay whenever AFXDP ZC is setup.
This patch introduces two new functions that just sufficiently tear down DMA descriptors, buffer, NAPI process, and IRQs and reestablish them accordingly in both stmmac_xdp_release() and stammac_xdp_open().
As the results of this enhancement, we get rid of transient state introduced by the link auto-negotiation:
$ ./xdpsock -i eth0 -t -z
sock0@eth0:0 txonly xdp-drv
pps pkts 1.00 rx 0 0 tx 634444 634560
sock0@eth0:0 txonly xdp-drv
pps pkts 1.00 rx 0 0 tx 632330 1267072
sock0@eth0:0 txonly xdp-drv
pps pkts 1.00 rx 0 0 tx 632438 1899584
sock0@eth0:0 txonly xdp-drv
pps pkts 1.00 rx 0 0 tx 632502 2532160
--- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 4 +- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 137 +++++++++++++++++- .../net/ethernet/stmicro/stmmac/stmmac_xdp.c | 4 +- 3 files changed, 139 insertions(+), 6 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac.h +2 -2
@@ -316,8 +316,8 @@ void stmmac_set_ethtool_ops(struct net_device *netdev);void stmmac_ptp_register (struct stmmac_priv *priv);void stmmac_ptp_unregister (struct stmmac_priv *priv); -int stmmac_open (struct net_device *dev); -int stmmac_release (struct net_device *dev); +int stmmac_xdp_open (struct net_device *dev); +void stmmac_xdp_release (struct net_device *dev);int stmmac_resume (struct device *dev);int stmmac_suspend (struct device *dev);int stmmac_dvr_remove (struct device *dev);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +135 -2
155 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c +2 -2
@@ -119,7 +119,7 @@ int stmmac_xdp_set_prog(struct stmmac_priv *priv, struct bpf_prog *prog, need_update = !!priv->xdp_prog != !!prog;if (if_running && need_update) -stmmac_release (dev); +stmmac_xdp_release (dev); old_prog =xchg (&priv->xdp_prog, prog);if (old_prog)
@@ -129,7 +129,7 @@ int stmmac_xdp_set_prog(struct stmmac_priv *priv, struct bpf_prog *prog, priv->sph = priv->sph_cap && !stmmac_xdp_is_enabled (priv);if (if_running && need_update) -stmmac_open (dev); +stmmac_xdp_open (dev);return 0 ; }
Signature · 1 line
2.25.1
Quoted 28 lines · Ong Boon Leong
The previous
stmmac_xdp_set_prog()implementation usesstmmac_release()andstmmac_open()which tear down the PHY device and causes undesirable autonegotiation which causes a delay whenever AFXDP ZC is setup.This patch introduces two new functions that just sufficiently tear down DMA descriptors, buffer, NAPI process, and IRQs and reestablish them accordingly in both
stmmac_xdp_release()andstammac_xdp_open().As the results of this enhancement, we get rid of transient state introduced by the link auto-negotiation:
$ ./xdpsock -i eth0 -t -zsock0@eth0:0 txonly xdp-drv
pps pkts 1.00 rx 0 0 tx 634444 634560sock0@eth0:0 txonly xdp-drv
pps pkts 1.00 rx 0 0 tx 632330 1267072sock0@eth0:0 txonly xdp-drv
pps pkts 1.00 rx 0 0 tx 632438 1899584
Quoted 7 lines
sock0@eth0:0 txonly xdp-drv
pps pkts 1.00 rx 0 0 tx 632502 2532160Reported-by Kurt Kanzenbach <[email protected]>Signed-off-by Ong Boon Leong <[email protected]>
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 9 lines · On Thu, 11 Nov 2021 22:39:49 +0800 you wrote:
The previous
stmmac_xdp_set_prog()implementation usesstmmac_release()andstmmac_open()which tear down the PHY device and causes undesirable autonegotiation which causes a delay whenever AFXDP ZC is setup.This patch introduces two new functions that just sufficiently tear down DMA descriptors, buffer, NAPI process, and IRQs and reestablish them accordingly in both
stmmac_xdp_release()andstammac_xdp_open().[...]
Here is the summary with links:
- [net-next,1/1] net: stmmac: enhance XDP ZC driver level switching performance
https://git.kernel.org/netdev/net-next/c/ac746c8520d9
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html