[dpdk-dev] [PATCH v2] net: calculate checksums for packets with IPv4 options

Stephen Hemminger stephen at networkplumber.org
Tue Oct 6 04:39:45 CEST 2020


On Tue, 06 Oct 2020 00:55:19 +0200
Thomas Monjalon <thomas at monjalon.net> wrote:

> > -       cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct rte_ipv4_hdr));
> > +       cksum = rte_raw_cksum(ipv4_hdr, (ipv4_hdr->version_ihl & 0xf) * 4);  
> 
> Truly naive questions:
> - doesn't it deserve a static inline function rte_ipv4_hdr_len()?

Makes sense to have that.

> - how generated code for "* 4" compares with "<< 2"?

The code is the same if value is unsigned.


More information about the dev mailing list