summaryrefslogtreecommitdiff
path: root/datapath
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2010-12-04 12:04:39 -0800
committerJesse Gross <jesse@nicira.com>2010-12-13 13:40:20 -0800
commit8dda8c9b63c8803621f900beaa397c673b736197 (patch)
tree2c88b330dc8f6e6d5e94a201eced9de4db3d254c /datapath
parente1040c772fbebc3abe9e7222f9c540112c4dca81 (diff)
downloadopenvswitch-8dda8c9b63c8803621f900beaa397c673b736197.tar.gz
datapath: Correct byte order annotations.
We have generally been using the byte order specific data types (i.e. __be32 instead of u32) in most places. This corrects a declaration and adds a few needed casts. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath')
-rw-r--r--datapath/datapath.c3
-rw-r--r--datapath/flow.c2
-rw-r--r--datapath/tunnel.c5
-rw-r--r--datapath/vport-gre.c8
4 files changed, 10 insertions, 8 deletions
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 5e2821a54..c633e8463 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -493,7 +493,8 @@ void dp_process_received_packet(struct vport *p, struct sk_buff *skb)
flow_node = tbl_lookup(rcu_dereference(dp->table), &key,
flow_hash(&key), flow_cmp);
if (unlikely(!flow_node)) {
- dp_output_control(dp, skb, _ODPL_MISS_NR, OVS_CB(skb)->tun_id);
+ dp_output_control(dp, skb, _ODPL_MISS_NR,
+ (__force u64)OVS_CB(skb)->tun_id);
stats_counter_off = offsetof(struct dp_stats_percpu, n_missed);
goto out;
}
diff --git a/datapath/flow.c b/datapath/flow.c
index 8a6ee23d3..5cf0d54a7 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -218,7 +218,7 @@ static __be16 parse_ethertype(struct sk_buff *skb)
u8 ssap; /* Always 0xAA */
u8 ctrl;
u8 oui[3];
- u16 ethertype;
+ __be16 ethertype;
};
struct llc_snap_hdr *llc;
__be16 proto;
diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index d2ede147e..982412914 100644
--- a/datapath/tunnel.c
+++ b/datapath/tunnel.c
@@ -191,8 +191,9 @@ static int port_cmp(const struct tbl_node *node, void *target)
static u32 port_hash(struct port_lookup_key *k)
{
- u32 x = jhash_3words(k->saddr, k->daddr, k->tunnel_type, 0);
- return jhash_2words(k->key >> 32, k->key, x);
+ u32 x = jhash_3words((__force u32)k->saddr, (__force u32)k->daddr,
+ k->tunnel_type, 0);
+ return jhash_2words((__force u64)k->key >> 32, (__force u32)k->key, x);
}
static u32 mutable_hash(const struct tnl_mutable_config *mutable)
diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
index eb109035a..191fd0634 100644
--- a/datapath/vport-gre.c
+++ b/datapath/vport-gre.c
@@ -54,9 +54,9 @@ static int gre_hdr_len(const struct tnl_port_config *port_config)
static __be32 be64_get_low32(__be64 x)
{
#ifdef __BIG_ENDIAN
- return x;
+ return (__force __be32)x;
#else
- return x >> 32;
+ return (__force __be32)((__force u64)x >> 32);
#endif
}
@@ -116,9 +116,9 @@ static struct sk_buff *gre_update_header(const struct vport *vport,
static __be64 be32_extend_to_be64(__be32 x)
{
#ifdef __BIG_ENDIAN
- return x;
+ return (__force __be64)x;
#else
- return (__be64) x << 32;
+ return (__force __be64)((__force u64)x << 32);
#endif
}