Skip to content

Commit 2ce1241

Browse files
pmachatadavem330
authored andcommitted
net: tc_skbedit: Make the skbedit priority offloadable
The skbedit action "priority" is used for adjusting SKB priority. Allow drivers to offload the action by introducing two new skbedit getters and a new flow action, and initializing appropriately in tc_setup_flow_action(). Signed-off-by: Petr Machata <petrm@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fe93f0b commit 2ce1241

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎include/net/flow_offload.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ enum flow_action_id {
137137
FLOW_ACTION_CSUM,
138138
FLOW_ACTION_MARK,
139139
FLOW_ACTION_PTYPE,
140+
FLOW_ACTION_PRIORITY,
140141
FLOW_ACTION_WAKE,
141142
FLOW_ACTION_QUEUE,
142143
FLOW_ACTION_SAMPLE,
@@ -211,6 +212,7 @@ struct flow_action_entry {
211212
u32 csum_flags; /* FLOW_ACTION_CSUM */
212213
u32 mark; /* FLOW_ACTION_MARK */
213214
u16 ptype; /* FLOW_ACTION_PTYPE */
215+
u32 priority; /* FLOW_ACTION_PRIORITY */
214216
struct { /* FLOW_ACTION_QUEUE */
215217
u32 ctx;
216218
u32 index;

‎include/net/tc_act/tc_skbedit.h‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,21 @@ static inline u32 tcf_skbedit_ptype(const struct tc_action *a)
7777
return ptype;
7878
}
7979

80+
/* Return true iff action is priority */
81+
static inline bool is_tcf_skbedit_priority(const struct tc_action *a)
82+
{
83+
return is_tcf_skbedit_with_flag(a, SKBEDIT_F_PRIORITY);
84+
}
85+
86+
static inline u32 tcf_skbedit_priority(const struct tc_action *a)
87+
{
88+
u32 priority;
89+
90+
rcu_read_lock();
91+
priority = rcu_dereference(to_skbedit(a)->params)->priority;
92+
rcu_read_unlock();
93+
94+
return priority;
95+
}
96+
8097
#endif /* __NET_TC_SKBEDIT_H */

‎net/sched/cls_api.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3665,6 +3665,9 @@ int tc_setup_flow_action(struct flow_action *flow_action,
36653665
} else if (is_tcf_skbedit_ptype(act)) {
36663666
entry->id = FLOW_ACTION_PTYPE;
36673667
entry->ptype = tcf_skbedit_ptype(act);
3668+
} else if (is_tcf_skbedit_priority(act)) {
3669+
entry->id = FLOW_ACTION_PRIORITY;
3670+
entry->priority = tcf_skbedit_priority(act);
36683671
} else {
36693672
err = -EOPNOTSUPP;
36703673
goto err_out_locked;

0 commit comments

Comments
 (0)