diff options
author | jamal <hadi@cyberus.ca> | 2009-10-14 23:09:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-23 00:56:42 -0400 |
commit | 1c55d62e77fa16cdace417834fc7b8a421a1877f (patch) | |
tree | 24a9a8775beb7b7b0cc8b9d1fba2406ef9bf0643 /net/sched/act_skbedit.c | |
parent | 188586b28deda2dd4888a306cb6202cc6f408103 (diff) |
pkt_sched: skbedit add support for setting mark
This adds support for setting the skb mark.
Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_skbedit.c')
-rw-r--r-- | net/sched/act_skbedit.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index 4ab916b8074b..e9607fe55b58 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c | |||
@@ -54,6 +54,8 @@ static int tcf_skbedit(struct sk_buff *skb, struct tc_action *a, | |||
54 | if (d->flags & SKBEDIT_F_QUEUE_MAPPING && | 54 | if (d->flags & SKBEDIT_F_QUEUE_MAPPING && |
55 | skb->dev->real_num_tx_queues > d->queue_mapping) | 55 | skb->dev->real_num_tx_queues > d->queue_mapping) |
56 | skb_set_queue_mapping(skb, d->queue_mapping); | 56 | skb_set_queue_mapping(skb, d->queue_mapping); |
57 | if (d->flags & SKBEDIT_F_MARK) | ||
58 | skb->mark = d->mark; | ||
57 | 59 | ||
58 | spin_unlock(&d->tcf_lock); | 60 | spin_unlock(&d->tcf_lock); |
59 | return d->tcf_action; | 61 | return d->tcf_action; |
@@ -63,6 +65,7 @@ static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = { | |||
63 | [TCA_SKBEDIT_PARMS] = { .len = sizeof(struct tc_skbedit) }, | 65 | [TCA_SKBEDIT_PARMS] = { .len = sizeof(struct tc_skbedit) }, |
64 | [TCA_SKBEDIT_PRIORITY] = { .len = sizeof(u32) }, | 66 | [TCA_SKBEDIT_PRIORITY] = { .len = sizeof(u32) }, |
65 | [TCA_SKBEDIT_QUEUE_MAPPING] = { .len = sizeof(u16) }, | 67 | [TCA_SKBEDIT_QUEUE_MAPPING] = { .len = sizeof(u16) }, |
68 | [TCA_SKBEDIT_MARK] = { .len = sizeof(u32) }, | ||
66 | }; | 69 | }; |
67 | 70 | ||
68 | static int tcf_skbedit_init(struct nlattr *nla, struct nlattr *est, | 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 | struct tc_skbedit *parm; | 75 | struct tc_skbedit *parm; |
73 | struct tcf_skbedit *d; | 76 | struct tcf_skbedit *d; |
74 | struct tcf_common *pc; | 77 | struct tcf_common *pc; |
75 | u32 flags = 0, *priority = NULL; | 78 | u32 flags = 0, *priority = NULL, *mark = NULL; |
76 | u16 *queue_mapping = NULL; | 79 | u16 *queue_mapping = NULL; |
77 | int ret = 0, err; | 80 | int ret = 0, err; |
78 | 81 | ||
@@ -95,6 +98,12 @@ static int tcf_skbedit_init(struct nlattr *nla, struct nlattr *est, | |||
95 | flags |= SKBEDIT_F_QUEUE_MAPPING; | 98 | flags |= SKBEDIT_F_QUEUE_MAPPING; |
96 | queue_mapping = nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING]); | 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 | if (!flags) | 107 | if (!flags) |
99 | return -EINVAL; | 108 | return -EINVAL; |
100 | 109 | ||
@@ -124,6 +133,9 @@ static int tcf_skbedit_init(struct nlattr *nla, struct nlattr *est, | |||
124 | d->priority = *priority; | 133 | d->priority = *priority; |
125 | if (flags & SKBEDIT_F_QUEUE_MAPPING) | 134 | if (flags & SKBEDIT_F_QUEUE_MAPPING) |
126 | d->queue_mapping = *queue_mapping; | 135 | d->queue_mapping = *queue_mapping; |
136 | if (flags & SKBEDIT_F_MARK) | ||
137 | d->mark = *mark; | ||
138 | |||
127 | d->tcf_action = parm->action; | 139 | d->tcf_action = parm->action; |
128 | 140 | ||
129 | spin_unlock_bh(&d->tcf_lock); | 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 | if (d->flags & SKBEDIT_F_QUEUE_MAPPING) | 173 | if (d->flags & SKBEDIT_F_QUEUE_MAPPING) |
162 | NLA_PUT(skb, TCA_SKBEDIT_QUEUE_MAPPING, | 174 | NLA_PUT(skb, TCA_SKBEDIT_QUEUE_MAPPING, |
163 | sizeof(d->queue_mapping), &d->queue_mapping); | 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 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); | 179 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); |
165 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); | 180 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); |
166 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); | 181 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); |