From: Wei Fang <wei.fang@nxp.com>
To: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
richardcochran@gmail.com, claudiu.manoil@nxp.com,
vladimir.oltean@nxp.com, xiaoning.wang@nxp.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, vadim.fedorenko@linux.dev,
Frank.Li@nxp.com, shawnguo@kernel.org
Cc: fushi.peng@nxp.com, devicetree@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev
Subject: [PATCH v6 net-next 14/17] net: enetc: move sync packet modification before dma_map_single()
Date: Wed, 27 Aug 2025 14:33:29 +0800 [thread overview]
Message-ID: <20250827063332.1217664-15-wei.fang@nxp.com> (raw)
In-Reply-To: <20250827063332.1217664-1-wei.fang@nxp.com>
Move sync packet content modification before dma_map_single() to follow
correct DMA usage process, even though the previous sequence worked due
to hardware DMA-coherence support (LS1028A). But for the upcoming i.MX95,
its ENETC (v4) does not support "dma-coherent", so this step is very
necessary. Otherwise, the originTimestamp and correction fields of the
sent packets will still be the values before the modification.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
v6 changes:
new patch, separated from the patch "net: enetc: add PTP synchronization
support for ENETC v4"
---
drivers/net/ethernet/freescale/enetc/enetc.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
index 4325eb3d9481..25379ac7d69d 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -303,6 +303,7 @@ static int enetc_map_tx_buffs(struct enetc_bdr *tx_ring, struct sk_buff *skb)
unsigned int f;
dma_addr_t dma;
u8 flags = 0;
+ u32 tstamp;
enetc_clear_tx_bd(&temp_bd);
if (skb->ip_summed == CHECKSUM_PARTIAL) {
@@ -327,6 +328,13 @@ static int enetc_map_tx_buffs(struct enetc_bdr *tx_ring, struct sk_buff *skb)
}
}
+ if (enetc_cb->flag & ENETC_F_TX_ONESTEP_SYNC_TSTAMP) {
+ do_onestep_tstamp = true;
+ tstamp = enetc_update_ptp_sync_msg(priv, skb);
+ } else if (enetc_cb->flag & ENETC_F_TX_TSTAMP) {
+ do_twostep_tstamp = true;
+ }
+
i = tx_ring->next_to_use;
txbd = ENETC_TXBD(*tx_ring, i);
prefetchw(txbd);
@@ -346,11 +354,6 @@ static int enetc_map_tx_buffs(struct enetc_bdr *tx_ring, struct sk_buff *skb)
count++;
do_vlan = skb_vlan_tag_present(skb);
- if (enetc_cb->flag & ENETC_F_TX_ONESTEP_SYNC_TSTAMP)
- do_onestep_tstamp = true;
- else if (enetc_cb->flag & ENETC_F_TX_TSTAMP)
- do_twostep_tstamp = true;
-
tx_swbd->do_twostep_tstamp = do_twostep_tstamp;
tx_swbd->qbv_en = !!(priv->active_offloads & ENETC_F_QBV);
tx_swbd->check_wb = tx_swbd->do_twostep_tstamp || tx_swbd->qbv_en;
@@ -393,8 +396,6 @@ static int enetc_map_tx_buffs(struct enetc_bdr *tx_ring, struct sk_buff *skb)
}
if (do_onestep_tstamp) {
- u32 tstamp = enetc_update_ptp_sync_msg(priv, skb);
-
/* Configure extension BD */
temp_bd.ext.tstamp = cpu_to_le32(tstamp);
e_flags |= ENETC_TXBD_E_FLAGS_ONE_STEP_PTP;
--
2.34.1
next prev parent reply other threads:[~2025-08-27 6:56 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-27 6:33 [PATCH v6 net-next 00/17] Add NETC Timer PTP driver and add PTP support for i.MX95 Wei Fang
2025-08-27 6:33 ` [PATCH v6 net-next 01/17] dt-bindings: ptp: add NETC Timer PTP clock Wei Fang
2025-08-27 12:15 ` Krzysztof Kozlowski
2025-08-27 6:33 ` [PATCH v6 net-next 02/17] dt-bindings: net: move ptp-timer property to ethernet-controller.yaml Wei Fang
2025-08-27 6:33 ` [PATCH v6 net-next 03/17] ptp: add helpers to get the phc_index by of_node or dev Wei Fang
2025-08-27 6:33 ` [PATCH v6 net-next 04/17] ptp: add debugfs interfaces to loop back the periodic output signal Wei Fang
2025-08-27 15:11 ` Frank Li
2025-08-28 2:04 ` Wei Fang
2025-08-28 0:00 ` Jakub Kicinski
2025-08-28 2:10 ` Wei Fang
2025-08-27 6:33 ` [PATCH v6 net-next 05/17] ptp: netc: add NETC V4 Timer PTP driver support Wei Fang
2025-08-27 6:33 ` [PATCH v6 net-next 06/17] ptp: netc: add PTP_CLK_REQ_PPS support Wei Fang
2025-08-27 6:33 ` [PATCH v6 net-next 07/17] ptp: netc: add periodic pulse output support Wei Fang
2025-08-27 6:33 ` [PATCH v6 net-next 08/17] ptp: netc: add external trigger stamp support Wei Fang
2025-08-27 6:33 ` [PATCH v6 net-next 09/17] ptp: netc: add the periodic output signal loopback support Wei Fang
2025-08-27 6:33 ` [PATCH v6 net-next 10/17] MAINTAINERS: add NETC Timer PTP clock driver section Wei Fang
2025-08-27 6:33 ` [PATCH v6 net-next 11/17] net: enetc: save the parsed information of PTP packet to skb->cb Wei Fang
2025-08-27 6:33 ` [PATCH v6 net-next 12/17] net: enetc: extract enetc_update_ptp_sync_msg() to handle PTP Sync packets Wei Fang
2025-08-27 6:33 ` [PATCH v6 net-next 13/17] net: enetc: remove unnecessary CONFIG_FSL_ENETC_PTP_CLOCK check Wei Fang
2025-08-27 6:33 ` Wei Fang [this message]
2025-08-27 14:49 ` [PATCH v6 net-next 14/17] net: enetc: move sync packet modification before dma_map_single() Frank Li
2025-08-27 6:33 ` [PATCH v6 net-next 15/17] net: enetc: add PTP synchronization support for ENETC v4 Wei Fang
2025-08-27 15:02 ` Frank Li
2025-08-27 6:33 ` [PATCH v6 net-next 16/17] net: enetc: don't update sync packet checksum if checksum offload is used Wei Fang
2025-08-27 6:33 ` [PATCH v6 17/17] arm64: dts: imx95: add standard PCI device compatible string to NETC Timer Wei Fang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250827063332.1217664-15-wei.fang@nxp.com \
--to=wei.fang@nxp.com \
--cc=Frank.Li@nxp.com \
--cc=andrew+netdev@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=fushi.peng@nxp.com \
--cc=imx@lists.linux.dev \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=shawnguo@kernel.org \
--cc=vadim.fedorenko@linux.dev \
--cc=vladimir.oltean@nxp.com \
--cc=xiaoning.wang@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).