diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-02-02 14:50:45 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-02-06 21:38:25 +0300 |
commit | e3ab786b42535da00c731c3585165e88bf35ab09 (patch) | |
tree | 5f988db3d1322f794a250abd16ae281ad18aa170 /net/core/flow_offload.c | |
parent | c500c86b0c75da167b59ee82f78e394fd10cb792 (diff) | |
download | linux-e3ab786b42535da00c731c3585165e88bf35ab09.tar.xz |
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.c | 14 |
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); |