bnx: Rearrange the code to check the spare TX descripors first
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 8 Aug 2012 08:11:11 +0000 (16:11 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 8 Aug 2012 08:11:11 +0000 (16:11 +0800)
While im here, remove the useless fragmentation checksum code, which
is never supported by this driver

sys/dev/netif/bnx/if_bnx.c

index b14cc3f..acaa38b 100644 (file)
@@ -2955,46 +2955,22 @@ bnx_start(struct ifnet *ifp)
 
        need_trans = 0;
        while (sc->bnx_cdata.bnx_tx_chain[prodidx] == NULL) {
 
        need_trans = 0;
        while (sc->bnx_cdata.bnx_tx_chain[prodidx] == NULL) {
-               m_head = ifq_dequeue(&ifp->if_snd, NULL);
-               if (m_head == NULL)
-                       break;
-
-               /*
-                * XXX
-                * The code inside the if() block is never reached since we
-                * must mark CSUM_IP_FRAGS in our if_hwassist to start getting
-                * requests to checksum TCP/UDP in a fragmented packet.
-                * 
-                * XXX
-                * safety overkill.  If this is a fragmented packet chain
-                * with delayed TCP/UDP checksums, then only encapsulate
-                * it if we have enough descriptors to handle the entire
-                * chain at once.
-                * (paranoia -- may not actually be needed)
-                */
-               if ((m_head->m_flags & M_FIRSTFRAG) &&
-                   (m_head->m_pkthdr.csum_flags & CSUM_DELAY_DATA)) {
-                       if ((BGE_TX_RING_CNT - sc->bnx_txcnt) <
-                           m_head->m_pkthdr.csum_data + BNX_NSEG_RSVD) {
-                               ifp->if_flags |= IFF_OACTIVE;
-                               ifq_prepend(&ifp->if_snd, m_head);
-                               break;
-                       }
-               }
-
                /*
                 * Sanity check: avoid coming within BGE_NSEG_RSVD
                 * descriptors of the end of the ring.  Also make
                 * sure there are BGE_NSEG_SPARE descriptors for
                /*
                 * Sanity check: avoid coming within BGE_NSEG_RSVD
                 * descriptors of the end of the ring.  Also make
                 * sure there are BGE_NSEG_SPARE descriptors for
-                * jumbo buffers' defragmentation.
+                * jumbo buffers' or TSO segments' defragmentation.
                 */
                if ((BGE_TX_RING_CNT - sc->bnx_txcnt) <
                    (BNX_NSEG_RSVD + BNX_NSEG_SPARE)) {
                        ifp->if_flags |= IFF_OACTIVE;
                 */
                if ((BGE_TX_RING_CNT - sc->bnx_txcnt) <
                    (BNX_NSEG_RSVD + BNX_NSEG_SPARE)) {
                        ifp->if_flags |= IFF_OACTIVE;
-                       ifq_prepend(&ifp->if_snd, m_head);
                        break;
                }
 
                        break;
                }
 
+               m_head = ifq_dequeue(&ifp->if_snd, NULL);
+               if (m_head == NULL)
+                       break;
+
                /*
                 * Pack the data into the transmit ring. If we
                 * don't have room, set the OACTIVE flag and wait
                /*
                 * Pack the data into the transmit ring. If we
                 * don't have room, set the OACTIVE flag and wait