[ovs-dev] [xlate v3 8/8] ofproto-dpif: Revamp xlate_actions() interface.
Ethan Jackson
ethan at nicira.com
Wed May 29 20:22:00 UTC 2013
This incremental (applied on v3) should address your comments on the v2 version
of the patch. I consider this series reviewed at this point, unless there's
something you'd like to make additional comments on.
Ethan
---
ofproto/ofproto-dpif.c | 43 +++++++++++++++++++++++--------------------
1 file changed, 23 insertions(+), 20 deletions(-)
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 89b693a..386434d 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -210,6 +210,21 @@ static bool ofbundle_includes_vlan(const struct ofbundle *, uint16_t vlan);
struct xlate_ctx;
+/* Initial values of fields of the packet that may be changed during
+ * flow processing and needed later. */
+struct initial_vals {
+ /* This is the value of vlan_tci in the packet as actually received from
+ * dpif. This is the same as the facet's flow.vlan_tci unless the packet
+ * was received via a VLAN splinter. In that case, this value is 0
+ * (because the packet as actually received from the dpif had no 802.1Q
+ * tag) but the facet's flow.vlan_tci is set to the VLAN that the splinter
+ * represents.
+ *
+ * This member should be removed when the VLAN splinters feature is no
+ * longer needed. */
+ ovs_be16 vlan_tci;
+};
+
struct xlate_out {
tag_type tags; /* Tags associated with actions. */
enum slow_path_reason slow; /* 0 if fast path may be used. */
@@ -230,7 +245,7 @@ struct xlate_in {
* this flow when actions change header fields. */
struct flow flow;
- const struct initial_vals *initial_vals;
+ struct initial_vals initial_vals;
/* The packet corresponding to 'flow', or a null pointer if we are
* revalidating without a packet to refer to. */
@@ -316,21 +331,6 @@ struct xlate_ctx {
bool exit; /* No further actions should be processed. */
};
-/* Initial values of fields of the packet that may be changed during
- * flow processing and needed later. */
-struct initial_vals {
- /* This is the value of vlan_tci in the packet as actually received from
- * dpif. This is the same as the facet's flow.vlan_tci unless the packet
- * was received via a VLAN splinter. In that case, this value is 0
- * (because the packet as actually received from the dpif had no 802.1Q
- * tag) but the facet's flow.vlan_tci is set to the VLAN that the splinter
- * represents.
- *
- * This member should be removed when the VLAN splinters feature is no
- * longer needed. */
- ovs_be16 vlan_tci;
-};
-
static void xlate_in_init(struct xlate_in *, struct ofproto_dpif *,
const struct flow *, const struct initial_vals *,
struct rule_dpif *, uint8_t tcp_flags,
@@ -6856,7 +6856,6 @@ xlate_in_init(struct xlate_in *xin, struct ofproto_dpif *ofproto,
{
xin->ofproto = ofproto;
xin->flow = *flow;
- xin->initial_vals = initial_vals;
xin->packet = packet;
xin->may_learn = packet != NULL;
xin->rule = rule;
@@ -6866,6 +6865,12 @@ xlate_in_init(struct xlate_in *xin, struct ofproto_dpif *ofproto,
xin->resubmit_hook = NULL;
xin->report_hook = NULL;
xin->resubmit_stats = NULL;
+
+ if (initial_vals) {
+ xin->initial_vals = *initial_vals;
+ } else {
+ xin->initial_vals.vlan_tci = xin->flow.vlan_tci;
+ }
}
static void
@@ -6923,9 +6928,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
ctx.rule = xin->rule;
ctx.base_flow = ctx.xin->flow;
- if (xin->initial_vals) {
- ctx.base_flow.vlan_tci = xin->initial_vals->vlan_tci;
- }
+ ctx.base_flow.vlan_tci = xin->initial_vals.vlan_tci;
memset(&ctx.base_flow.tunnel, 0, sizeof ctx.base_flow.tunnel);
ctx.orig_tunnel_ip_dst = ctx.xin->flow.tunnel.ip_dst;
--
1.7.9.5
More information about the dev
mailing list