Skip to content

Commit 148d3d0

Browse files
ffainellidavem330
authored andcommitted
net: systemport: Decouple flow control from __bcm_sysport_tx_reclaim
The __bcm_sysport_tx_reclaim() function is used to reclaim transmit resources in different places within the driver. Most of them should not affect the state of the transit flow control. Introduce bcm_sysport_tx_clean() which cleans the ring, but does not re-enable flow control towards the networking stack, and make bcm_sysport_tx_reclaim() do the actual transmit queue flow control. Fixes: 80105be ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver") Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7aa4865 commit 148d3d0

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

drivers/net/ethernet/broadcom/bcmsysport.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -710,11 +710,8 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
710710
unsigned int c_index, last_c_index, last_tx_cn, num_tx_cbs;
711711
unsigned int pkts_compl = 0, bytes_compl = 0;
712712
struct bcm_sysport_cb *cb;
713-
struct netdev_queue *txq;
714713
u32 hw_ind;
715714

716-
txq = netdev_get_tx_queue(ndev, ring->index);
717-
718715
/* Compute how many descriptors have been processed since last call */
719716
hw_ind = tdma_readl(priv, TDMA_DESC_RING_PROD_CONS_INDEX(ring->index));
720717
c_index = (hw_ind >> RING_CONS_INDEX_SHIFT) & RING_CONS_INDEX_MASK;
@@ -745,9 +742,6 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
745742

746743
ring->c_index = c_index;
747744

748-
if (netif_tx_queue_stopped(txq) && pkts_compl)
749-
netif_tx_wake_queue(txq);
750-
751745
netif_dbg(priv, tx_done, ndev,
752746
"ring=%d c_index=%d pkts_compl=%d, bytes_compl=%d\n",
753747
ring->index, ring->c_index, pkts_compl, bytes_compl);
@@ -759,16 +753,33 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
759753
static unsigned int bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
760754
struct bcm_sysport_tx_ring *ring)
761755
{
756+
struct netdev_queue *txq;
762757
unsigned int released;
763758
unsigned long flags;
764759

760+
txq = netdev_get_tx_queue(priv->netdev, ring->index);
761+
765762
spin_lock_irqsave(&ring->lock, flags);
766763
released = __bcm_sysport_tx_reclaim(priv, ring);
764+
if (released)
765+
netif_tx_wake_queue(txq);
766+
767767
spin_unlock_irqrestore(&ring->lock, flags);
768768

769769
return released;
770770
}
771771

772+
/* Locked version of the per-ring TX reclaim, but does not wake the queue */
773+
static void bcm_sysport_tx_clean(struct bcm_sysport_priv *priv,
774+
struct bcm_sysport_tx_ring *ring)
775+
{
776+
unsigned long flags;
777+
778+
spin_lock_irqsave(&ring->lock, flags);
779+
__bcm_sysport_tx_reclaim(priv, ring);
780+
spin_unlock_irqrestore(&ring->lock, flags);
781+
}
782+
772783
static int bcm_sysport_tx_poll(struct napi_struct *napi, int budget)
773784
{
774785
struct bcm_sysport_tx_ring *ring =
@@ -1252,7 +1263,7 @@ static void bcm_sysport_fini_tx_ring(struct bcm_sysport_priv *priv,
12521263
napi_disable(&ring->napi);
12531264
netif_napi_del(&ring->napi);
12541265

1255-
bcm_sysport_tx_reclaim(priv, ring);
1266+
bcm_sysport_tx_clean(priv, ring);
12561267

12571268
kfree(ring->cbs);
12581269
ring->cbs = NULL;

0 commit comments

Comments
 (0)