svn commit: r326004 - head/sys/dev/dpaa
Justin Hibbits
jhibbits at FreeBSD.org
Mon Nov 20 04:32:04 UTC 2017
Author: jhibbits
Date: Mon Nov 20 04:32:01 2017
New Revision: 326004
URL: https://svnweb.freebsd.org/changeset/base/326004
Log:
Eliminate 1 XX_VirtToPhys() and 2 XX_PhysToVirt() calls from if_dtsec(4)
XX_VirtToPhys(), by way of pmap_kextract(), is an expensive operation.
Profiling via dtrace during a series of iperf tests I found 16111 / 30432
stack frames were located in mmu_booke_kextract(), so eliminating this
expensive call should improve performance slightly. XX_PhysToVirt() is not
as expensive, but redundant calls in this context is wasteful.
Modified:
head/sys/dev/dpaa/if_dtsec_rm.c
Modified: head/sys/dev/dpaa/if_dtsec_rm.c
==============================================================================
--- head/sys/dev/dpaa/if_dtsec_rm.c Mon Nov 20 03:40:50 2017 (r326003)
+++ head/sys/dev/dpaa/if_dtsec_rm.c Mon Nov 20 04:32:01 2017 (r326004)
@@ -358,10 +358,12 @@ dtsec_rm_fqr_rx_callback(t_Handle app, t_Handle fqr, t
{
struct dtsec_softc *sc;
struct mbuf *m;
+ void *frame_va;
m = NULL;
sc = app;
+ frame_va = DPAA_FD_GET_ADDR(frame);
KASSERT(DPAA_FD_GET_FORMAT(frame) == e_DPAA_FD_FORMAT_TYPE_SHORT_SBSF,
("%s(): Got unsupported frame format 0x%02X!", __func__,
DPAA_FD_GET_FORMAT(frame)));
@@ -379,8 +381,8 @@ dtsec_rm_fqr_rx_callback(t_Handle app, t_Handle fqr, t
if (m == NULL)
goto err;
- m_extadd(m, DPAA_FD_GET_ADDR(frame), FM_PORT_BUFFER_SIZE,
- dtsec_rm_fqr_mext_free, DPAA_FD_GET_ADDR(frame), sc, 0,
+ m_extadd(m, frame_va, FM_PORT_BUFFER_SIZE,
+ dtsec_rm_fqr_mext_free, frame_va, sc, 0,
EXT_NET_DRV);
m->m_pkthdr.rcvif = sc->sc_ifnet;
@@ -392,7 +394,7 @@ dtsec_rm_fqr_rx_callback(t_Handle app, t_Handle fqr, t
return (e_RX_STORE_RESPONSE_CONTINUE);
err:
- bman_put_buffer(sc->sc_rx_pool, DPAA_FD_GET_ADDR(frame));
+ bman_put_buffer(sc->sc_rx_pool, frame_va);
if (m != NULL)
m_freem(m);
@@ -545,7 +547,6 @@ dtsec_rm_if_start_locked(struct dtsec_softc *sc)
unsigned int qlen, i;
struct mbuf *m0, *m;
vm_offset_t vaddr;
- vm_paddr_t paddr;
t_DpaaFD fd;
DTSEC_LOCK_ASSERT(sc);
@@ -602,8 +603,7 @@ dtsec_rm_if_start_locked(struct dtsec_softc *sc)
dsize = m->m_len;
vaddr = (vm_offset_t)m->m_data;
while (dsize > 0 && i < DPAA_NUM_OF_SG_TABLE_ENTRY) {
- paddr = XX_VirtToPhys((void *)vaddr);
- ssize = PAGE_SIZE - (paddr & PAGE_MASK);
+ ssize = PAGE_SIZE - (vaddr & PAGE_MASK);
if (m->m_len < ssize)
ssize = m->m_len;
More information about the svn-src-all
mailing list