]> git.proxmox.com Git - mirror_ovs.git/blame - ofproto/ofproto-dpif-mirror.h
ofproto: Rename struct rule's evict lock and use it more widely.
[mirror_ovs.git] / ofproto / ofproto-dpif-mirror.h
CommitLineData
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
23typedef uint32_t mirror_mask_t;
24
25struct ofproto_dpif;
26struct ofbundle;
27
28struct mbridge *mbridge_create(void);
29struct mbridge *mbridge_ref(const struct mbridge *);
30void mbridge_unref(struct mbridge *);
31bool mbridge_has_mirrors(struct mbridge *);
32bool mbridge_need_revalidate(struct mbridge *);
33
34void mbridge_register_bundle(struct mbridge *, struct ofbundle *);
35void mbridge_unregister_bundle(struct mbridge *, struct ofbundle *);
36
37mirror_mask_t mirror_bundle_out(struct mbridge *, struct ofbundle *);
38mirror_mask_t mirror_bundle_src(struct mbridge *, struct ofbundle *);
39mirror_mask_t mirror_bundle_dst(struct mbridge *, struct ofbundle *);
40
41int 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);
46void mirror_destroy(struct mbridge *, void *aux);
47int mirror_get_stats(struct mbridge *, void *aux, uint64_t *packets,
48 uint64_t *bytes);
49void mirror_update_stats(struct mbridge*, mirror_mask_t, uint64_t packets,
50 uint64_t bytes);
51bool mirror_get(struct mbridge *, int index, unsigned long **vlans,
52 mirror_mask_t *dup_mirrors, struct ofbundle **out,
53 int *out_vlan);
54
55static inline int
56mirror_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 */