Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7dbe5c54 authored by Chris Zankel's avatar Chris Zankel
Browse files

xtensa: Fix checksum header file



We need to add a "memory" dependency (barrier) in assembly macros
that access (read or write) memory. Otherwise, the compiler might
ill-optimize the order of memory accesses.

Signed-off-by: default avatarChris Zankel <chris@zankel.net>
parent 35e71f90
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -113,7 +113,8 @@ static __inline__ __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
	   are modified, we must also specify them as outputs, or gcc
	   are modified, we must also specify them as outputs, or gcc
	   will assume they contain their original values. */
	   will assume they contain their original values. */
		: "=r" (sum), "=r" (iph), "=r" (ihl), "=&r" (tmp), "=&r" (endaddr)
		: "=r" (sum), "=r" (iph), "=r" (ihl), "=&r" (tmp), "=&r" (endaddr)
		: "1" (iph), "2" (ihl));
		: "1" (iph), "2" (ihl)
		: "memory");


	return	csum_fold(sum);
	return	csum_fold(sum);
}
}
@@ -227,7 +228,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
		"1:\t"
		"1:\t"
		: "=r" (sum), "=&r" (__dummy)
		: "=r" (sum), "=&r" (__dummy)
		: "r" (saddr), "r" (daddr),
		: "r" (saddr), "r" (daddr),
		  "r" (htonl(len)), "r" (htonl(proto)), "0" (sum));
		  "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)
		: "memory");


	return csum_fold(sum);
	return csum_fold(sum);
}
}