Hi all,
there are currently three very similiar checksum algorithms
in the
IPv4/IPv6 stack that platforms should provide assembler
versions for.
in_cksum is the core and implemented on all platforms.
in4_cksum and in6_cksum are variants of in_cksum that skip
parts of the
mbuf chain and instead use a separately computed initial
checksum over
the header. in6_cksum is currently only implement for i386.
I would like to simplify this and implement in4_cksum and
in6_cksum in C
and have a single MD backend function (md_in_cksum).
md_in_cksum takes the mbuf, len, initial cksum (as uint32_t)
and offset
to skip. The required modifications for the existing
in_cksum
implementation is loading the initial checksum instead of
zeroing it and
a small loop to compensate for the offset. I expect this to
two loads
and a branch for in_cksum, which should be cheap enough to
not bother
with a single entry point.
Opinions?
Joerg
|