Commit cb20f741 authored by Roman Mashak's avatar Roman Mashak Committed by Greg Kroah-Hartman

net sched: update vlan action for batched events operations

[ Upstream commit b35475c5 ]

Add get_fill_size() routine used to calculate the action size
when building a batch of events.

Fixes: c7e2b968 ("sched: introduce vlan action")
Signed-off-by: default avatarRoman Mashak <mrv@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d82dc254
...@@ -296,6 +296,14 @@ static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index, ...@@ -296,6 +296,14 @@ static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index,
return tcf_idr_search(tn, a, index); return tcf_idr_search(tn, a, index);
} }
static size_t tcf_vlan_get_fill_size(const struct tc_action *act)
{
return nla_total_size(sizeof(struct tc_vlan))
+ nla_total_size(sizeof(u16)) /* TCA_VLAN_PUSH_VLAN_ID */
+ nla_total_size(sizeof(u16)) /* TCA_VLAN_PUSH_VLAN_PROTOCOL */
+ nla_total_size(sizeof(u8)); /* TCA_VLAN_PUSH_VLAN_PRIORITY */
}
static struct tc_action_ops act_vlan_ops = { static struct tc_action_ops act_vlan_ops = {
.kind = "vlan", .kind = "vlan",
.type = TCA_ACT_VLAN, .type = TCA_ACT_VLAN,
...@@ -305,6 +313,7 @@ static struct tc_action_ops act_vlan_ops = { ...@@ -305,6 +313,7 @@ static struct tc_action_ops act_vlan_ops = {
.init = tcf_vlan_init, .init = tcf_vlan_init,
.cleanup = tcf_vlan_cleanup, .cleanup = tcf_vlan_cleanup,
.walk = tcf_vlan_walker, .walk = tcf_vlan_walker,
.get_fill_size = tcf_vlan_get_fill_size,
.lookup = tcf_vlan_search, .lookup = tcf_vlan_search,
.size = sizeof(struct tcf_vlan), .size = sizeof(struct tcf_vlan),
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment