1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2 /* Copyright (C) 2019 Netronome Systems, Inc. */
4 #ifndef __NET_TC_MPLS_H
5 #define __NET_TC_MPLS_H
7 #include <linux/tc_act/tc_mpls.h>
8 #include <net/act_api.h>
10 struct tcf_mpls_params {
20 #define ACT_MPLS_TC_NOT_SET 0xff
21 #define ACT_MPLS_BOS_NOT_SET 0xff
22 #define ACT_MPLS_LABEL_NOT_SET 0xffffffff
25 struct tc_action common;
26 struct tcf_mpls_params __rcu *mpls_p;
28 #define to_mpls(a) ((struct tcf_mpls *)a)
30 static inline bool is_tcf_mpls(const struct tc_action *a)
32 #ifdef CONFIG_NET_CLS_ACT
33 if (a->ops && a->ops->id == TCA_ID_MPLS)
39 static inline u32 tcf_mpls_action(const struct tc_action *a)
44 tcfm_action = rcu_dereference(to_mpls(a)->mpls_p)->tcfm_action;
50 static inline __be16 tcf_mpls_proto(const struct tc_action *a)
55 tcfm_proto = rcu_dereference(to_mpls(a)->mpls_p)->tcfm_proto;
61 static inline u32 tcf_mpls_label(const struct tc_action *a)
66 tcfm_label = rcu_dereference(to_mpls(a)->mpls_p)->tcfm_label;
72 static inline u8 tcf_mpls_tc(const struct tc_action *a)
77 tcfm_tc = rcu_dereference(to_mpls(a)->mpls_p)->tcfm_tc;
83 static inline u8 tcf_mpls_bos(const struct tc_action *a)
88 tcfm_bos = rcu_dereference(to_mpls(a)->mpls_p)->tcfm_bos;
94 static inline u8 tcf_mpls_ttl(const struct tc_action *a)
99 tcfm_ttl = rcu_dereference(to_mpls(a)->mpls_p)->tcfm_ttl;
105 #endif /* __NET_TC_MPLS_H */