Store virtual address of buffer in mvneta_rx_ring

Now the virtual address of received buffer is taken from a software ring.
Thanks to this, we can use the NETA driver on 64 bits architecture and
avoid 32-bit buf_cookie descriptor field limitation.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12257
This commit is contained in:
mw 2017-09-09 11:49:36 +00:00
parent 365ae18aeb
commit da6ff7cde5
2 changed files with 5 additions and 2 deletions

View File

@ -3008,7 +3008,7 @@ mvneta_rx_queue(struct mvneta_softc *sc, int q, int npkt)
* bytecnt cover MH, PKT, CRC
*/
pktlen = r->bytecnt - ETHER_CRC_LEN - MVNETA_HWHEADER_SIZE;
pktbuf = (uint8_t *)r->bufptr_va + MVNETA_PACKET_OFFSET +
pktbuf = (uint8_t *)rx->rxbuf_virt_addr[rx->dma] + MVNETA_PACKET_OFFSET +
MVNETA_HWHEADER_SIZE;
/* Prefetch mbuf data. */
@ -3135,7 +3135,7 @@ mvneta_rx_queue_refill(struct mvneta_softc *sc, int q)
rxbuf->m = m;
r = &rx->desc[rx->cpu];
r->bufptr_pa = segs.ds_addr;
r->bufptr_va = (uint32_t)m->m_data;
rx->rxbuf_virt_addr[rx->cpu] = m->m_data;
rx->cpu = rx_counter_adv(rx->cpu, 1);
}

View File

@ -118,6 +118,9 @@ struct mvneta_rx_ring {
bus_dmamap_t desc_map;
bus_addr_t desc_pa;
/* Virtual address of the RX buffer */
void *rxbuf_virt_addr[MVNETA_RX_RING_CNT];
/* Managment entries for each of descritors */
struct mvneta_buf rxbuf[MVNETA_RX_RING_CNT];