Port-sparc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: hme(4) hardware RX checksum



christos%astron.com@localhost wrote:

> >In hme.c:hme_get(), m_pkthdr.csum_flags is always cleared after
> >a goto label, so hardware RX checksum on hme(4) seems unused at all.
> >(no one has checked hwcsum stats by options TCP_CSUM_COUNTERS etc?)
> >
> >There is also a wrong pointer arith in VLAN case.
> >
> >Is it okay to commit this fix?
> 
> Please do!

Now I notice gem.c has the similar code and hme.c needs to
have one more `else' for swcsum cases. Which is better?

Index: hme.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/hme.c,v
retrieving revision 1.68
diff -u -r1.68 hme.c
--- hme.c       16 Dec 2008 22:35:31 -0000      1.68
+++ hme.c       6 Mar 2009 17:45:55 -0000
@@ -836,7 +836,7 @@
                }
 
                m0->m_pkthdr.csum_flags |= M_CSUM_DATA | M_CSUM_NO_PSEUDOHDR;
-       }
+       } else
 swcsum:
                m0->m_pkthdr.csum_flags = 0;
 #endif


BTW, does hardware checksum work even for VLAN packets?

At least it looks wrong to check sc_ethercom.ec_capenable
without checking eh->ether_type == ETHERTYPE_VLAN.

---
                if (sc->sc_ethercom.ec_capenable & ETHERCAP_VLAN_MTU) {
                        pktlen = m0->m_pkthdr.len - ETHER_HDR_LEN -
                                ETHER_VLAN_ENCAP_LEN;
                        eh = (struct ether_header *) mtod(m0, void *) +
                                ETHER_VLAN_ENCAP_LEN;
                } else {
                        pktlen = m0->m_pkthdr.len - ETHER_HDR_LEN;
                        eh = mtod(m0, struct ether_header *);
                }
                if (ntohs(eh->ether_type) != ETHERTYPE_IP)
                        goto swcsum;
---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index