Commit 9da3242e authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

net: sched: add helpers to handle extended actions

Jump is now the only one using value action opcode. This is going to
change soon. So introduce helpers to work with this. Convert TC_ACT_JUMP.

This also fixes the TC_ACT_JUMP check, which is incorrectly done as a
bit check, not a value check.

Fixes: e0ee84de ("net sched actions: Complete the JUMPX opcode")
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5657f89a
...@@ -37,7 +37,20 @@ enum { ...@@ -37,7 +37,20 @@ enum {
#define TC_ACT_QUEUED 5 #define TC_ACT_QUEUED 5
#define TC_ACT_REPEAT 6 #define TC_ACT_REPEAT 6
#define TC_ACT_REDIRECT 7 #define TC_ACT_REDIRECT 7
#define TC_ACT_JUMP 0x10000000
/* There is a special kind of actions called "extended actions",
* which need a value parameter. These have a local opcode located in
* the highest nibble, starting from 1. The rest of the bits
* are used to carry the value. These two parts together make
* a combined opcode.
*/
#define __TC_ACT_EXT_SHIFT 28
#define __TC_ACT_EXT(local) ((local) << __TC_ACT_EXT_SHIFT)
#define TC_ACT_EXT_VAL_MASK ((1 << __TC_ACT_EXT_SHIFT) - 1)
#define TC_ACT_EXT_CMP(combined, opcode) \
(((combined) & (~TC_ACT_EXT_VAL_MASK)) == opcode)
#define TC_ACT_JUMP __TC_ACT_EXT(1)
/* Action type identifiers*/ /* Action type identifiers*/
enum { enum {
......
...@@ -453,7 +453,7 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions, ...@@ -453,7 +453,7 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions,
if (ret == TC_ACT_REPEAT) if (ret == TC_ACT_REPEAT)
goto repeat; /* we need a ttl - JHS */ goto repeat; /* we need a ttl - JHS */
if (ret & TC_ACT_JUMP) { if (TC_ACT_EXT_CMP(ret, TC_ACT_JUMP)) {
jmp_prgcnt = ret & TCA_ACT_MAX_PRIO_MASK; jmp_prgcnt = ret & TCA_ACT_MAX_PRIO_MASK;
if (!jmp_prgcnt || (jmp_prgcnt > nr_actions)) { if (!jmp_prgcnt || (jmp_prgcnt > nr_actions)) {
/* faulty opcode, stop pipeline */ /* faulty opcode, stop pipeline */
......
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