]> git.proxmox.com Git - mirror_ovs.git/blob - ofproto/ofproto-dpif-mirror.h
ofproto-dpif: Fix for recirc issue with mpls traffic with dp_hash
[mirror_ovs.git] / ofproto / ofproto-dpif-mirror.h
1 /* Copyright (c) 2013, 2015 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 OFPROTO_DPIF_MIRROR_H
16 #define OFPROTO_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 /* The following functions are used by handler threads without any locking,
29 * assuming RCU protection. */
30
31 struct mbridge *mbridge_ref(const struct mbridge *);
32 void mbridge_unref(struct mbridge *);
33 bool mbridge_has_mirrors(struct mbridge *);
34
35 mirror_mask_t mirror_bundle_out(struct mbridge *, struct ofbundle *);
36 mirror_mask_t mirror_bundle_src(struct mbridge *, struct ofbundle *);
37 mirror_mask_t mirror_bundle_dst(struct mbridge *, struct ofbundle *);
38
39 void mirror_update_stats(struct mbridge*, mirror_mask_t, uint64_t packets,
40 uint64_t bytes);
41 bool mirror_get(struct mbridge *, int index, const unsigned long **vlans,
42 mirror_mask_t *dup_mirrors, struct ofbundle **out,
43 int *snaplen, int *out_vlan);
44
45 /* The remaining functions are assumed to be called by the main thread only. */
46
47 struct mbridge *mbridge_create(void);
48 bool mbridge_need_revalidate(struct mbridge *);
49
50 void mbridge_register_bundle(struct mbridge *, struct ofbundle *);
51 void mbridge_unregister_bundle(struct mbridge *, struct ofbundle *);
52
53 int mirror_set(struct mbridge *, void *aux, const char *name,
54 struct ofbundle **srcs, size_t n_srcs,
55 struct ofbundle **dsts, size_t n_dsts,
56 unsigned long *src_vlans, struct ofbundle *out_bundle,
57 uint16_t snaplen, uint16_t out_vlan);
58 void mirror_destroy(struct mbridge *, void *aux);
59 int mirror_get_stats(struct mbridge *, void *aux, uint64_t *packets,
60 uint64_t *bytes);
61
62 #endif /* ofproto-dpif-mirror.h */