diff options
author | arybchik <arybchik@FreeBSD.org> | 2017-01-01 19:13:53 +0000 |
---|---|---|
committer | arybchik <arybchik@FreeBSD.org> | 2017-01-01 19:13:53 +0000 |
commit | 64deceef7c3cc60ebbd86849597f776bce9471e2 (patch) | |
tree | 50b3fe3e6e12e8f30f5f98401f2826060cae13c9 /sys/dev/sfxge | |
parent | 4a2712cfe22832cc2bc4da5b21991c707dae246a (diff) | |
download | FreeBSD-src-64deceef7c3cc60ebbd86849597f776bce9471e2.zip FreeBSD-src-64deceef7c3cc60ebbd86849597f776bce9471e2.tar.gz |
MFC r310752
sfxge(4): allow to have no NIC handle on Rx datapath in DPDK PMD
It is required to minimize RxQ context in the driver or avoid chaising
for the NIC handle in adapter (global per-interface) structure.
Sponsored by: Solarflare Communications, Inc.
Diffstat (limited to 'sys/dev/sfxge')
-rw-r--r-- | sys/dev/sfxge/common/efx.h | 4 | ||||
-rw-r--r-- | sys/dev/sfxge/common/efx_rx.c | 10 | ||||
-rw-r--r-- | sys/dev/sfxge/sfxge_rx.c | 19 |
3 files changed, 20 insertions, 13 deletions
diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index 32e8344..cdc956b 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -1921,7 +1921,7 @@ efx_rx_scale_key_set( extern __checkReturn uint32_t efx_psuedo_hdr_hash_get( - __in efx_nic_t *enp, + __in efx_rxq_t *erp, __in efx_rx_hash_alg_t func, __in uint8_t *buffer); @@ -1929,7 +1929,7 @@ efx_psuedo_hdr_hash_get( extern __checkReturn efx_rc_t efx_psuedo_hdr_pkt_length_get( - __in efx_nic_t *enp, + __in efx_rxq_t *erp, __in uint8_t *buffer, __out uint16_t *pkt_lengthp); diff --git a/sys/dev/sfxge/common/efx_rx.c b/sys/dev/sfxge/common/efx_rx.c index 4a3b76e..cc43aef 100644 --- a/sys/dev/sfxge/common/efx_rx.c +++ b/sys/dev/sfxge/common/efx_rx.c @@ -541,24 +541,30 @@ efx_rx_qdestroy( __checkReturn efx_rc_t efx_psuedo_hdr_pkt_length_get( - __in efx_nic_t *enp, + __in efx_rxq_t *erp, __in uint8_t *buffer, __out uint16_t *lengthp) { + efx_nic_t *enp = erp->er_enp; const efx_rx_ops_t *erxop = enp->en_erxop; + EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC); + return (erxop->erxo_prefix_pktlen(enp, buffer, lengthp)); } #if EFSYS_OPT_RX_SCALE __checkReturn uint32_t efx_psuedo_hdr_hash_get( - __in efx_nic_t *enp, + __in efx_rxq_t *erp, __in efx_rx_hash_alg_t func, __in uint8_t *buffer) { + efx_nic_t *enp = erp->er_enp; const efx_rx_ops_t *erxop = enp->en_erxop; + EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC); + EFSYS_ASSERT3U(enp->en_hash_support, ==, EFX_RX_HASH_AVAILABLE); return (erxop->erxo_prefix_hash(enp, func, buffer)); } diff --git a/sys/dev/sfxge/sfxge_rx.c b/sys/dev/sfxge/sfxge_rx.c index 643d071..cd38281 100644 --- a/sys/dev/sfxge/sfxge_rx.c +++ b/sys/dev/sfxge/sfxge_rx.c @@ -330,8 +330,9 @@ static void __sfxge_rx_deliver(struct sfxge_softc *sc, struct mbuf *m) } static void -sfxge_rx_deliver(struct sfxge_softc *sc, struct sfxge_rx_sw_desc *rx_desc) +sfxge_rx_deliver(struct sfxge_rxq *rxq, struct sfxge_rx_sw_desc *rx_desc) { + struct sfxge_softc *sc = rxq->sc; struct mbuf *m = rx_desc->mbuf; int flags = rx_desc->flags; int csum_flags; @@ -344,7 +345,7 @@ sfxge_rx_deliver(struct sfxge_softc *sc, struct sfxge_rx_sw_desc *rx_desc) if (flags & (EFX_PKT_IPV4 | EFX_PKT_IPV6)) { m->m_pkthdr.flowid = - efx_psuedo_hdr_hash_get(sc->enp, + efx_psuedo_hdr_hash_get(rxq->common, EFX_RX_HASHALG_TOEPLITZ, mtod(m, uint8_t *)); /* The hash covers a 4-tuple for TCP only */ @@ -423,7 +424,7 @@ static void sfxge_lro_drop(struct sfxge_rxq *rxq, struct sfxge_lro_conn *c) KASSERT(!c->mbuf, ("found orphaned mbuf")); if (c->next_buf.mbuf != NULL) { - sfxge_rx_deliver(rxq->sc, &c->next_buf); + sfxge_rx_deliver(rxq, &c->next_buf); LIST_REMOVE(c, active_link); } @@ -618,7 +619,7 @@ sfxge_lro_try_merge(struct sfxge_rxq *rxq, struct sfxge_lro_conn *c) return (1); deliver_buf_out: - sfxge_rx_deliver(rxq->sc, rx_buf); + sfxge_rx_deliver(rxq, rx_buf); return (1); } @@ -679,7 +680,7 @@ sfxge_lro(struct sfxge_rxq *rxq, struct sfxge_rx_sw_desc *rx_buf) unsigned bucket; /* Get the hardware hash */ - conn_hash = efx_psuedo_hdr_hash_get(sc->enp, + conn_hash = efx_psuedo_hdr_hash_get(rxq->common, EFX_RX_HASHALG_TOEPLITZ, mtod(m, uint8_t *)); @@ -765,7 +766,7 @@ sfxge_lro(struct sfxge_rxq *rxq, struct sfxge_rx_sw_desc *rx_buf) sfxge_lro_new_conn(&rxq->lro, conn_hash, l2_id, nh, th); deliver_now: - sfxge_rx_deliver(sc, rx_buf); + sfxge_rx_deliver(rxq, rx_buf); } static void sfxge_lro_end_of_burst(struct sfxge_rxq *rxq) @@ -842,7 +843,7 @@ sfxge_rx_qcomplete(struct sfxge_rxq *rxq, boolean_t eop) if (rx_desc->flags & EFX_PKT_PREFIX_LEN) { uint16_t tmp_size; int rc; - rc = efx_psuedo_hdr_pkt_length_get(sc->enp, + rc = efx_psuedo_hdr_pkt_length_get(rxq->common, mtod(m, uint8_t *), &tmp_size); KASSERT(rc == 0, ("cannot get packet length: %d", rc)); @@ -891,7 +892,7 @@ sfxge_rx_qcomplete(struct sfxge_rxq *rxq, boolean_t eop) (EFX_PKT_TCP | EFX_CKSUM_TCPUDP))) sfxge_lro(rxq, prev); else - sfxge_rx_deliver(sc, prev); + sfxge_rx_deliver(rxq, prev); } prev = rx_desc; continue; @@ -912,7 +913,7 @@ discard: (EFX_PKT_TCP | EFX_CKSUM_TCPUDP))) sfxge_lro(rxq, prev); else - sfxge_rx_deliver(sc, prev); + sfxge_rx_deliver(rxq, prev); } /* |