* [PATCH net 0/2] net: renesas: rswitch: Fix rx and timestamp
@ 2023-03-15 7:04 Yoshihiro Shimoda
2023-03-15 7:04 ` [PATCH net 1/2] net: renesas: rswitch: Fix the output value of quote from rswitch_rx() Yoshihiro Shimoda
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2023-03-15 7:04 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
I got reports locally about issues on the rswitch driver.
So, fix the issues.
Yoshihiro Shimoda (2):
net: renesas: rswitch: Fix the output value of quote from rswitch_rx()
net: renesas: rswitch: Fix GWTSDIE register handling
drivers/net/ethernet/renesas/rswitch.c | 19 ++++++++++++++-----
drivers/net/ethernet/renesas/rswitch.h | 1 +
2 files changed, 15 insertions(+), 5 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net 1/2] net: renesas: rswitch: Fix the output value of quote from rswitch_rx()
2023-03-15 7:04 [PATCH net 0/2] net: renesas: rswitch: Fix rx and timestamp Yoshihiro Shimoda
@ 2023-03-15 7:04 ` Yoshihiro Shimoda
2023-03-15 7:04 ` [PATCH net 2/2] net: renesas: rswitch: Fix GWTSDIE register handling Yoshihiro Shimoda
2023-03-17 8:00 ` [PATCH net 0/2] net: renesas: rswitch: Fix rx and timestamp patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2023-03-15 7:04 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda, Volodymyr Babchuk
If the RX descriptor doesn't have any data, the output value of quote
from rswitch_rx() will be increased unexpectedily. So, fix it.
Reported-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Fixes: 3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/net/ethernet/renesas/rswitch.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index 853394e5bb8b..46d8d9c8fc19 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -702,13 +702,14 @@ static bool rswitch_rx(struct net_device *ndev, int *quota)
u16 pkt_len;
u32 get_ts;
+ if (*quota <= 0)
+ return true;
+
boguscnt = min_t(int, gq->ring_size, *quota);
limit = boguscnt;
desc = &gq->rx_ring[gq->cur];
while ((desc->desc.die_dt & DT_MASK) != DT_FEMPTY) {
- if (--boguscnt < 0)
- break;
dma_rmb();
pkt_len = le16_to_cpu(desc->desc.info_ds) & RX_DS;
skb = gq->skbs[gq->cur];
@@ -734,6 +735,9 @@ static bool rswitch_rx(struct net_device *ndev, int *quota)
gq->cur = rswitch_next_queue_index(gq, true, 1);
desc = &gq->rx_ring[gq->cur];
+
+ if (--boguscnt <= 0)
+ break;
}
num = rswitch_get_num_cur_queues(gq);
@@ -745,7 +749,7 @@ static bool rswitch_rx(struct net_device *ndev, int *quota)
goto err;
gq->dirty = rswitch_next_queue_index(gq, false, num);
- *quota -= limit - (++boguscnt);
+ *quota -= limit - boguscnt;
return boguscnt <= 0;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/2] net: renesas: rswitch: Fix GWTSDIE register handling
2023-03-15 7:04 [PATCH net 0/2] net: renesas: rswitch: Fix rx and timestamp Yoshihiro Shimoda
2023-03-15 7:04 ` [PATCH net 1/2] net: renesas: rswitch: Fix the output value of quote from rswitch_rx() Yoshihiro Shimoda
@ 2023-03-15 7:04 ` Yoshihiro Shimoda
2023-03-17 8:00 ` [PATCH net 0/2] net: renesas: rswitch: Fix rx and timestamp patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2023-03-15 7:04 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda, Phong Hoang
Since the GWCA has the TX timestamp feature, this driver
should not disable it if one of ports is opened. So, fix it.
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>
---
drivers/net/ethernet/renesas/rswitch.c | 9 +++++++--
drivers/net/ethernet/renesas/rswitch.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index 46d8d9c8fc19..c4f93d24c6a4 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -1441,7 +1441,10 @@ static int rswitch_open(struct net_device *ndev)
rswitch_enadis_data_irq(rdev->priv, rdev->tx_queue->index, true);
rswitch_enadis_data_irq(rdev->priv, rdev->rx_queue->index, true);
- iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDIE);
+ if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS))
+ iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDIE);
+
+ bitmap_set(rdev->priv->opened_ports, rdev->port, 1);
return 0;
};
@@ -1452,8 +1455,10 @@ static int rswitch_stop(struct net_device *ndev)
struct rswitch_gwca_ts_info *ts_info, *ts_info2;
netif_tx_stop_all_queues(ndev);
+ bitmap_clear(rdev->priv->opened_ports, rdev->port, 1);
- iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDID);
+ if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS))
+ iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDID);
list_for_each_entry_safe(ts_info, ts_info2, &rdev->priv->gwca.ts_info_list, list) {
if (ts_info->port != rdev->port)
diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/renesas/rswitch.h
index 27d3d38c055f..b3e0411b408e 100644
--- a/drivers/net/ethernet/renesas/rswitch.h
+++ b/drivers/net/ethernet/renesas/rswitch.h
@@ -998,6 +998,7 @@ struct rswitch_private {
struct rcar_gen4_ptp_private *ptp_priv;
struct rswitch_device *rdev[RSWITCH_NUM_PORTS];
+ DECLARE_BITMAP(opened_ports, RSWITCH_NUM_PORTS);
struct rswitch_gwca gwca;
struct rswitch_etha etha[RSWITCH_NUM_PORTS];
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net 0/2] net: renesas: rswitch: Fix rx and timestamp
2023-03-15 7:04 [PATCH net 0/2] net: renesas: rswitch: Fix rx and timestamp Yoshihiro Shimoda
2023-03-15 7:04 ` [PATCH net 1/2] net: renesas: rswitch: Fix the output value of quote from rswitch_rx() Yoshihiro Shimoda
2023-03-15 7:04 ` [PATCH net 2/2] net: renesas: rswitch: Fix GWTSDIE register handling Yoshihiro Shimoda
@ 2023-03-17 8:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-17 8:00 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: davem, edumazet, kuba, pabeni, netdev, linux-renesas-soc
Hello:
This series was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Wed, 15 Mar 2023 16:04:22 +0900 you wrote:
> I got reports locally about issues on the rswitch driver.
> So, fix the issues.
>
> Yoshihiro Shimoda (2):
> net: renesas: rswitch: Fix the output value of quote from rswitch_rx()
> net: renesas: rswitch: Fix GWTSDIE register handling
>
> [...]
Here is the summary with links:
- [net,1/2] net: renesas: rswitch: Fix the output value of quote from rswitch_rx()
https://git.kernel.org/netdev/net/c/e05bb97d9c9d
- [net,2/2] net: renesas: rswitch: Fix GWTSDIE register handling
https://git.kernel.org/netdev/net/c/2c59e993c86a
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] 4+ messages in thread
end of thread, other threads:[~2023-03-17 8:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 7:04 [PATCH net 0/2] net: renesas: rswitch: Fix rx and timestamp Yoshihiro Shimoda
2023-03-15 7:04 ` [PATCH net 1/2] net: renesas: rswitch: Fix the output value of quote from rswitch_rx() Yoshihiro Shimoda
2023-03-15 7:04 ` [PATCH net 2/2] net: renesas: rswitch: Fix GWTSDIE register handling Yoshihiro Shimoda
2023-03-17 8:00 ` [PATCH net 0/2] net: renesas: rswitch: Fix rx and timestamp 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).