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

Commit 6044735d authored by Eilon Greenstein's avatar Eilon Greenstein Committed by David S. Miller
Browse files

bnx2x: Reduce the likelihood of smb_mb



As the comment explains, this smb_mb is needed only if the queue is stopped
(which is unlikely) so the barrier can be moved to that location

Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0d1a8d2d
Loading
Loading
Loading
Loading
+8 −7
Original line number Original line Diff line number Diff line
@@ -916,18 +916,19 @@ static void bnx2x_tx_int(struct bnx2x_fastpath *fp, int work)
	fp->tx_pkt_cons = sw_cons;
	fp->tx_pkt_cons = sw_cons;
	fp->tx_bd_cons = bd_cons;
	fp->tx_bd_cons = bd_cons;


	/* Need to make the tx_bd_cons update visible to start_xmit()
	 * before checking for netif_tx_queue_stopped().  Without the
	 * memory barrier, there is a small possibility that start_xmit()
	 * will miss it and cause the queue to be stopped forever.
	 */
	smp_mb();

	/* TBD need a thresh? */
	/* TBD need a thresh? */
	if (unlikely(netif_tx_queue_stopped(txq))) {
	if (unlikely(netif_tx_queue_stopped(txq))) {


		__netif_tx_lock(txq, smp_processor_id());
		__netif_tx_lock(txq, smp_processor_id());


		/* Need to make the tx_bd_cons update visible to start_xmit()
		 * before checking for netif_tx_queue_stopped().  Without the
		 * memory barrier, there is a small possibility that
		 * start_xmit() will miss it and cause the queue to be stopped
		 * forever.
		 */
		smp_mb();

		if ((netif_tx_queue_stopped(txq)) &&
		if ((netif_tx_queue_stopped(txq)) &&
		    (bp->state == BNX2X_STATE_OPEN) &&
		    (bp->state == BNX2X_STATE_OPEN) &&
		    (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3))
		    (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3))