RE: [PATCH v6 net-next 1/2] net: add skb_mstamp infrastructure
From: Eric Dumazet <hidden>
Date: 2014-02-25 12:21:19
From: Eric Dumazet <hidden>
Date: 2014-02-25 12:21:19
On Tue, 2014-02-25 at 09:51 +0000, David Laight wrote:
Do you need the union here? If you don't attempt to convert the value to a u64 then code is less likely to process it incorrectly.
Check the second patch, it uses :
first_ackt.v64 = 0;
...
last_ackt = skb->skb_mstamp;
if (!first_ackt.v64)
first_ackt = last_ackt;
...
skb_mstamp_get(&now);
if (first_ackt.v64) {
seq_rtt_us = skb_mstamp_us_delta(&now, &first_ackt);
ca_seq_rtt_us = skb_mstamp_us_delta(&now, &last_ackt);
}
Without the union, it would be more expensive on 64bit arches,
or relying on the compiler to be smart enough.
Most modern ABI pass/return short structures in registers, so the actual code should be similar if you return the struct by value.
I am well aware of this, but this is a matter of taste, and I prefer this more traditional way.