Commit a7a7be60 authored by Pieter Jansen van Vuuren's avatar Pieter Jansen van Vuuren Committed by David S. Miller

net/sched: add sample action to the hardware intermediate representation

Add sample action to the hardware intermediate representation model which
would subsequently allow it to be used by drivers for offload.
Signed-off-by: default avatarPieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c8f8207c
...@@ -118,6 +118,7 @@ enum flow_action_id { ...@@ -118,6 +118,7 @@ enum flow_action_id {
FLOW_ACTION_MARK, FLOW_ACTION_MARK,
FLOW_ACTION_WAKE, FLOW_ACTION_WAKE,
FLOW_ACTION_QUEUE, FLOW_ACTION_QUEUE,
FLOW_ACTION_SAMPLE,
}; };
/* This is mirroring enum pedit_header_type definition for easy mapping between /* This is mirroring enum pedit_header_type definition for easy mapping between
...@@ -157,6 +158,12 @@ struct flow_action_entry { ...@@ -157,6 +158,12 @@ struct flow_action_entry {
u32 index; u32 index;
u8 vf; u8 vf;
} queue; } queue;
struct { /* FLOW_ACTION_SAMPLE */
struct psample_group *psample_group;
u32 rate;
u32 trunc_size;
bool truncate;
} sample;
}; };
}; };
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <net/tc_act/tc_tunnel_key.h> #include <net/tc_act/tc_tunnel_key.h>
#include <net/tc_act/tc_csum.h> #include <net/tc_act/tc_csum.h>
#include <net/tc_act/tc_gact.h> #include <net/tc_act/tc_gact.h>
#include <net/tc_act/tc_sample.h>
#include <net/tc_act/tc_skbedit.h> #include <net/tc_act/tc_skbedit.h>
extern const struct nla_policy rtm_tca_policy[TCA_MAX + 1]; extern const struct nla_policy rtm_tca_policy[TCA_MAX + 1];
...@@ -3257,6 +3258,13 @@ int tc_setup_flow_action(struct flow_action *flow_action, ...@@ -3257,6 +3258,13 @@ int tc_setup_flow_action(struct flow_action *flow_action,
} else if (is_tcf_skbedit_mark(act)) { } else if (is_tcf_skbedit_mark(act)) {
entry->id = FLOW_ACTION_MARK; entry->id = FLOW_ACTION_MARK;
entry->mark = tcf_skbedit_mark(act); entry->mark = tcf_skbedit_mark(act);
} else if (is_tcf_sample(act)) {
entry->id = FLOW_ACTION_SAMPLE;
entry->sample.psample_group =
tcf_sample_psample_group(act);
entry->sample.trunc_size = tcf_sample_trunc_size(act);
entry->sample.truncate = tcf_sample_truncate(act);
entry->sample.rate = tcf_sample_rate(act);
} else { } else {
goto err_out; goto err_out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment