[Bug 272780] genet: General question of DMA alignment requirement for tx/rx_buf

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 28 Jul 2023 19:47:08 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272780

            Bug ID: 272780
           Summary: genet: General question of DMA alignment requirement
                    for tx/rx_buf
           Product: Base System
           Version: CURRENT
          Hardware: arm
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: jiahali@blackberry.com

Hi,

Is there a DMA alignment requirement for genet driver's TX/RX buffer?

In gen_bus_dma_init(), genet driver requires the TX/RX buffer to be 4 bytes
aligned. However, gen_newbuf_rx() fetches a mbuf cluster, then trims the first
two bytes of the mbuf cluster.

My understanding is that the RX buffer will be 2 bytes aligned but might not be
4 bytes aligned. I understand that the DMA stack will handle this misalignment
using something like a bounce buffer. 

Since there isn't a document for the bcm ethernet controller online, I am
curious about the reason why genet driver does not enforce the allocated mbuf
to be 4 bytes aligned.

In TX, genet driver does not know the starting address of mbuf passed from the
upper layer.

Is it possible that the genet driver is also compatible with other alignment
constraints, like 1, 2, or 32 byte(s)?

Thanks,
Jiahao

-- 
You are receiving this mail because:
You are the assignee for the bug.