net: sched: add skbedit of ptype action to hardware IR
authorJohn Hurley <john.hurley@netronome.com>
Sun, 4 Aug 2019 15:09:04 +0000 (16:09 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 6 Aug 2019 21:24:21 +0000 (14:24 -0700)
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>
include/net/flow_offload.h
net/sched/cls_api.c

index 00b9aab5fdc1289678d51e7e6cf3f6f218f3ca05..04c29f5bb60a297c0b32d88545a49f6b6b932392 100644 (file)
@@ -126,6 +126,7 @@ enum flow_action_id {
        FLOW_ACTION_ADD,
        FLOW_ACTION_CSUM,
        FLOW_ACTION_MARK,
+       FLOW_ACTION_PTYPE,
        FLOW_ACTION_WAKE,
        FLOW_ACTION_QUEUE,
        FLOW_ACTION_SAMPLE,
@@ -168,6 +169,7 @@ struct flow_action_entry {
                const struct ip_tunnel_info *tunnel;    /* FLOW_ACTION_TUNNEL_ENCAP */
                u32                     csum_flags;     /* FLOW_ACTION_CSUM */
                u32                     mark;           /* FLOW_ACTION_MARK */
+               u16                     ptype;          /* FLOW_ACTION_PTYPE */
                struct {                                /* FLOW_ACTION_QUEUE */
                        u32             ctx;
                        u32             index;
index 3565d9aa09aace4e97683c3fd39cfb50b45d6082..ae73d37055719a4ab0823584273639970762514a 100644 (file)
@@ -3294,6 +3294,9 @@ int tc_setup_flow_action(struct flow_action *flow_action,
                        default:
                                goto err_out;
                        }
+               } else if (is_tcf_skbedit_ptype(act)) {
+                       entry->id = FLOW_ACTION_PTYPE;
+                       entry->ptype = tcf_skbedit_ptype(act);
                } else {
                        goto err_out;
                }