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 /* Adds 'netdev' as a new port in 'dpif'. If '*port_no' is not
192 * ODPP_NONE, attempts to use that as the port's port number.
194 * If port is successfully added, sets '*port_no' to the new port's
195 * port number. Returns EBUSY if caller attempted to choose a port
196 * number, and it was in use. */
197 int (*port_add
)(struct dpif
*dpif
, struct netdev
*netdev
,
198 odp_port_t
*port_no
);
200 /* Removes port numbered 'port_no' from 'dpif'. */
201 int (*port_del
)(struct dpif
*dpif
, odp_port_t port_no
);
203 /* Refreshes configuration of 'dpif's port. The implementation might
204 * postpone applying the changes until run() is called. */
205 int (*port_set_config
)(struct dpif
*dpif
, odp_port_t port_no
,
206 const struct smap
*cfg
);
208 /* Queries 'dpif' for a port with the given 'port_no' or 'devname'.
209 * If 'port' is not null, stores information about the port into
210 * '*port' if successful.
212 * If the port doesn't exist, the provider must return ENODEV. Other
213 * error numbers means that something wrong happened and will be
214 * treated differently by upper layers.
216 * If 'port' is not null, the caller takes ownership of data in
217 * 'port' and must free it with dpif_port_destroy() when it is no
219 int (*port_query_by_number
)(const struct dpif
*dpif
, odp_port_t port_no
,
220 struct dpif_port
*port
);
221 int (*port_query_by_name
)(const struct dpif
*dpif
, const char *devname
,
222 struct dpif_port
*port
);
224 /* Returns the Netlink PID value to supply in OVS_ACTION_ATTR_USERSPACE
225 * actions as the OVS_USERSPACE_ATTR_PID attribute's value, for use in
226 * flows whose packets arrived on port 'port_no'.
228 * A 'port_no' of UINT32_MAX should be treated as a special case. The
229 * implementation should return a reserved PID, not allocated to any port,
230 * that the client may use for special purposes.
232 * The return value only needs to be meaningful when DPIF_UC_ACTION has
233 * been enabled in the 'dpif''s listen mask, and it is allowed to change
234 * when DPIF_UC_ACTION is disabled and then re-enabled.
236 * A dpif provider that doesn't have meaningful Netlink PIDs can use NULL
237 * for this function. This is equivalent to always returning 0. */
238 uint32_t (*port_get_pid
)(const struct dpif
*dpif
, odp_port_t port_no
);
240 /* Attempts to begin dumping the ports in a dpif. On success, returns 0
241 * and initializes '*statep' with any data needed for iteration. On
242 * failure, returns a positive errno value. */
243 int (*port_dump_start
)(const struct dpif
*dpif
, void **statep
);
245 /* Attempts to retrieve another port from 'dpif' for 'state', which was
246 * initialized by a successful call to the 'port_dump_start' function for
247 * 'dpif'. On success, stores a new dpif_port into 'port' and returns 0.
248 * Returns EOF if the end of the port table has been reached, or a positive
249 * errno value on error. This function will not be called again once it
250 * returns nonzero once for a given iteration (but the 'port_dump_done'
251 * function will be called afterward).
253 * The dpif provider retains ownership of the data stored in 'port'. It
254 * must remain valid until at least the next call to 'port_dump_next' or
255 * 'port_dump_done' for 'state'. */
256 int (*port_dump_next
)(const struct dpif
*dpif
, void *state
,
257 struct dpif_port
*port
);
259 /* Releases resources from 'dpif' for 'state', which was initialized by a
260 * successful call to the 'port_dump_start' function for 'dpif'. */
261 int (*port_dump_done
)(const struct dpif
*dpif
, void *state
);
263 /* Polls for changes in the set of ports in 'dpif'. If the set of ports in
264 * 'dpif' has changed, then this function should do one of the
267 * - Preferably: store the name of the device that was added to or deleted
268 * from 'dpif' in '*devnamep' and return 0. The caller is responsible
269 * for freeing '*devnamep' (with free()) when it no longer needs it.
271 * - Alternatively: return ENOBUFS, without indicating the device that was
274 * Occasional 'false positives', in which the function returns 0 while
275 * indicating a device that was not actually added or deleted or returns
276 * ENOBUFS without any change, are acceptable.
278 * If the set of ports in 'dpif' has not changed, returns EAGAIN. May also
279 * return other positive errno values to indicate that something has gone
281 int (*port_poll
)(const struct dpif
*dpif
, char **devnamep
);
283 /* Arranges for the poll loop to wake up when 'port_poll' will return a
284 * value other than EAGAIN. */
285 void (*port_poll_wait
)(const struct dpif
*dpif
);
287 /* Deletes all flows from 'dpif' and clears all of its queues of received
289 int (*flow_flush
)(struct dpif
*dpif
);
291 /* Flow dumping interface.
293 * This is the back-end for the flow dumping interface described in
294 * dpif.h. Please read the comments there first, because this code
295 * closely follows it.
297 * 'flow_dump_create' and 'flow_dump_thread_create' must always return an
298 * initialized and usable data structure and defer error return until
299 * flow_dump_destroy(). This hasn't been a problem for the dpifs that
302 * 'flow_dump_create' and 'flow_dump_thread_create' must initialize the
303 * structures that they return with dpif_flow_dump_init() and
304 * dpif_flow_dump_thread_init(), respectively.
306 * If 'terse' is true, then only UID and statistics will
307 * be returned in the dump. Otherwise, all fields will be returned.
309 * If 'types' isn't null, dumps only the flows of the passed types. */
310 struct dpif_flow_dump
*(*flow_dump_create
)(
311 const struct dpif
*dpif
,
313 struct dpif_flow_dump_types
*types
);
314 int (*flow_dump_destroy
)(struct dpif_flow_dump
*dump
);
316 struct dpif_flow_dump_thread
*(*flow_dump_thread_create
)(
317 struct dpif_flow_dump
*dump
);
318 void (*flow_dump_thread_destroy
)(struct dpif_flow_dump_thread
*thread
);
320 int (*flow_dump_next
)(struct dpif_flow_dump_thread
*thread
,
321 struct dpif_flow
*flows
, int max_flows
);
322 /* Executes each of the 'n_ops' operations in 'ops' on 'dpif', in the order
323 * in which they are specified, placing each operation's results in the
324 * "output" members documented in comments and the 'error' member of each
325 * dpif_op. The offload_type argument tells the provider if 'ops' should
326 * be submitted to to a netdev (only offload) or to the kernel datapath
327 * (never offload) or to both (offload if possible; software fallback). */
328 void (*operate
)(struct dpif
*dpif
, struct dpif_op
**ops
, size_t n_ops
,
329 enum dpif_offload_type offload_type
);
331 /* Enables or disables receiving packets with dpif_recv() for 'dpif'.
332 * Turning packet receive off and then back on is allowed to change Netlink
333 * PID assignments (see ->port_get_pid()). The client is responsible for
334 * updating flows as necessary if it does this. */
335 int (*recv_set
)(struct dpif
*dpif
, bool enable
);
337 /* Refreshes the poll loops and Netlink sockets associated to each port,
338 * when the number of upcall handlers (upcall receiving thread) is changed
339 * to 'n_handlers' and receiving packets for 'dpif' is enabled by
342 * Since multiple upcall handlers can read upcalls simultaneously from
343 * 'dpif', each port can have multiple Netlink sockets, one per upcall
344 * handler. So, handlers_set() is responsible for the following tasks:
346 * When receiving upcall is enabled, extends or creates the
347 * configuration to support:
349 * - 'n_handlers' Netlink sockets for each port.
351 * - 'n_handlers' poll loops, one for each upcall handler.
353 * - registering the Netlink sockets for the same upcall handler to
354 * the corresponding poll loop.
356 int (*handlers_set
)(struct dpif
*dpif
, uint32_t n_handlers
);
358 /* Pass custom configuration options to the datapath. The implementation
359 * might postpone applying the changes until run() is called. */
360 int (*set_config
)(struct dpif
*dpif
, const struct smap
*other_config
);
362 /* Translates OpenFlow queue ID 'queue_id' (in host byte order) into a
363 * priority value used for setting packet priority. */
364 int (*queue_to_priority
)(const struct dpif
*dpif
, uint32_t queue_id
,
367 /* Polls for an upcall from 'dpif' for an upcall handler. Since there
368 * can be multiple poll loops (see ->handlers_set()), 'handler_id' is
369 * needed as index to identify the corresponding poll loop. If
370 * successful, stores the upcall into '*upcall', using 'buf' for
371 * storage. Should only be called if 'recv_set' has been used to enable
372 * receiving packets from 'dpif'.
374 * The implementation should point 'upcall->key' and 'upcall->userdata'
375 * (if any) into data in the caller-provided 'buf'. The implementation may
376 * also use 'buf' for storing the data of 'upcall->packet'. If necessary
377 * to make room, the implementation may reallocate the data in 'buf'.
379 * The caller owns the data of 'upcall->packet' and may modify it. If
380 * packet's headroom is exhausted as it is manipulated, 'upcall->packet'
381 * will be reallocated. This requires the data of 'upcall->packet' to be
382 * released with ofpbuf_uninit() before 'upcall' is destroyed. However,
383 * when an error is returned, the 'upcall->packet' may be uninitialized
384 * and should not be released.
386 * This function must not block. If no upcall is pending when it is
387 * called, it should return EAGAIN without blocking. */
388 int (*recv
)(struct dpif
*dpif
, uint32_t handler_id
,
389 struct dpif_upcall
*upcall
, struct ofpbuf
*buf
);
391 /* Arranges for the poll loop for an upcall handler to wake up when 'dpif'
392 * has a message queued to be received with the recv member functions.
393 * Since there can be multiple poll loops (see ->handlers_set()),
394 * 'handler_id' is needed as index to identify the corresponding poll loop.
396 void (*recv_wait
)(struct dpif
*dpif
, uint32_t handler_id
);
398 /* Throws away any queued upcalls that 'dpif' currently has ready to
400 void (*recv_purge
)(struct dpif
*dpif
);
402 /* When 'dpif' is about to purge the datapath, the higher layer may want
403 * to be notified so that it could try reacting accordingly (e.g. grabbing
404 * all flow stats before they are gone).
406 * Registers an upcall callback function with 'dpif'. This is only used
407 * if 'dpif' needs to notify the purging of datapath. 'aux' is passed to
408 * the callback on invocation. */
409 void (*register_dp_purge_cb
)(struct dpif
*, dp_purge_callback
*, void *aux
);
411 /* For datapaths that run in userspace (i.e. dpif-netdev), threads polling
412 * for incoming packets can directly call upcall functions instead of
413 * offloading packet processing to separate handler threads. Datapaths
414 * that directly call upcall functions should use the functions below to
415 * to register an upcall function and enable / disable upcalls.
417 * Registers an upcall callback function with 'dpif'. This is only used
418 * if 'dpif' directly executes upcall functions. 'aux' is passed to the
419 * callback on invocation. */
420 void (*register_upcall_cb
)(struct dpif
*, upcall_callback
*, void *aux
);
422 /* Enables upcalls if 'dpif' directly executes upcall functions. */
423 void (*enable_upcall
)(struct dpif
*);
425 /* Disables upcalls if 'dpif' directly executes upcall functions. */
426 void (*disable_upcall
)(struct dpif
*);
428 /* Get datapath version. Caller is responsible for freeing the string
430 char *(*get_datapath_version
)(void);
432 /* Conntrack entry dumping interface.
434 * These functions are used by ct-dpif.c to provide a datapath-agnostic
435 * dumping interface to the connection trackers provided by the
438 * ct_dump_start() should put in '*state' a pointer to a newly allocated
439 * stucture that will be passed by the caller to ct_dump_next() and
440 * ct_dump_done(). If 'zone' is not NULL, only the entries in '*zone'
443 * ct_dump_next() should fill 'entry' with information from a connection
444 * and prepare to dump the next one on a subsequest invocation.
446 * ct_dump_done() should perform any cleanup necessary (including
447 * deallocating the 'state' structure, if applicable). */
448 int (*ct_dump_start
)(struct dpif
*, struct ct_dpif_dump_state
**state
,
449 const uint16_t *zone
, int *);
450 int (*ct_dump_next
)(struct dpif
*, struct ct_dpif_dump_state
*state
,
451 struct ct_dpif_entry
*entry
);
452 int (*ct_dump_done
)(struct dpif
*, struct ct_dpif_dump_state
*state
);
454 /* Flushes the connection tracking tables. The arguments have the
455 * following behavior:
457 * - If both 'zone' and 'tuple' are NULL, flush all the conntrack
459 * - If 'zone' is not NULL, and 'tuple' is NULL, flush all the
460 * conntrack entries in '*zone'.
461 * - If 'tuple' is not NULL, flush the conntrack entry specified by
462 * 'tuple' in '*zone'. If 'zone' is NULL, use the default zone
464 int (*ct_flush
)(struct dpif
*, const uint16_t *zone
,
465 const struct ct_dpif_tuple
*tuple
);
466 /* Set max connections allowed. */
467 int (*ct_set_maxconns
)(struct dpif
*, uint32_t maxconns
);
468 /* Get max connections allowed. */
469 int (*ct_get_maxconns
)(struct dpif
*, uint32_t *maxconns
);
470 /* Get number of connections tracked. */
471 int (*ct_get_nconns
)(struct dpif
*, uint32_t *nconns
);
472 /* Enable or disable TCP sequence checking. */
473 int (*ct_set_tcp_seq_chk
)(struct dpif
*, bool enabled
);
474 /* Get the TCP sequence checking configuration. */
475 int (*ct_get_tcp_seq_chk
)(struct dpif
*, bool *enabled
);
478 /* Connection tracking per zone limit */
480 /* Per zone conntrack limit sets the maximum allowed connections in zones
481 * to provide resource isolation. If a per zone limit for a particular
482 * zone is not available in the datapath, it defaults to the default
483 * per zone limit. Initially, the default per zone limit is
486 /* Sets the max connections allowed per zone according to 'zone_limits',
487 * a list of 'struct ct_dpif_zone_limit' entries (the 'count' member
488 * is not used when setting limits). If 'default_limit' is not NULL,
489 * modifies the default limit to '*default_limit'. */
490 int (*ct_set_limits
)(struct dpif
*, const uint32_t *default_limit
,
491 const struct ovs_list
*zone_limits
);
493 /* Looks up the default per zone limit and stores that in
494 * 'default_limit'. Look up the per zone limits for all zones in
495 * the 'zone_limits_in' list of 'struct ct_dpif_zone_limit' entries
496 * (the 'limit' and 'count' members are not used), and stores the
497 * reply that includes the zone, the per zone limit, and the number
498 * of connections in the zone into 'zone_limits_out' list. */
499 int (*ct_get_limits
)(struct dpif
*, uint32_t *default_limit
,
500 const struct ovs_list
*zone_limits_in
,
501 struct ovs_list
*zone_limits_out
);
503 /* Deletes per zone limit of all zones specified in 'zone_limits', a
504 * list of 'struct ct_dpif_zone_limit' entries. */
505 int (*ct_del_limits
)(struct dpif
*, const struct ovs_list
*zone_limits
);
507 /* Connection tracking timeout policy */
509 /* A connection tracking timeout policy contains a list of timeout
510 * attributes that specify timeout values on various connection states.
511 * In a datapath, the timeout policy is identified by a 4-byte unsigned
512 * integer. Unsupported timeout attributes are ignored. When a
513 * connection is committed it can be associated with a timeout
514 * policy, or it defaults to the datapath's default timeout policy. */
516 /* Sets timeout policy '*tp' into the datapath. */
517 int (*ct_set_timeout_policy
)(struct dpif
*,
518 const struct ct_dpif_timeout_policy
*tp
);
519 /* Gets a timeout policy specified by tp_id and stores it into '*tp'. */
520 int (*ct_get_timeout_policy
)(struct dpif
*, uint32_t tp_id
,
521 struct ct_dpif_timeout_policy
*tp
);
522 /* Deletes a timeout policy identified by 'tp_id'. */
523 int (*ct_del_timeout_policy
)(struct dpif
*, uint32_t tp_id
);
525 /* Conntrack timeout policy dumping interface.
527 * These functions provide a datapath-agnostic dumping interface
528 * to the conntrack timeout policy provided by the datapaths.
530 * ct_timeout_policy_dump_start() should put in '*statep' a pointer to
531 * a newly allocated structure that will be passed by the caller to
532 * ct_timeout_policy_dump_next() and ct_timeout_policy_dump_done().
534 * ct_timeout_policy_dump_next() attempts to retrieve another timeout
535 * policy from 'dpif' for 'state', which was initialized by a successful
536 * call to ct_timeout_policy_dump_start(). On success, stores a new
537 * timeout policy into 'tp' and returns 0. Returns EOF if the last
538 * timeout policy has been dumped, or a positive errno value on error.
539 * This function will not be called again once it returns nonzero once
540 * for a given iteration (but the ct_timeout_policy_dump_done() will
541 * be called afterward).
543 * ct_timeout_policy_dump_done() should perform any cleanup necessary
544 * (including deallocating the 'state' structure, if applicable). */
545 int (*ct_timeout_policy_dump_start
)(struct dpif
*, void **statep
);
546 int (*ct_timeout_policy_dump_next
)(struct dpif
*, void *state
,
547 struct ct_dpif_timeout_policy
*tp
);
548 int (*ct_timeout_policy_dump_done
)(struct dpif
*, void *state
);
550 /* Gets timeout policy based on 'tp_id', 'dl_type' and 'nw_proto'.
551 * On success, returns 0, stores the timeout policy name in 'tp_name',
552 * and sets 'is_generic'. 'is_generic' is false if the returned timeout
553 * policy in the 'dpif' is specific to 'dl_type' and 'nw_proto' in the
554 * datapath (e.g., the Linux kernel datapath). Sets 'is_generic' to
555 * true, if the timeout policy supports all OVS supported L3/L4
558 * The caller is responsible for freeing 'tp_name'. */
559 int (*ct_get_timeout_policy_name
)(struct dpif
*, uint32_t tp_id
,
560 uint16_t dl_type
, uint8_t nw_proto
,
561 char **tp_name
, bool *is_generic
);
563 /* IP Fragmentation. */
565 /* Disables or enables conntrack fragment reassembly. The default
566 * setting is enabled. */
567 int (*ipf_set_enabled
)(struct dpif
*, bool v6
, bool enabled
);
569 /* Set minimum fragment allowed. */
570 int (*ipf_set_min_frag
)(struct dpif
*, bool v6
, uint32_t min_frag
);
572 /* Set maximum number of fragments tracked. */
573 int (*ipf_set_max_nfrags
)(struct dpif
*, uint32_t max_nfrags
);
575 /* Get fragmentation configuration status and counters. */
576 int (*ipf_get_status
)(struct dpif
*,
577 struct dpif_ipf_status
*dpif_ipf_status
);
579 /* The following 3 apis find and print ipf lists by creating a string
580 * representation of the state of an ipf list, to which 'dump' is pointed
581 * to. 'ipf_dump_start()' allocates memory for 'ipf_dump_ctx'.
582 * 'ipf_dump_next()' finds the next ipf list and copies it's
583 * characteristics to a string, which is freed by the caller.
584 * 'ipf_dump_done()' frees the 'ipf_dump_ctx' that was allocated in
585 * 'ipf_dump_start'. */
586 int (*ipf_dump_start
)(struct dpif
*, struct ipf_dump_ctx
**ipf_dump_ctx
);
587 int (*ipf_dump_next
)(struct dpif
*, void *ipf_dump_ctx
, char **dump
);
588 int (*ipf_dump_done
)(struct dpif
*, void *ipf_dump_ctx
);
592 /* Queries 'dpif' for supported meter features.
593 * NULL pointer means no meter features are supported. */
594 void (*meter_get_features
)(const struct dpif
*,
595 struct ofputil_meter_features
*);
597 /* Adds or modifies the meter in 'dpif' with the given 'meter_id'
598 * and the configuration in 'config'.
600 * The meter id specified through 'config->meter_id' is ignored. */
601 int (*meter_set
)(struct dpif
*, ofproto_meter_id meter_id
,
602 struct ofputil_meter_config
*);
604 /* Queries 'dpif' for meter stats with the given 'meter_id'. Stores
605 * maximum of 'n_bands' meter statistics, returning the number of band
606 * stats returned in 'stats->n_bands' if successful. */
607 int (*meter_get
)(const struct dpif
*, ofproto_meter_id meter_id
,
608 struct ofputil_meter_stats
*, uint16_t n_bands
);
610 /* Removes meter 'meter_id' from 'dpif'. Stores meter and band statistics
611 * (for maximum of 'n_bands', returning the number of band stats returned
612 * in 'stats->n_bands' if successful. 'stats' may be passed in as NULL if
613 * no stats are needed, in which case 'n_bands' must be passed in as
615 int (*meter_del
)(struct dpif
*, ofproto_meter_id meter_id
,
616 struct ofputil_meter_stats
*, uint16_t n_bands
);
619 extern const struct dpif_class dpif_netlink_class
;
620 extern const struct dpif_class dpif_netdev_class
;
626 #endif /* dpif-provider.h */