@@ -54,6 +54,8 @@ static int tcf_skbedit(struct sk_buff *skb, struct tc_action *a,
54
54
if (d -> flags & SKBEDIT_F_QUEUE_MAPPING &&
55
55
skb -> dev -> real_num_tx_queues > d -> queue_mapping )
56
56
skb_set_queue_mapping (skb , d -> queue_mapping );
57
+ if (d -> flags & SKBEDIT_F_MARK )
58
+ skb -> mark = d -> mark ;
57
59
58
60
spin_unlock (& d -> tcf_lock );
59
61
return d -> tcf_action ;
@@ -63,6 +65,7 @@ static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = {
63
65
[TCA_SKBEDIT_PARMS ] = { .len = sizeof (struct tc_skbedit ) },
64
66
[TCA_SKBEDIT_PRIORITY ] = { .len = sizeof (u32 ) },
65
67
[TCA_SKBEDIT_QUEUE_MAPPING ] = { .len = sizeof (u16 ) },
68
+ [TCA_SKBEDIT_MARK ] = { .len = sizeof (u32 ) },
66
69
};
67
70
68
71
static int tcf_skbedit_init (struct nlattr * nla , struct nlattr * est ,
@@ -72,7 +75,7 @@ static int tcf_skbedit_init(struct nlattr *nla, struct nlattr *est,
72
75
struct tc_skbedit * parm ;
73
76
struct tcf_skbedit * d ;
74
77
struct tcf_common * pc ;
75
- u32 flags = 0 , * priority = NULL ;
78
+ u32 flags = 0 , * priority = NULL , * mark = NULL ;
76
79
u16 * queue_mapping = NULL ;
77
80
int ret = 0 , err ;
78
81
@@ -95,6 +98,12 @@ static int tcf_skbedit_init(struct nlattr *nla, struct nlattr *est,
95
98
flags |= SKBEDIT_F_QUEUE_MAPPING ;
96
99
queue_mapping = nla_data (tb [TCA_SKBEDIT_QUEUE_MAPPING ]);
97
100
}
101
+
102
+ if (tb [TCA_SKBEDIT_MARK ] != NULL ) {
103
+ flags |= SKBEDIT_F_MARK ;
104
+ mark = nla_data (tb [TCA_SKBEDIT_MARK ]);
105
+ }
106
+
98
107
if (!flags )
99
108
return - EINVAL ;
100
109
@@ -124,6 +133,9 @@ static int tcf_skbedit_init(struct nlattr *nla, struct nlattr *est,
124
133
d -> priority = * priority ;
125
134
if (flags & SKBEDIT_F_QUEUE_MAPPING )
126
135
d -> queue_mapping = * queue_mapping ;
136
+ if (flags & SKBEDIT_F_MARK )
137
+ d -> mark = * mark ;
138
+
127
139
d -> tcf_action = parm -> action ;
128
140
129
141
spin_unlock_bh (& d -> tcf_lock );
@@ -161,6 +173,9 @@ static inline int tcf_skbedit_dump(struct sk_buff *skb, struct tc_action *a,
161
173
if (d -> flags & SKBEDIT_F_QUEUE_MAPPING )
162
174
NLA_PUT (skb , TCA_SKBEDIT_QUEUE_MAPPING ,
163
175
sizeof (d -> queue_mapping ), & d -> queue_mapping );
176
+ if (d -> flags & SKBEDIT_F_MARK )
177
+ NLA_PUT (skb , TCA_SKBEDIT_MARK , sizeof (d -> mark ),
178
+ & d -> mark );
164
179
t .install = jiffies_to_clock_t (jiffies - d -> tcf_tm .install );
165
180
t .lastuse = jiffies_to_clock_t (jiffies - d -> tcf_tm .lastuse );
166
181
t .expires = jiffies_to_clock_t (d -> tcf_tm .expires );
0 commit comments