[ovs-dev] [RFC L3 1/4] ofproto-dpif: add support for layer 3 ports
Lorand Jakab
lojakab at cisco.com
Fri Oct 4 13:38:11 UTC 2013
Add member is_layer3 to struct ofport_dpif to mark layer 3 ports. Set
it to "true" for the only layer 3 port we support for now: lisp.
Additionally, prevent flooding to layer 3 ports. A later patch will
also prevent MAC learning.
This patch could be applied even without the rest of the layer 3
patches, since flooding packets to lisp ports shouldn't happen anyway.
It currently breaks tests 2 and 669, not sure why.
Signed-off-by: Lorand Jakab <lojakab at cisco.com>
---
lib/netdev-vport.c | 8 ++++++++
lib/netdev-vport.h | 1 +
ofproto/ofproto-dpif.c | 5 +++++
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 0374ae3..608fb6d 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -108,6 +108,14 @@ netdev_vport_is_patch(const struct netdev *netdev)
return class->get_config == get_patch_config;
}
+bool
+netdev_vport_is_layer3(const struct netdev *dev)
+{
+ const char *type = netdev_get_type(dev);
+
+ return (!strcmp("lisp", type));
+}
+
static bool
netdev_vport_needs_dst_port(const struct netdev *dev)
{
diff --git a/lib/netdev-vport.h b/lib/netdev-vport.h
index dc49097..eaeb386 100644
--- a/lib/netdev-vport.h
+++ b/lib/netdev-vport.h
@@ -30,6 +30,7 @@ void netdev_vport_tunnel_register(void);
void netdev_vport_patch_register(void);
bool netdev_vport_is_patch(const struct netdev *);
+bool netdev_vport_is_layer3(const struct netdev *);
char *netdev_vport_patch_peer(const struct netdev *netdev);
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 80e97e0..58bdd2f 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -309,6 +309,7 @@ struct ofport_dpif {
struct bfd *bfd; /* BFD, if any. */
bool may_enable; /* May be enabled in bonds. */
bool is_tunnel; /* This port is a tunnel. */
+ bool is_layer3; /* This is a layer 3 port. */
long long int carrier_seq; /* Carrier status changes. */
struct ofport_dpif *peer; /* Peer if patch port. */
@@ -1710,6 +1711,8 @@ port_construct(struct ofport *port_)
return 0;
}
+ port->is_layer3 = netdev_vport_is_layer3(netdev);
+
error = dpif_port_query_by_name(ofproto->backer->dpif,
netdev_vport_get_dpif_port(netdev, namebuf,
sizeof namebuf),
@@ -2288,6 +2291,7 @@ bundle_update(struct ofbundle *bundle)
bundle->floodable = true;
LIST_FOR_EACH (port, bundle_node, &bundle->ports) {
if (port->up.pp.config & OFPUTIL_PC_NO_FLOOD
+ || port->is_layer3
|| !stp_forward_in_state(port->stp_state)) {
bundle->floodable = false;
break;
@@ -2335,6 +2339,7 @@ bundle_add_port(struct ofbundle *bundle, ofp_port_t ofp_port,
port->bundle = bundle;
list_push_back(&bundle->ports, &port->bundle_node);
if (port->up.pp.config & OFPUTIL_PC_NO_FLOOD
+ || port->is_layer3
|| !stp_forward_in_state(port->stp_state)) {
bundle->floodable = false;
}
--
1.7.7.5 (Apple Git-26)
More information about the dev
mailing list