summaryrefslogtreecommitdiff
path: root/lib/netdev.c
diff options
context:
space:
mode:
authorSriharsha Basavapatna via dev <ovs-dev@openvswitch.org>2018-10-18 21:43:12 +0530
committerSimon Horman <horms@verge.net.au>2018-10-19 11:27:45 +0200
commit738c785ff16288cf758470348de4106dd5b4416a (patch)
tree294d2bfce02816a5ad923aca0934b20b4125cd56 /lib/netdev.c
parentd7abfe39cfd234227bb6174b7f959a16dc803b83 (diff)
downloadopenvswitch-738c785ff16288cf758470348de4106dd5b4416a.tar.gz
dpif-netlink: Detect Out-Of-Resource condition on a netdev
This is the first patch in the patch-set to support dynamic rebalancing of offloaded flows. The patch detects OOR condition on a netdev port when ENOSPC error is returned by TC-Flower while adding a flow rule. A new structure is added to the netdev called "netdev_hw_info", to store OOR related information required to perform dynamic offload-rebalancing. Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com> Co-authored-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com> Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com> Reviewed-by: Sathya Perla <sathya.perla@broadcom.com> Reviewed-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Simon Horman <simon.horman@netronome.com>
Diffstat (limited to 'lib/netdev.c')
-rw-r--r--lib/netdev.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/netdev.c b/lib/netdev.c
index 722ea89bf..708a4bbd7 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -415,6 +415,7 @@ netdev_open(const char *name, const char *type, struct netdev **netdevp)
netdev->reconfigure_seq = seq_create();
netdev->last_reconfigure_seq =
seq_read(netdev->reconfigure_seq);
+ netdev->hw_info.oor = false;
netdev->node = shash_add(&netdev_shash, name, netdev);
/* By default enable one tx and rx queue per netdev. */
@@ -2253,6 +2254,31 @@ netdev_get_block_id(struct netdev *netdev)
: 0);
}
+/*
+ * Get the value of the hw info parameter specified by type.
+ * Returns the value on success (>= 0). Returns -1 on failure.
+ */
+int
+netdev_get_hw_info(struct netdev *netdev, int type)
+{
+ if (type == HW_INFO_TYPE_OOR) {
+ return netdev->hw_info.oor;
+ }
+
+ return -1;
+}
+
+/*
+ * Set the value of the hw info parameter specified by type.
+ */
+void
+netdev_set_hw_info(struct netdev *netdev, int type, int val)
+{
+ if (type == HW_INFO_TYPE_OOR) {
+ netdev->hw_info.oor = val;
+ }
+}
+
bool
netdev_is_flow_api_enabled(void)
{
@@ -2489,6 +2515,14 @@ netdev_free_custom_stats_counters(struct netdev_custom_stats *custom_stats)
}
}
+static bool netdev_offload_rebalance_policy = false;
+
+bool
+netdev_is_offload_rebalance_policy_enabled(void)
+{
+ return netdev_offload_rebalance_policy;
+}
+
#ifdef __linux__
static void
netdev_ports_flow_init(void)