]> git.baikalelectronics.ru Git - kernel.git/commit
net: sched: add mpls manipulation actions to TC
authorJohn Hurley <john.hurley@netronome.com>
Sun, 7 Jul 2019 14:01:57 +0000 (15:01 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 9 Jul 2019 02:50:13 +0000 (19:50 -0700)
commit08c1ecd9d277b59f1051fc4ba7ebf8a058226504
treef91f72a2abd1fd7b0c43066af35b7aac32621521
parent2ab40c3f276309a054beb8031f658e81ffe214a6
net: sched: add mpls manipulation actions to TC

Currently, TC offers the ability to match on the MPLS fields of a packet
through the use of the flow_dissector_key_mpls struct. However, as yet, TC
actions do not allow the modification or manipulation of such fields.

Add a new module that registers TC action ops to allow manipulation of
MPLS. This includes the ability to push and pop headers as well as modify
the contents of new or existing headers. A further action to decrement the
TTL field of an MPLS header is also provided with a new helper added to
support this.

Examples of the usage of the new action with flower rules to push and pop
MPLS labels are:

tc filter add dev eth0 protocol ip parent ffff: flower \
    action mpls push protocol mpls_uc label 123  \
    action mirred egress redirect dev eth1

tc filter add dev eth0 protocol mpls_uc parent ffff: flower \
    action mpls pop protocol ipv4  \
    action mirred egress redirect dev eth1

Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h
include/net/tc_act/tc_mpls.h [new file with mode: 0644]
include/uapi/linux/pkt_cls.h
include/uapi/linux/tc_act/tc_mpls.h [new file with mode: 0644]
net/core/skbuff.c
net/sched/Kconfig
net/sched/Makefile
net/sched/act_mpls.c [new file with mode: 0644]