* [PATCH net-next] net: ethernet: ti: am65-cpsw-qos: Add support to taprio for past base_time
@ 2024-04-25 10:31 Chintan Vankar
2024-04-27 13:31 ` Simon Horman
2024-04-29 5:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Chintan Vankar @ 2024-04-25 10:31 UTC (permalink / raw)
To: Tanmay Patil, Asbjørn Sloth Tønnesen, Simon Horman,
Roger Quadros, Vladimir Oltean, Paolo Abeni, Jakub Kicinski,
Eric Dumazet, David S. Miller, s-vadapalli, srk, danishanwar,
r-gunasekaran
Cc: linux-kernel, netdev, Chintan Vankar
From: Tanmay Patil <t-patil@ti.com>
If the base-time for taprio is in the past, start the schedule at the time
of the form "base_time + N*cycle_time" where N is the smallest possible
integer such that the above time is in the future.
Signed-off-by: Tanmay Patil <t-patil@ti.com>
Signed-off-by: Chintan Vankar <c-vankar@ti.com>
---
This patch is based on net-next commit d80687161271.
drivers/net/ethernet/ti/am65-cpsw-qos.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/ti/am65-cpsw-qos.c b/drivers/net/ethernet/ti/am65-cpsw-qos.c
index 16f192a5b160..fa96db7c1a13 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-qos.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-qos.c
@@ -9,6 +9,7 @@
#include <linux/pm_runtime.h>
#include <linux/math.h>
+#include <linux/math64.h>
#include <linux/time.h>
#include <linux/units.h>
#include <net/pkt_cls.h>
@@ -837,6 +838,7 @@ static int am65_cpsw_taprio_replace(struct net_device *ndev,
struct am65_cpsw_port *port = am65_ndev_to_port(ndev);
struct am65_cpts *cpts = common->cpts;
struct am65_cpsw_est *est_new;
+ u64 cur_time, n;
int ret, tact;
if (!netif_running(ndev)) {
@@ -888,13 +890,21 @@ static int am65_cpsw_taprio_replace(struct net_device *ndev,
if (tact == TACT_PROG)
am65_cpsw_timer_stop(ndev);
- if (!est_new->taprio.base_time)
- est_new->taprio.base_time = am65_cpts_ns_gettime(cpts);
-
am65_cpsw_port_est_get_buf_num(ndev, est_new);
am65_cpsw_est_set_sched_list(ndev, est_new);
am65_cpsw_port_est_assign_buf_num(ndev, est_new->buf);
+ /* If the base-time is in the past, start schedule from the time:
+ * base_time + (N*cycle_time)
+ * where N is the smallest possible integer such that the above
+ * time is in the future.
+ */
+ cur_time = am65_cpts_ns_gettime(cpts);
+ if (est_new->taprio.base_time < cur_time) {
+ n = div64_u64(cur_time - est_new->taprio.base_time, est_new->taprio.cycle_time);
+ est_new->taprio.base_time += (n + 1) * est_new->taprio.cycle_time;
+ }
+
am65_cpsw_est_set(ndev, 1);
if (tact == TACT_PROG) {
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next] net: ethernet: ti: am65-cpsw-qos: Add support to taprio for past base_time
2024-04-25 10:31 [PATCH net-next] net: ethernet: ti: am65-cpsw-qos: Add support to taprio for past base_time Chintan Vankar
@ 2024-04-27 13:31 ` Simon Horman
2024-04-29 5:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-04-27 13:31 UTC (permalink / raw)
To: Chintan Vankar
Cc: Tanmay Patil, Asbjørn Sloth Tønnesen, Roger Quadros,
Vladimir Oltean, Paolo Abeni, Jakub Kicinski, Eric Dumazet,
David S. Miller, s-vadapalli, srk, danishanwar, r-gunasekaran,
linux-kernel, netdev
On Thu, Apr 25, 2024 at 04:01:42PM +0530, Chintan Vankar wrote:
> From: Tanmay Patil <t-patil@ti.com>
>
> If the base-time for taprio is in the past, start the schedule at the time
> of the form "base_time + N*cycle_time" where N is the smallest possible
> integer such that the above time is in the future.
>
> Signed-off-by: Tanmay Patil <t-patil@ti.com>
> Signed-off-by: Chintan Vankar <c-vankar@ti.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: ethernet: ti: am65-cpsw-qos: Add support to taprio for past base_time
2024-04-25 10:31 [PATCH net-next] net: ethernet: ti: am65-cpsw-qos: Add support to taprio for past base_time Chintan Vankar
2024-04-27 13:31 ` Simon Horman
@ 2024-04-29 5:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-29 5:20 UTC (permalink / raw)
To: Chintan Vankar
Cc: t-patil, ast, horms, rogerq, vladimir.oltean, pabeni, kuba,
edumazet, davem, s-vadapalli, srk, danishanwar, r-gunasekaran,
linux-kernel, netdev
Hello:
This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Thu, 25 Apr 2024 16:01:42 +0530 you wrote:
> From: Tanmay Patil <t-patil@ti.com>
>
> If the base-time for taprio is in the past, start the schedule at the time
> of the form "base_time + N*cycle_time" where N is the smallest possible
> integer such that the above time is in the future.
>
> Signed-off-by: Tanmay Patil <t-patil@ti.com>
> Signed-off-by: Chintan Vankar <c-vankar@ti.com>
>
> [...]
Here is the summary with links:
- [net-next] net: ethernet: ti: am65-cpsw-qos: Add support to taprio for past base_time
https://git.kernel.org/netdev/net-next/c/d63394abc923
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:[~2024-04-29 5:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-25 10:31 [PATCH net-next] net: ethernet: ti: am65-cpsw-qos: Add support to taprio for past base_time Chintan Vankar
2024-04-27 13:31 ` Simon Horman
2024-04-29 5:20 ` 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).