Skip to content

Commit fb1b775

Browse files
jahurleydavem330
authored andcommitted
net: sched: add skbedit of ptype action to hardware IR
TC rules can impliment skbedit actions. Currently actions that modify the skb mark are passed to offloading drivers via the hardware intermediate representation in the flow_offload API. Extend this to include skbedit actions that modify the packet type of the skb. Such actions may be used to set the ptype to HOST when redirecting a packet to ingress. Signed-off-by: John Hurley <john.hurley@netronome.com> Reviewed-by: Simon Horman <simon.horman@netronome.com> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 77feb4e commit fb1b775

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎include/net/flow_offload.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ enum flow_action_id {
126126
FLOW_ACTION_ADD,
127127
FLOW_ACTION_CSUM,
128128
FLOW_ACTION_MARK,
129+
FLOW_ACTION_PTYPE,
129130
FLOW_ACTION_WAKE,
130131
FLOW_ACTION_QUEUE,
131132
FLOW_ACTION_SAMPLE,
@@ -168,6 +169,7 @@ struct flow_action_entry {
168169
const struct ip_tunnel_info *tunnel; /* FLOW_ACTION_TUNNEL_ENCAP */
169170
u32 csum_flags; /* FLOW_ACTION_CSUM */
170171
u32 mark; /* FLOW_ACTION_MARK */
172+
u16 ptype; /* FLOW_ACTION_PTYPE */
171173
struct { /* FLOW_ACTION_QUEUE */
172174
u32 ctx;
173175
u32 index;

‎net/sched/cls_api.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3294,6 +3294,9 @@ int tc_setup_flow_action(struct flow_action *flow_action,
32943294
default:
32953295
goto err_out;
32963296
}
3297+
} else if (is_tcf_skbedit_ptype(act)) {
3298+
entry->id = FLOW_ACTION_PTYPE;
3299+
entry->ptype = tcf_skbedit_ptype(act);
32973300
} else {
32983301
goto err_out;
32993302
}

0 commit comments

Comments
 (0)