Skip to content

Commit

Permalink
Merge branch 'sxgbe-stmmac-remove-private-tx-lock'
Browse files Browse the repository at this point in the history
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: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Dec 11, 2016
2 parents c280b48 + 739c8e1 commit 0972770
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 45 deletions.
1 change: 0 additions & 1 deletion drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
27 changes: 6 additions & 21 deletions drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -781,18 +778,13 @@ 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);
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);
}

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

/**
Expand Down Expand Up @@ -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);

Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/stmicro/stmmac/stmmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 6 additions & 22 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;

Expand Down Expand Up @@ -1379,22 +1379,17 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
netdev_completed_queue(priv->dev, pkts_compl, bytes_compl);

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);
stmmac_tx_avail(priv) > STMMAC_TX_THRESH)) {
netif_dbg(priv, tx_done, priv->dev,
"%s: restart transmit\n", __func__);
netif_wake_queue(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)
Expand Down Expand Up @@ -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);

Expand All @@ -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;
}

Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 0972770

Please sign in to comment.