The struct mcast_fport_bundle will be used for ports forwarding Reports too, so make it generic.
Signed-off-by: Flavio Leitner <f...@redhat.com> --- lib/mcast-snooping.c | 28 ++++++++++++++-------------- lib/mcast-snooping.h | 12 ++++++------ ofproto/ofproto-dpif-xlate.c | 8 ++++---- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/mcast-snooping.c b/lib/mcast-snooping.c index 8651445..887519c 100644 --- a/lib/mcast-snooping.c +++ b/lib/mcast-snooping.c @@ -517,16 +517,16 @@ mcast_snooping_flush_mrouter(struct mcast_mrouter_bundle *mrouter) /* Flood ports. */ -static struct mcast_fport_bundle * +static struct mcast_port_bundle * mcast_fport_from_list_node(struct list *list) { - return CONTAINER_OF(list, struct mcast_fport_bundle, fport_node); + return CONTAINER_OF(list, struct mcast_port_bundle, node); } /* If the list is not empty, stores the fport in '*f' and returns true. * Otherwise, if the list is empty, stores NULL in '*f' and return false. */ static bool -fport_get(const struct mcast_snooping *ms, struct mcast_fport_bundle **f) +fport_get(const struct mcast_snooping *ms, struct mcast_port_bundle **f) OVS_REQ_RDLOCK(ms->rwlock) { if (!list_is_empty(&ms->fport_list)) { @@ -538,14 +538,14 @@ fport_get(const struct mcast_snooping *ms, struct mcast_fport_bundle **f) } } -struct mcast_fport_bundle * +struct mcast_port_bundle * mcast_snooping_fport_lookup(struct mcast_snooping *ms, uint16_t vlan, void *port) OVS_REQ_RDLOCK(ms->rwlock) { - struct mcast_fport_bundle *fport; + struct mcast_port_bundle *fport; - LIST_FOR_EACH (fport, fport_node, &ms->fport_list) { + LIST_FOR_EACH (fport, node, &ms->fport_list) { if (fport->vlan == vlan && fport->port == port) { return fport; } @@ -557,18 +557,18 @@ static void mcast_snooping_add_fport(struct mcast_snooping *ms, uint16_t vlan, void *port) OVS_REQ_WRLOCK(ms->rwlock) { - struct mcast_fport_bundle *fport; + struct mcast_port_bundle *fport; fport = xmalloc(sizeof *fport); fport->vlan = vlan; fport->port = port; - list_insert(&ms->fport_list, &fport->fport_node); + list_insert(&ms->fport_list, &fport->node); } static void -mcast_snooping_flush_fport(struct mcast_fport_bundle *fport) +mcast_snooping_flush_fport(struct mcast_port_bundle *fport) { - list_remove(&fport->fport_node); + list_remove(&fport->node); free(fport); } @@ -577,7 +577,7 @@ mcast_snooping_set_port_flood(struct mcast_snooping *ms, uint16_t vlan, void *port, bool flood) OVS_REQ_WRLOCK(ms->rwlock) { - struct mcast_fport_bundle *fport; + struct mcast_port_bundle *fport; fport = mcast_snooping_fport_lookup(ms, vlan, port); if (flood && !fport) { @@ -628,7 +628,7 @@ mcast_snooping_flush__(struct mcast_snooping *ms) { struct mcast_group *grp; struct mcast_mrouter_bundle *mrouter; - struct mcast_fport_bundle *fport; + struct mcast_port_bundle *port; while (group_get_lru(ms, &grp)) { mcast_snooping_flush_group(ms, grp); @@ -640,8 +640,8 @@ mcast_snooping_flush__(struct mcast_snooping *ms) mcast_snooping_flush_mrouter(mrouter); } - while (fport_get(ms, &fport)) { - mcast_snooping_flush_fport(fport); + while (fport_get(ms, &port)) { + mcast_snooping_flush_fport(port); } } diff --git a/lib/mcast-snooping.h b/lib/mcast-snooping.h index f15e973..861b973 100644 --- a/lib/mcast-snooping.h +++ b/lib/mcast-snooping.h @@ -87,11 +87,11 @@ struct mcast_mrouter_bundle { void *port OVS_GUARDED; }; -/* The bundle to be flooded with multicast traffic. +/* The bundle to send multicast traffic. * Guarded by owning 'mcast_snooping''s rwlock */ -struct mcast_fport_bundle { - /* Node in parent struct mcast_snooping fport_list. */ - struct list fport_node; +struct mcast_port_bundle { + /* Node in parent struct mcast_snooping. */ + struct list node; /* VLAN tag. */ uint16_t vlan; @@ -113,7 +113,7 @@ struct mcast_snooping { * front, most recently used at the back. */ struct list mrouter_lru OVS_GUARDED; - /* Contains struct mcast_fport_bundle to be flooded with multicast + /* Contains struct mcast_port_bundle to be flooded with multicast * packets in no special order. */ struct list fport_list OVS_GUARDED; @@ -180,7 +180,7 @@ bool mcast_snooping_leave_group(struct mcast_snooping *ms, ovs_be32 ip4, bool mcast_snooping_add_mrouter(struct mcast_snooping *ms, uint16_t vlan, void *port) OVS_REQ_WRLOCK(ms->rwlock); -struct mcast_fport_bundle * +struct mcast_port_bundle * mcast_snooping_fport_lookup(struct mcast_snooping *ms, uint16_t vlan, void *port) OVS_REQ_RDLOCK(ms->rwlock); diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 8f0a3aa..7f6aaf9 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -1958,7 +1958,7 @@ update_mcast_snooping_table(const struct xbridge *xbridge, struct mcast_snooping *ms = xbridge->ms; struct xlate_cfg *xcfg; struct xbundle *mcast_xbundle; - struct mcast_fport_bundle *fport; + struct mcast_port_bundle *fport; /* Don't learn the OFPP_NONE port. */ if (in_xbundle == &ofpp_none_bundle) { @@ -1969,7 +1969,7 @@ update_mcast_snooping_table(const struct xbridge *xbridge, mcast_xbundle = NULL; ovs_rwlock_wrlock(&ms->rwlock); xcfg = ovsrcu_get(struct xlate_cfg *, &xcfgp); - LIST_FOR_EACH(fport, fport_node, &ms->fport_list) { + LIST_FOR_EACH(fport, node, &ms->fport_list) { mcast_xbundle = xbundle_lookup(xcfg, fport->port); if (mcast_xbundle == in_xbundle) { break; @@ -2042,11 +2042,11 @@ xlate_normal_mcast_send_fports(struct xlate_ctx *ctx, OVS_REQ_RDLOCK(ms->rwlock) { struct xlate_cfg *xcfg; - struct mcast_fport_bundle *fport; + struct mcast_port_bundle *fport; struct xbundle *mcast_xbundle; xcfg = ovsrcu_get(struct xlate_cfg *, &xcfgp); - LIST_FOR_EACH(fport, fport_node, &ms->fport_list) { + LIST_FOR_EACH(fport, node, &ms->fport_list) { mcast_xbundle = xbundle_lookup(xcfg, fport->port); if (mcast_xbundle && mcast_xbundle != in_xbundle) { xlate_report(ctx, "forwarding to mcast flood port"); -- 1.9.3 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev