Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0972770e authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'sxgbe-stmmac-remove-private-tx-lock'



Lino Sanfilippo says:

====================
Remove private tx queue locks

this patch series removes unnecessary private locks in the sxgbe and the
stmmac driver.

v2:
- adjust commit message
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c280b482 739c8e14
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -384,7 +384,6 @@ struct sxgbe_tx_queue {
	dma_addr_t *tx_skbuff_dma;
	struct sk_buff **tx_skbuff;
	struct timer_list txtimer;
	spinlock_t tx_lock;	/* lock for tx queues */
	unsigned int cur_tx;
	unsigned int dirty_tx;
	u32 tx_count_frames;
+6 −21
Original line number Diff line number Diff line
@@ -426,9 +426,6 @@ static int init_tx_ring(struct device *dev, u8 queue_no,
	tx_ring->dirty_tx = 0;
	tx_ring->cur_tx = 0;

	/* initialise TX queue lock */
	spin_lock_init(&tx_ring->tx_lock);

	return 0;

dmamem_err:
@@ -743,7 +740,7 @@ static void sxgbe_tx_queue_clean(struct sxgbe_tx_queue *tqueue)

	dev_txq = netdev_get_tx_queue(priv->dev, queue_no);

	spin_lock(&tqueue->tx_lock);
	__netif_tx_lock(dev_txq, smp_processor_id());

	priv->xstats.tx_clean++;
	while (tqueue->dirty_tx != tqueue->cur_tx) {
@@ -782,17 +779,12 @@ static void sxgbe_tx_queue_clean(struct sxgbe_tx_queue *tqueue)
	/* wake up queue */
	if (unlikely(netif_tx_queue_stopped(dev_txq) &&
	    sxgbe_tx_avail(tqueue, tx_rsize) > SXGBE_TX_THRESH(priv))) {
		netif_tx_lock(priv->dev);
		if (netif_tx_queue_stopped(dev_txq) &&
		    sxgbe_tx_avail(tqueue, tx_rsize) > SXGBE_TX_THRESH(priv)) {
		if (netif_msg_tx_done(priv))
			pr_debug("%s: restart transmit\n", __func__);
		netif_tx_wake_queue(dev_txq);
	}
		netif_tx_unlock(priv->dev);
	}

	spin_unlock(&tqueue->tx_lock);
	__netif_tx_unlock(dev_txq);
}

/**
@@ -1304,9 +1296,6 @@ static netdev_tx_t sxgbe_xmit(struct sk_buff *skb, struct net_device *dev)
		      tqueue->hwts_tx_en)))
		ctxt_desc_req = 1;

	/* get the spinlock */
	spin_lock(&tqueue->tx_lock);

	if (priv->tx_path_in_lpi_mode)
		sxgbe_disable_eee_mode(priv);

@@ -1316,8 +1305,6 @@ static netdev_tx_t sxgbe_xmit(struct sk_buff *skb, struct net_device *dev)
			netdev_err(dev, "%s: Tx Ring is full when %d queue is awake\n",
				   __func__, txq_index);
		}
		/* release the spin lock in case of BUSY */
		spin_unlock(&tqueue->tx_lock);
		return NETDEV_TX_BUSY;
	}

@@ -1436,8 +1423,6 @@ static netdev_tx_t sxgbe_xmit(struct sk_buff *skb, struct net_device *dev)

	priv->hw->dma->enable_dma_transmission(priv->ioaddr, txq_index);

	spin_unlock(&tqueue->tx_lock);

	return NETDEV_TX_OK;
}

+0 −1
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@ struct stmmac_priv {
	dma_addr_t dma_tx_phy;
	int tx_coalesce;
	int hwts_tx_en;
	spinlock_t tx_lock;
	bool tx_path_in_lpi_mode;
	struct timer_list txtimer;
	bool tso;
+6 −22
Original line number Diff line number Diff line
@@ -1308,7 +1308,7 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
	unsigned int bytes_compl = 0, pkts_compl = 0;
	unsigned int entry = priv->dirty_tx;

	spin_lock(&priv->tx_lock);
	netif_tx_lock(priv->dev);

	priv->xstats.tx_clean++;

@@ -1380,21 +1380,16 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)

	if (unlikely(netif_queue_stopped(priv->dev) &&
	    stmmac_tx_avail(priv) > STMMAC_TX_THRESH)) {
		netif_tx_lock(priv->dev);
		if (netif_queue_stopped(priv->dev) &&
		    stmmac_tx_avail(priv) > STMMAC_TX_THRESH) {
		netif_dbg(priv, tx_done, priv->dev,
			  "%s: restart transmit\n", __func__);
		netif_wake_queue(priv->dev);
	}
		netif_tx_unlock(priv->dev);
	}

	if ((priv->eee_enabled) && (!priv->tx_path_in_lpi_mode)) {
		stmmac_enable_eee_mode(priv);
		mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(eee_timer));
	}
	spin_unlock(&priv->tx_lock);
	netif_tx_unlock(priv->dev);
}

static inline void stmmac_enable_dma_irq(struct stmmac_priv *priv)
@@ -2002,8 +1997,6 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
	u8 proto_hdr_len;
	int i;

	spin_lock(&priv->tx_lock);

	/* Compute header lengths */
	proto_hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);

@@ -2017,7 +2010,6 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
				   "%s: Tx Ring full when queue awake\n",
				   __func__);
		}
		spin_unlock(&priv->tx_lock);
		return NETDEV_TX_BUSY;
	}

@@ -2152,11 +2144,9 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
	priv->hw->dma->set_tx_tail_ptr(priv->ioaddr, priv->tx_tail_addr,
				       STMMAC_CHAN0);

	spin_unlock(&priv->tx_lock);
	return NETDEV_TX_OK;

dma_map_err:
	spin_unlock(&priv->tx_lock);
	dev_err(priv->device, "Tx dma map failed\n");
	dev_kfree_skb(skb);
	priv->dev->stats.tx_dropped++;
@@ -2188,10 +2178,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
			return stmmac_tso_xmit(skb, dev);
	}

	spin_lock(&priv->tx_lock);

	if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) {
		spin_unlock(&priv->tx_lock);
		if (!netif_queue_stopped(dev)) {
			netif_stop_queue(dev);
			/* This is a hard error, log it. */
@@ -2362,11 +2349,9 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
		priv->hw->dma->set_tx_tail_ptr(priv->ioaddr, priv->tx_tail_addr,
					       STMMAC_CHAN0);

	spin_unlock(&priv->tx_lock);
	return NETDEV_TX_OK;

dma_map_err:
	spin_unlock(&priv->tx_lock);
	netdev_err(priv->dev, "Tx DMA map failed\n");
	dev_kfree_skb(skb);
	priv->dev->stats.tx_dropped++;
@@ -3353,7 +3338,6 @@ int stmmac_dvr_probe(struct device *device,
	netif_napi_add(ndev, &priv->napi, stmmac_poll, 64);

	spin_lock_init(&priv->lock);
	spin_lock_init(&priv->tx_lock);

	ret = register_netdev(ndev);
	if (ret) {