Author: arybchik
Date: Wed Mar 25 13:50:38 2015
New Revision: 280606
URL: https://svnweb.freebsd.org/changeset/base/280606

Log:
  MFC: 280376
  
  sfxge: remove obsolete Tx non-multi queue support
  
  Tx multi queue is added in FreeBSD 8.0. So, the changeset drops earlier
  versions support.
  
  Sponsored by:   Solarflare Communications, Inc.
  Original Differential Revision: https://reviews.freebsd.org/D2081

Modified:
  stable/10/sys/dev/sfxge/sfxge.c
  stable/10/sys/dev/sfxge/sfxge.h
  stable/10/sys/dev/sfxge/sfxge_rx.c
  stable/10/sys/dev/sfxge/sfxge_tx.c
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge.c
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge.c     Wed Mar 25 13:48:54 2015        
(r280605)
+++ stable/10/sys/dev/sfxge/sfxge.c     Wed Mar 25 13:50:38 2015        
(r280606)
@@ -329,19 +329,8 @@ sfxge_ifnet_init(struct ifnet *ifp, stru
 
        ether_ifattach(ifp, encp->enc_mac_addr);
 
-#ifdef SFXGE_HAVE_MQ
        ifp->if_transmit = sfxge_if_transmit;
        ifp->if_qflush = sfxge_if_qflush;
-#else
-       ifp->if_start = sfxge_if_start;
-       IFQ_SET_MAXLEN(&ifp->if_snd, sc->txq_entries - 1);
-       ifp->if_snd.ifq_drv_maxlen = sc->txq_entries - 1;
-       IFQ_SET_READY(&ifp->if_snd);
-
-       snprintf(sc->tx_lock_name, sizeof(sc->tx_lock_name),
-                "%s:tx", device_get_nameunit(sc->dev));
-       mtx_init(&sc->tx_lock, sc->tx_lock_name, NULL, MTX_DEF);
-#endif
 
        if ((rc = sfxge_port_ifmedia_init(sc)) != 0)
                goto fail;

Modified: stable/10/sys/dev/sfxge/sfxge.h
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge.h     Wed Mar 25 13:48:54 2015        
(r280605)
+++ stable/10/sys/dev/sfxge/sfxge.h     Wed Mar 25 13:50:38 2015        
(r280606)
@@ -66,12 +66,6 @@
 #ifndef IFM_10G_KX4
 #define        IFM_10G_KX4 IFM_10G_CX4
 #endif
-#if __FreeBSD_version >= 800054
-/* Networking core is multiqueue aware. We can manage our own TX
- * queues and use m_pkthdr.flowid.
- */
-#define        SFXGE_HAVE_MQ
-#endif
 #if (__FreeBSD_version >= 800501 && __FreeBSD_version < 900000) || \
        __FreeBSD_version >= 900003
 #define        SFXGE_HAVE_DESCRIBE_INTR
@@ -242,11 +236,7 @@ struct sfxge_softc {
        struct sfxge_rxq                *rxq[SFXGE_RX_SCALE_MAX];
        unsigned int                    rx_indir_table[SFXGE_RX_SCALE_MAX];
 
-#ifdef SFXGE_HAVE_MQ
        struct sfxge_txq                *txq[SFXGE_TXQ_NTYPES + 
SFXGE_RX_SCALE_MAX];
-#else
-       struct sfxge_txq                *txq[SFXGE_TXQ_NTYPES];
-#endif
 
        struct ifmedia                  media;
 
@@ -254,11 +244,6 @@ struct sfxge_softc {
        size_t                          rx_buffer_size;
        uma_zone_t                      rx_buffer_zone;
 
-#ifndef SFXGE_HAVE_MQ
-       struct mtx                      tx_lock __aligned(CACHE_LINE_SIZE);
-       char                            tx_lock_name[SFXGE_LOCK_NAME_MAX];
-#endif
-
        unsigned int                    evq_count;
        unsigned int                    rxq_count;
        unsigned int                    txq_count;

Modified: stable/10/sys/dev/sfxge/sfxge_rx.c
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge_rx.c  Wed Mar 25 13:48:54 2015        
(r280605)
+++ stable/10/sys/dev/sfxge/sfxge_rx.c  Wed Mar 25 13:50:38 2015        
(r280606)
@@ -326,14 +326,12 @@ sfxge_rx_deliver(struct sfxge_softc *sc,
        if (rx_desc->flags & EFX_CKSUM_TCPUDP)
                csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
 
-#ifdef SFXGE_HAVE_MQ
        /* The hash covers a 4-tuple for TCP only */
        if (rx_desc->flags & EFX_PKT_TCP) {
                m->m_pkthdr.flowid = EFX_RX_HASH_VALUE(EFX_RX_HASHALG_TOEPLITZ,
                                                       mtod(m, uint8_t *));
                m->m_flags |= M_FLOWID;
        }
-#endif
        m->m_data += sc->rx_prefix_size;
        m->m_len = rx_desc->size - sc->rx_prefix_size;
        m->m_pkthdr.len = m->m_len;
@@ -380,10 +378,9 @@ sfxge_lro_deliver(struct sfxge_lro_state
                memcpy(c_th + 1, c->th_last + 1, optlen);
        }
 
-#ifdef SFXGE_HAVE_MQ
        m->m_pkthdr.flowid = c->conn_hash;
        m->m_flags |= M_FLOWID;
-#endif
+
        m->m_pkthdr.csum_flags = csum_flags;
        __sfxge_rx_deliver(sc, m);
 

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:48:54 2015        
(r280605)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:50:38 2015        
(r280606)
@@ -84,7 +84,6 @@ __FBSDID("$FreeBSD$");
 #define        SFXGE_TXQ_BLOCK_LEVEL(_entries)                                 
\
        (EFX_TXQ_LIMIT(_entries) - SFXGE_TSO_MAX_DESC)
 
-#ifdef SFXGE_HAVE_MQ
 
 #define        SFXGE_PARAM_TX_DPL_GET_MAX      SFXGE_PARAM(tx_dpl_get_max)
 static int sfxge_tx_dpl_get_max = SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT;
@@ -109,8 +108,6 @@ SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_dpl_p
           &sfxge_tx_dpl_put_max, 0,
           "Maximum number of any packets in deferred packet put-list");
 
-#endif
-
 
 /* Forward declarations. */
 static void sfxge_tx_qdpl_service(struct sfxge_txq *txq);
@@ -160,8 +157,6 @@ sfxge_tx_qcomplete(struct sfxge_txq *txq
        }
 }
 
-#ifdef SFXGE_HAVE_MQ
-
 static unsigned int
 sfxge_is_mbuf_non_tcp(struct mbuf *mbuf)
 {
@@ -225,8 +220,6 @@ sfxge_tx_qdpl_swizzle(struct sfxge_txq *
        stdp->std_get_non_tcp_count += non_tcp_count;
 }
 
-#endif /* SFXGE_HAVE_MQ */
-
 static void
 sfxge_tx_qreap(struct sfxge_txq *txq)
 {
@@ -401,8 +394,6 @@ reject:
        return (rc);
 }
 
-#ifdef SFXGE_HAVE_MQ
-
 /*
  * Drain the deferred packet list into the transmit queue.
  */
@@ -708,88 +699,6 @@ sfxge_if_transmit(struct ifnet *ifp, str
        return (rc);
 }
 
-#else /* !SFXGE_HAVE_MQ */
-
-static void sfxge_if_start_locked(struct ifnet *ifp)
-{
-       struct sfxge_softc *sc = ifp->if_softc;
-       struct sfxge_txq *txq;
-       struct mbuf *mbuf;
-       unsigned int pushed[SFXGE_TXQ_NTYPES];
-       unsigned int q_index;
-
-       if ((ifp->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) !=
-           IFF_DRV_RUNNING)
-               return;
-
-       if (!sc->port.link_up)
-               return;
-
-       for (q_index = 0; q_index < SFXGE_TXQ_NTYPES; q_index++) {
-               txq = sc->txq[q_index];
-               pushed[q_index] = txq->added;
-       }
-
-       while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
-               IFQ_DRV_DEQUEUE(&ifp->if_snd, mbuf);
-               if (mbuf == NULL)
-                       break;
-
-               ETHER_BPF_MTAP(ifp, mbuf); /* packet capture */
-
-               /* Pick the desired transmit queue. */
-               if (mbuf->m_pkthdr.csum_flags & (CSUM_DELAY_DATA | CSUM_TSO))
-                       q_index = SFXGE_TXQ_IP_TCP_UDP_CKSUM;
-               else if (mbuf->m_pkthdr.csum_flags & CSUM_DELAY_IP)
-                       q_index = SFXGE_TXQ_IP_CKSUM;
-               else
-                       q_index = SFXGE_TXQ_NON_CKSUM;
-               txq = sc->txq[q_index];
-
-               if (sfxge_tx_queue_mbuf(txq, mbuf) != 0)
-                       continue;
-
-               if (txq->blocked) {
-                       ifp->if_drv_flags |= IFF_DRV_OACTIVE;
-                       break;
-               }
-
-               /* Push the fragments to the hardware in batches. */
-               if (txq->added - pushed[q_index] >= SFXGE_TX_BATCH) {
-                       efx_tx_qpush(txq->common, txq->added);
-                       pushed[q_index] = txq->added;
-               }
-       }
-
-       for (q_index = 0; q_index < SFXGE_TXQ_NTYPES; q_index++) {
-               txq = sc->txq[q_index];
-               if (txq->added != pushed[q_index])
-                       efx_tx_qpush(txq->common, txq->added);
-       }
-}
-
-void sfxge_if_start(struct ifnet *ifp)
-{
-       struct sfxge_softc *sc = ifp->if_softc;
-
-       SFXGE_TXQ_LOCK(sc->txq[0]);
-       sfxge_if_start_locked(ifp);
-       SFXGE_TXQ_UNLOCK(sc->txq[0]);
-}
-
-static void
-sfxge_tx_qdpl_service(struct sfxge_txq *txq)
-{
-       struct ifnet *ifp = txq->sc->ifnet;
-
-       SFXGE_TXQ_LOCK_ASSERT_OWNED(txq);
-       ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-       sfxge_if_start_locked(ifp);
-       SFXGE_TXQ_UNLOCK(txq);
-}
-
-#endif /* SFXGE_HAVE_MQ */
-
 /*
  * Software "TSO".  Not quite as good as doing it in hardware, but
  * still faster than segmenting in the stack.
@@ -1378,9 +1287,7 @@ sfxge_tx_qfini(struct sfxge_softc *sc, u
 
        sc->txq[index] = NULL;
 
-#ifdef SFXGE_HAVE_MQ
        SFXGE_TXQ_LOCK_DESTROY(txq);
-#endif
 
        free(txq, M_SFXGE);
 }
@@ -1394,10 +1301,8 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
        struct sysctl_oid *txq_node;
        struct sfxge_txq *txq;
        struct sfxge_evq *evq;
-#ifdef SFXGE_HAVE_MQ
        struct sfxge_tx_dpl *stdp;
        struct sysctl_oid *dpl_node;
-#endif
        efsys_mem_t *esmp;
        unsigned int nmaps;
        int rc;
@@ -1456,7 +1361,6 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
            (rc = tso_init(txq)) != 0)
                goto fail3;
 
-#ifdef SFXGE_HAVE_MQ
        if (sfxge_tx_dpl_get_max <= 0) {
                log(LOG_ERR, "%s=%d must be greater than 0",
                    SFXGE_PARAM_TX_DPL_GET_MAX, sfxge_tx_dpl_get_max);
@@ -1506,7 +1410,6 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
        SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(dpl_node), OID_AUTO,
                        "put_hiwat", CTLFLAG_RD | CTLFLAG_STATS,
                        &stdp->std_put_hiwat, 0, "");
-#endif
 
        txq->type = type;
        txq->evq_index = evq_index;
@@ -1613,11 +1516,7 @@ sfxge_tx_init(struct sfxge_softc *sc)
        KASSERT(intr->state == SFXGE_INTR_INITIALIZED,
            ("intr->state != SFXGE_INTR_INITIALIZED"));
 
-#ifdef SFXGE_HAVE_MQ
        sc->txq_count = SFXGE_TXQ_NTYPES - 1 + sc->intr.n_alloc;
-#else
-       sc->txq_count = SFXGE_TXQ_NTYPES;
-#endif
 
        sc->txqs_node = SYSCTL_ADD_NODE(
                device_get_sysctl_ctx(sc->dev),

Modified: stable/10/sys/dev/sfxge/sfxge_tx.h
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 13:48:54 2015        
(r280605)
+++ stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 13:50:38 2015        
(r280606)
@@ -128,12 +128,6 @@ enum sfxge_txq_type {
 
 #define        SFXGE_TX_BATCH  64
 
-#ifdef SFXGE_HAVE_MQ
-#define        SFXGE_TX_LOCK(txq)              (&(txq)->lock)
-#else
-#define        SFXGE_TX_LOCK(txq)              (&(txq)->sc->tx_lock)
-#endif
-
 #define        SFXGE_TXQ_LOCK_INIT(_txq, _ifname, _txq_index)                  
\
        do {                                                            \
                struct sfxge_txq  *__txq = (_txq);                      \
@@ -147,13 +141,13 @@ enum sfxge_txq_type {
 #define        SFXGE_TXQ_LOCK_DESTROY(_txq)                                    
\
        mtx_destroy(&(_txq)->lock)
 #define        SFXGE_TXQ_LOCK(_txq)                                            
\
-       mtx_lock(SFXGE_TX_LOCK(_txq))
+       mtx_lock(&(_txq)->lock)
 #define        SFXGE_TXQ_TRYLOCK(_txq)                                         
\
-       mtx_trylock(SFXGE_TX_LOCK(_txq))
+       mtx_trylock(&(_txq)->lock)
 #define        SFXGE_TXQ_UNLOCK(_txq)                                          
\
-       mtx_unlock(SFXGE_TX_LOCK(_txq))
+       mtx_unlock(&(_txq)->lock)
 #define        SFXGE_TXQ_LOCK_ASSERT_OWNED(_txq)                               
\
-       mtx_assert(SFXGE_TX_LOCK(_txq), MA_OWNED)
+       mtx_assert(&(_txq)->lock, MA_OWNED)
 
 
 struct sfxge_txq {
@@ -186,13 +180,9 @@ struct sfxge_txq {
        /* The following fields change more often, and are used mostly
         * on the initiation path
         */
-#ifdef SFXGE_HAVE_MQ
        struct mtx                      lock __aligned(CACHE_LINE_SIZE);
        struct sfxge_tx_dpl             dpl;    /* Deferred packet list. */
        unsigned int                    n_pend_desc;
-#else
-       unsigned int                    n_pend_desc __aligned(CACHE_LINE_SIZE);
-#endif
        unsigned int                    added;
        unsigned int                    reaped;
        /* Statistics */
@@ -226,11 +216,7 @@ extern int sfxge_tx_start(struct sfxge_s
 extern void sfxge_tx_stop(struct sfxge_softc *sc);
 extern void sfxge_tx_qcomplete(struct sfxge_txq *txq, struct sfxge_evq *evq);
 extern void sfxge_tx_qflush_done(struct sfxge_txq *txq);
-#ifdef SFXGE_HAVE_MQ
 extern void sfxge_if_qflush(struct ifnet *ifp);
 extern int sfxge_if_transmit(struct ifnet *ifp, struct mbuf *m);
-#else
-extern void sfxge_if_start(struct ifnet *ifp);
-#endif
 
 #endif
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to