Unverified Commit 73e3864f authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!10427 net: stmmac: move the EST lock to struct stmmac_priv

parents cdac497b cef3b30b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -192,6 +192,8 @@ struct stmmac_priv {
	struct stmmac_extra_stats xstats ____cacheline_aligned_in_smp;
	struct stmmac_safety_stats sstats;
	struct plat_stmmacenet_data *plat;
	/* Protect est parameters */
	struct mutex est_lock;
	struct dma_features dma_cap;
	struct stmmac_counters mmc;
	int hw_cap_support;
+11 −9
Original line number Diff line number Diff line
@@ -688,17 +688,19 @@ static int tc_setup_taprio(struct stmmac_priv *priv,
		if (!plat->est)
			return -ENOMEM;

		mutex_init(&priv->plat->est->lock);
		mutex_init(&priv->est_lock);
	} else {
		mutex_lock(&priv->est_lock);
		memset(plat->est, 0, sizeof(*plat->est));
		mutex_unlock(&priv->est_lock);
	}

	size = qopt->num_entries;

	mutex_lock(&priv->plat->est->lock);
	mutex_lock(&priv->est_lock);
	priv->plat->est->gcl_size = size;
	priv->plat->est->enable = qopt->enable;
	mutex_unlock(&priv->plat->est->lock);
	mutex_unlock(&priv->est_lock);

	for (i = 0; i < size; i++) {
		s64 delta_ns = qopt->entries[i].interval;
@@ -729,7 +731,7 @@ static int tc_setup_taprio(struct stmmac_priv *priv,
		priv->plat->est->gcl[i] = delta_ns | (gates << wid);
	}

	mutex_lock(&priv->plat->est->lock);
	mutex_lock(&priv->est_lock);
	/* Adjust for real system time */
	priv->ptp_clock_ops.gettime64(&priv->ptp_clock_ops, &current_time);
	current_time_ns = timespec64_to_ktime(current_time);
@@ -755,7 +757,7 @@ static int tc_setup_taprio(struct stmmac_priv *priv,
	priv->plat->est->ctr[1] = (u32)ctr;

	if (fpe && !priv->dma_cap.fpesel) {
		mutex_unlock(&priv->plat->est->lock);
		mutex_unlock(&priv->est_lock);
		return -EOPNOTSUPP;
	}

@@ -763,14 +765,14 @@ static int tc_setup_taprio(struct stmmac_priv *priv,
				   priv->plat->tx_queues_to_use,
				   priv->plat->rx_queues_to_use, fpe);
	if (ret && fpe) {
		mutex_unlock(&priv->plat->est->lock);
		mutex_unlock(&priv->est_lock);
		netdev_err(priv->dev, "failed to enable Frame Preemption\n");
		return ret;
	}

	ret = stmmac_est_configure(priv, priv->ioaddr, priv->plat->est,
				   priv->plat->clk_ptp_rate);
	mutex_unlock(&priv->plat->est->lock);
	mutex_unlock(&priv->est_lock);
	if (ret) {
		netdev_err(priv->dev, "failed to configure EST\n");
		goto disable;
@@ -781,11 +783,11 @@ static int tc_setup_taprio(struct stmmac_priv *priv,

disable:
	if (priv->plat->est) {
		mutex_lock(&priv->plat->est->lock);
		mutex_lock(&priv->est_lock);
		priv->plat->est->enable = false;
		stmmac_est_configure(priv, priv->ioaddr, priv->plat->est,
				     priv->plat->clk_ptp_rate);
		mutex_unlock(&priv->plat->est->lock);
		mutex_unlock(&priv->est_lock);
	}

	return ret;
+0 −1
Original line number Diff line number Diff line
@@ -112,7 +112,6 @@ struct stmmac_axi {

#define EST_GCL		1024
struct stmmac_est {
	struct mutex lock;
	int enable;
	u32 btr_offset[2];
	u32 btr[2];