2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

mac-learning: Change 'port' member to a union.

This allow the client a little more flexibility.  The next commit shows
how this can be useful.
This commit is contained in:
Ben Pfaff
2011-03-18 15:03:24 -07:00
parent db8077c315
commit 1bfe968160
4 changed files with 20 additions and 16 deletions

View File

@@ -326,12 +326,12 @@ lswitch_choose_destination(struct lswitch *sw, const struct flow *flow)
/* Learn the source MAC. */
if (mac_learning_may_learn(sw->ml, flow->dl_src, 0)) {
struct mac_entry *mac = mac_learning_insert(sw->ml, flow->dl_src, 0);
if (mac_entry_is_new(mac) || mac->port != flow->in_port) {
if (mac_entry_is_new(mac) || mac->port.i != flow->in_port) {
VLOG_DBG_RL(&rl, "%016llx: learned that "ETH_ADDR_FMT" is on "
"port %"PRIu16, sw->datapath_id,
ETH_ADDR_ARGS(flow->dl_src), flow->in_port);
mac->port = flow->in_port;
mac->port.i = flow->in_port;
mac_learning_changed(sw->ml, mac);
}
}
@@ -347,7 +347,7 @@ lswitch_choose_destination(struct lswitch *sw, const struct flow *flow)
mac = mac_learning_lookup(sw->ml, flow->dl_dst, 0, NULL);
if (mac) {
out_port = mac->port;
out_port = mac->port.i;
if (out_port == flow->in_port) {
/* Don't send a packet back out its input port. */
return OFPP_NONE;