Commit a1ec57c0 authored by Jose Abreu's avatar Jose Abreu Committed by David S. Miller
Browse files

net: stmmac: tc: Fix TAPRIO division operation



For ARCHs that don't support 64 bits division we need to use the
helpers.

Fixes: b60189e0 ("net: stmmac: Integrate EST with TAPRIO scheduler API")
Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6bff0017
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -599,6 +599,7 @@ static int tc_setup_taprio(struct stmmac_priv *priv,
	struct timespec64 time;
	bool fpe = false;
	int i, ret = 0;
	u64 ctr;

	if (!priv->dma_cap.estsel)
		return -EOPNOTSUPP;
@@ -694,8 +695,9 @@ static int tc_setup_taprio(struct stmmac_priv *priv,
	priv->plat->est->btr[0] = (u32)time.tv_nsec;
	priv->plat->est->btr[1] = (u32)time.tv_sec;

	priv->plat->est->ctr[0] = (u32)(qopt->cycle_time % NSEC_PER_SEC);
	priv->plat->est->ctr[1] = (u32)(qopt->cycle_time / NSEC_PER_SEC);
	ctr = qopt->cycle_time;
	priv->plat->est->ctr[0] = do_div(ctr, NSEC_PER_SEC);
	priv->plat->est->ctr[1] = (u32)ctr;

	if (fpe && !priv->dma_cap.fpesel)
		return -EOPNOTSUPP;