summaryrefslogtreecommitdiff
path: root/lib/netdev-provider.h
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@samsung.com>2019-05-07 12:24:07 +0300
committerIlya Maximets <i.maximets@samsung.com>2019-06-11 09:39:36 +0300
commit5fc5c50f3d9cda4512e3fc9ae7a1b6c27e342f7d (patch)
tree6bd7e0c63484306b9fc6e30f257ec9ebb870683d /lib/netdev-provider.h
parent7a65e5a9252ac06df62707a571931f501747ecfc (diff)
downloadopenvswitch-5fc5c50f3d9cda4512e3fc9ae7a1b6c27e342f7d.tar.gz
netdev: Dynamic per-port Flow API.
Current issues with Flow API: * OVS calls offloading functions regardless of successful flow API initialization. (ex. on init_flow_api failure) * Static initilaization of Flow API for a netdev_class forbids having different offloading types for different instances of netdev with the same netdev_class. (ex. different vports in 'system' and 'netdev' datapaths at the same time) Solution: * Move Flow API from the netdev_class to netdev instance. * Make Flow API dynamic, i.e. probe the APIs and choose the suitable one. Side effects: * Flow API providers localized as possible in their modules. * Now we have an ability to make runtime checks. For example, we could check if particular device supports features we need, like if dpdk device supports RSS+MARK action. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Roi Dayan <roid@mellanox.com>
Diffstat (limited to 'lib/netdev-provider.h')
-rw-r--r--lib/netdev-provider.h67
1 files changed, 4 insertions, 63 deletions
diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h
index fb0c27e6e..653854cbd 100644
--- a/lib/netdev-provider.h
+++ b/lib/netdev-provider.h
@@ -23,6 +23,7 @@
#include "netdev.h"
#include "openvswitch/list.h"
#include "ovs-numa.h"
+#include "ovs-rcu.h"
#include "packets.h"
#include "seq.h"
#include "openvswitch/shash.h"
@@ -93,6 +94,9 @@ struct netdev {
int n_rxq;
struct shash_node *node; /* Pointer to element in global map. */
struct ovs_list saved_flags_list; /* Contains "struct netdev_saved_flags". */
+
+ /* Functions to control flow offloading. */
+ OVSRCU_TYPE(const struct netdev_flow_api *) flow_api;
struct netdev_hw_info hw_info; /* offload-capable netdev info */
};
@@ -822,69 +826,6 @@ struct netdev_class {
/* Discards all packets waiting to be received from 'rx'. */
int (*rxq_drain)(struct netdev_rxq *rx);
- /* ## -------------------------------- ## */
- /* ## netdev flow offloading functions ## */
- /* ## -------------------------------- ## */
-
- /* If a particular netdev class does not support offloading flows,
- * all these function pointers must be NULL. */
-
- /* Flush all offloaded flows from a netdev.
- * Return 0 if successful, otherwise returns a positive errno value. */
- int (*flow_flush)(struct netdev *);
-
- /* Flow dumping interface.
- *
- * This is the back-end for the flow dumping interface described in
- * dpif.h. Please read the comments there first, because this code
- * closely follows it.
- *
- * On success returns 0 and allocates data, on failure returns
- * positive errno. */
- int (*flow_dump_create)(struct netdev *, struct netdev_flow_dump **dump);
- int (*flow_dump_destroy)(struct netdev_flow_dump *);
-
- /* Returns true if there are more flows to dump.
- * 'rbuffer' is used as a temporary buffer and needs to be pre allocated
- * by the caller. While there are more flows the same 'rbuffer'
- * should be provided. 'wbuffer' is used to store dumped actions and needs
- * to be pre allocated by the caller. */
- bool (*flow_dump_next)(struct netdev_flow_dump *, struct match *,
- struct nlattr **actions,
- struct dpif_flow_stats *stats,
- struct dpif_flow_attrs *attrs, ovs_u128 *ufid,
- struct ofpbuf *rbuffer, struct ofpbuf *wbuffer);
-
- /* Offload the given flow on netdev.
- * To modify a flow, use the same ufid.
- * 'actions' are in netlink format, as with struct dpif_flow_put.
- * 'info' is extra info needed to offload the flow.
- * 'stats' is populated according to the rules set out in the description
- * above 'struct dpif_flow_put'.
- * Return 0 if successful, otherwise returns a positive errno value. */
- int (*flow_put)(struct netdev *, struct match *, struct nlattr *actions,
- size_t actions_len, const ovs_u128 *ufid,
- struct offload_info *info, struct dpif_flow_stats *);
-
- /* Queries a flow specified by ufid on netdev.
- * Fills output buffer as 'wbuffer' in flow_dump_next, which
- * needs to be be pre allocated.
- * Return 0 if successful, otherwise returns a positive errno value. */
- int (*flow_get)(struct netdev *, struct match *, struct nlattr **actions,
- const ovs_u128 *ufid, struct dpif_flow_stats *,
- struct dpif_flow_attrs *, struct ofpbuf *wbuffer);
-
- /* Delete a flow specified by ufid from netdev.
- * 'stats' is populated according to the rules set out in the description
- * above 'struct dpif_flow_del'.
- * Return 0 if successful, otherwise returns a positive errno value. */
- int (*flow_del)(struct netdev *, const ovs_u128 *ufid,
- struct dpif_flow_stats *);
-
- /* Initializies the netdev flow api.
- * Return 0 if successful, otherwise returns a positive errno value. */
- int (*init_flow_api)(struct netdev *);
-
/* Get a block_id from the netdev.
* Returns the block_id or 0 if none exists for netdev. */
uint32_t (*get_block_id)(struct netdev *);