linux_dsm_epyc7002/include/net/tc_act/tc_mpls.h
John Hurley 2a2ea50870 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>
2019-07-08 19:50:13 -07:00

31 lines
636 B
C

/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
/* Copyright (C) 2019 Netronome Systems, Inc. */
#ifndef __NET_TC_MPLS_H
#define __NET_TC_MPLS_H
#include <linux/tc_act/tc_mpls.h>
#include <net/act_api.h>
struct tcf_mpls_params {
int tcfm_action;
u32 tcfm_label;
u8 tcfm_tc;
u8 tcfm_ttl;
u8 tcfm_bos;
__be16 tcfm_proto;
struct rcu_head rcu;
};
#define ACT_MPLS_TC_NOT_SET 0xff
#define ACT_MPLS_BOS_NOT_SET 0xff
#define ACT_MPLS_LABEL_NOT_SET 0xffffffff
struct tcf_mpls {
struct tc_action common;
struct tcf_mpls_params __rcu *mpls_p;
};
#define to_mpls(a) ((struct tcf_mpls *)a)
#endif /* __NET_TC_MPLS_H */