ether_crc32_[bl]e()

Poul-Henning Kamp phk at phk.freebsd.dk
Sun May 30 12:56:30 PDT 2004


In message <c9d9u3$o6k$1 at kemoauc.mips.inka.de>, Christian Weisgerber writes:
>NetBSD and OpenBSD have two helper functions in if_ethersubr.c
>
>ether_crc32_le(const u_int8_t *buf, size_t len)
>ether_crc32_be(const u_int8_t *buf, size_t len)
>
>that will calculate an ethernet CRC-32 in little endian/big endian
>fashion.
>
>These CRCs are used all over our network drivers, e.g. for setting
>up multicast hash filters.  Functions to calculate them are duplicated
>all over.  These could be factored out of some thirty drivers.
>NetBSD has done so, btw.
>
>The patch below adds the functions to if_ethersubr.c and, as an
>example, switches re(4) to make use of this.
>
>1. Do we want this?

In general for stuff like this, if you save more than a handful of
lines in more than a handful of drivers you can assume that we want it.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-arch mailing list