Skip to content

Commit

Permalink
datapath: Fix tunnel source port selection for mega flow
Browse files Browse the repository at this point in the history
Tunnel source port selection was based on hash value cached in the
flow. This no longer works with mega flow, since all flows matching
a mega flow will be transmitted with the same tunnel source port.

This patch computes the tunnel source port at run time based on each
incoming packet. Packets belong to the same micro flow would still get
the same source port, but multiple micro flows hitting the same mega flow
can get different source ports.

Packets injected from the usespace will be assigned to the same
source port as if they are forwarded in the kernel.

Bug #18216

Signed-off-by: Andy Zhou <[email protected]>
Signed-off-by: Jesse Gross <[email protected]>
  • Loading branch information
azhou-nicira authored and jessegross committed Jul 3, 2013
1 parent e4052cb commit 5bc6241
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion datapath/tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ u16 ovs_tnl_get_src_port(struct sk_buff *skb)
int low;
int high;
unsigned int range;
u32 hash = OVS_CB(skb)->flow->hash;
struct sw_flow_key *pkt_key = OVS_CB(skb)->pkt_key;
u32 hash = jhash2((const u32 *)pkt_key,
sizeof(*pkt_key) / sizeof(u32), 0);

inet_get_local_port_range(&low, &high);
range = (high - low) + 1;
Expand Down

0 comments on commit 5bc6241

Please sign in to comment.