From: Simon Horman <simon.horman@netronome.com>
To: John Fastabend <john.r.fastabend@intel.com>, netdev@vger.kernel.org
Cc: Simon Horman <simon.horman@netronome.com>
Subject: [PATCH/RFC flow-net-next 09/10] net: flow: Add eviction flags to table configuration
Date: Mon, 29 Dec 2014 11:15:39 +0900 [thread overview]
Message-ID: <1419819340-19000-10-git-send-email-simon.horman@netronome.com> (raw)
In-Reply-To: <1419819340-19000-1-git-send-email-simon.horman@netronome.com>
The intention is to allow run-time configuration of if and how
a switch or switch-like device may evict flows from tables in
the case of resource contention.
Inspired by a feature of the same name in in OpenFlow.
Signed-off-by: Simon Horman <simon.horman@netronome.com>
---
include/uapi/linux/if_flow.h | 16 ++++++++++++++++
net/core/flow_table.c | 11 ++++++++---
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/include/uapi/linux/if_flow.h b/include/uapi/linux/if_flow.h
index bd29145..7264629 100644
--- a/include/uapi/linux/if_flow.h
+++ b/include/uapi/linux/if_flow.h
@@ -186,6 +186,7 @@
* [NET_FLOW_TABLE_CONFIGS]
* [NET_FLOW_TABLE_CONFIG_TABLE]
* [NET_FLOW_TABLE_CONFIG_TABLE_ATTR_UID]
+ * [NET_FLOW_TABLE_CONFIG_TABLE_ATTR_EVICTION]
* ...
*
* Set Flow Notification <Request>,
@@ -742,9 +743,11 @@ enum {
* @brief flow table configuration
*
* @table unique identifier of table
+ * @eviction flags to control eviction. Bitmask of NET_FLOW_EVICTION_F_*
*/
struct net_flow_table_config {
int table;
+ __u32 eviction;
};
enum {
@@ -757,10 +760,23 @@ enum {
enum {
NET_FLOW_TABLE_CONFIG_TABLE_ATTR_UNSPEC,
NET_FLOW_TABLE_CONFIG_TABLE_ATTR_UID,
+ NET_FLOW_TABLE_CONFIG_TABLE_ATTR_EVICTION,
__NET_FLOW_TABLE_CONFIG_TABLE_ATTR_MAX,
};
#define NET_FLOW_TABLE_CONFIG_TABLE_ATTR_MAX (__NET_FLOW_TABLE_CONFIG_TABLE_ATTR_MAX - 1)
+
+enum {
+ /* Eviction enabled.
+ * Must be set for any eviction to occur */
+ NET_FLOW_EVICTION_F_ENABLE = (0 << 1),
+
+ /* Evict entries based on their importance */
+ NET_FLOW_EVICTION_F_IMPORTANCE = (1 << 1),
+ /* Evict entries based on how close they are to timing out */
+ NET_FLOW_EVICTION_F_TIMEOUT = (2 << 1),
+};
+
enum {
NET_FLOW_REM_FLOW_UNSPEC,
NET_FLOW_REM_FLOW_TABLE,
diff --git a/net/core/flow_table.c b/net/core/flow_table.c
index 6c44311..3030246 100644
--- a/net/core/flow_table.c
+++ b/net/core/flow_table.c
@@ -1595,13 +1595,14 @@ static int net_flow_table_cmd_get_table_config(struct sk_buff *skb,
}
if (nla_put_u32(msg, NET_FLOW_TABLE_CONFIG_TABLE_ATTR_UID,
- table)) {
+ table) ||
+ nla_put_u32(msg,
+ NET_FLOW_TABLE_CONFIG_TABLE_ATTR_EVICTION,
+ tc->eviction)) {
err = -ENOBUFS;
goto err;
}
- /* Write other attributes of tc: Currently none are defined. */
-
nla_nest_end(msg, config);
}
@@ -1669,6 +1670,10 @@ static int net_flow_table_cmd_set_table_config(struct sk_buff *skb,
new_tc = *tc;
+ if (!tb[NET_FLOW_TABLE_CONFIG_TABLE_ATTR_EVICTION]) {
+ new_tc.eviction = nla_get_u32(tb[NET_FLOW_TABLE_CONFIG_TABLE_ATTR_EVICTION]);
+ }
+
err = dev->netdev_ops->ndo_flow_table_set_table_config(dev, &new_tc);
if (err)
goto out;
--
2.1.3
next prev parent reply other threads:[~2014-12-29 2:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-29 2:15 [PATCH/RFC flow-net-next 00/10] Flow Table API Cache Enhancements Simon Horman
2014-12-29 2:15 ` [PATCH/RFC flow-net-next 01/10] net: flow: Correct spelling of action Simon Horman
2014-12-29 2:15 ` [PATCH/RFC flow-net-next 02/10] net: flow: Add features to tables Simon Horman
2014-12-29 23:03 ` Cong Wang
2015-01-05 2:18 ` Simon Horman
2014-12-29 2:15 ` [PATCH/RFC flow-net-next 03/10] net: flow: Add timeouts to flows Simon Horman
2014-12-29 2:15 ` [PATCH/RFC flow-net-next 04/10] net: flow: Add counters " Simon Horman
2014-12-29 7:31 ` Arad, Ronen
2015-01-05 2:10 ` Simon Horman
2014-12-29 2:15 ` [PATCH/RFC flow-net-next 05/10] net: flow: Add get, set and del notifier commands Simon Horman
2014-12-29 2:15 ` [PATCH/RFC flow-net-next 06/10] net: flow: Add flow removed notification Simon Horman
2014-12-29 2:15 ` [PATCH/RFC flow-net-next 07/10] net: flow: Add importance to flows Simon Horman
2014-12-29 2:15 ` [PATCH/RFC flow-net-next 08/10] net: flow: Add get and set table config commands Simon Horman
2014-12-29 2:15 ` Simon Horman [this message]
2014-12-29 2:15 ` [PATCH/RFC flow-net-next 10/10] net: flow: Add flow removed notification for eviction Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1419819340-19000-10-git-send-email-simon.horman@netronome.com \
--to=simon.horman@netronome.com \
--cc=john.r.fastabend@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).