@@ -72,7 +72,11 @@ enum {
* the skb and act like everything
* is alright.
*/
-#define TC_ACT_VALUE_MAX TC_ACT_TRAP
+#define TC_ACT_TRAP_FWD 9 /* For hw path, this means "send a copy
+ * of the packet to the cpu". For sw
+ * datapath, this is like TC_ACT_OK.
+ */
+#define TC_ACT_VALUE_MAX TC_ACT_TRAP_FWD
/* There is a special kind of actions called "extended actions",
* which need a value parameter. These have a local opcode located in
@@ -3975,6 +3975,7 @@ sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev)
switch (tcf_classify(skb, miniq->filter_list, &cl_res, false)) {
case TC_ACT_OK:
case TC_ACT_RECLASSIFY:
+ case TC_ACT_TRAP_FWD:
skb->tc_index = TC_H_MIN(cl_res.classid);
break;
case TC_ACT_SHOT:
@@ -5083,6 +5084,7 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret,
&cl_res, false)) {
case TC_ACT_OK:
case TC_ACT_RECLASSIFY:
+ case TC_ACT_TRAP_FWD:
skb->tc_index = TC_H_MIN(cl_res.classid);
break;
case TC_ACT_SHOT:
@@ -54,8 +54,16 @@ static int tcf_bpf_act(struct sk_buff *skb, const struct tc_action *act,
bpf_compute_data_pointers(skb);
filter_res = BPF_PROG_RUN(filter, skb);
}
- if (skb_sk_is_prefetched(skb) && filter_res != TC_ACT_OK)
- skb_orphan(skb);
+ if (skb_sk_is_prefetched(skb)) {
+ switch (filter_res) {
+ case TC_ACT_OK:
+ case TC_ACT_TRAP_FWD:
+ break;
+ default:
+ skb_orphan(skb);
+ break;
+ }
+ }
rcu_read_unlock();
/* A BPF program may overwrite the default action opcode.
@@ -72,6 +80,7 @@ static int tcf_bpf_act(struct sk_buff *skb, const struct tc_action *act,
case TC_ACT_PIPE:
case TC_ACT_RECLASSIFY:
case TC_ACT_OK:
+ case TC_ACT_TRAP_FWD:
case TC_ACT_REDIRECT:
action = filter_res;
break;
@@ -69,6 +69,7 @@ static int cls_bpf_exec_opcode(int code)
case TC_ACT_SHOT:
case TC_ACT_STOLEN:
case TC_ACT_TRAP:
+ case TC_ACT_TRAP_FWD:
case TC_ACT_REDIRECT:
case TC_ACT_UNSPEC:
return code;
@@ -258,6 +258,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch,
goto drop;
#endif
case TC_ACT_OK:
+ case TC_ACT_TRAP_FWD:
skb->tc_index = TC_H_MIN(res.classid);
break;
@@ -45,7 +45,11 @@ enum {
* the skb and act like everything
* is alright.
*/
-#define TC_ACT_VALUE_MAX TC_ACT_TRAP
+#define TC_ACT_TRAP_FWD 9 /* For hw path, this means "send a copy
+ * of the packet to the cpu". For sw
+ * datapath, this is like TC_ACT_OK.
+ */
+#define TC_ACT_VALUE_MAX TC_ACT_TRAP_FWD
/* There is a special kind of actions called "extended actions",
* which need a value parameter. These have a local opcode located in