Necessary for future patches which need the provided flow to be const.
Signed-off-by: Ethan Jackson <[email protected]>
---
ofproto/ofproto-dpif-upcall.c | 37 +++++++++++++++++++------------------
ofproto/ofproto-dpif-xlate.c | 23 ++++++++++++-----------
ofproto/ofproto-dpif-xlate.h | 6 +++---
ofproto/ofproto-dpif.c | 10 ++++++----
4 files changed, 40 insertions(+), 36 deletions(-)
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 3003455..96a7e0b 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -153,7 +153,6 @@ struct upcall {
size_t key_len;
enum dpif_upcall_type upcall_type;
struct dpif_flow_stats stats;
- odp_port_t odp_in_port;
uint64_t slow_path_buf[128 / 8];
struct odputil_keybuf mask_buf;
@@ -726,7 +725,7 @@ compose_slow_path(struct udpif *udpif, struct xlate_out
*xout,
static void
upcall_init(struct upcall *upcall, struct flow *flow, struct ofpbuf *packet,
struct ofproto_dpif *ofproto, struct dpif_upcall *dupcall,
- odp_port_t odp_in_port)
+ ofp_port_t ofp_in_port)
{
struct pkt_metadata md = pkt_metadata_from_flow(flow);
struct xlate_in xin;
@@ -741,9 +740,8 @@ upcall_init(struct upcall *upcall, struct flow *flow,
struct ofpbuf *packet,
upcall->stats.n_bytes = ofpbuf_size(packet);
upcall->stats.used = time_msec();
upcall->stats.tcp_flags = ntohs(upcall->flow.tcp_flags);
- upcall->odp_in_port = odp_in_port;
- xlate_in_init(&xin, upcall->ofproto, &upcall->flow, NULL,
+ xlate_in_init(&xin, upcall->ofproto, &upcall->flow, ofp_in_port, NULL,
upcall->stats.tcp_flags, packet);
if (upcall->upcall_type == DPIF_UC_MISS) {
@@ -853,9 +851,9 @@ convert_upcall(struct udpif *udpif, struct upcall *upcall)
struct ofproto_dpif *ofproto;
struct dpif_sflow *sflow;
struct dpif_ipfix *ipfix;
- struct flow flow;
+ ofp_port_t ofp_in_port;
enum upcall_type type;
- odp_port_t odp_in_port;
+ struct flow flow;
int error;
if (odp_flow_key_to_flow(dupcall->key, dupcall->key_len, &flow)
@@ -865,7 +863,7 @@ convert_upcall(struct udpif *udpif, struct upcall *upcall)
}
error = xlate_receive(udpif->backer, &flow, &ofproto, &ipfix, &sflow, NULL,
- &odp_in_port);
+ &ofp_in_port);
if (error) {
if (error == ENODEV) {
@@ -876,7 +874,7 @@ convert_upcall(struct udpif *udpif, struct upcall *upcall)
* so that future packets of the flow are inexpensively dropped
* in the kernel. */
VLOG_INFO_RL(&rl, "received packet on unassociated datapath "
- "port %"PRIu32, odp_in_port);
+ "port %"PRIu32, flow.in_port.odp_port);
dpif_flow_put(udpif->dpif, DPIF_FP_CREATE | DPIF_FP_MODIFY,
dupcall->key, dupcall->key_len, NULL, 0, NULL, 0,
NULL);
@@ -886,7 +884,7 @@ convert_upcall(struct udpif *udpif, struct upcall *upcall)
type = classify_upcall(upcall);
if (type == MISS_UPCALL) {
- upcall_init(upcall, &flow, packet, ofproto, dupcall, odp_in_port);
+ upcall_init(upcall, &flow, packet, ofproto, dupcall, ofp_in_port);
return error;
}
@@ -898,7 +896,7 @@ convert_upcall(struct udpif *udpif, struct upcall *upcall)
memset(&cookie, 0, sizeof cookie);
memcpy(&cookie, nl_attr_get(dupcall->userdata),
sizeof cookie.sflow);
- dpif_sflow_received(sflow, packet, &flow, odp_in_port,
+ dpif_sflow_received(sflow, packet, &flow, flow.in_port.odp_port,
&cookie);
}
break;
@@ -1014,7 +1012,7 @@ handle_upcalls(struct udpif *udpif, struct upcall
*upcalls,
ofpbuf_use_stack(&buf, upcall->slow_path_buf,
sizeof upcall->slow_path_buf);
compose_slow_path(udpif, &upcall->xout, &upcall->flow,
- upcall->odp_in_port, &buf);
+ upcall->flow.in_port.odp_port, &buf);
op->u.flow_put.actions = ofpbuf_data(&buf);
op->u.flow_put.actions_len = ofpbuf_size(&buf);
}
@@ -1202,7 +1200,7 @@ revalidate_ukey(struct udpif *udpif, struct udpif_key
*ukey,
struct ofpbuf xout_actions;
struct flow flow, dp_mask;
uint32_t *dp32, *xout32;
- odp_port_t odp_in_port;
+ ofp_port_t ofp_in_port;
struct xlate_in xin;
long long int last_used;
int error;
@@ -1249,7 +1247,7 @@ revalidate_ukey(struct udpif *udpif, struct udpif_key
*ukey,
}
error = xlate_receive(udpif->backer, &flow, &ofproto, NULL, NULL, &netflow,
- &odp_in_port);
+ &ofp_in_port);
if (error) {
goto exit;
}
@@ -1261,7 +1259,8 @@ revalidate_ukey(struct udpif *udpif, struct udpif_key
*ukey,
ukey->xcache = xlate_cache_new();
}
- xlate_in_init(&xin, ofproto, &flow, NULL, push.tcp_flags, NULL);
+ xlate_in_init(&xin, ofproto, &flow, ofp_in_port, NULL, push.tcp_flags,
+ NULL);
xin.resubmit_stats = push.n_packets ? &push : NULL;
xin.xcache = ukey->xcache;
xin.may_learn = may_learn;
@@ -1279,7 +1278,8 @@ revalidate_ukey(struct udpif *udpif, struct udpif_key
*ukey,
ofpbuf_size(xout.odp_actions));
} else {
ofpbuf_use_stack(&xout_actions, slow_path_buf, sizeof slow_path_buf);
- compose_slow_path(udpif, &xout, &flow, odp_in_port, &xout_actions);
+ compose_slow_path(udpif, &xout, &flow, flow.in_port.odp_port,
+ &xout_actions);
}
if (f->actions_len != ofpbuf_size(&xout_actions)
@@ -1363,6 +1363,7 @@ push_dump_ops__(struct udpif *udpif, struct dump_op *ops,
size_t n_ops)
if (push->n_packets || netflow_exists()) {
struct ofproto_dpif *ofproto;
struct netflow *netflow;
+ ofp_port_t ofp_in_port;
struct flow flow;
bool may_learn;
@@ -1379,11 +1380,11 @@ push_dump_ops__(struct udpif *udpif, struct dump_op
*ops, size_t n_ops)
op->op.u.flow_del.key_len,
&flow) != ODP_FIT_ERROR
&& !xlate_receive(udpif->backer, &flow, &ofproto, NULL, NULL,
- &netflow, NULL)) {
+ &netflow, &ofp_in_port)) {
struct xlate_in xin;
- xlate_in_init(&xin, ofproto, &flow, NULL, push->tcp_flags,
- NULL);
+ xlate_in_init(&xin, ofproto, &flow, ofp_in_port, NULL,
+ push->tcp_flags, NULL);
xin.resubmit_stats = push->n_packets ? push : NULL;
xin.may_learn = may_learn;
xin.skip_wildcards = true;
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index a1d13c7..0c67d19 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -935,8 +935,8 @@ xlate_ofport_remove(struct ofport_dpif *ofport)
}
/* Given a datpath and flow metadata ('backer', and 'flow' respectively),
- * Optionally populates 'ofproto' with the ofproto_dpif, 'odp_in_port' with the
- * datapath in_port, and 'ipfix', 'sflow', and 'netflow' with the appropriate
+ * Optionally populates 'ofproto' with the ofproto_dpif, 'ofp_in_port' with the
+ * openflow in_port, and 'ipfix', 'sflow', and 'netflow' with the appropriate
* handles for those protocols if they're enabled. Caller is responsible for
* unrefing them.
*
@@ -950,23 +950,22 @@ xlate_ofport_remove(struct ofport_dpif *ofport)
* Returns 0 if successful, ENODEV if the parsed flow has no associated ofport,
* or some other positive errno if there are other problems. */
int
-xlate_receive(const struct dpif_backer *backer, struct flow *flow,
+xlate_receive(const struct dpif_backer *backer, const struct flow *flow,
struct ofproto_dpif **ofproto, struct dpif_ipfix **ipfix,
struct dpif_sflow **sflow, struct netflow **netflow,
- odp_port_t *odp_in_port)
+ ofp_port_t *ofp_in_port)
{
struct xlate_cfg *xcfg = ovsrcu_get(struct xlate_cfg *, &xcfgp);
const struct xport *xport;
- if (odp_in_port) {
- *odp_in_port = flow->in_port.odp_port;
- }
-
xport = xport_lookup(xcfg, tnl_port_should_receive(flow)
? tnl_port_receive(flow)
: odp_port_to_ofport(backer, flow->in_port.odp_port));
- flow->in_port.ofp_port = xport ? xport->ofp_port : OFPP_NONE;
+ if (ofp_in_port) {
+ *ofp_in_port = xport ? xport->ofp_port : OFPP_NONE;
+ }
+
if (!xport) {
return ENODEV;
}
@@ -3756,11 +3755,13 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t
ofpacts_len,
void
xlate_in_init(struct xlate_in *xin, struct ofproto_dpif *ofproto,
- const struct flow *flow, struct rule_dpif *rule,
- uint16_t tcp_flags, const struct ofpbuf *packet)
+ const struct flow *flow, ofp_port_t in_port,
+ struct rule_dpif *rule, uint16_t tcp_flags,
+ const struct ofpbuf *packet)
{
xin->ofproto = ofproto;
xin->flow = *flow;
+ xin->flow.in_port.ofp_port = in_port;
xin->packet = packet;
xin->may_learn = packet != NULL;
xin->rule = rule;
diff --git a/ofproto/ofproto-dpif-xlate.h b/ofproto/ofproto-dpif-xlate.h
index 07586aa..7394249 100644
--- a/ofproto/ofproto-dpif-xlate.h
+++ b/ofproto/ofproto-dpif-xlate.h
@@ -173,14 +173,14 @@ void xlate_ofport_set(struct ofproto_dpif *, struct
ofbundle *,
bool may_enable);
void xlate_ofport_remove(struct ofport_dpif *);
-int xlate_receive(const struct dpif_backer *, struct flow *,
+int xlate_receive(const struct dpif_backer *, const struct flow *,
struct ofproto_dpif **, struct dpif_ipfix **,
struct dpif_sflow **, struct netflow **,
- odp_port_t *odp_in_port);
+ ofp_port_t *ofp_in_port);
void xlate_actions(struct xlate_in *, struct xlate_out *);
void xlate_in_init(struct xlate_in *, struct ofproto_dpif *,
- const struct flow *, struct rule_dpif *,
+ const struct flow *, ofp_port_t in_port, struct rule_dpif *,
uint16_t tcp_flags, const struct ofpbuf *packet);
void xlate_out_uninit(struct xlate_out *);
void xlate_actions_for_side_effects(struct xlate_in *);
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 77cdce3..6fd7d3d 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -3174,7 +3174,8 @@ ofproto_dpif_execute_actions(struct ofproto_dpif *ofproto,
rule_dpif_credit_stats(rule, &stats);
}
- xlate_in_init(&xin, ofproto, flow, rule, stats.tcp_flags, packet);
+ xlate_in_init(&xin, ofproto, flow, flow->in_port.ofp_port, rule,
+ stats.tcp_flags, packet);
xin.ofpacts = ofpacts;
xin.ofpacts_len = ofpacts_len;
xin.resubmit_stats = &stats;
@@ -4211,7 +4212,8 @@ parse_flow_and_packet(int argc, const char *argv[],
goto exit;
}
- if (xlate_receive(backer, flow, ofprotop, NULL, NULL, NULL, NULL)) {
+ if (xlate_receive(backer, flow, ofprotop, NULL, NULL, NULL,
+ &flow->in_port.ofp_port)) {
error = "Invalid datapath flow";
goto exit;
}
@@ -4422,8 +4424,8 @@ ofproto_trace(struct ofproto_dpif *ofproto, struct flow
*flow,
trace.result = ds;
trace.key = flow; /* Original flow key, used for megaflow. */
trace.flow = *flow; /* May be modified by actions. */
- xlate_in_init(&trace.xin, ofproto, flow, rule, ntohs(flow->tcp_flags),
- packet);
+ xlate_in_init(&trace.xin, ofproto, flow, flow->in_port.ofp_port, rule,
+ ntohs(flow->tcp_flags), packet);
if (ofpacts) {
trace.xin.ofpacts = ofpacts;
trace.xin.ofpacts_len = ofpacts_len;
--
1.8.1.2
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev