lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1C9E2497@AcuExch.aculab.com> Date: Thu, 30 Oct 2014 16:39:33 +0000 From: David Laight <David.Laight@...LAB.COM> To: 'Or Gerlitz' <ogerlitz@...lanox.com> CC: "David S. Miller" <davem@...emloft.net>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>, Matan Barak <matanb@...lanox.com>, Amir Vadai <amirv@...lanox.com>, Saeed Mahameed <saeedm@...lanox.com>, Shani Michaeli <shanim@...lanox.com> Subject: RE: [PATCH net-next 7/8] net: Add calaulation of non folded IPV6 pseudo header checksum From: Or Gerlitz [mailto:ogerlitz@...lanox.com] > On 10/30/2014 6:25 PM, David Laight wrote: > >> >+static inline __wsum csum_ipv6_magic_nofold(const struct in6_addr *saddr, > >> >+ const struct in6_addr *daddr, > >> >+ __u32 len, unsigned short proto, > >> >+ __wsum sum) > >> >+{ > >> >+ __wsum res = sum; > >> >+ > >> >+ res = csum_add(res, (__force __wsum)saddr->in6_u.u6_addr32[0]); > >> >+ res = csum_add(res, (__force __wsum)saddr->in6_u.u6_addr32[1]); > >> >+ res = csum_add(res, (__force __wsum)saddr->in6_u.u6_addr32[2]); > >> >+ res = csum_add(res, (__force __wsum)saddr->in6_u.u6_addr32[3]); > >> >+ res = csum_add(res, (__force __wsum)daddr->in6_u.u6_addr32[0]); > >> >+ res = csum_add(res, (__force __wsum)daddr->in6_u.u6_addr32[1]); > >> >+ res = csum_add(res, (__force __wsum)daddr->in6_u.u6_addr32[2]); > >> >+ res = csum_add(res, (__force __wsum)daddr->in6_u.u6_addr32[3]); > > > That probably generates a very long dependency chain. > > > > Could you clarify this comment a bit? csum_add() probably generates a 32bit 'add with carry' instruction. So the above generates 8 instructions that have to be executed in series (dependencies on the register and the carry flag). On a 64bit cpu there are other options, eg adding 32bit values into several 64bit registers, then adding those together and finally collapsing the value to 32 then 16 bits. Maybe __wsum does end up being 64bit (not looked), but gcc won't generate a 'tree' of additions, it will still generate a dependency chain. Hopefully the software 'checksum a buffer' function is written to avoid these problems. David -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists