diff options
author | Jarno Rajahalme <jrajahalme@nicira.com> | 2013-10-28 13:54:39 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-10-29 09:40:19 -0700 |
commit | a66733a8bc1c42d92f498108d7e27987989dc206 (patch) | |
tree | 94b0d6a06383a235d3109ba64bbaf2e7c8524476 /datapath/flow.c | |
parent | 1591fe8ee5b0ac14b1223c35af95c4e6efa269be (diff) | |
download | openvswitch-a66733a8bc1c42d92f498108d7e27987989dc206.tar.gz |
Widen TCP flags handling.
Widen TCP flags handling from 7 bits (uint8_t) to 12 bits (uint16_t).
The kernel interface remains at 8 bits, which makes no functional
difference now, as none of the higher bits is currently of interest
to the userspace.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'datapath/flow.c')
-rw-r--r-- | datapath/flow.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/datapath/flow.c b/datapath/flow.c index 2193a333e..510bb8785 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -60,20 +60,18 @@ u64 ovs_flow_used_time(unsigned long flow_jiffies) return cur_ms - idle_ms; } -#define TCP_FLAGS_OFFSET 13 -#define TCP_FLAG_MASK 0x3f +#define TCP_FLAGS_BE16(tp) (*(__be16 *)&tcp_flag_word(tp) & htons(0x0FFF)) void ovs_flow_stats_update(struct sw_flow *flow, struct sk_buff *skb) { struct sw_flow_stats *stats = &flow->stats[smp_processor_id()]; - u8 tcp_flags = 0; + __be16 tcp_flags = 0; if ((flow->key.eth.type == htons(ETH_P_IP) || flow->key.eth.type == htons(ETH_P_IPV6)) && flow->key.ip.proto == IPPROTO_TCP && likely(skb->len >= skb_transport_offset(skb) + sizeof(struct tcphdr))) { - u8 *tcp = (u8 *)tcp_hdr(skb); - tcp_flags = *(tcp + TCP_FLAGS_OFFSET) & TCP_FLAG_MASK; + tcp_flags = TCP_FLAGS_BE16(tcp_hdr(skb)); } spin_lock(&stats->lock); |