]>
Commit | Line | Data |
---|---|---|
da4a6191 JS |
1 | /* |
2 | * Copyright (c) 2013 Nicira, Inc. | |
3 | * | |
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: | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
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. | |
15 | */ | |
16 | ||
17 | #include <config.h> | |
18 | #include "connectivity.h" | |
19 | #include "ovs-thread.h" | |
20 | #include "seq.h" | |
21 | ||
22 | static struct seq *connectivity_seq; | |
23 | ||
24 | /* Provides a global seq for connectivity changes. | |
25 | * | |
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 | |
28 | * remote. | |
29 | * | |
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. */ | |
32 | struct seq * | |
33 | connectivity_seq_get(void) | |
34 | { | |
35 | static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; | |
36 | ||
37 | if (ovsthread_once_start(&once)) { | |
38 | connectivity_seq = seq_create(); | |
39 | ovsthread_once_done(&once); | |
40 | } | |
41 | ||
42 | return connectivity_seq; | |
43 | } |