Skip to content

Commit

Permalink
net sched: update vlan action for batched events operations
Browse files Browse the repository at this point in the history
Add get_fill_size() routine used to calculate the action size
when building a batch of events.

Fixes: c7e2b96 ("sched: introduce vlan action")
Signed-off-by: Roman Mashak <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Roman Mashak authored and davem330 committed Aug 6, 2019
1 parent 3abd24a commit b35475c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions net/sched/act_vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,14 @@ static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 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 = {
.kind = "vlan",
.id = TCA_ID_VLAN,
Expand All @@ -317,6 +325,7 @@ static struct tc_action_ops act_vlan_ops = {
.init = tcf_vlan_init,
.cleanup = tcf_vlan_cleanup,
.walk = tcf_vlan_walker,
.get_fill_size = tcf_vlan_get_fill_size,
.lookup = tcf_vlan_search,
.size = sizeof(struct tcf_vlan),
};
Expand Down

0 comments on commit b35475c

Please sign in to comment.