[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1337850554-10339-15-git-send-email-horms@verge.net.au>
Date: Thu, 24 May 2012 18:09:07 +0900
From: Simon Horman <horms@...ge.net.au>
To: dev@...nvswitch.org
Cc: netdev@...r.kernel.org, Kyle Mestery <kmestery@...co.com>,
Simon Horman <horms@...ge.net.au>
Subject: [PATCH 14/21] ofproto: Set flow tun_key in compose_output_action()
In essence this attached the tun_key, if any,
to the output processing of a packet. This allows
it the packet to be transmitted using flow-based
tunneling as necessary.
Cc: Kyle Mestery <kmestery@...co.com>
Signed-off-by: Simon Horman <horms@...ge.net.au>
---
v4
* Set tun_flags field of flow.tun_key
* Remove debugging message
v3
* Initial release
datapath: Add flags to ovs_key_ipv4_tunnel
Add flags to ovs_key_ipv4_tunnel and set from
the tunnel's realdev flags. This allows the datapath
to have access to flags on transmit which can be
used to effect the transmission - e.g. add a tunnel id.
Signed-off-by: Simon Horman <horms@...ge.net.au>
---
ofproto/ofproto-dpif.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 2a52f37..b1354a2 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -4919,8 +4919,17 @@ compose_output_action__(struct action_xlate_ctx *ctx, uint16_t ofp_port,
}
out_port = realdev_to_txdev(ctx->ofproto, ofport, ctx->flow.vlan_tci);
- if (out_port != odp_port && !ofport->tun) {
- ctx->flow.vlan_tci = htons(0);
+ if (out_port != odp_port) {
+ if (ofport->tun) {
+ ctx->flow.tun_key.tun_id = ofport->tun->s.out_key;
+ ctx->flow.tun_key.tun_flags = ofport->tun->s.flags;
+ ctx->flow.tun_key.ipv4_src = ofport->tun->s.saddr;
+ ctx->flow.tun_key.ipv4_dst = ofport->tun->s.daddr;
+ ctx->flow.tun_key.ipv4_tos = ofport->tun->s.tos;
+ ctx->flow.tun_key.ipv4_ttl = ofport->tun->s.ttl;
+ } else {
+ ctx->flow.vlan_tci = htons(0);
+ }
}
commit_odp_actions(&ctx->flow, &ctx->base_flow, ctx->odp_actions);
nl_msg_put_u32(ctx->odp_actions, OVS_ACTION_ATTR_OUTPUT, out_port);
@@ -5576,7 +5585,7 @@ action_xlate_ctx_init(struct action_xlate_ctx *ctx,
ctx->ofproto = ofproto;
ctx->flow = *flow;
ctx->base_flow = ctx->flow;
- ctx->base_flow.tun_key.ipv4_src = 0;
+ ctx->base_flow.tun_key.ipv4_src = htonl(0);
ctx->base_flow.vlan_tci = initial_tci;
ctx->rule = rule;
ctx->packet = packet;
--
1.7.10.2.484.gcd07cc5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists