about if_arge.c

Mori Hiroki yamori813 at yahoo.co.jp
Thu Feb 11 04:48:12 UTC 2016


I make AR2315 ethercode. I refer if_arge.c and I have idea.

Current code is here.

                if (sc->arge_hw_flags & ARGE_HW_FLG_RX_DESC_ALIGN_4BYTE)
                        arge_fixup_rx(m);

                m->m_pkthdr.rcvif = ifp;
                /* Skip 4 bytes of CRC */
                m->m_pkthdr.len = m->m_len = packet_len - ETHER_CRC_LEN;


I think better set m_len before arge_fixup_rx(). 
This is only copy packet length at arge_fixup_rx().

                /* Skip 4 bytes of CRC */
                m->m_pkthdr.len = m->m_len = packet_len - ETHER_CRC_LEN;                                 if (sc->arge_hw_flags & ARGE_HW_FLG_RX_DESC_ALIGN_4BYTE)
                        arge_fixup_rx(m);

                m->m_pkthdr.rcvif = ifp;

And

        if (sc->arge_hw_flags & ARGE_HW_FLG_RX_DESC_ALIGN_4BYTE)
                m_adj(m, sizeof(uint64_t));

I think not need uint64_t(8byte) only tcp header 2 byte(ETHER_ALIGN) shift. 

        if (sc->arge_hw_flags & ARGE_HW_FLG_RX_DESC_ALIGN_4BYTE)
                m_adj(m, sizeof(uint32_t));

Regards.

Hiroki Mori



More information about the freebsd-mips mailing list