summaryrefslogtreecommitdiffstats
path: root/net/core/flow_offload.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2019-02-02 12:50:45 +0100
committerDavid S. Miller <davem@davemloft.net>2019-02-06 10:38:25 -0800
commite3ab786b42535da00c731c3585165e88bf35ab09 (patch)
tree5f988db3d1322f794a250abd16ae281ad18aa170 /net/core/flow_offload.c
parentc500c86b0c75da167b59ee82f78e394fd10cb792 (diff)
downloadlinux-e3ab786b42535da00c731c3585165e88bf35ab09.tar.bz2
flow_offload: add flow action infrastructure
This new infrastructure defines the nic actions that you can perform from existing network drivers. This infrastructure allows us to avoid a direct dependency with the native software TC action representation. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/flow_offload.c')
-rw-r--r--net/core/flow_offload.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/net/core/flow_offload.c b/net/core/flow_offload.c
index 2fbf6903d2f6..c3a00eac4804 100644
--- a/net/core/flow_offload.c
+++ b/net/core/flow_offload.c
@@ -3,9 +3,19 @@
#include <linux/slab.h>
#include <net/flow_offload.h>
-struct flow_rule *flow_rule_alloc(void)
+struct flow_rule *flow_rule_alloc(unsigned int num_actions)
{
- return kzalloc(sizeof(struct flow_rule), GFP_KERNEL);
+ struct flow_rule *rule;
+
+ rule = kzalloc(sizeof(struct flow_rule) +
+ sizeof(struct flow_action_entry) * num_actions,
+ GFP_KERNEL);
+ if (!rule)
+ return NULL;
+
+ rule->action.num_entries = num_actions;
+
+ return rule;
}
EXPORT_SYMBOL(flow_rule_alloc);