File Index
Files and directories
Sign in
FILE

tc_vlan.h

File preview with syntax highlighting.

linux-6.19.14/include/net/tc_act/tc_vlan.h C
 1/* SPDX-License-Identifier: GPL-2.0-or-later */
 2/*
 3 * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>
 4 */
 5
 6#ifndef __NET_TC_VLAN_H
 7#define __NET_TC_VLAN_H
 8
 9#include <net/act_api.h>
10#include <linux/tc_act/tc_vlan.h>
11
12struct tcf_vlan_params {
13	int		  action;
14	int               tcfv_action;
15	unsigned char     tcfv_push_dst[ETH_ALEN];
16	unsigned char     tcfv_push_src[ETH_ALEN];
17	u16               tcfv_push_vid;
18	__be16            tcfv_push_proto;
19	u8                tcfv_push_prio;
20	bool              tcfv_push_prio_exists;
21	struct rcu_head   rcu;
22};
23
24struct tcf_vlan {
25	struct tc_action	common;
26	struct tcf_vlan_params __rcu *vlan_p;
27};
28#define to_vlan(a) ((struct tcf_vlan *)a)
29
30static inline u32 tcf_vlan_action(const struct tc_action *a)
31{
32	u32 tcfv_action;
33
34	rcu_read_lock();
35	tcfv_action = rcu_dereference(to_vlan(a)->vlan_p)->tcfv_action;
36	rcu_read_unlock();
37
38	return tcfv_action;
39}
40
41static inline u16 tcf_vlan_push_vid(const struct tc_action *a)
42{
43	u16 tcfv_push_vid;
44
45	rcu_read_lock();
46	tcfv_push_vid = rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_vid;
47	rcu_read_unlock();
48
49	return tcfv_push_vid;
50}
51
52static inline __be16 tcf_vlan_push_proto(const struct tc_action *a)
53{
54	__be16 tcfv_push_proto;
55
56	rcu_read_lock();
57	tcfv_push_proto = rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_proto;
58	rcu_read_unlock();
59
60	return tcfv_push_proto;
61}
62
63static inline u8 tcf_vlan_push_prio(const struct tc_action *a)
64{
65	u8 tcfv_push_prio;
66
67	rcu_read_lock();
68	tcfv_push_prio = rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_prio;
69	rcu_read_unlock();
70
71	return tcfv_push_prio;
72}
73
74static inline void tcf_vlan_push_eth(unsigned char *src, unsigned char *dest,
75				     const struct tc_action *a)
76{
77	rcu_read_lock();
78	memcpy(dest, rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_dst, ETH_ALEN);
79	memcpy(src, rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_src, ETH_ALEN);
80	rcu_read_unlock();
81}
82
83#endif /* __NET_TC_VLAN_H */
~/ Read-only file preview.