The branch main has been updated by mw:

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

commit cd945dc08a86a0cfd1637335de04e4c4c5bf70d9
Author:     Marcin Wojtas <m...@freebsd.org>
AuthorDate: 2021-04-27 09:00:15 +0000
Commit:     Marcin Wojtas <m...@freebsd.org>
CommitDate: 2021-04-30 10:46:17 +0000

    iflib: Take iri_pad into account when processing small frames
    
    Drivers can specify padding of received frames with iri_pad field.
    This can be used to enforce ip alignment by hardware.
    Iflib ignored that padding when processing small frames,
    which rendered this feature inoperable.
    I found it while writing a driver for a NIC that can ip align
    received packets. Note that this doesn't change behavior of existing
    drivers as they all set iri_pad to 0.
    
    Submitted by: Kornel Duleba <min...@semihalf.com>
    Reviewed by: gallatin
    Obtained from: Semihalf
    Sponsored by: Alstom Group
    Differential Revision: https://reviews.freebsd.org/D30009
---
 sys/net/iflib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index faf58917c96b..01da882f0d12 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -2827,11 +2827,13 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri)
                if (pf_rv == PFIL_PASS) {
                        m_init(m, M_NOWAIT, MT_DATA, M_PKTHDR);
 #ifndef __NO_STRICT_ALIGNMENT
-                       if (!IP_ALIGNED(m))
+                       if (!IP_ALIGNED(m) && ri->iri_pad == 0)
                                m->m_data += 2;
 #endif
                        memcpy(m->m_data, *sd.ifsd_cl, ri->iri_len);
                        m->m_len = ri->iri_frags[0].irf_len;
+                       m->m_data += ri->iri_pad;
+                       ri->iri_len -= ri->iri_pad;
                }
        } else {
                m = assemble_segments(rxq, ri, &sd, &pf_rv);
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to