From: Roman Mashak Date: Fri, 2 Aug 2019 19:16:46 +0000 (-0400) Subject: net sched: update vlan action for batched events operations X-Git-Tag: v5.2.8~27 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f08d8c217a04b5dc83925a5dffe2410a5807ae3a;p=users%2Fdwmw2%2Flinux.git net sched: update vlan action for batched events operations [ Upstream commit b35475c5491a14c8ce7a5046ef7bcda8a860581a ] Add get_fill_size() routine used to calculate the action size when building a batch of events. Fixes: c7e2b9689 ("sched: introduce vlan action") Signed-off-by: Roman Mashak Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index 9269d350fb8aa..e0c97267bccb2 100644 --- a/net/sched/act_vlan.c +++ b/net/sched/act_vlan.c @@ -306,6 +306,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, @@ -315,6 +323,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), };