DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [Patch] Eth Driver: Optimization for improved NIC processing rates
@ 2015-10-27 20:56 Polehn, Mike A
  2015-10-28 10:44 ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Polehn, Mike A @ 2015-10-27 20:56 UTC (permalink / raw)
  To: dev

Prefetch of interface access variables while calling into driver RX and TX subroutines.

For converging zero loss packet task tests, a small drop in latency for zero loss measurements 
and small drop in lost packet counts for the lossy measurement points was observed, 
indicating some savings of execution clock cycles.

Signed-off-by: Mike A. Polehn <mike.a.polehn@intel.com>

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 8a8c82b..09f1069 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -2357,11 +2357,15 @@ rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
 		 struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
 {
 	struct rte_eth_dev *dev;
+	void *rxq;
 
 	dev = &rte_eth_devices[port_id];
 
-	int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
-			rx_pkts, nb_pkts);
+	/* rxq is going to be immediately used, prefetch it */
+	rxq = dev->data->rx_queues[queue_id];
+	rte_prefetch0(rxq);
+
+	int16_t nb_rx = (*dev->rx_pkt_burst)(rxq, rx_pkts, nb_pkts);
 
 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
 	struct rte_eth_rxtx_callback *cb = dev->post_rx_burst_cbs[queue_id];
@@ -2499,6 +2503,7 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
 		 struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
 	struct rte_eth_dev *dev;
+	void *txq;
 
 	dev = &rte_eth_devices[port_id];
 
@@ -2514,7 +2519,11 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
 	}
 #endif
 
-	return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, nb_pkts);
+	/* txq is going to be immediately used, prefetch it */
+	txq = dev->data->tx_queues[queue_id];
+	rte_prefetch0(txq);
+
+	return (*dev->tx_pkt_burst)(txq, tx_pkts, nb_pkts);
 }
 #endif

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-28 21:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-27 20:56 [dpdk-dev] [Patch] Eth Driver: Optimization for improved NIC processing rates Polehn, Mike A
2015-10-28 10:44 ` Bruce Richardson
2015-10-28 21:27   ` Polehn, Mike A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).