@@ -732,11 +732,8 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
732732 unsigned int c_index , last_c_index , last_tx_cn , num_tx_cbs ;
733733 unsigned int pkts_compl = 0 , bytes_compl = 0 ;
734734 struct bcm_sysport_cb * cb ;
735- struct netdev_queue * txq ;
736735 u32 hw_ind ;
737736
738- txq = netdev_get_tx_queue (ndev , ring -> index );
739-
740737 /* Compute how many descriptors have been processed since last call */
741738 hw_ind = tdma_readl (priv , TDMA_DESC_RING_PROD_CONS_INDEX (ring -> index ));
742739 c_index = (hw_ind >> RING_CONS_INDEX_SHIFT ) & RING_CONS_INDEX_MASK ;
@@ -767,9 +764,6 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
767764
768765 ring -> c_index = c_index ;
769766
770- if (netif_tx_queue_stopped (txq ) && pkts_compl )
771- netif_tx_wake_queue (txq );
772-
773767 netif_dbg (priv , tx_done , ndev ,
774768 "ring=%d c_index=%d pkts_compl=%d, bytes_compl=%d\n" ,
775769 ring -> index , ring -> c_index , pkts_compl , bytes_compl );
@@ -781,16 +775,33 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
781775static unsigned int bcm_sysport_tx_reclaim (struct bcm_sysport_priv * priv ,
782776 struct bcm_sysport_tx_ring * ring )
783777{
778+ struct netdev_queue * txq ;
784779 unsigned int released ;
785780 unsigned long flags ;
786781
782+ txq = netdev_get_tx_queue (priv -> netdev , ring -> index );
783+
787784 spin_lock_irqsave (& ring -> lock , flags );
788785 released = __bcm_sysport_tx_reclaim (priv , ring );
786+ if (released )
787+ netif_tx_wake_queue (txq );
788+
789789 spin_unlock_irqrestore (& ring -> lock , flags );
790790
791791 return released ;
792792}
793793
794+ /* Locked version of the per-ring TX reclaim, but does not wake the queue */
795+ static void bcm_sysport_tx_clean (struct bcm_sysport_priv * priv ,
796+ struct bcm_sysport_tx_ring * ring )
797+ {
798+ unsigned long flags ;
799+
800+ spin_lock_irqsave (& ring -> lock , flags );
801+ __bcm_sysport_tx_reclaim (priv , ring );
802+ spin_unlock_irqrestore (& ring -> lock , flags );
803+ }
804+
794805static int bcm_sysport_tx_poll (struct napi_struct * napi , int budget )
795806{
796807 struct bcm_sysport_tx_ring * ring =
@@ -1275,7 +1286,7 @@ static void bcm_sysport_fini_tx_ring(struct bcm_sysport_priv *priv,
12751286 napi_disable (& ring -> napi );
12761287 netif_napi_del (& ring -> napi );
12771288
1278- bcm_sysport_tx_reclaim (priv , ring );
1289+ bcm_sysport_tx_clean (priv , ring );
12791290
12801291 kfree (ring -> cbs );
12811292 ring -> cbs = NULL ;
0 commit comments