mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
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. Differential Revision: https://reviews.freebsd.org/D2081
This commit is contained in:
parent
1cc8febf4c
commit
a411fe4e80
5 changed files with 5 additions and 149 deletions
|
|
@ -330,19 +330,8 @@ sfxge_ifnet_init(struct ifnet *ifp, struct sfxge_softc *sc)
|
|||
|
||||
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
|
||||
|
||||
ifp->if_get_counter = sfxge_get_counter;
|
||||
|
||||
|
|
|
|||
|
|
@ -67,12 +67,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
|
||||
|
|
@ -243,11 +237,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;
|
||||
|
||||
|
|
@ -255,11 +245,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;
|
||||
|
|
|
|||
|
|
@ -330,14 +330,12 @@ sfxge_rx_deliver(struct sfxge_softc *sc, struct sfxge_rx_sw_desc *rx_desc)
|
|||
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_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE);
|
||||
}
|
||||
#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;
|
||||
|
|
@ -386,10 +384,9 @@ sfxge_lro_deliver(struct sfxge_lro_state *st, struct sfxge_lro_conn *c)
|
|||
memcpy(c_th + 1, c->th_last + 1, optlen);
|
||||
}
|
||||
|
||||
#ifdef SFXGE_HAVE_MQ
|
||||
m->m_pkthdr.flowid = c->conn_hash;
|
||||
M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE);
|
||||
#endif
|
||||
|
||||
m->m_pkthdr.csum_flags = csum_flags;
|
||||
__sfxge_rx_deliver(sc, m);
|
||||
|
||||
|
|
|
|||
|
|
@ -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_put_max, CTLFLAG_RDTUN,
|
|||
&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, struct sfxge_evq *evq)
|
|||
}
|
||||
}
|
||||
|
||||
#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 *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.
|
||||
*/
|
||||
|
|
@ -709,88 +700,6 @@ sfxge_if_transmit(struct ifnet *ifp, struct mbuf *m)
|
|||
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.
|
||||
|
|
@ -1379,9 +1288,7 @@ sfxge_tx_qfini(struct sfxge_softc *sc, unsigned int index)
|
|||
|
||||
sc->txq[index] = NULL;
|
||||
|
||||
#ifdef SFXGE_HAVE_MQ
|
||||
SFXGE_TXQ_LOCK_DESTROY(txq);
|
||||
#endif
|
||||
|
||||
free(txq, M_SFXGE);
|
||||
}
|
||||
|
|
@ -1395,10 +1302,8 @@ sfxge_tx_qinit(struct sfxge_softc *sc, unsigned int txq_index,
|
|||
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;
|
||||
|
|
@ -1457,7 +1362,6 @@ sfxge_tx_qinit(struct sfxge_softc *sc, unsigned int txq_index,
|
|||
(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);
|
||||
|
|
@ -1507,7 +1411,6 @@ sfxge_tx_qinit(struct sfxge_softc *sc, unsigned int txq_index,
|
|||
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;
|
||||
|
|
@ -1637,11 +1540,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),
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
@ -227,11 +217,7 @@ extern int sfxge_tx_start(struct sfxge_softc *sc);
|
|||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue