cvs commit: src/sys/dev/bge if_bge.c
nate at root.org
Mon Feb 6 15:09:05 PST 2006
Oleg Bulyzhin wrote:
> On Mon, Feb 06, 2006 at 02:21:09PM -0800, Nate Lawson wrote:
>>Oleg Bulyzhin wrote:
>>> nq = q->m_nextpkt;
>>> q->m_nextpkt = NULL;
>>> m->m_pkthdr.csum_flags &= q->m_pkthdr.csum_flags;
>>>- m->m_pkthdr.csum_data += q->m_pkthdr.csum_data;
>>>+ sum = m->m_pkthdr.csum_data + q->m_pkthdr.csum_data;
>>>+ m->m_pkthdr.csum_data = (sum & 0xffff) + (sum >> 16);
>>> m_cat(m, q);
>>I'm not familiar with this code. So m->m_pkthdr.csum_data is 32 bits?
>>Couldn't the same thing be achieved with making it 16 bits since the add
>>will wrap normally?
> It will not work cause it's not just a trivial sum it's so called
> "1's complement sum" (refer rfc1071 for details).
You're right, but aren't you missing the NOT step?
1. 2's complement sum
2. Add in carry
3. 1's complement of result (not)
More information about the cvs-src