VLOG_WARN("dp%u reported interface %"PRIu16" twice",
dpif_id(&br->dpif), p->port);
} else {
- uint16_t ofp_port = p->port == ODPP_LOCAL ? OFPP_LOCAL : p->port;
- port_array_set(&br->ifaces, ofp_port, iface);
+ port_array_set(&br->ifaces, p->port, iface);
iface->dp_ifidx = p->port;
}
}
*tags |= in_port->stp_state_tag;
if (out_port == FLOOD_PORT) {
/* XXX use OFPP_FLOOD if no vlans or bonding. */
+ /* XXX even better, define each VLAN as a datapath port group */
for (i = 0; i < br->n_ports; i++) {
struct port *port = br->ports[i];
if (port != in_port && port_includes_vlan(port, vlan)
struct ft_dst dsts[DP_MAX_PORTS * (MAX_MIRRORS + 1)];
size_t actions_len; /* Estimated length of actions, in bytes. */
size_t n_dsts;
- flow_t odp_flow;
n_dsts = compose_dsts(br, flow, vlan, in_port, out_port, dsts, &tags);
actions_len = (sizeof(struct ofp_action_header) + 2) * n_dsts;
- /* XXX for now everything in bridge.c is still in terms of OFP ports. In
- * the long term we should change that (and avoid this awkward copy). */
- odp_flow = *flow;
- odp_flow.in_port = ofp_port_to_odp_port(odp_flow.in_port);
-
if (setup_flow) {
enum { NO_OP, ADD_FLOW, SET_ACTIONS } command;
struct ft_flow *f;
n_actions = abuf.size / sizeof(union ofp_action);
if (command == ADD_FLOW) {
- ofproto_add_flow(br->ofproto, &odp_flow, 0, UINT16_MAX,
+ ofproto_add_flow(br->ofproto, flow, 0, UINT16_MAX,
abuf.data, n_actions,
pkt, bridge_idle_time(br));
pkt = NULL; /* Already sent. */
/* ofproto_add_flow() will reset the byte counters. */
f->last_byte_count = f->byte_count = 0;
} else {
- ofproto_set_actions(br->ofproto, &odp_flow, abuf.data,
- n_actions);
+ ofproto_set_actions(br->ofproto, flow, abuf.data, n_actions);
}
ofpbuf_uninit(&abuf);
}
ofpbuf_init(&abuf, actions_len);
put_actions(dsts, n_dsts, ntohs(flow->dl_vlan), &abuf);
- ofproto_send_packet(br->ofproto, &odp_flow,
+ ofproto_send_packet(br->ofproto, flow,
abuf.data, abuf.size / sizeof(union ofp_action),
pkt);
ofpbuf_uninit(&abuf);
* one of our bridge ports.
*/
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
- flow_t odp_flow;
VLOG_WARN_RL(&rl, "bridge %s: received packet on unknown "
"interface %"PRIu16, br->name, flow->in_port);
- /* XXX for now everything in bridge.c is still in terms of OFP
- * ports. In the long term we should change that (and avoid this
- * awkward copy). */
- odp_flow = *flow;
- odp_flow.in_port = ofp_port_to_odp_port(odp_flow.in_port);
- ofproto_add_flow(br->ofproto, &odp_flow, 0, UINT16_MAX,
+ ofproto_add_flow(br->ofproto, flow, 0, UINT16_MAX,
NULL, 0, NULL, bridge_idle_time(br));
if (f) {
ftf_set_dsts(f, NULL, 0);
/* We're revalidating, not receiving a fresh packet. Most likely,
* this interface existed and has now been deleted from the
* datapath. Drop the flow. */
- flow_t odp_flow;
-
assert(f);
- /* XXX for now everything in bridge.c is still in terms of OFP
- * ports. In the long term we should change that (and avoid this
- * awkward copy). */
- odp_flow = *flow;
- odp_flow.in_port = ofp_port_to_odp_port(odp_flow.in_port);
- ofproto_delete_flow(br->ofproto, &odp_flow, 0, UINT16_MAX);
+ ofproto_delete_flow(br->ofproto, flow, 0, UINT16_MAX);
/* ofproto_delete_flow() better not call back to
* bridge_flow_expired_ofhook_cb(). */
struct iface *iface;
struct port *port;
- iface = iface_from_dp_ifidx(br, opp->port_no);
+ iface = iface_from_dp_ifidx(br, ofp_port_to_odp_port(opp->port_no));
if (!iface) {
return;
}
}
static bool
-bridge_packet_in_ofhook_cb(const flow_t *flow_, const struct ofpbuf *payload,
+bridge_packet_in_ofhook_cb(const flow_t *flow, const struct ofpbuf *payload,
void *br_)
{
struct bridge *br = br_;
struct ft_flow *f;
- flow_t flow;
-
- /* XXX for now everything in bridge.c is still in terms of OFP ports. In
- * the long term we should change that (and avoid this awkward copy). */
- flow = *flow_;
- flow.in_port = odp_port_to_ofp_port(flow.in_port);
/* Delete any existing flow from the flow tracker. The flow cannot really
* be in the flow table (otherwise we wouldn't be getting called). */
- f = ft_lookup(br->ft, &flow, flow_hash(&flow, 0));
+ f = ft_lookup(br->ft, flow, flow_hash(flow, 0));
if (f) {
ft_remove(br->ft, f);
ftf_destroy(f);
}
- if (flow.dl_type == htons(OFP_DL_TYPE_NOT_ETH_TYPE)
- && eth_addr_equals(flow.dl_dst, stp_eth_addr)) {
- brstp_receive(br, &flow, payload);
+ if (flow->dl_type == htons(OFP_DL_TYPE_NOT_ETH_TYPE)
+ && eth_addr_equals(flow->dl_dst, stp_eth_addr)) {
+ brstp_receive(br, flow, payload);
return true;
}
- process_flow(br, &flow, payload);
+ process_flow(br, flow, payload);
return true;
}
{
struct bridge *br = br_;
struct ft_flow *f;
- flow_t flow;
-
- /* XXX for now everything in bridge.c is still in terms of OFP ports. In
- * the long term we should change that (and avoid this awkward copy). */
- flow = expired->flow;
- flow.in_port = odp_port_to_ofp_port(flow.in_port);
- f = ft_lookup(br->ft, &flow, flow_hash(&flow, 0));
+ f = ft_lookup(br->ft, &expired->flow, flow_hash(&expired->flow, 0));
if (f) {
/* Update statistics. */
f->last_byte_count = f->byte_count;