The branch main has been updated by tuexen:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=f8ddf74175c8013268e65b18750e247306fa088a

commit f8ddf74175c8013268e65b18750e247306fa088a
Author:     Michael Tuexen <[email protected]>
AuthorDate: 2026-01-16 11:02:53 +0000
Commit:     Michael Tuexen <[email protected]>
CommitDate: 2026-01-16 11:02:53 +0000

    dwc: improve IPv4 transmit checksum offloading
    
    This patch provides two improvements for TCP/IPv4 and UDP/IPv4
    transmit checksum offloading:
    (1) Use *CIC_SEG instead of *CIC_FULL, since FreeBSD always provides
        a pseudo header checksum.
    (2) Don't make transmit IPv4 header checksum offloading a prerequisite
        for TCP/IPv4 or UDP/IPv4 transmit checksum offloading.
    This is the root cause of PR 291696, since right now the epair
    interface does not support transmit IPv4 header checksum offloading,
    but TCP/IPv4 and UDP/IPv4 transmit checksum offloading.
    
    PR:                     291696
    Reviewed by:            Timo Voelker
    Tested by:              Marek Benc
    MFC after:              3 days
    Differential Revision:  https://reviews.freebsd.org/D54395
---
 sys/dev/dwc/dwc1000_dma.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c
index 44b9f0d114bf..8cc145216c2d 100644
--- a/sys/dev/dwc/dwc1000_dma.c
+++ b/sys/dev/dwc/dwc1000_dma.c
@@ -248,7 +248,7 @@ dma1000_setup_txbuf(struct dwc_softc *sc, int idx, struct 
mbuf **mp)
        struct bus_dma_segment segs[TX_MAP_MAX_SEGS];
        int error, nsegs;
        struct mbuf * m;
-       uint32_t flags = 0;
+       uint32_t flags;
        int i;
        int last;
 
@@ -276,19 +276,12 @@ dma1000_setup_txbuf(struct dwc_softc *sc, int idx, struct 
mbuf **mp)
 
        m = *mp;
 
-       if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0) {
-               if ((m->m_pkthdr.csum_flags & (CSUM_TCP|CSUM_UDP)) != 0) {
-                       if (!sc->dma_ext_desc)
-                               flags = NTDESC1_CIC_FULL;
-                       else
-                               flags = ETDESC0_CIC_FULL;
-               } else {
-                       if (!sc->dma_ext_desc)
-                               flags = NTDESC1_CIC_HDR;
-                       else
-                               flags = ETDESC0_CIC_HDR;
-               }
-       }
+       if ((m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) != 0)
+               flags = sc->dma_ext_desc ? ETDESC0_CIC_SEG : NTDESC1_CIC_SEG;
+       else if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0)
+               flags = sc->dma_ext_desc ? ETDESC0_CIC_HDR : NTDESC1_CIC_HDR;
+       else
+               flags = sc->dma_ext_desc ? ETDESC0_CIC_NONE : NTDESC1_CIC_NONE;
 
        bus_dmamap_sync(sc->txbuf_tag, sc->txbuf_map[idx].map,
            BUS_DMASYNC_PREWRITE);

Reply via email to