]>
git.proxmox.com Git - ovs.git/blob - ofproto/ofproto-dpif-xlate-cache.h
1 /* Copyright (c) 2016 Nicira, Inc.
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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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. */
15 #ifndef OFPROTO_DPIF_XLATE_CACHE_H
16 #define OFPROTO_DPIF_XLATE_CACHE_H 1
19 #include <sys/socket.h>
20 #include <sys/types.h>
21 #include <netinet/in.h>
23 #include "openvswitch/types.h"
24 #include "dp-packet.h"
26 #include "ofproto/ofproto-dpif-mirror.h"
27 #include "openvswitch/ofpbuf.h"
31 struct dpif_flow_stats
;
39 struct ofputil_bucket
;
40 struct ofputil_flow_mod
;
50 XC_LEARN
, /* Calls back to ofproto. */
52 XC_FIN_TIMEOUT
, /* Calls back to ofproto. */
58 /* xlate_cache entries hold enough information to perform the side effects of
59 * xlate_actions() for a rule, without needing to perform rule translation
60 * from scratch. The primary usage of these is to submit statistics to objects
61 * that a flow relates to, although they may be used for other effects as well
62 * (for instance, refreshing hard timeouts for learned flows).
64 * An explicit reference is taken to all pointers other than the ones for
65 * struct ofproto_dpif. ofproto_dpif pointers are explicitly protected by
66 * destroying all xlate caches before the ofproto is destroyed. */
71 struct ofproto_dpif
*ofproto
;
73 bool match
; /* or miss. */
75 struct rule_dpif
*rule
;
82 struct netflow
*netflow
;
87 struct mbridge
*mbridge
;
88 mirror_mask_t mirrors
;
96 struct ofproto_flow_mod
*ofm
;
100 struct ofproto_dpif
*ofproto
;
102 struct eth_addr dl_src
;
104 bool is_gratuitous_arp
;
107 struct rule_dpif
*rule
;
112 struct group_dpif
*group
;
113 struct ofputil_bucket
*bucket
;
116 char br_name
[IFNAMSIZ
];
117 struct in6_addr d_ipv6
;
120 struct ofproto_dpif
*ofproto
;
121 struct ofproto_async_msg
*am
;
133 #define XC_ENTRY_FOR_EACH(ENTRY, ENTRIES) \
134 for (ENTRY = ofpbuf_try_pull(ENTRIES, sizeof *ENTRY); \
136 ENTRY = ofpbuf_try_pull(ENTRIES, sizeof *ENTRY))
139 struct ofpbuf entries
;
142 void xlate_cache_init(struct xlate_cache
*);
143 struct xlate_cache
*xlate_cache_new(void);
144 struct xc_entry
*xlate_cache_add_entry(struct xlate_cache
*, enum xc_type
);
145 void xlate_push_stats_entry(struct xc_entry
*, struct dpif_flow_stats
*);
146 void xlate_push_stats(struct xlate_cache
*, struct dpif_flow_stats
*);
147 void xlate_cache_clear_entry(struct xc_entry
*);
148 void xlate_cache_clear(struct xlate_cache
*);
149 void xlate_cache_uninit(struct xlate_cache
*);
150 void xlate_cache_delete(struct xlate_cache
*);
151 void xlate_cache_steal_entries(struct xlate_cache
*, struct xlate_cache
*);
153 #endif /* ofproto-dpif-xlate-cache.h */