Since dpif registering for routing table at initialization there is no need to unregister it. Following patch removes support for turning routing table notifications on and off. Due to this change OVS always listens for these notifications.
Reported-by: YAMAMOTO Takashi <yamam...@valinux.co.jp> Signed-off-by: Pravin B Shelar <pshe...@nicira.com> --- lib/netdev-vport.c | 1 - lib/route-table-bsd.c | 13 +--------- lib/route-table-stub.c | 5 ---- lib/route-table.c | 53 ++++++++---------------------------------- lib/route-table.h | 1 - ofproto/ofproto-dpif-sflow.c | 2 - 6 files changed, 11 insertions(+), 64 deletions(-) diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 3825a09..e6b97fa 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -262,7 +262,6 @@ netdev_vport_destruct(struct netdev *netdev_) { struct netdev_vport *netdev = netdev_vport_cast(netdev_); - route_table_unregister(); free(netdev->peer); ovs_mutex_destroy(&netdev->mutex); } diff --git a/lib/route-table-bsd.c b/lib/route-table-bsd.c index 9ebfaa3..0d631b4 100644 --- a/lib/route-table-bsd.c +++ b/lib/route-table-bsd.c @@ -118,18 +118,7 @@ route_table_get_change_seq(void) void route_table_register(void) { - if (!register_count) - { - pid = getpid(); - } - - register_count++; -} - -void -route_table_unregister(void) -{ - register_count--; + pid = getpid(); } void diff --git a/lib/route-table-stub.c b/lib/route-table-stub.c index b7686e4..347149d 100644 --- a/lib/route-table-stub.c +++ b/lib/route-table-stub.c @@ -43,11 +43,6 @@ route_table_register(void) } void -route_table_unregister(void) -{ -} - -void route_table_run(void) { } diff --git a/lib/route-table.c b/lib/route-table.c index 63a9bd3..29ba38c 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -61,7 +61,6 @@ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20); * every time route_table_reset() is called. */ static uint64_t rt_change_seq; -static unsigned int register_count = 0; static struct nln *nln = NULL; static struct route_table_msg rtmsg; static struct nln_notifier *route_notifier = NULL; @@ -76,7 +75,6 @@ static void route_table_change(const struct route_table_msg *, void *); static void route_map_clear(void); static void name_table_init(void); -static void name_table_uninit(void); static void name_table_change(const struct rtnetlink_link_change *, void *); uint64_t @@ -92,45 +90,20 @@ route_table_register(void) OVS_EXCLUDED(route_table_mutex) { ovs_mutex_lock(&route_table_mutex); - if (!register_count) { - ovs_assert(!nln); - ovs_assert(!route_notifier); + ovs_assert(!nln); + ovs_assert(!route_notifier); - ovs_router_init(); - nln = nln_create(NETLINK_ROUTE, RTNLGRP_IPV4_ROUTE, - (nln_parse_func *) route_table_parse, &rtmsg); + ovs_router_init(); + nln = nln_create(NETLINK_ROUTE, RTNLGRP_IPV4_ROUTE, + (nln_parse_func *) route_table_parse, &rtmsg); - route_notifier = - nln_notifier_create(nln, (nln_notify_func *) route_table_change, - NULL); + route_notifier = + nln_notifier_create(nln, (nln_notify_func *) route_table_change, + NULL); - route_table_reset(); - name_table_init(); - } - - register_count++; - ovs_mutex_unlock(&route_table_mutex); -} - -/* Users of the route_table module should unregister themselves with this - * function when they will no longer be making any more route_table fuction - * calls. */ -void -route_table_unregister(void) - OVS_EXCLUDED(route_table_mutex) -{ - ovs_mutex_lock(&route_table_mutex); - register_count--; + route_table_reset(); + name_table_init(); - if (!register_count) { - nln_notifier_destroy(route_notifier); - route_notifier = NULL; - nln_destroy(nln); - nln = NULL; - - route_map_clear(); - name_table_uninit(); - } ovs_mutex_unlock(&route_table_mutex); } @@ -300,12 +273,6 @@ name_table_init(void) name_notifier = rtnetlink_link_notifier_create(name_table_change, NULL); } -static void -name_table_uninit(void) -{ - rtnetlink_link_notifier_destroy(name_notifier); - name_notifier = NULL; -} static void name_table_change(const struct rtnetlink_link_change *change OVS_UNUSED, diff --git a/lib/route-table.h b/lib/route-table.h index 709dfb0..97f5b34 100644 --- a/lib/route-table.h +++ b/lib/route-table.h @@ -27,7 +27,6 @@ uint64_t route_table_get_change_seq(void); void route_table_register(void); -void route_table_unregister(void); void route_table_run(void); void route_table_wait(void); diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c index 60b65a3..35667ca 100644 --- a/ofproto/ofproto-dpif-sflow.c +++ b/ofproto/ofproto-dpif-sflow.c @@ -390,7 +390,6 @@ dpif_sflow_create(void) ds->next_tick = time_now() + 1; hmap_init(&ds->ports); ds->probability = 0; - route_table_register(); ovs_refcount_init(&ds->ref_cnt); return ds; @@ -425,7 +424,6 @@ dpif_sflow_unref(struct dpif_sflow *ds) OVS_EXCLUDED(mutex) if (ds && ovs_refcount_unref_relaxed(&ds->ref_cnt) == 1) { struct dpif_sflow_port *dsp, *next; - route_table_unregister(); dpif_sflow_clear(ds); HMAP_FOR_EACH_SAFE (dsp, next, hmap_node, &ds->ports) { dpif_sflow_del_port__(ds, dsp); -- 1.7.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev