2 * Copyright (c) 2009-2014, 2018 Nicira, Inc.
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef DPIF_PROVIDER_H
18 #define DPIF_PROVIDER_H 1
20 /* Provider interface to dpifs, which provide an interface to an Open vSwitch
21 * datapath. A datapath is a collection of physical or virtual ports that are
22 * exposed over OpenFlow as a single switch. Datapaths and the collections of
23 * ports that they contain may be fixed or dynamic. */
25 #include "openflow/openflow.h"
33 /* Open vSwitch datapath interface.
35 * This structure should be treated as opaque by dpif implementations. */
37 const struct dpif_class
*dpif_class
;
40 uint8_t netflow_engine_type
;
41 uint8_t netflow_engine_id
;
42 long long int current_ms
;
45 struct dpif_ipf_status
;
48 void dpif_init(struct dpif
*, const struct dpif_class
*, const char *name
,
49 uint8_t netflow_engine_type
, uint8_t netflow_engine_id
);
50 void dpif_uninit(struct dpif
*dpif
, bool close
);
52 static inline void dpif_assert_class(const struct dpif
*dpif
,
53 const struct dpif_class
*dpif_class
)
55 ovs_assert(dpif
->dpif_class
== dpif_class
);
58 struct dpif_flow_dump
{
60 bool terse
; /* If true, key/mask/actions may be omitted. */
64 dpif_flow_dump_init(struct dpif_flow_dump
*dump
, const struct dpif
*dpif
)
66 dump
->dpif
= CONST_CAST(struct dpif
*, dpif
);
69 struct dpif_flow_dump_thread
{
74 dpif_flow_dump_thread_init(struct dpif_flow_dump_thread
*thread
,
75 struct dpif_flow_dump
*dump
)
77 thread
->dpif
= dump
->dpif
;
80 struct ct_dpif_dump_state
;
83 struct ct_dpif_timeout_policy
;
85 /* 'dpif_ipf_proto_status' and 'dpif_ipf_status' are presently in
86 * sync with 'ipf_proto_status' and 'ipf_status', but more
87 * generally represent a superset of present and future support. */
88 struct dpif_ipf_proto_status
{
89 uint64_t nfrag_accepted
;
90 uint64_t nfrag_completed_sent
;
91 uint64_t nfrag_expired_sent
;
92 uint64_t nfrag_too_small
;
93 uint64_t nfrag_overlap
;
94 uint64_t nfrag_purged
;
95 unsigned int min_frag_size
;
99 struct dpif_ipf_status
{
100 struct dpif_ipf_proto_status v4
;
101 struct dpif_ipf_proto_status v6
;
103 unsigned int nfrag_max
;
106 /* Datapath interface class structure, to be defined by each implementation of
107 * a datapath interface.
109 * These functions return 0 if successful or a positive errno value on failure,
110 * except where otherwise noted.
112 * These functions are expected to execute synchronously, that is, to block as
113 * necessary to obtain a result. Thus, they may not return EAGAIN or
114 * EWOULDBLOCK or EINPROGRESS. We may relax this requirement in the future if
115 * and when we encounter performance problems. */
117 /* Type of dpif in this class, e.g. "system", "netdev", etc.
119 * One of the providers should supply a "system" type, since this is
120 * the type assumed if no type is specified when opening a dpif. */
123 /* If 'true', datapath ports should be destroyed on ofproto destruction.
125 * This is used by the vswitch at exit, so that it can clean any
126 * datapaths that can not exist without it (e.g. netdev datapath). */
127 bool cleanup_required
;
129 /* Called when the dpif provider is registered, typically at program
130 * startup. Returning an error from this function will prevent any
131 * datapath with this class from being created.
133 * This function may be set to null if a datapath class needs no
134 * initialization at registration time. */
137 /* Enumerates the names of all known created datapaths (of class
138 * 'dpif_class'), if possible, into 'all_dps'. The caller has already
139 * initialized 'all_dps' and other dpif classes might already have added
142 * This is used by the vswitch at startup, so that it can delete any
143 * datapaths that are not configured.
145 * Some kinds of datapaths might not be practically enumerable, in which
146 * case this function may be a null pointer. */
147 int (*enumerate
)(struct sset
*all_dps
, const struct dpif_class
*dpif_class
);
149 /* Returns the type to pass to netdev_open() when a dpif of class
150 * 'dpif_class' has a port of type 'type', for a few special cases
151 * when a netdev type differs from a port type. For example, when
152 * using the userspace datapath, a port of type "internal" needs to
153 * be opened as "tap".
155 * Returns either 'type' itself or a string literal, which must not
157 const char *(*port_open_type
)(const struct dpif_class
*dpif_class
,
160 /* Attempts to open an existing dpif called 'name', if 'create' is false,
161 * or to open an existing dpif or create a new one, if 'create' is true.
163 * 'dpif_class' is the class of dpif to open.
165 * If successful, stores a pointer to the new dpif in '*dpifp', which must
166 * have class 'dpif_class'. On failure there are no requirements on what
167 * is stored in '*dpifp'. */
168 int (*open
)(const struct dpif_class
*dpif_class
,
169 const char *name
, bool create
, struct dpif
**dpifp
);
171 /* Closes 'dpif' and frees associated memory. */
172 void (*close
)(struct dpif
*dpif
);
174 /* Attempts to destroy the dpif underlying 'dpif'.
176 * If successful, 'dpif' will not be used again except as an argument for
177 * the 'close' member function. */
178 int (*destroy
)(struct dpif
*dpif
);
180 /* Performs periodic work needed by 'dpif', if any is necessary.
181 * Returns true if need to revalidate. */
182 bool (*run
)(struct dpif
*dpif
);
184 /* Arranges for poll_block() to wake up if the "run" member function needs
185 * to be called for 'dpif'. */
186 void (*wait
)(struct dpif
*dpif
);
188 /* Retrieves statistics for 'dpif' into 'stats'. */
189 int (*get_stats
)(const struct dpif
*dpif
, struct dpif_dp_stats
*stats
);
191 int (*set_features
)(struct dpif
*dpif
, uint32_t user_features
);
193 /* Adds 'netdev' as a new port in 'dpif'. If '*port_no' is not
194 * ODPP_NONE, attempts to use that as the port's port number.
196 * If port is successfully added, sets '*port_no' to the new port's
197 * port number. Returns EBUSY if caller attempted to choose a port
198 * number, and it was in use. */
199 int (*port_add
)(struct dpif
*dpif
, struct netdev
*netdev
,
200 odp_port_t
*port_no
);
202 /* Removes port numbered 'port_no' from 'dpif'. */
203 int (*port_del
)(struct dpif
*dpif
, odp_port_t port_no
);
205 /* Refreshes configuration of 'dpif's port. The implementation might
206 * postpone applying the changes until run() is called. */
207 int (*port_set_config
)(struct dpif
*dpif
, odp_port_t port_no
,
208 const struct smap
*cfg
);
210 /* Queries 'dpif' for a port with the given 'port_no' or 'devname'.
211 * If 'port' is not null, stores information about the port into
212 * '*port' if successful.
214 * If the port doesn't exist, the provider must return ENODEV. Other
215 * error numbers means that something wrong happened and will be
216 * treated differently by upper layers.
218 * If 'port' is not null, the caller takes ownership of data in
219 * 'port' and must free it with dpif_port_destroy() when it is no
221 int (*port_query_by_number
)(const struct dpif
*dpif
, odp_port_t port_no
,
222 struct dpif_port
*port
);
223 int (*port_query_by_name
)(const struct dpif
*dpif
, const char *devname
,
224 struct dpif_port
*port
);
226 /* Returns the Netlink PID value to supply in OVS_ACTION_ATTR_USERSPACE
227 * actions as the OVS_USERSPACE_ATTR_PID attribute's value, for use in
228 * flows whose packets arrived on port 'port_no'.
230 * A 'port_no' of UINT32_MAX should be treated as a special case. The
231 * implementation should return a reserved PID, not allocated to any port,
232 * that the client may use for special purposes.
234 * The return value only needs to be meaningful when DPIF_UC_ACTION has
235 * been enabled in the 'dpif''s listen mask, and it is allowed to change
236 * when DPIF_UC_ACTION is disabled and then re-enabled.
238 * A dpif provider that doesn't have meaningful Netlink PIDs can use NULL
239 * for this function. This is equivalent to always returning 0. */
240 uint32_t (*port_get_pid
)(const struct dpif
*dpif
, odp_port_t port_no
);
242 /* Attempts to begin dumping the ports in a dpif. On success, returns 0
243 * and initializes '*statep' with any data needed for iteration. On
244 * failure, returns a positive errno value. */
245 int (*port_dump_start
)(const struct dpif
*dpif
, void **statep
);
247 /* Attempts to retrieve another port from 'dpif' for 'state', which was
248 * initialized by a successful call to the 'port_dump_start' function for
249 * 'dpif'. On success, stores a new dpif_port into 'port' and returns 0.
250 * Returns EOF if the end of the port table has been reached, or a positive
251 * errno value on error. This function will not be called again once it
252 * returns nonzero once for a given iteration (but the 'port_dump_done'
253 * function will be called afterward).
255 * The dpif provider retains ownership of the data stored in 'port'. It
256 * must remain valid until at least the next call to 'port_dump_next' or
257 * 'port_dump_done' for 'state'. */
258 int (*port_dump_next
)(const struct dpif
*dpif
, void *state
,
259 struct dpif_port
*port
);
261 /* Releases resources from 'dpif' for 'state', which was initialized by a
262 * successful call to the 'port_dump_start' function for 'dpif'. */
263 int (*port_dump_done
)(const struct dpif
*dpif
, void *state
);
265 /* Polls for changes in the set of ports in 'dpif'. If the set of ports in
266 * 'dpif' has changed, then this function should do one of the
269 * - Preferably: store the name of the device that was added to or deleted
270 * from 'dpif' in '*devnamep' and return 0. The caller is responsible
271 * for freeing '*devnamep' (with free()) when it no longer needs it.
273 * - Alternatively: return ENOBUFS, without indicating the device that was
276 * Occasional 'false positives', in which the function returns 0 while
277 * indicating a device that was not actually added or deleted or returns
278 * ENOBUFS without any change, are acceptable.
280 * If the set of ports in 'dpif' has not changed, returns EAGAIN. May also
281 * return other positive errno values to indicate that something has gone
283 int (*port_poll
)(const struct dpif
*dpif
, char **devnamep
);
285 /* Arranges for the poll loop to wake up when 'port_poll' will return a
286 * value other than EAGAIN. */
287 void (*port_poll_wait
)(const struct dpif
*dpif
);
289 /* Deletes all flows from 'dpif' and clears all of its queues of received
291 int (*flow_flush
)(struct dpif
*dpif
);
293 /* Flow dumping interface.
295 * This is the back-end for the flow dumping interface described in
296 * dpif.h. Please read the comments there first, because this code
297 * closely follows it.
299 * 'flow_dump_create' and 'flow_dump_thread_create' must always return an
300 * initialized and usable data structure and defer error return until
301 * flow_dump_destroy(). This hasn't been a problem for the dpifs that
304 * 'flow_dump_create' and 'flow_dump_thread_create' must initialize the
305 * structures that they return with dpif_flow_dump_init() and
306 * dpif_flow_dump_thread_init(), respectively.
308 * If 'terse' is true, then only UID and statistics will
309 * be returned in the dump. Otherwise, all fields will be returned.
311 * If 'types' isn't null, dumps only the flows of the passed types. */
312 struct dpif_flow_dump
*(*flow_dump_create
)(
313 const struct dpif
*dpif
,
315 struct dpif_flow_dump_types
*types
);
316 int (*flow_dump_destroy
)(struct dpif_flow_dump
*dump
);
318 struct dpif_flow_dump_thread
*(*flow_dump_thread_create
)(
319 struct dpif_flow_dump
*dump
);
320 void (*flow_dump_thread_destroy
)(struct dpif_flow_dump_thread
*thread
);
322 int (*flow_dump_next
)(struct dpif_flow_dump_thread
*thread
,
323 struct dpif_flow
*flows
, int max_flows
);
324 /* Executes each of the 'n_ops' operations in 'ops' on 'dpif', in the order
325 * in which they are specified, placing each operation's results in the
326 * "output" members documented in comments and the 'error' member of each
327 * dpif_op. The offload_type argument tells the provider if 'ops' should
328 * be submitted to to a netdev (only offload) or to the kernel datapath
329 * (never offload) or to both (offload if possible; software fallback). */
330 void (*operate
)(struct dpif
*dpif
, struct dpif_op
**ops
, size_t n_ops
,
331 enum dpif_offload_type offload_type
);
333 /* Enables or disables receiving packets with dpif_recv() for 'dpif'.
334 * Turning packet receive off and then back on is allowed to change Netlink
335 * PID assignments (see ->port_get_pid()). The client is responsible for
336 * updating flows as necessary if it does this. */
337 int (*recv_set
)(struct dpif
*dpif
, bool enable
);
339 /* Refreshes the poll loops and Netlink sockets associated to each port,
340 * when the number of upcall handlers (upcall receiving thread) is changed
341 * to 'n_handlers' and receiving packets for 'dpif' is enabled by
344 * Since multiple upcall handlers can read upcalls simultaneously from
345 * 'dpif', each port can have multiple Netlink sockets, one per upcall
346 * handler. So, handlers_set() is responsible for the following tasks:
348 * When receiving upcall is enabled, extends or creates the
349 * configuration to support:
351 * - 'n_handlers' Netlink sockets for each port.
353 * - 'n_handlers' poll loops, one for each upcall handler.
355 * - registering the Netlink sockets for the same upcall handler to
356 * the corresponding poll loop.
358 int (*handlers_set
)(struct dpif
*dpif
, uint32_t n_handlers
);
360 /* Pass custom configuration options to the datapath. The implementation
361 * might postpone applying the changes until run() is called. */
362 int (*set_config
)(struct dpif
*dpif
, const struct smap
*other_config
);
364 /* Translates OpenFlow queue ID 'queue_id' (in host byte order) into a
365 * priority value used for setting packet priority. */
366 int (*queue_to_priority
)(const struct dpif
*dpif
, uint32_t queue_id
,
369 /* Polls for an upcall from 'dpif' for an upcall handler. Since there
370 * can be multiple poll loops (see ->handlers_set()), 'handler_id' is
371 * needed as index to identify the corresponding poll loop. If
372 * successful, stores the upcall into '*upcall', using 'buf' for
373 * storage. Should only be called if 'recv_set' has been used to enable
374 * receiving packets from 'dpif'.
376 * The implementation should point 'upcall->key' and 'upcall->userdata'
377 * (if any) into data in the caller-provided 'buf'. The implementation may
378 * also use 'buf' for storing the data of 'upcall->packet'. If necessary
379 * to make room, the implementation may reallocate the data in 'buf'.
381 * The caller owns the data of 'upcall->packet' and may modify it. If
382 * packet's headroom is exhausted as it is manipulated, 'upcall->packet'
383 * will be reallocated. This requires the data of 'upcall->packet' to be
384 * released with ofpbuf_uninit() before 'upcall' is destroyed. However,
385 * when an error is returned, the 'upcall->packet' may be uninitialized
386 * and should not be released.
388 * This function must not block. If no upcall is pending when it is
389 * called, it should return EAGAIN without blocking. */
390 int (*recv
)(struct dpif
*dpif
, uint32_t handler_id
,
391 struct dpif_upcall
*upcall
, struct ofpbuf
*buf
);
393 /* Arranges for the poll loop for an upcall handler to wake up when 'dpif'
394 * has a message queued to be received with the recv member functions.
395 * Since there can be multiple poll loops (see ->handlers_set()),
396 * 'handler_id' is needed as index to identify the corresponding poll loop.
398 void (*recv_wait
)(struct dpif
*dpif
, uint32_t handler_id
);
400 /* Throws away any queued upcalls that 'dpif' currently has ready to
402 void (*recv_purge
)(struct dpif
*dpif
);
404 /* When 'dpif' is about to purge the datapath, the higher layer may want
405 * to be notified so that it could try reacting accordingly (e.g. grabbing
406 * all flow stats before they are gone).
408 * Registers an upcall callback function with 'dpif'. This is only used
409 * if 'dpif' needs to notify the purging of datapath. 'aux' is passed to
410 * the callback on invocation. */
411 void (*register_dp_purge_cb
)(struct dpif
*, dp_purge_callback
*, void *aux
);
413 /* For datapaths that run in userspace (i.e. dpif-netdev), threads polling
414 * for incoming packets can directly call upcall functions instead of
415 * offloading packet processing to separate handler threads. Datapaths
416 * that directly call upcall functions should use the functions below to
417 * to register an upcall function and enable / disable upcalls.
419 * Registers an upcall callback function with 'dpif'. This is only used
420 * if 'dpif' directly executes upcall functions. 'aux' is passed to the
421 * callback on invocation. */
422 void (*register_upcall_cb
)(struct dpif
*, upcall_callback
*, void *aux
);
424 /* Enables upcalls if 'dpif' directly executes upcall functions. */
425 void (*enable_upcall
)(struct dpif
*);
427 /* Disables upcalls if 'dpif' directly executes upcall functions. */
428 void (*disable_upcall
)(struct dpif
*);
430 /* Get datapath version. Caller is responsible for freeing the string
432 char *(*get_datapath_version
)(void);
434 /* Conntrack entry dumping interface.
436 * These functions are used by ct-dpif.c to provide a datapath-agnostic
437 * dumping interface to the connection trackers provided by the
440 * ct_dump_start() should put in '*state' a pointer to a newly allocated
441 * stucture that will be passed by the caller to ct_dump_next() and
442 * ct_dump_done(). If 'zone' is not NULL, only the entries in '*zone'
445 * ct_dump_next() should fill 'entry' with information from a connection
446 * and prepare to dump the next one on a subsequest invocation.
448 * ct_dump_done() should perform any cleanup necessary (including
449 * deallocating the 'state' structure, if applicable). */
450 int (*ct_dump_start
)(struct dpif
*, struct ct_dpif_dump_state
**state
,
451 const uint16_t *zone
, int *);
452 int (*ct_dump_next
)(struct dpif
*, struct ct_dpif_dump_state
*state
,
453 struct ct_dpif_entry
*entry
);
454 int (*ct_dump_done
)(struct dpif
*, struct ct_dpif_dump_state
*state
);
456 /* Flushes the connection tracking tables. The arguments have the
457 * following behavior:
459 * - If both 'zone' and 'tuple' are NULL, flush all the conntrack
461 * - If 'zone' is not NULL, and 'tuple' is NULL, flush all the
462 * conntrack entries in '*zone'.
463 * - If 'tuple' is not NULL, flush the conntrack entry specified by
464 * 'tuple' in '*zone'. If 'zone' is NULL, use the default zone
466 int (*ct_flush
)(struct dpif
*, const uint16_t *zone
,
467 const struct ct_dpif_tuple
*tuple
);
468 /* Set max connections allowed. */
469 int (*ct_set_maxconns
)(struct dpif
*, uint32_t maxconns
);
470 /* Get max connections allowed. */
471 int (*ct_get_maxconns
)(struct dpif
*, uint32_t *maxconns
);
472 /* Get number of connections tracked. */
473 int (*ct_get_nconns
)(struct dpif
*, uint32_t *nconns
);
474 /* Enable or disable TCP sequence checking. */
475 int (*ct_set_tcp_seq_chk
)(struct dpif
*, bool enabled
);
476 /* Get the TCP sequence checking configuration. */
477 int (*ct_get_tcp_seq_chk
)(struct dpif
*, bool *enabled
);
480 /* Connection tracking per zone limit */
482 /* Per zone conntrack limit sets the maximum allowed connections in zones
483 * to provide resource isolation. If a per zone limit for a particular
484 * zone is not available in the datapath, it defaults to the default
485 * per zone limit. Initially, the default per zone limit is
488 /* Sets the max connections allowed per zone according to 'zone_limits',
489 * a list of 'struct ct_dpif_zone_limit' entries (the 'count' member
490 * is not used when setting limits). If 'default_limit' is not NULL,
491 * modifies the default limit to '*default_limit'. */
492 int (*ct_set_limits
)(struct dpif
*, const uint32_t *default_limit
,
493 const struct ovs_list
*zone_limits
);
495 /* Looks up the default per zone limit and stores that in
496 * 'default_limit'. Look up the per zone limits for all zones in
497 * the 'zone_limits_in' list of 'struct ct_dpif_zone_limit' entries
498 * (the 'limit' and 'count' members are not used), and stores the
499 * reply that includes the zone, the per zone limit, and the number
500 * of connections in the zone into 'zone_limits_out' list. */
501 int (*ct_get_limits
)(struct dpif
*, uint32_t *default_limit
,
502 const struct ovs_list
*zone_limits_in
,
503 struct ovs_list
*zone_limits_out
);
505 /* Deletes per zone limit of all zones specified in 'zone_limits', a
506 * list of 'struct ct_dpif_zone_limit' entries. */
507 int (*ct_del_limits
)(struct dpif
*, const struct ovs_list
*zone_limits
);
509 /* Connection tracking timeout policy */
511 /* A connection tracking timeout policy contains a list of timeout
512 * attributes that specify timeout values on various connection states.
513 * In a datapath, the timeout policy is identified by a 4-byte unsigned
514 * integer. Unsupported timeout attributes are ignored. When a
515 * connection is committed it can be associated with a timeout
516 * policy, or it defaults to the datapath's default timeout policy. */
518 /* Sets timeout policy '*tp' into the datapath. */
519 int (*ct_set_timeout_policy
)(struct dpif
*,
520 const struct ct_dpif_timeout_policy
*tp
);
521 /* Gets a timeout policy specified by tp_id and stores it into '*tp'. */
522 int (*ct_get_timeout_policy
)(struct dpif
*, uint32_t tp_id
,
523 struct ct_dpif_timeout_policy
*tp
);
524 /* Deletes a timeout policy identified by 'tp_id'. */
525 int (*ct_del_timeout_policy
)(struct dpif
*, uint32_t tp_id
);
527 /* Conntrack timeout policy dumping interface.
529 * These functions provide a datapath-agnostic dumping interface
530 * to the conntrack timeout policy provided by the datapaths.
532 * ct_timeout_policy_dump_start() should put in '*statep' a pointer to
533 * a newly allocated structure that will be passed by the caller to
534 * ct_timeout_policy_dump_next() and ct_timeout_policy_dump_done().
536 * ct_timeout_policy_dump_next() attempts to retrieve another timeout
537 * policy from 'dpif' for 'state', which was initialized by a successful
538 * call to ct_timeout_policy_dump_start(). On success, stores a new
539 * timeout policy into 'tp' and returns 0. Returns EOF if the last
540 * timeout policy has been dumped, or a positive errno value on error.
541 * This function will not be called again once it returns nonzero once
542 * for a given iteration (but the ct_timeout_policy_dump_done() will
543 * be called afterward).
545 * ct_timeout_policy_dump_done() should perform any cleanup necessary
546 * (including deallocating the 'state' structure, if applicable). */
547 int (*ct_timeout_policy_dump_start
)(struct dpif
*, void **statep
);
548 int (*ct_timeout_policy_dump_next
)(struct dpif
*, void *state
,
549 struct ct_dpif_timeout_policy
*tp
);
550 int (*ct_timeout_policy_dump_done
)(struct dpif
*, void *state
);
552 /* Gets timeout policy based on 'tp_id', 'dl_type' and 'nw_proto'.
553 * On success, returns 0, stores the timeout policy name in 'tp_name',
554 * and sets 'is_generic'. 'is_generic' is false if the returned timeout
555 * policy in the 'dpif' is specific to 'dl_type' and 'nw_proto' in the
556 * datapath (e.g., the Linux kernel datapath). Sets 'is_generic' to
557 * true, if the timeout policy supports all OVS supported L3/L4
560 * The caller is responsible for freeing 'tp_name'. */
561 int (*ct_get_timeout_policy_name
)(struct dpif
*, uint32_t tp_id
,
562 uint16_t dl_type
, uint8_t nw_proto
,
563 char **tp_name
, bool *is_generic
);
565 /* IP Fragmentation. */
567 /* Disables or enables conntrack fragment reassembly. The default
568 * setting is enabled. */
569 int (*ipf_set_enabled
)(struct dpif
*, bool v6
, bool enabled
);
571 /* Set minimum fragment allowed. */
572 int (*ipf_set_min_frag
)(struct dpif
*, bool v6
, uint32_t min_frag
);
574 /* Set maximum number of fragments tracked. */
575 int (*ipf_set_max_nfrags
)(struct dpif
*, uint32_t max_nfrags
);
577 /* Get fragmentation configuration status and counters. */
578 int (*ipf_get_status
)(struct dpif
*,
579 struct dpif_ipf_status
*dpif_ipf_status
);
581 /* The following 3 apis find and print ipf lists by creating a string
582 * representation of the state of an ipf list, to which 'dump' is pointed
583 * to. 'ipf_dump_start()' allocates memory for 'ipf_dump_ctx'.
584 * 'ipf_dump_next()' finds the next ipf list and copies it's
585 * characteristics to a string, which is freed by the caller.
586 * 'ipf_dump_done()' frees the 'ipf_dump_ctx' that was allocated in
587 * 'ipf_dump_start'. */
588 int (*ipf_dump_start
)(struct dpif
*, struct ipf_dump_ctx
**ipf_dump_ctx
);
589 int (*ipf_dump_next
)(struct dpif
*, void *ipf_dump_ctx
, char **dump
);
590 int (*ipf_dump_done
)(struct dpif
*, void *ipf_dump_ctx
);
594 /* Queries 'dpif' for supported meter features.
595 * NULL pointer means no meter features are supported. */
596 void (*meter_get_features
)(const struct dpif
*,
597 struct ofputil_meter_features
*);
599 /* Adds or modifies the meter in 'dpif' with the given 'meter_id'
600 * and the configuration in 'config'.
602 * The meter id specified through 'config->meter_id' is ignored. */
603 int (*meter_set
)(struct dpif
*, ofproto_meter_id meter_id
,
604 struct ofputil_meter_config
*);
606 /* Queries 'dpif' for meter stats with the given 'meter_id'. Stores
607 * maximum of 'n_bands' meter statistics, returning the number of band
608 * stats returned in 'stats->n_bands' if successful. */
609 int (*meter_get
)(const struct dpif
*, ofproto_meter_id meter_id
,
610 struct ofputil_meter_stats
*, uint16_t n_bands
);
612 /* Removes meter 'meter_id' from 'dpif'. Stores meter and band statistics
613 * (for maximum of 'n_bands', returning the number of band stats returned
614 * in 'stats->n_bands' if successful. 'stats' may be passed in as NULL if
615 * no stats are needed, in which case 'n_bands' must be passed in as
617 int (*meter_del
)(struct dpif
*, ofproto_meter_id meter_id
,
618 struct ofputil_meter_stats
*, uint16_t n_bands
);
621 extern const struct dpif_class dpif_netlink_class
;
622 extern const struct dpif_class dpif_netdev_class
;
628 #endif /* dpif-provider.h */