2 * Copyright (c) 2013 Nicira, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "connectivity.h"
19 #include "ovs-thread.h"
22 static struct seq *connectivity_seq;
24 /* Provides a global seq for connectivity changes.
26 * Connectivity monitoring modules should call seq_change() on the returned
27 * object whenever the status of a port changes, whether the cause is local or
30 * Clients can seq_wait() on this object for changes to netdev flags, features,
31 * ethernet addresses, carrier changes, and bfd/cfm/lacp/stp status. */
33 connectivity_seq_get(void)
35 static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
37 if (ovsthread_once_start(&once)) {
38 connectivity_seq = seq_create();
39 ovsthread_once_done(&once);
42 return connectivity_seq;