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.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8950
This commit is contained in:
Andrew Rybchenko 2016-12-29 07:00:26 +00:00
parent d5a0c7e00a
commit dae5708683
3 changed files with 20 additions and 13 deletions

View File

@ -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);

View File

@ -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));
}

View File

@ -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 @@ 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);
}
/*