]>
Commit | Line | Data |
---|---|---|
ec7ceaed EJ |
1 | /* Copyright (c) 2013 Nicira, Inc. |
2 | * | |
3 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | * you may not use this file except in compliance with the License. | |
5 | * You may obtain a copy of the License at: | |
6 | * | |
7 | * http://www.apache.org/licenses/LICENSE-2.0 | |
8 | * | |
9 | * Unless required by applicable law or agreed to in writing, software | |
10 | * distributed under the License is distributed on an "AS IS" BASIS, | |
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | * See the License for the specific language governing permissions and | |
13 | * limitations under the License. */ | |
14 | ||
15 | #ifndef OFPROT_DPIF_MIRROR_H | |
16 | #define OFPROT_DPIF_MIRROR_H 1 | |
17 | ||
18 | #include <stdint.h> | |
19 | ||
20 | #include "util.h" | |
21 | ||
22 | #define MAX_MIRRORS 32 | |
23 | typedef uint32_t mirror_mask_t; | |
24 | ||
25 | struct ofproto_dpif; | |
26 | struct ofbundle; | |
27 | ||
28 | struct mbridge *mbridge_create(void); | |
29 | struct mbridge *mbridge_ref(const struct mbridge *); | |
30 | void mbridge_unref(struct mbridge *); | |
31 | bool mbridge_has_mirrors(struct mbridge *); | |
32 | bool mbridge_need_revalidate(struct mbridge *); | |
33 | ||
34 | void mbridge_register_bundle(struct mbridge *, struct ofbundle *); | |
35 | void mbridge_unregister_bundle(struct mbridge *, struct ofbundle *); | |
36 | ||
37 | mirror_mask_t mirror_bundle_out(struct mbridge *, struct ofbundle *); | |
38 | mirror_mask_t mirror_bundle_src(struct mbridge *, struct ofbundle *); | |
39 | mirror_mask_t mirror_bundle_dst(struct mbridge *, struct ofbundle *); | |
40 | ||
41 | int mirror_set(struct mbridge *, void *aux, const char *name, | |
42 | struct ofbundle **srcs, size_t n_srcs, | |
43 | struct ofbundle **dsts, size_t n_dsts, | |
44 | unsigned long *src_vlans, struct ofbundle *out_bundle, | |
45 | uint16_t out_vlan); | |
46 | void mirror_destroy(struct mbridge *, void *aux); | |
47 | int mirror_get_stats(struct mbridge *, void *aux, uint64_t *packets, | |
48 | uint64_t *bytes); | |
49 | void mirror_update_stats(struct mbridge*, mirror_mask_t, uint64_t packets, | |
50 | uint64_t bytes); | |
51 | bool mirror_get(struct mbridge *, int index, unsigned long **vlans, | |
52 | mirror_mask_t *dup_mirrors, struct ofbundle **out, | |
53 | int *out_vlan); | |
54 | ||
55 | static inline int | |
56 | mirror_mask_ffs(mirror_mask_t mask) | |
57 | { | |
58 | BUILD_ASSERT_DECL(sizeof(unsigned int) >= sizeof(mask)); | |
59 | return ffs(mask); | |
60 | } | |
61 | #endif /* ofproto-dpif-mirror.h */ |