Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Dec 2016 07:00:27 +0000 (UTC)
From:      Andrew Rybchenko <arybchik@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r310752 - in head/sys/dev/sfxge: . common
Message-ID:  <201612290700.uBT70RKa050694@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arybchik
Date: Thu Dec 29 07:00:26 2016
New Revision: 310752
URL: https://svnweb.freebsd.org/changeset/base/310752

Log:
  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

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_rx.c
  head/sys/dev/sfxge/sfxge_rx.c

Modified: head/sys/dev/sfxge/common/efx.h
==============================================================================
--- head/sys/dev/sfxge/common/efx.h	Thu Dec 29 06:59:24 2016	(r310751)
+++ head/sys/dev/sfxge/common/efx.h	Thu Dec 29 07:00:26 2016	(r310752)
@@ -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);
 

Modified: head/sys/dev/sfxge/common/efx_rx.c
==============================================================================
--- head/sys/dev/sfxge/common/efx_rx.c	Thu Dec 29 06:59:24 2016	(r310751)
+++ head/sys/dev/sfxge/common/efx_rx.c	Thu Dec 29 07:00:26 2016	(r310752)
@@ -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));
 }

Modified: head/sys/dev/sfxge/sfxge_rx.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_rx.c	Thu Dec 29 06:59:24 2016	(r310751)
+++ head/sys/dev/sfxge/sfxge_rx.c	Thu Dec 29 07:00:26 2016	(r310752)
@@ -330,8 +330,9 @@ static void __sfxge_rx_deliver(struct sf
 }
 
 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,
 
 	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_
 	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 *rx
 	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 
 	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_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
 		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
 			     (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);
 	}
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612290700.uBT70RKa050694>