[ovs-dev] [PATCH 14/18] dpif-xlate: Add multicast snooping sending functions
Flavio Leitner
fbl at redhat.com
Fri Apr 11 21:34:19 UTC 2014
This patch adds the functions needed for multicast snooping
in order to send the packets to the correct ports.
They are marked as OVS_UNUSED for now.
Acked-by: Thomas Graf <tgraf at redhat.com>
Signed-off-by: Flavio Leitner <fbl at redhat.com>
---
ofproto/ofproto-dpif-xlate.c | 65 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 22798cc..e38be4c 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -1401,6 +1401,71 @@ update_learning_table(const struct xbridge *xbridge,
}
}
+/* send the packet to ports having the multicast group learned */
+OVS_UNUSED static void
+xlate_normal_mcast_send_group(struct xlate_ctx *ctx, struct mcast_entry *mcast,
+ struct xbundle *in_xbundle, uint16_t vlan)
+{
+ struct mcast_entry_bundle *b;
+ struct xbundle *mcast_xbundle;
+
+ LIST_FOR_EACH(b, bundle_node, &mcast->lru_bundles) {
+ mcast_xbundle = xbundle_lookup(b->port.p);
+ if (mcast_xbundle && mcast_xbundle != in_xbundle) {
+ xlate_report(ctx, "forwarding to mcast group port");
+ output_normal(ctx, mcast_xbundle, vlan);
+ } else if (!mcast_xbundle) {
+ xlate_report(ctx, "mcast group port is unknown, dropping");
+ } else {
+ xlate_report(ctx, "mcast group port is input port, dropping");
+ }
+ }
+}
+
+/* send the packet to ports connected to multicast routers */
+OVS_UNUSED static void
+xlate_normal_mcast_send_mrouters(struct xlate_ctx *ctx,
+ struct mcast_snooping *ms,
+ struct xbundle *in_xbundle, uint16_t vlan)
+{
+ struct mcast_mrouter_bundle *mrouter;
+ struct xbundle *mcast_xbundle;
+
+ LIST_FOR_EACH(mrouter, lru_node, &ms->mrouter_lru) {
+ mcast_xbundle = xbundle_lookup(mrouter->port.p);
+ if (mcast_xbundle && mcast_xbundle != in_xbundle) {
+ xlate_report(ctx, "forwarding to mcast router port");
+ output_normal(ctx, mcast_xbundle, vlan);
+ } else if (!mcast_xbundle) {
+ xlate_report(ctx, "mcast router port is unknown, dropping");
+ } else {
+ xlate_report(ctx, "mcast router port is input port, dropping");
+ }
+ }
+}
+
+/* send the packet to ports flagged to be flooded */
+OVS_UNUSED static void
+xlate_normal_mcast_send_fports(struct xlate_ctx *ctx,
+ struct mcast_snooping *ms,
+ struct xbundle *in_xbundle, uint16_t vlan)
+{
+ struct mcast_fport_bundle *fport;
+ struct xbundle *mcast_xbundle;
+
+ LIST_FOR_EACH(fport, list_node, &ms->fport_list) {
+ mcast_xbundle = xbundle_lookup(fport->port.p);
+ if (mcast_xbundle && mcast_xbundle != in_xbundle) {
+ xlate_report(ctx, "forwarding to mcast flood port");
+ output_normal(ctx, mcast_xbundle, vlan);
+ } else if (!mcast_xbundle) {
+ xlate_report(ctx, "mcast flood port is unknown, dropping");
+ } else {
+ xlate_report(ctx, "mcast flood port is input port, dropping");
+ }
+ }
+}
+
static void
xlate_normal_flood(struct xlate_ctx *ctx, struct xbundle *in_xbundle,
uint16_t vlan)
--
1.9.0
More information about the dev
mailing list