From: Wilson Peng <[email protected]> The stats is got via function call ofputil_decode_flow_stats_reply() and for OpenFlow15 it will also call oxs_pull_entry__(). Currently we found on Windows the counter is incorrect.
From the output below, it is incorrect for the n_bytes counter via OpenFlow15 on CMD ovs-ofctl dump-flows. In the patch, get_unaligned_u64__() will return network byte order value to caller on Windows. ovs-ofctl.exe -O OpenFlow15 dump-flows nsx-managed | findstr 1504762 cookie=0x1e77082def43e867, duration=1868893.146s, table=4, n_packets=1504762, n_bytes=18446744071589406094, … cookie=0x2033543ed8e89cc1, duration=1868893.146s, table=4, n_packets=1504762, n_bytes=18446744071589406094, … ovs-ofctl.exe -O OpenFlow10 dump-flows nsx-managed | findstr 1504762 cookie=0x1e77082def43e867, duration=1868902.796s, table=4, n_packets=1504762, n_bytes=2174821774, idle_age=59, cookie=0x2033543ed8e89cc1, duration=1868902.796s, table=4, n_packets=1504762, n_bytes=2174821774, idle_age=59, With the fix, new compiled ovs-ofctl10211.exe could dump the correct n_bytes counter Via OpenFlow15 ovs-ofctl10211.exe -O OpenFlow15 dump-flows nsx-managed | findstr 1504762 cookie=0x1e77082def43e867, duration=1868872.272s, table=4, n_packets=1504762, n_bytes=2174821774, reset_counts idle_age=29, … cookie=0x2033543ed8e89cc1, duration=1868872.272s, table=4, n_packets=1504762, n_bytes=2174821774, reset_counts idle_age=29, … Signed-off-by: Wilson Peng <[email protected]> --- lib/unaligned.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/unaligned.h b/lib/unaligned.h index f40e4e10d..cceab6eb8 100644 --- a/lib/unaligned.h +++ b/lib/unaligned.h @@ -91,6 +91,8 @@ GCC_UNALIGNED_ACCESSORS(ovs_be32, be32); GCC_UNALIGNED_ACCESSORS(ovs_be64, be64); #else /* Generic implementations. */ +static inline ovs_be64 +get_32aligned_be64(const ovs_32aligned_be64 *x); static inline uint16_t get_unaligned_u16(const uint16_t *p_) { @@ -126,6 +128,9 @@ static inline void put_unaligned_u32(uint32_t *p_, uint32_t x_) static inline uint64_t get_unaligned_u64__(const uint64_t *p_) { +#if defined(WIN32) + return get_32aligned_be64(p_); +#else const uint8_t *p = (const uint8_t *) p_; return ntohll(((uint64_t) p[0] << 56) | ((uint64_t) p[1] << 48) @@ -135,6 +140,7 @@ static inline uint64_t get_unaligned_u64__(const uint64_t *p_) | (p[5] << 16) | (p[6] << 8) | p[7]); +#endif } static inline void put_unaligned_u64__(uint64_t *p_, uint64_t x_) -- 2.32.1 (Apple Git-133) _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
