* [PATCH net v3] net: renesas: rswitch: Fix timestamp feature after all descriptors are used
@ 2023-06-08 1:57 Yoshihiro Shimoda
2023-06-08 13:51 ` Simon Horman
2023-06-09 9:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Yoshihiro Shimoda @ 2023-06-08 1:57 UTC (permalink / raw)
To: s.shtylyov, davem, edumazet, kuba, pabeni
Cc: lanhao, simon.horman, netdev, linux-renesas-soc,
Yoshihiro Shimoda, Phong Hoang
The timestamp descriptors were intended to act cyclically. Descriptors
from index 0 through gq->ring_size - 1 contain actual information, and
the last index (gq->ring_size) should have LINKFIX to indicate
the first index 0 descriptor. However, the LINKFIX value is missing,
causing the timestamp feature to stop after all descriptors are used.
To resolve this issue, set the LINKFIX to the timestamp descritors.
Reported-by: Phong Hoang <phong.hoang.wz@renesas.com>
Fixes: 33f5d733b589 ("net: renesas: rswitch: Improve TX timestamp accuracy")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
Since I got this report locally, I didn't add Closes: tag.
Changes from v2:
https://lore.kernel.org/all/20230607070141.1795982-1-yoshihiro.shimoda.uh@renesas.com/
- Rebase the latest net.git / main branch.
- Fix typo in the commit description.
- Modify the implementation of setting the last LINKFIX setting from
rswitch_gwca_ts_queue_fill() to rswitch_gwca_ts_queue_alloc() because
the last LINKFIX setting is only needed at the initialization time.
Changes from v1:
https://lore.kernel.org/all/20230607064402.1795548-1-yoshihiro.shimoda.uh@renesas.com/
- Fix typo in the subject.
drivers/net/ethernet/renesas/rswitch.c | 36 ++++++++++++++++----------
1 file changed, 22 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index aace87139cea..fa6d6202b129 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -347,17 +347,6 @@ static int rswitch_gwca_queue_alloc(struct net_device *ndev,
return -ENOMEM;
}
-static int rswitch_gwca_ts_queue_alloc(struct rswitch_private *priv)
-{
- struct rswitch_gwca_queue *gq = &priv->gwca.ts_queue;
-
- gq->ring_size = TS_RING_SIZE;
- gq->ts_ring = dma_alloc_coherent(&priv->pdev->dev,
- sizeof(struct rswitch_ts_desc) *
- (gq->ring_size + 1), &gq->ring_dma, GFP_KERNEL);
- return !gq->ts_ring ? -ENOMEM : 0;
-}
-
static void rswitch_desc_set_dptr(struct rswitch_desc *desc, dma_addr_t addr)
{
desc->dptrl = cpu_to_le32(lower_32_bits(addr));
@@ -533,6 +522,28 @@ static void rswitch_gwca_linkfix_free(struct rswitch_private *priv)
gwca->linkfix_table = NULL;
}
+static int rswitch_gwca_ts_queue_alloc(struct rswitch_private *priv)
+{
+ struct rswitch_gwca_queue *gq = &priv->gwca.ts_queue;
+ struct rswitch_ts_desc *desc;
+
+ gq->ring_size = TS_RING_SIZE;
+ gq->ts_ring = dma_alloc_coherent(&priv->pdev->dev,
+ sizeof(struct rswitch_ts_desc) *
+ (gq->ring_size + 1), &gq->ring_dma, GFP_KERNEL);
+
+ if (!gq->ts_ring)
+ return -ENOMEM;
+
+ rswitch_gwca_ts_queue_fill(priv, 0, TS_RING_SIZE);
+ desc = &gq->ts_ring[gq->ring_size];
+ desc->desc.die_dt = DT_LINKFIX;
+ rswitch_desc_set_dptr(&desc->desc, gq->ring_dma);
+ INIT_LIST_HEAD(&priv->gwca.ts_info_list);
+
+ return 0;
+}
+
static struct rswitch_gwca_queue *rswitch_gwca_get(struct rswitch_private *priv)
{
struct rswitch_gwca_queue *gq;
@@ -1780,9 +1791,6 @@ static int rswitch_init(struct rswitch_private *priv)
if (err < 0)
goto err_ts_queue_alloc;
- rswitch_gwca_ts_queue_fill(priv, 0, TS_RING_SIZE);
- INIT_LIST_HEAD(&priv->gwca.ts_info_list);
-
for (i = 0; i < RSWITCH_NUM_PORTS; i++) {
err = rswitch_device_alloc(priv, i);
if (err < 0) {
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net v3] net: renesas: rswitch: Fix timestamp feature after all descriptors are used
2023-06-08 1:57 [PATCH net v3] net: renesas: rswitch: Fix timestamp feature after all descriptors are used Yoshihiro Shimoda
@ 2023-06-08 13:51 ` Simon Horman
2023-06-09 9:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-06-08 13:51 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: s.shtylyov, davem, edumazet, kuba, pabeni, lanhao, netdev,
linux-renesas-soc, Phong Hoang
On Thu, Jun 08, 2023 at 10:57:27AM +0900, Yoshihiro Shimoda wrote:
> The timestamp descriptors were intended to act cyclically. Descriptors
> from index 0 through gq->ring_size - 1 contain actual information, and
> the last index (gq->ring_size) should have LINKFIX to indicate
> the first index 0 descriptor. However, the LINKFIX value is missing,
> causing the timestamp feature to stop after all descriptors are used.
> To resolve this issue, set the LINKFIX to the timestamp descritors.
>
> Reported-by: Phong Hoang <phong.hoang.wz@renesas.com>
> Fixes: 33f5d733b589 ("net: renesas: rswitch: Improve TX timestamp accuracy")
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
> Since I got this report locally, I didn't add Closes: tag.
>
> Changes from v2:
> https://lore.kernel.org/all/20230607070141.1795982-1-yoshihiro.shimoda.uh@renesas.com/
> - Rebase the latest net.git / main branch.
> - Fix typo in the commit description.
> - Modify the implementation of setting the last LINKFIX setting from
> rswitch_gwca_ts_queue_fill() to rswitch_gwca_ts_queue_alloc() because
> the last LINKFIX setting is only needed at the initialization time.
>
> Changes from v1:
> https://lore.kernel.org/all/20230607064402.1795548-1-yoshihiro.shimoda.uh@renesas.com/
> - Fix typo in the subject.
>
> drivers/net/ethernet/renesas/rswitch.c | 36 ++++++++++++++++----------
> 1 file changed, 22 insertions(+), 14 deletions(-)
Hi all,
Hao Lan has provided a Reviewed-by for v2 [1], which was perhaps intended
for v3 (this version). In any case, I think we good on this one.
Reviewed-by: Simon Horman <simon.horman@corigine.com>
[1] https://lore.kernel.org/all/08006a4c-0627-9779-2260-a7e10dda454e@huawei.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net v3] net: renesas: rswitch: Fix timestamp feature after all descriptors are used
2023-06-08 1:57 [PATCH net v3] net: renesas: rswitch: Fix timestamp feature after all descriptors are used Yoshihiro Shimoda
2023-06-08 13:51 ` Simon Horman
@ 2023-06-09 9:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-09 9:50 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: s.shtylyov, davem, edumazet, kuba, pabeni, lanhao, simon.horman,
netdev, linux-renesas-soc, phong.hoang.wz
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Thu, 8 Jun 2023 10:57:27 +0900 you wrote:
> The timestamp descriptors were intended to act cyclically. Descriptors
> from index 0 through gq->ring_size - 1 contain actual information, and
> the last index (gq->ring_size) should have LINKFIX to indicate
> the first index 0 descriptor. However, the LINKFIX value is missing,
> causing the timestamp feature to stop after all descriptors are used.
> To resolve this issue, set the LINKFIX to the timestamp descritors.
>
> [...]
Here is the summary with links:
- [net,v3] net: renesas: rswitch: Fix timestamp feature after all descriptors are used
https://git.kernel.org/netdev/net/c/0ad4982c520e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-09 9:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-08 1:57 [PATCH net v3] net: renesas: rswitch: Fix timestamp feature after all descriptors are used Yoshihiro Shimoda
2023-06-08 13:51 ` Simon Horman
2023-06-09 9:50 ` patchwork-bot+netdevbpf
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).